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 all 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,13 +2,13 @@ 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');
const syncPromise = require('./utils/syncPromise');
const logger = require('./Logger');
const Resolver = require('./Resolver');
const objectHash = require('./utils/objectHash');

/**
* An Asset represents a file in the dependency tree. Assets can have multiple
Expand Down Expand Up @@ -203,7 +203,6 @@ class Asset {
await this.getDependencies();
await this.transform();
this.generated = await this.generate();
this.hash = await this.generateHash();
}

return this.generated;
Expand Down
6 changes: 3 additions & 3 deletions src/Pipeline.js
@@ -1,6 +1,5 @@
const Parser = require('./Parser');
const path = require('path');
const md5 = require('./utils/md5');

/**
* A Pipeline composes multiple Asset types together.
Expand Down Expand Up @@ -72,20 +71,21 @@ class Pipeline {
}

generated = generated.concat(processed);
asset.hash = md5(asset.hash + subAsset.hash);
} else {
generated.push(rendition);
}
}

// Post process. This allows assets a chance to modify the output produced by sub-asset types.
asset.generated = generated;
try {
generated = await asset.postProcess(generated);
} catch (err) {
throw asset.generateErrorMessage(err);
}

asset.generated = generated;
asset.hash = await asset.generateHash();

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"