Skip to content

Commit

Permalink
calcSourceHash
Browse files Browse the repository at this point in the history
  • Loading branch information
jogold committed May 16, 2020
1 parent 13057c8 commit aad39af
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/@aws-cdk/aws-lambda/test/integ.docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ app.synth();
// with Python dependencies. Needed for integ test expectation.
function calcSourceHash(srcDir: string): string {
const sha = crypto.createHash('sha256');
for (const dirent of fs.readdirSync(srcDir, { withFileTypes: true })) {
if (!dirent.isFile()) {
continue;
}
const data = fs.readFileSync(path.join(srcDir, dirent.name));
sha.update(`<file name=${dirent.name}>`);
const files = ['index.py', 'requirements.txt'];
for (const file of files) {
const data = fs.readFileSync(path.join(srcDir, file));
sha.update(`<file name=${file}>`);
sha.update(data);
sha.update('</file>');
}
Expand Down

0 comments on commit aad39af

Please sign in to comment.