Hapiest-lambda-deploy is designed to make it super-simple to deploy one or more lambda functions in a repository.
Create a deploy config folder with the following files:
i. deployConfig.json (see example below)
ii. deployCredentials.json (see example below)
Create a "bin" .js file similar to the one belowconst Promise = ;const Path = ;const NodeConfig = ;const serviceLocator = ;const logger = serviceLocator;/** @type */const folders =config: PathprojectRoot: Path;const DeployServiceFactory = ;const deployService = DeployServiceFactory;deployService;
Update package.json to make it easy to deploy using "npm run ..."
Note, you want to ensure that you have a clean directory so that you don't accidentally deploy code that hasn't been tested / check in. You can optionally remove git:ensureClean step if you like playing Russian Roulette.
Deploy the Lambda function by running
npm run deploy:env1
Running the tests
Currently there's only a single integration test. I plan to add unit tests at some later point in time. To get the integration test up and running, you should:
Create test/helper/integration/config/deployCredentials.json file with valid credentials from Setup step 1
Create an AWS Lambda function with the name
hapiestLambdaDeployTest_env1and a corresponding alias named
Check that the test runs using
npm run test:integration