node-lambda 0.22.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ jobs:
9
9
  strategy:
10
10
  fail-fast: false
11
11
  matrix:
12
- node-version: [14.x, 16.x, 17.x]
12
+ node-version: [14.x, 16.x, 18.x]
13
13
  steps:
14
14
  - uses: actions/checkout@v2
15
15
  - uses: actions/setup-node@v2
@@ -33,7 +33,7 @@ jobs:
33
33
  - uses: actions/checkout@v2
34
34
  - uses: actions/setup-node@v2
35
35
  with:
36
- node-version: 16.x
36
+ node-version: 18.x
37
37
  cache: 'npm'
38
38
  - run: npm i -g npm
39
39
  - run: node -v
package/CHANGELOG.md CHANGED
@@ -450,3 +450,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
450
450
  - Support for Architectures parameter [#591](https://github.com/motdotla/node-lambda/pull/591)
451
451
  ### Bugfixes
452
452
  - fix: skip installing the package, when there is no `package.json` [#589](https://github.com/motdotla/node-lambda/pull/589)
453
+
454
+ ## [1.0.0] - 2022-05-19
455
+ ### Features
456
+ - feat: remove BUILD from the exclusion list [#607](https://github.com/motdotla/node-lambda/pull/607)
457
+ - BREAKING CHANGES
458
+ - add nodejs16.x to runtime [#605](https://github.com/motdotla/node-lambda/pull/605)
package/README.md CHANGED
@@ -83,7 +83,7 @@ AWS_TIMEOUT // (default: 60)
83
83
  AWS_RUN_TIMEOUT // (default: 3)
84
84
  AWS_ARCHITECTURE // (default: 'x86_64')
85
85
  AWS_DESCRIPTION // (default: package.json.description or '')
86
- AWS_RUNTIME // (default: 'nodejs14.x')
86
+ AWS_RUNTIME // (default: 'nodejs16.x')
87
87
  AWS_PUBLISH // (default: false)
88
88
  AWS_FUNCTION_VERSION // (default: '')
89
89
  AWS_VPC_SUBNETS // (default: '')
@@ -118,7 +118,7 @@ Run your Amazon Lambda application locally
118
118
  Options:
119
119
  -H, --handler [AWS_HANDLER] Lambda Handler {index.handler} (default: "index.handler")
120
120
  -j, --eventFile [EVENT_FILE] Event JSON File (default: "event.json")
121
- -u, --runtime [AWS_RUNTIME] Lambda Runtime (default: "nodejs14.x")
121
+ -u, --runtime [AWS_RUNTIME] Lambda Runtime (default: "nodejs16.x")
122
122
  -t, --timeout [AWS_RUN_TIMEOUT] Lambda Timeout (default: 3)
123
123
  -f, --configFile [CONFIG_FILE] Path to file holding secret environment variables (e.g. "deploy.env") (default: "")
124
124
  -x, --contextFile [CONTEXT_FILE] Context JSON File (default: "context.json")
@@ -182,7 +182,7 @@ Options:
182
182
  -t, --timeout [AWS_TIMEOUT] Lambda Timeout (default: 60)
183
183
  --architecture [AWS_ARCHITECTURE] The instruction set architecture that the function supports. (x86_64|arm64) (default: "x86_64")
184
184
  -d, --description [AWS_DESCRIPTION] Lambda Description (default: "Command line tool for locally running and remotely deploying your node.js applications to Amazon Lambda.")
185
- -u, --runtime [AWS_RUNTIME] Lambda Runtime (default: "nodejs14.x")
185
+ -u, --runtime [AWS_RUNTIME] Lambda Runtime (default: "nodejs16.x")
186
186
  -p, --publish [AWS_PUBLISH] Lambda Publish (default: false)
187
187
  -L, --lambdaVersion [AWS_FUNCTION_VERSION] Lambda Function Version (default: "")
188
188
  -b, --vpcSubnets [AWS_VPC_SUBNETS] Lambda Function VPC Subnet IDs (comma delimited) (default: "")
@@ -221,7 +221,7 @@ AWS Lambda will let you set environment variables for your function. Use the sam
221
221
 
222
222
  ## Node.js Runtime Configuration
223
223
 
224
- AWS Lambda now supports Node.js14 and Node.js 12. Please also check the [Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) page.
224
+ AWS Lambda now supports Node.js 16, Node.js 14 and Node.js 12. Please also check the [Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) page.
225
225
 
226
226
  ## Use S3 to deploy
227
227
 
package/bin/node-lambda CHANGED
@@ -31,7 +31,7 @@ const AWS_TIMEOUT = process.env.AWS_TIMEOUT || 60
31
31
  const AWS_RUN_TIMEOUT = process.env.AWS_RUN_TIMEOUT || 3
32
32
  const AWS_ARCHITECTURE = process.env.AWS_ARCHITECTURE || 'x86_64'
33
33
  const AWS_DESCRIPTION = process.env.AWS_DESCRIPTION || packageJson.description || ''
34
- const AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs14.x'
34
+ const AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs16.x'
35
35
  const AWS_PUBLISH = process.env.AWS_PUBLISH || false
36
36
  const AWS_FUNCTION_VERSION = process.env.AWS_FUNCTION_VERSION || ''
37
37
  const AWS_VPC_SUBNETS = process.env.AWS_VPC_SUBNETS || ''
package/lib/.env.example CHANGED
@@ -10,10 +10,10 @@ AWS_HANDLER=index.handler
10
10
  AWS_MEMORY_SIZE=128
11
11
  AWS_TIMEOUT=3
12
12
  AWS_DESCRIPTION=
13
- AWS_RUNTIME=nodejs14.x
13
+ AWS_RUNTIME=nodejs16.x
14
14
  AWS_VPC_SUBNETS=
15
15
  AWS_VPC_SECURITY_GROUPS=
16
16
  AWS_TRACING_CONFIG=
17
17
  AWS_LOGS_RETENTION_IN_DAYS=
18
- EXCLUDE_GLOBS="event.json"
18
+ EXCLUDE_GLOBS="event.json build/"
19
19
  PACKAGE_DIRECTORY=build
package/lib/aws.js CHANGED
@@ -6,7 +6,7 @@ const proxy = require('proxy-agent')
6
6
  module.exports = {
7
7
  sdk: aws,
8
8
  updateConfig (config, region) {
9
- const awsSecurity = { region: region }
9
+ const awsSecurity = { region }
10
10
 
11
11
  if (config.profile) {
12
12
  aws.config.credentials = new aws.SharedIniFileCredentials({
@@ -4,7 +4,7 @@ class CloudWatchLogs {
4
4
  constructor (aws, region) {
5
5
  // Authenticated `aws` object in `lib/main.js`
6
6
  this.lambda = new aws.Lambda({
7
- region: region,
7
+ region,
8
8
  apiVersion: '2015-03-31'
9
9
  })
10
10
  this.cloudwatchlogs = new aws.CloudWatchLogs({
package/lib/main.js CHANGED
@@ -52,7 +52,7 @@ event_sources.json and ${program.eventFile} files as needed.`)
52
52
  }
53
53
 
54
54
  run (program) {
55
- if (!['nodejs12.x', 'nodejs14.x'].includes(program.runtime)) {
55
+ if (!['nodejs12.x', 'nodejs14.x', 'nodejs16.x'].includes(program.runtime)) {
56
56
  console.error(`Runtime [${program.runtime}] is not supported.`)
57
57
  process.exit(254)
58
58
  }
@@ -336,8 +336,7 @@ Emulate only the body of the API Gateway event.
336
336
  '.editorconfig',
337
337
  '.lambda',
338
338
  'deploy.env',
339
- '*.log',
340
- path.join('build', path.sep)
339
+ '*.log'
341
340
  ]
342
341
  .concat(program.excludeGlobs ? program.excludeGlobs.split(' ') : [])
343
342
  .concat(excludeNodeModules ? [path.join('node_modules')] : [])
@@ -352,7 +351,7 @@ Emulate only the body of the API Gateway event.
352
351
  }
353
352
  return str
354
353
  }).join(',') + '}'
355
- const dirPatternRegExp = new RegExp(`(${dirBlobs.join('|')})$`)
354
+ const dirPatternRegExp = dirBlobs.length > 0 ? new RegExp(`(${dirBlobs.join('|')})$`) : null
356
355
 
357
356
  return new Promise((resolve, reject) => {
358
357
  fs.mkdirs(dest, (err) => {
@@ -368,10 +367,12 @@ Emulate only the body of the API Gateway event.
368
367
  if (!minimatch(src, pattern, { matchBase: true })) {
369
368
  return true
370
369
  }
370
+
371
371
  // Directory check. Even if `src` is a directory it will not end with '/'.
372
- if (!dirPatternRegExp.test(src)) {
372
+ if (dirPatternRegExp === null || !dirPatternRegExp.test(src)) {
373
373
  return false
374
374
  }
375
+
375
376
  return !fs.statSync(src).isDirectory()
376
377
  }
377
378
  }
@@ -973,7 +974,7 @@ they may not work as expected in the Lambda environment.
973
974
  console.log(params)
974
975
 
975
976
  const lambda = new aws.sdk.Lambda({
976
- region: region,
977
+ region,
977
978
  apiVersion: '2015-03-31'
978
979
  })
979
980
  const scheduleEvents = new ScheduleEvents(aws.sdk, region)
package/lib/s3_deploy.js CHANGED
@@ -35,7 +35,7 @@ class S3Deploy {
35
35
  constructor (aws, region) {
36
36
  // Authenticated `aws` object in `lib/main.js`
37
37
  this.s3 = new aws.S3({
38
- region: region,
38
+ region,
39
39
  apiVersion: '2006-03-01'
40
40
  })
41
41
  }
@@ -133,7 +133,7 @@ class S3Deploy {
133
133
  }
134
134
 
135
135
  putPackage (params, region, buffer) {
136
- const _params = Object.assign({ region: region }, params)
136
+ const _params = Object.assign({ region }, params)
137
137
  _params.bucketName = this._bucketName(_params)
138
138
  _params.s3Key = this._s3Key(_params)
139
139
 
package/lib/s3_events.js CHANGED
@@ -8,11 +8,11 @@ class S3Events {
8
8
  constructor (aws, region) {
9
9
  // Authenticated `aws` object in `lib/main.js`
10
10
  this.lambda = new aws.Lambda({
11
- region: region,
11
+ region,
12
12
  apiVersion: '2015-03-31'
13
13
  })
14
14
  this.s3 = new aws.S3({
15
- region: region,
15
+ region,
16
16
  apiVersion: '2006-03-01'
17
17
  })
18
18
  }
@@ -4,7 +4,7 @@ class ScheduleEvents {
4
4
  constructor (aws, region) {
5
5
  // Authenticated `aws` object in `lib/main.js`
6
6
  this.lambda = new aws.Lambda({
7
- region: region,
7
+ region,
8
8
  apiVersion: '2015-03-31'
9
9
  })
10
10
  this.cloudwatchevents = new aws.CloudWatchEvents({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-lambda",
3
- "version": "0.22.0",
3
+ "version": "1.0.0",
4
4
  "description": "Command line tool for locally running and remotely deploying your node.js applications to Amazon Lambda.",
5
5
  "main": "lib/main.js",
6
6
  "directories": {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "archiver": "^5.3.0",
39
- "aws-sdk": "^2.1074.0",
39
+ "aws-sdk": "^2.1135.0",
40
40
  "aws-xray-sdk-core": "^3.3.4",
41
41
  "commander": "^9.0.0",
42
42
  "continuation-local-storage": "^3.2.1",
@@ -51,6 +51,6 @@
51
51
  "chai": "^4.3.6",
52
52
  "mocha": "^9.2.0",
53
53
  "node-zip": "^1.1.1",
54
- "standard": "^16.0.4"
54
+ "standard": "^17.0.0"
55
55
  }
56
56
  }
package/test/main.js CHANGED
@@ -22,7 +22,7 @@ const originalProgram = {
22
22
  memorySize: 128,
23
23
  timeout: 3,
24
24
  description: '',
25
- runtime: 'nodejs14.x',
25
+ runtime: 'nodejs16.x',
26
26
  deadLetterConfigTargetArn: '',
27
27
  tracingConfig: '',
28
28
  Layers: '',
@@ -151,7 +151,7 @@ describe('lib/main', function () {
151
151
  })
152
152
 
153
153
  it('version should be set', () => {
154
- assert.equal(lambda.version, '0.22.0')
154
+ assert.equal(lambda.version, '1.0.0')
155
155
  })
156
156
 
157
157
  describe('_codeDirectory', () => {
@@ -459,7 +459,6 @@ describe('lib/main', function () {
459
459
 
460
460
  describe('_fileCopy', () => {
461
461
  before(() => {
462
- fs.mkdirSync('build')
463
462
  fs.mkdirsSync(path.join('__unittest', 'hoge'))
464
463
  fs.mkdirsSync(path.join('__unittest', 'fuga'))
465
464
  fs.writeFileSync(path.join('__unittest', 'hoge', 'piyo'), '')
@@ -467,7 +466,7 @@ describe('lib/main', function () {
467
466
  fs.writeFileSync('fuga', '')
468
467
  })
469
468
  after(() => {
470
- ['build', 'fuga', '__unittest'].forEach((path) => {
469
+ ['fuga', '__unittest'].forEach((path) => {
471
470
  fs.removeSync(path)
472
471
  })
473
472
  })
@@ -157,7 +157,7 @@ describe('bin/node-lambda', () => {
157
157
  process.env.AWS_RUNTIME = 'test'
158
158
  })
159
159
  after(() => {
160
- process.env.AWS_RUNTIME = 'nodejs14.x'
160
+ process.env.AWS_RUNTIME = 'nodejs16.x'
161
161
  })
162
162
 
163
163
  it('`node-lambda run` exitCode is `254` (callback(null))', (done) => {
package/test/s3_events.js CHANGED
@@ -60,7 +60,7 @@ describe('lib/s3_events', () => {
60
60
  describe('_statementId', () => {
61
61
  it('StatementId that matches /[a-zA-Z0-9-_]+/.', () => {
62
62
  [{
63
- params: params,
63
+ params,
64
64
  expected: 'node-lambda-test-bucket'
65
65
  }, {
66
66
  params: { Bucket: 'example.com' },