This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 159
fix: bundle lambdas in script instead of command line #655
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
616b467
fix: build lambdas with script
ssvegaraju d2e86f1
fix linting issue
ssvegaraju 3019836
Merge branch 'develop' into cdk-lambdaBundleFix
ssvegaraju 6e32999
possible fix for rest hook
ssvegaraju 8ddf0f6
Merge branch 'cdk-lambdaBundleFix' of github.com:awslabs/fhir-works-o…
ssvegaraju 1a4f39e
fix linting issues
ssvegaraju d10bf5d
address comments
ssvegaraju File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
path = require('path'); | ||
esbuild = require('esbuild'); | ||
var fs = require('fs'); | ||
var fse = require('fs-extra'); | ||
var path = require('path'); | ||
|
||
esbuild.build({ | ||
entryPoints: [path.join(__dirname, '../../src/index.ts')], | ||
bundle: true, | ||
platform: 'node', | ||
target: 'node14', | ||
external: ['aws-sdk'], | ||
outfile: path.join(__dirname, '../index.js'), | ||
}).catch(() => process.exit(1)); | ||
// expected usage: `node build_lambda.js <path> <path> <pathToFile> <fileName>` | ||
// for use with NodeJsFunction command hooks to add files to Lambda functions, | ||
// so <path> <path> will usually be the inputDir and outputDir variables, respectively | ||
var inputDir = process.argv[2]; | ||
var outputDir = process.argv[3]; | ||
var fileToMove = process.argv[4]; | ||
var isDirectory = process.argv.length > 5 ? true : false; | ||
|
||
function ensureDirectoryExistence(filePath) { | ||
var dirname = path.dirname(filePath); | ||
if (fs.existsSync(dirname)) { | ||
return true; | ||
} | ||
fs.mkdirSync(dirname, { recursive: true }); | ||
} | ||
|
||
if (isDirectory) { | ||
fse.copySync(inputDir, outputDir); | ||
} else { | ||
ensureDirectoryExistence(`${outputDir}\\${fileToMove}`); | ||
fs.copyFileSync(`${inputDir}\\${fileToMove}`, `${outputDir}\\${fileToMove}`); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit - No new line at end of file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will want forward slashes not back slashes - https://stackoverflow.com/a/38428899