-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Current State
Currently Greenwood has a bit of an ad-hoc solution for generating hashes for filenames in hashing-utils.js
https://github.com/ProjectEvergreen/greenwood/blob/master/packages/cli/src/lib/hashing-utils.js
But as seen in #1523 this can cause different results across operating systems.
However, NodeJS has had a createHash
function available in the standard library for a while which would probably a lot more of a stable option
https://nodejs.org/docs/latest-v18.x/api/crypto.html#cryptocreatehashalgorithm-options
Desired State
The desired state would be to refactor that hashing implementation to use createHash
instead.
This may likely break some test cases that are expecting certain hash files for validating bundling took place, so for those test cases, we should probably move to using expect.match
with a Regex instead, like we can see here
So instead of hardcoding the filename
expect(scriptContents).to.contain(
`import r from"/styles/theme.${themeFileHash}.css"with{type:"css"};`,
);
We would use a Regex
expect(scriptContents).to.match(
/import r from"\/styles\/theme\.([a-zA-Z0-9]{8}.)\.css"with{type:"css"};/,
);
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status