Skip to content

Commit

Permalink
Identify changes via md5 instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Lepozepo committed Feb 25, 2020
1 parent 8641021 commit 5954202
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
"@pulumi/tls": "^1.4.0",
"aws-sdk": "^2.618.0",
"lodash": "^4.17.15",
"md5-file": "^4.0.0",
"mime": "^2.4.4",
"recursive-readdir-sync": "^1.0.6",
"sha256-file": "^1.0.0",
"uuid": "^3.4.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/Lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import cp from 'child_process';
import readdirp from 'recursive-readdir-sync';
import fs from 'fs';
import uuid from 'uuid/v3';
import sha256File from 'sha256-file';
import md5File from 'md5-file';
import WebsocketApi from './WebsocketApi';

export default class Lambda extends pulumi.ComponentResource {
Expand Down Expand Up @@ -90,7 +90,7 @@ export default class Lambda extends pulumi.ComponentResource {
readdirp(source).forEach((srcObject) => {
if (srcObject.includes('node_modules')) return;
lambdaAssetMap[p.relative(source, srcObject)] = new pulumi.asset.FileAsset(srcObject);
sourceCodeHashObj[p.relative(source, srcObject)] = sha256File(srcObject);
sourceCodeHashObj[p.relative(source, srcObject)] = md5File.sync(srcObject);
});

const sourceCodeHash = uuid(JSON.stringify(sourceCodeHashObj), uuid.URL);
Expand Down
6 changes: 3 additions & 3 deletions src/StaticWebApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import mime from 'mime';
import cp from 'child_process';
import path from 'path';
import isEmpty from 'lodash/isEmpty';
import sha256File from 'sha256-file';
import md5File from 'md5-file';

export default class StaticWebApp extends pulumi.ComponentResource {
constructor(name, props = {}, ops) {
Expand Down Expand Up @@ -123,7 +123,7 @@ export default class StaticWebApp extends pulumi.ComponentResource {
source: new pulumi.asset.FileAsset(dir),
key: path.relative(buildDir, dir),
contentType: mime.getType(dir) || undefined,
etag: sha256File(dir),
etag: md5File.sync(dir),
}, { parent: this });
}
/* eslint-enable */
Expand All @@ -136,7 +136,7 @@ export default class StaticWebApp extends pulumi.ComponentResource {
source: new pulumi.asset.FileAsset(dir),
key: path.relative(buildDir, dir),
contentType: mime.getType(dir) || undefined,
etag: sha256File(dir),
etag: md5File.sync(dir),
}, { parent: this });
}
/* eslint-enable */
Expand Down

0 comments on commit 5954202

Please sign in to comment.