aws-lambda-layer-cli 1.4.1 → 2.0.2

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.
package/README.md CHANGED
@@ -4,384 +4,87 @@ A command-line tool for creating and publishing AWS Lambda layers for Node.js an
4
4
 
5
5
  ## Features
6
6
 
7
- - **Create Layers**: Generate Lambda layer zip files for Node.js and Python
8
- - **Publish to AWS**: Directly publish layers to AWS Lambda with IAM credentials
9
- - **Version Management**: Support for package version specification
10
- - **Security**: Input validation and sanitization
11
- - **Smart Naming**: Automatic layer naming with package versions
12
- - **Multiple Packages**: Support for multiple packages in a single layer
13
- - **Runtime Versioning**: Specify Node.js or Python versions
14
- - **Package Managers**: Support for npm (Node.js) and uv/pip (Python)
15
- - **AWS Profile Support**: Use different AWS profiles for publishing
16
- - **Region Specification**: Target specific AWS regions
7
+ - Create and publish Lambda layers for Node.js (npm) and Python (uv/pip)
8
+ - Automatic version management and smart naming
9
+ - Direct publishing to AWS with IAM credentials and region support
10
+ - Support for multiple packages in a single layer
17
11
 
18
12
  ## Installation
19
13
 
20
- ### Package managers (recommended)
21
-
22
- These installs do **not** write to `/usr/local` and do **not** require `sudo`.
14
+ ### Package Managers (Recommended)
23
15
 
24
16
  #### npm (Node.js)
25
-
26
17
  ```bash
27
18
  npm i -g aws-lambda-layer-cli
28
- aws-lambda-layer --help
29
- ```
30
-
31
- #### pip (Python)
32
-
33
- ```bash
34
- python -m pip install --user aws-lambda-layer-cli
35
- aws-lambda-layer --help
36
19
  ```
37
20
 
38
21
  #### uv (Python)
39
-
40
22
  ```bash
41
23
  uv tool install aws-lambda-layer-cli
42
- aws-lambda-layer --help
43
24
  ```
44
25
 
45
- ### Linux/macOS
46
-
47
- ```bash
48
- # Clone or download the repository
49
- git clone <repository-url>
50
- cd aws-lambda-layer-cli
51
-
52
- # Run installation script (requires sudo)
53
- sudo ./scripts/install.sh
54
- ```
55
-
56
- The installation will:
57
- - Copy scripts to `/usr/local/lib/aws-lambda-layer`
58
- - Create a symlink in `/usr/local/bin` for global access
59
- - Install shell completions for bash and zsh
60
-
61
- ### Windows
62
-
63
- #### Option 1: PowerShell (Recommended)
64
-
65
- ```powershell
66
- # One-liner installation
67
- powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/install.ps1 | iex"
68
- ```
69
-
70
- Or download and run manually:
71
-
72
- ```powershell
73
- # Download the installer
74
- Invoke-WebRequest -Uri "https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/install.ps1" -OutFile "install.ps1"
75
-
76
- # Run the installer (as Administrator)
77
- .\install.ps1
78
- ```
79
-
80
- This will:
81
- - Download the tool to `%USERPROFILE%\.aws-lambda-layer`
82
- - Add it to your PATH
83
- - Create Windows wrapper scripts
84
-
85
- #### Option 2: Manual Installation
86
-
87
- 1. Install prerequisites:
88
- - [Git for Windows](https://gitforwindows.org/) (includes Git Bash)
89
- - [AWS CLI](https://aws.amazon.com/cli/) (for publish command)
90
-
91
- 2. Download the scripts from the [repository](https://github.com/yukcw/aws-lambda-layer-cli)
92
-
93
- 3. Extract to a directory and add to PATH
94
-
95
26
  ### Requirements
27
+ - **System**: Linux, macOS, or Windows (WSL recommended)
28
+ - **Tools**: `zip`, `aws-cli` (for publishing), `node` (for Node.js layers), `python` (for Python layers)
96
29
 
97
- - **Linux/macOS**: Bash shell
98
- - **Windows**: Windows Subsystem for Linux (WSL) (recommended), or Git Bash/Cygwin
99
- - **AWS CLI**: Required for `publish` command
100
- - **Node.js**: Required for Node.js layer creation
101
- - **Python**: Required for Python layer creation (uv recommended)
102
- - **zip**: Required for creating zip archives
103
-
104
- **Note**: If using WSL, ensure that AWS CLI, Node.js, Python, and zip are installed within WSL for proper functionality.
105
-
106
- ## Uninstallation
107
-
108
- ### Package managers
109
-
110
- ```bash
111
- # npm
112
- npm uninstall -g aws-lambda-layer-cli
113
-
114
- # pip
115
- python -m pip uninstall aws-lambda-layer-cli
116
-
117
- # uv
118
- uv tool uninstall aws-lambda-layer-cli
119
- ```
120
-
121
- ### Linux/macOS
122
-
123
- ```bash
124
- sudo ./scripts/uninstall.sh
125
- ```
126
-
127
- ### Windows
128
-
129
- #### Using PowerShell
130
-
131
- ```powershell
132
- # Download and run the uninstaller
133
- Invoke-WebRequest -Uri "https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/uninstall.ps1" -OutFile "uninstall.ps1"
134
- .\uninstall.ps1
135
- ```
136
-
137
- Or run directly without downloading:
138
-
139
- ```powershell
140
- powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/uninstall.ps1 | iex"
141
- ```
142
- #### Troubleshooting Windows Installation
143
-
144
- If you encounter issues:
145
-
146
- 1. **"bash: command not found"**
147
- - Install [Git for Windows](https://gitforwindows.org/) or [WSL](https://docs.microsoft.com/en-us/windows/wsl/install)
148
- - Restart PowerShell/Command Prompt after installation
149
-
150
- 2. **"No such file or directory"**
151
- - Try running: `bash "$env:USERPROFILE\.aws-lambda-layer\aws-lambda-layer" --help`
152
- - Or reinstall: `powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/install.ps1 | iex"`
153
-
154
- 3. **Permission issues**
155
- - Run PowerShell as Administrator
156
- - Or run: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`
157
30
  ## Usage
158
31
 
159
- ### Basic Syntax
160
-
161
32
  ```bash
162
- # Create a local zip file
163
- aws-lambda-layer zip --nodejs <packages> [options]
164
- aws-lambda-layer zip --python <packages> [options]
165
-
166
- # Publish directly to AWS
167
- aws-lambda-layer publish --nodejs <packages> [options]
168
- aws-lambda-layer publish --python <packages> [options]
33
+ aws-lambda-layer-cli <command> [options]
169
34
  ```
170
35
 
171
36
  ### Commands
172
-
173
- - **zip**: Create and package a Lambda layer as zip file
174
- - **publish**: Create and publish a Lambda layer to AWS (uses IAM credentials)
175
- - **help**: Show help message
176
-
177
- ### Runtime Options
178
-
179
- - `--nodejs`, `--node`, `-n`: Create a Node.js Lambda layer
180
- - `--python`, `--py`, `-p`: Create a Python Lambda layer
181
- - `--runtime=RUNTIME`: Specify runtime (nodejs or python)
182
-
183
- ### Common Options
184
-
185
- - `--name`: Name for the output zip file / layer name
186
- - `--description`: Description for the layer (publish command only)
187
- - `-h`, `--help`: Show help message
188
-
189
- ### AWS Options (publish command only)
190
-
191
- - `--profile`: AWS CLI profile to use (default: default profile)
192
- - `--region`: AWS region (e.g., us-east-1, ap-east-1)
193
-
194
- ### Node.js Specific Options
195
-
196
- - `--node-version`: Node.js version (default: 24)
197
-
198
- ### Python Specific Options
199
-
200
- - `--python-version`: Python version (default: 3.14)
201
- - `--no-uv`: Use pip/venv instead of uv
37
+ - `zip`: Create a local zip file
38
+ - `publish`: Create and publish a layer to AWS
39
+ - `completion`: Generate shell completion scripts
40
+ - `uninstall`: Uninstall the tool
41
+ - `help`: Show help message
42
+
43
+ ### Options
44
+
45
+ | Option | Description |
46
+ |--------|-------------|
47
+ | `--nodejs, -n <pkgs>` | Create Node.js layer (comma-separated packages) |
48
+ | `--python, -p <pkgs>` | Create Python layer (comma-separated packages) |
49
+ | `--name` | Custom layer name |
50
+ | `--description` | Layer description (publish only) |
51
+ | `--profile` | AWS CLI profile (publish only) |
52
+ | `--region` | AWS region (publish only) |
53
+ | `--node-version` | Node.js version (default: 24) |
54
+ | `--python-version` | Python version (default: 3.14) |
55
+ | `--no-uv` | Use pip/venv instead of uv |
56
+ | `-v, --version` | Show version |
202
57
 
203
58
  ## Examples
204
59
 
205
- ### Node.js Examples
206
-
207
- #### Create Local Zip Files
208
-
209
- ```bash
210
- # Single package with version
211
- aws-lambda-layer zip --nodejs express@4.18.2
212
-
213
- # Multiple packages with versions
214
- aws-lambda-layer zip --nodejs express@4.18.2,axios@1.6.2,lodash@4.17.21
215
-
216
- # With custom name
217
- aws-lambda-layer zip --nodejs axios,lodash --name utility-layer
218
-
219
- # With specific Node.js version
220
- aws-lambda-layer zip --nodejs express@4.18.2 --node-version 20
221
-
222
- # Scoped packages
223
- aws-lambda-layer zip --nodejs @babel/core@7.23.0,@babel/types@7.23.0
224
- ```
225
-
226
- #### Publish to AWS
227
-
228
- ```bash
229
- # Basic publish
230
- aws-lambda-layer publish --nodejs express@4.18.2 --description "Express layer"
231
-
232
- # With custom layer name
233
- aws-lambda-layer publish --nodejs date-fns,uuid --name utility-layer --description "Utility packages"
234
-
235
- # Using specific AWS profile
236
- aws-lambda-layer publish --nodejs express@4.18.2 --profile production --description "Express layer"
237
-
238
- # Specify AWS region
239
- aws-lambda-layer publish --nodejs axios --region ap-east-1 --description "Axios layer"
240
-
241
- # With both profile and region
242
- aws-lambda-layer publish --nodejs lodash --profile dev --region us-east-1 --description "Lodash layer"
243
- ```
244
-
245
- ### Python Examples
246
-
247
- #### Create Local Zip Files
248
-
60
+ ### Node.js
249
61
  ```bash
250
- # Single package with version
251
- aws-lambda-layer zip --python numpy==1.26.0
252
-
253
- # Multiple packages
254
- aws-lambda-layer zip --python numpy==1.26.0,pandas==2.1.3,requests>=2.31.0
255
-
256
- # With custom name
257
- aws-lambda-layer zip --python requests,pytz --name web-utils
62
+ # Create local zip with multiple packages
63
+ aws-lambda-layer-cli zip --nodejs express@4.18.2,axios --name my-layer
258
64
 
259
- # With specific Python version
260
- aws-lambda-layer zip --python numpy==1.26.0 --python-version 3.12
261
-
262
- # Using pip instead of uv
263
- aws-lambda-layer zip --python pandas==2.1.3 --no-uv
65
+ # Publish to AWS with specific profile and region
66
+ aws-lambda-layer-cli publish --nodejs lodash --profile prod --region us-east-1 --description "Utils"
264
67
  ```
265
68
 
266
- #### Publish to AWS
267
-
69
+ ### Python
268
70
  ```bash
269
- # Basic publish
270
- aws-lambda-layer publish --python numpy==1.26.0 --description "NumPy layer"
71
+ # Create local zip with specific python version
72
+ aws-lambda-layer-cli zip --python numpy==1.26.0,pandas --python-version 3.12
271
73
 
272
- # Multiple packages with description
273
- aws-lambda-layer publish --python requests==2.31.0,pytz==2023.3 --description "Web utilities"
274
-
275
- # Using specific AWS profile
276
- aws-lambda-layer publish --python pandas==2.1.3 --profile production --description "Pandas layer"
277
-
278
- # Specify AWS region
279
- aws-lambda-layer publish --python numpy==1.26.0 --region us-west-2 --description "NumPy layer"
280
-
281
- # With both profile and region
282
- aws-lambda-layer publish --python scikit-learn --profile ml-account --region eu-west-1 --description "ML layer"
74
+ # Publish to AWS
75
+ aws-lambda-layer-cli publish --python requests --name web-layer
283
76
  ```
284
77
 
285
- ## Package Version Formats
286
-
287
- ### Node.js
288
- - `express@4.18.2` - Exact version
289
- - `axios` - Latest version
290
- - `lodash@^4.17.0` - Compatible version
291
- - `@babel/core@7.23.0,@babel/types@7.23.0` - Multiple scoped packages
292
-
293
- ### Python
294
- - `numpy==1.26.0` - Exact version
295
- - `pandas` - Latest version
296
- - `requests>=2.31.0` - Minimum version
297
- - `pytz~=2023.3` - Compatible version
298
-
299
- ## Publishing to AWS
300
-
301
- ### Requirements
302
-
303
- Before using the `publish` command, ensure you have:
304
-
305
- 1. **AWS CLI installed and configured**
306
- ```bash
307
- aws configure
308
- # or for specific profile
309
- aws configure --profile production
310
- ```
311
-
312
- 2. **IAM Permissions**: Your IAM user/role needs:
313
- - `lambda:PublishLayerVersion`
314
- - `sts:GetCallerIdentity` (for account verification)
315
- - `iam:ListAccountAliases` (optional, for account info)
316
-
317
- 3. **Region Configuration**: Either:
318
- - Set default region: `aws configure set region us-east-1`
319
- - Or use `--region` flag when publishing
320
-
321
- 4. **zip command installed**: Ensure the `zip` command is available on your system.
322
-
323
- ### Confirmation Prompt
324
-
325
- When publishing, you'll see:
326
- 1. AWS Account ID
327
- 2. AWS Profile (if specified)
328
- 3. Account Aliases (if available)
329
- 4. Target Region
330
- 5. Confirmation prompt: `Do you want to proceed? [Y/n]:`
331
-
332
- Press Y (or Enter for default Yes) to proceed, or N to cancel.
333
-
334
- ## Output
335
-
336
- ### Zip Command
337
- Creates a zip file in the current directory with format:
338
- - Node.js: `<package-name>-<version>-nodejs<node-version>.zip`
339
- - Python: `<package-name>-<version>-python<python-version>.zip`
340
-
341
- ### Publish Command
342
- - Uploads layer to AWS Lambda
343
- - Returns Layer ARN
344
- - Shows usage examples
345
- - Provides command to attach to existing Lambda functions
346
-
347
- ## Troubleshooting
348
-
349
- ### Common Issues
350
-
351
- 1. **AWS credentials not configured**
352
- ```bash
353
- aws configure
354
- # or
355
- aws configure --profile your-profile
356
- ```
357
-
358
- 2. **IAM permissions missing**
359
- - Ensure your AWS credentials has `lambda:PublishLayerVersion` permission
360
-
361
- 3. **Layer name already exists**
362
- - Use `--name` option to specify a different name
363
- - Or delete the existing layer version
364
-
365
- 4. **Zip file too large**
366
- - AWS limit: 50MB for direct upload
367
- - Consider using fewer packages or S3 upload for larger layers
368
-
369
- 5. **Region not configured**
370
- - Use `--region` flag or configure default region:
371
- ```bash
372
- aws configure set region us-east-1
373
- ```
374
-
375
78
  ## Shell Completion
376
79
 
377
- Completions are installed for bash and zsh. Restart your shell or source the completion files:
80
+ Add to your shell config (`~/.bashrc` or `~/.zshrc`):
378
81
 
379
82
  ```bash
380
83
  # Bash
381
- source /etc/bash_completion.d/aws-lambda-layer-completion.bash
84
+ source <(aws-lambda-layer-cli completion --bash)
382
85
 
383
86
  # Zsh
384
- source /usr/local/share/zsh/site-functions/_aws-lambda-layer
87
+ source <(aws-lambda-layer-cli completion --zsh)
385
88
  ```
386
89
 
387
90
  ## License
@@ -0,0 +1,183 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ const { spawnSync } = require('child_process');
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ function which(cmd) {
10
+ const isWin = process.platform === 'win32';
11
+ const exts = isWin ? (process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM').split(';') : [''];
12
+ const paths = (process.env.PATH || '').split(path.delimiter);
13
+
14
+ for (const p of paths) {
15
+ if (!p) continue;
16
+ for (const ext of exts) {
17
+ const full = path.join(p, isWin ? cmd + ext.toLowerCase() : cmd);
18
+ if (fs.existsSync(full)) return full;
19
+ // Also check original case on Windows
20
+ const full2 = path.join(p, cmd + ext);
21
+ if (fs.existsSync(full2)) return full2;
22
+ }
23
+ }
24
+ return null;
25
+ }
26
+
27
+ function shQuote(s) {
28
+ // Single-quote for bash -lc
29
+ return `'${String(s).replace(/'/g, `'\\''`)}'`;
30
+ }
31
+
32
+ function windowsPathToWsl(p) {
33
+ // C:\Users\me\x -> /mnt/c/Users/me/x
34
+ const m = /^([a-zA-Z]):\\(.*)$/.exec(p);
35
+ if (!m) return null;
36
+ return `/mnt/${m[1].toLowerCase()}/${m[2].replace(/\\/g, '/')}`;
37
+ }
38
+
39
+ function cygpathConvert(mode, p) {
40
+ const cygpath = which('cygpath');
41
+ if (!cygpath) return null;
42
+ const res = spawnSync(cygpath, [mode, p], { encoding: 'utf8' });
43
+ if (res.status !== 0) return null;
44
+ return (res.stdout || '').trim();
45
+ }
46
+
47
+ function run(cmd, args) {
48
+ const res = spawnSync(cmd, args, { stdio: 'inherit' });
49
+ process.exit(res.status ?? 1);
50
+ }
51
+
52
+ const args = process.argv.slice(2);
53
+
54
+ if (args[0] === 'completion') {
55
+ const hasZsh = args.includes('--zsh');
56
+ const hasBash = args.includes('--bash');
57
+
58
+ if (args.includes('--help') || args.includes('-h') || (!hasZsh && !hasBash)) {
59
+ const GREEN = '\x1b[0;32m';
60
+ const YELLOW = '\x1b[0;33m';
61
+ const BLUE = '\x1b[0;34m';
62
+ const MAGENTA = '\x1b[0;35m';
63
+ const NC = '\x1b[0m';
64
+ const UNDERLINE = '\x1b[4m';
65
+
66
+ console.log(`${BLUE}Usage:${NC}`);
67
+ console.log(` aws-lambda-layer-cli ${GREEN}completion${NC} [options]`);
68
+ console.log('');
69
+ console.log(`${BLUE}Options:${NC}`);
70
+ console.log(` ${YELLOW}--zsh${NC} Output zsh completion script`);
71
+ console.log(` ${YELLOW}--bash${NC} Output bash completion script`);
72
+ console.log('');
73
+ console.log(`${MAGENTA}${UNDERLINE}Examples:${NC}`);
74
+ console.log(' # Load completion in current shell');
75
+ console.log(` source <(aws-lambda-layer-cli ${GREEN}completion${NC} ${YELLOW}--bash${NC})`);
76
+ console.log('');
77
+ console.log(' # Add to .zshrc');
78
+ console.log(` aws-lambda-layer-cli ${GREEN}completion${NC} ${YELLOW}--zsh${NC} >> ~/.zshrc`);
79
+ process.exit(0);
80
+ }
81
+
82
+ const completionDir = path.resolve(__dirname, '..', 'completion');
83
+ let shell = '';
84
+
85
+ if (hasZsh) {
86
+ shell = 'zsh';
87
+ } else if (hasBash) {
88
+ shell = 'bash';
89
+ }
90
+
91
+ if (shell === 'zsh') {
92
+ const file = path.join(completionDir, 'aws-lambda-layer-completion.zsh');
93
+ if (fs.existsSync(file)) {
94
+ let content = fs.readFileSync(file, 'utf8');
95
+ // Remove the auto-execution line if present, to make it safe for sourcing
96
+ content = content.replace(/_aws-lambda-layer-cli "\$@"\s*$/, '');
97
+ console.log(content);
98
+ console.log('\n# Register completion');
99
+ console.log('if type compdef &>/dev/null; then');
100
+ console.log(' compdef _aws-lambda-layer-cli aws-lambda-layer-cli');
101
+ console.log('fi');
102
+ } else {
103
+ console.error('Completion script not found for zsh');
104
+ process.exit(1);
105
+ }
106
+ } else {
107
+ // bash
108
+ const file = path.join(completionDir, 'aws-lambda-layer-completion.bash');
109
+ if (fs.existsSync(file)) {
110
+ console.log(fs.readFileSync(file, 'utf8'));
111
+ } else {
112
+ console.error('Completion script not found for bash');
113
+ process.exit(1);
114
+ }
115
+ }
116
+ process.exit(0);
117
+ }
118
+
119
+ if (args[0] === 'uninstall') {
120
+ if (args.includes('--help') || args.includes('-h')) {
121
+ const GREEN = '\x1b[0;32m';
122
+ const BLUE = '\x1b[0;34m';
123
+ const NC = '\x1b[0m';
124
+
125
+ console.log(`${BLUE}Usage:${NC}`);
126
+ console.log(` aws-lambda-layer-cli ${GREEN}uninstall${NC}`);
127
+ console.log('');
128
+ console.log(`${BLUE}Description:${NC}`);
129
+ console.log(' Uninstalls the AWS Lambda Layer CLI tool and removes all associated files.');
130
+ console.log(' This includes:');
131
+ console.log(' - The CLI executable and symlinks');
132
+ console.log(' - The installation directory');
133
+ console.log(' - Shell completion scripts');
134
+ process.exit(0);
135
+ }
136
+
137
+ const uninstallScript = path.resolve(__dirname, '..', 'scripts', 'uninstall.js');
138
+ if (fs.existsSync(uninstallScript)) {
139
+ run(process.execPath, [uninstallScript, ...args.slice(1)]);
140
+ } else {
141
+ console.error('Uninstall script not found');
142
+ process.exit(1);
143
+ }
144
+ return;
145
+ }
146
+
147
+ const bashScript = path.resolve(__dirname, '..', 'scripts', 'aws-lambda-layer-cli');
148
+
149
+ if (!fs.existsSync(bashScript)) {
150
+ console.error('Error: packaged bash script not found:', bashScript);
151
+ process.exit(1);
152
+ }
153
+
154
+ // POSIX platforms
155
+ if (process.platform !== 'win32') {
156
+ run('bash', [bashScript, ...args]);
157
+ }
158
+
159
+ // Windows platforms:
160
+ // - Prefer Git Bash / MSYS / Cygwin: convert to POSIX path using cygpath -u
161
+ // - Else attempt WSL: convert to /mnt/<drive>/... and run via wsl.exe
162
+ // - Else give a clear message
163
+
164
+ const posixPath = cygpathConvert('-u', bashScript);
165
+ if (posixPath) {
166
+ run('bash', [posixPath, ...args]);
167
+ }
168
+
169
+ const wsl = which('wsl.exe') || which('wsl');
170
+ if (wsl) {
171
+ const wslPath = windowsPathToWsl(bashScript);
172
+ if (!wslPath) {
173
+ console.error('Error: unable to convert path for WSL:', bashScript);
174
+ process.exit(1);
175
+ }
176
+
177
+ const cmd = `bash ${shQuote(wslPath)} ${args.map(shQuote).join(' ')}`.trim();
178
+ run(wsl, ['bash', '-lc', cmd]);
179
+ }
180
+
181
+ console.error('Error: no compatible bash found on Windows.');
182
+ console.error('Install and run this tool inside WSL, or install Git Bash and ensure `bash`/`cygpath` are on PATH.');
183
+ process.exit(1);
@@ -1,8 +1,12 @@
1
- # bash completion for aws-lambda-layer
1
+ # bash completion for aws-lambda-layer-cli
2
2
 
3
- _aws_lambda_layer() {
3
+ _aws_lambda_layer_cli() {
4
4
  local cur prev words cword
5
- _init_completion || return
5
+ # Use fallback variables for older bash versions
6
+ cur="${COMP_WORDS[COMP_CWORD]}"
7
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
8
+ words=("${COMP_WORDS[@]}")
9
+ cword=$COMP_CWORD
6
10
 
7
11
  local commands="zip publish help --help --version"
8
12
  local runtime_opts="--nodejs --node -n --python --py -p --runtime"
@@ -98,4 +102,4 @@ _aws_lambda_layer() {
98
102
  esac
99
103
  }
100
104
 
101
- complete -F _aws_lambda_layer aws-lambda-layer
105
+ complete -F _aws_lambda_layer_cli aws-lambda-layer-cli
@@ -1,6 +1,6 @@
1
- #compdef aws-lambda-layer
1
+ #compdef aws-lambda-layer-cli
2
2
 
3
- _aws-lambda-layer() {
3
+ _aws-lambda-layer-cli() {
4
4
  local -a commands runtime_opts common_opts node_opts python_opts
5
5
 
6
6
  commands=(
@@ -107,4 +107,4 @@ _aws-lambda-layer() {
107
107
  esac
108
108
  }
109
109
 
110
- _aws-lambda-layer "$@"
110
+ # _aws-lambda-layer-cli "$@"
package/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "aws-lambda-layer-cli",
3
- "version": "1.4.1",
3
+ "version": "2.0.2",
4
4
  "description": "CLI tool for creating and publishing AWS Lambda layers for Node.js and Python.",
5
+ "keywords": [
6
+ "aws",
7
+ "lambda",
8
+ "nodejs",
9
+ "serverless",
10
+ "amazon",
11
+ "cli",
12
+ "zip",
13
+ "publish",
14
+ "layer",
15
+ "tools"
16
+ ],
5
17
  "license": "MIT",
6
18
  "repository": {
7
19
  "type": "git",
@@ -13,10 +25,12 @@
13
25
  "homepage": "https://github.com/yukcw/aws-lambda-layer-cli#readme",
14
26
  "scripts": {
15
27
  "sync-version": "node scripts/sync_version.js",
16
- "prepublishOnly": "npm run sync-version"
28
+ "prepublishOnly": "npm run sync-version",
29
+ "postinstall": "node scripts/install.js",
30
+ "preuninstall": "node scripts/uninstall.js"
17
31
  },
18
32
  "bin": {
19
- "aws-lambda-layer": "bin/aws-lambda-layer.js"
33
+ "aws-lambda-layer-cli": "bin/aws-lambda-layer-cli.js"
20
34
  },
21
35
  "engines": {
22
36
  "node": ">=18"