Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-updating asset hashes #1861

Merged
merged 5 commits into from Aug 24, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Asset.js
Expand Up @@ -2,7 +2,6 @@ const URL = require('url');
const path = require('path');
const clone = require('clone');
const fs = require('./utils/fs');
const objectHash = require('./utils/objectHash');
const md5 = require('./utils/md5');
const isURL = require('./utils/is-url');
const config = require('./utils/config');
Expand Down Expand Up @@ -214,7 +213,7 @@ class Asset {
}

generateHash() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method needed anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RawAsset uses it as it has no generated content

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should keep the method then and just call it after post-processing is done?

return objectHash(this.generated);
return '';
}

invalidate() {
Expand Down
4 changes: 3 additions & 1 deletion src/Pipeline.js
@@ -1,5 +1,6 @@
const Parser = require('./Parser');
const path = require('path');
const objectHash = require('./utils/objectHash');
const md5 = require('./utils/md5');

/**
Expand Down Expand Up @@ -72,7 +73,6 @@ class Pipeline {
}

generated = generated.concat(processed);
asset.hash = md5(asset.hash + subAsset.hash);
} else {
generated.push(rendition);
}
Expand All @@ -86,6 +86,8 @@ class Pipeline {
throw asset.generateErrorMessage(err);
}

asset.hash = md5(objectHash(generated) + asset.hash);

return generated;
}

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Expand Up @@ -7244,4 +7244,4 @@ yargs@~3.10.0:
camelcase "^1.0.2"
cliui "^2.1.0"
decamelize "^1.0.0"
window-size "0.1.0"
window-size "0.1.0"