aws-lambda-layer-cli 2.0.1 → 2.0.3
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 +40 -339
- package/package.json +2 -1
- package/scripts/aws-lambda-layer-cli +4 -3
- package/scripts/install.ps1 +1 -1
- package/scripts/sync_version.js +36 -3
- package/scripts/uninstall.ps1 +10 -0
- package/scripts/uninstall.sh +9 -0
package/README.md
CHANGED
|
@@ -4,386 +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
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
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
14
|
### Package Managers (Recommended)
|
|
21
15
|
|
|
22
|
-
These installs do **not** write to `/usr/local` and do **not** require `sudo`.
|
|
23
|
-
|
|
24
16
|
#### npm (Node.js)
|
|
25
|
-
|
|
26
17
|
```bash
|
|
27
18
|
npm i -g aws-lambda-layer-cli
|
|
28
|
-
aws-lambda-layer-cli --help
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
#### pip (Python)
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
python -m pip install --user aws-lambda-layer-cli
|
|
35
|
-
aws-lambda-layer-cli --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-cli --help
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Native Installation
|
|
46
|
-
|
|
47
|
-
#### Linux/macOS
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
# Clone or download the repository
|
|
51
|
-
git clone https://github.com/yukcw/aws-lambda-layer-cli.git
|
|
52
|
-
cd aws-lambda-layer-cli
|
|
53
|
-
|
|
54
|
-
# Run installation script (requires sudo)
|
|
55
|
-
sudo ./scripts/install.sh
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
The installation will:
|
|
59
|
-
- Copy scripts to `/usr/local/lib/aws-lambda-layer-cli`
|
|
60
|
-
- Create a symlink in `/usr/local/bin` for global access
|
|
61
|
-
- Install shell completions for bash and zsh
|
|
62
|
-
|
|
63
|
-
#### Windows
|
|
64
|
-
|
|
65
|
-
##### Option 1: PowerShell
|
|
66
|
-
|
|
67
|
-
```powershell
|
|
68
|
-
# One-liner installation
|
|
69
|
-
powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/install.ps1 | iex"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Or download and run manually:
|
|
73
|
-
|
|
74
|
-
```powershell
|
|
75
|
-
# Download the installer
|
|
76
|
-
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/install.ps1" -OutFile "install.ps1"
|
|
77
|
-
|
|
78
|
-
# Run the installer (as Administrator)
|
|
79
|
-
.\install.ps1
|
|
80
24
|
```
|
|
81
25
|
|
|
82
|
-
This will:
|
|
83
|
-
- Download the tool to `%USERPROFILE%\.aws-lambda-layer-cli`
|
|
84
|
-
- Add it to your PATH
|
|
85
|
-
- Create Windows wrapper scripts
|
|
86
|
-
|
|
87
|
-
##### Option 2: Manual Installation
|
|
88
|
-
|
|
89
|
-
1. Install prerequisites:
|
|
90
|
-
- [Git for Windows](https://gitforwindows.org/) (includes Git Bash)
|
|
91
|
-
- [AWS CLI](https://aws.amazon.com/cli/) (for publish command)
|
|
92
|
-
|
|
93
|
-
2. Download the scripts from the [repository](https://github.com/yukcw/aws-lambda-layer-cli)
|
|
94
|
-
|
|
95
|
-
3. Extract to a directory and add to PATH
|
|
96
|
-
|
|
97
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)
|
|
98
29
|
|
|
99
|
-
- **Linux/macOS**: Bash shell
|
|
100
|
-
- **Windows**: Windows Subsystem for Linux (WSL) (recommended), or Git Bash/Cygwin
|
|
101
|
-
- **AWS CLI**: Required for `publish` command
|
|
102
|
-
- **Node.js**: Required for Node.js layer creation
|
|
103
|
-
- **Python**: Required for Python layer creation (uv recommended)
|
|
104
|
-
- **zip**: Required for creating zip archives
|
|
105
|
-
|
|
106
|
-
**Note**: If using WSL, ensure that AWS CLI, Node.js, Python, and zip are installed within WSL for proper functionality.
|
|
107
|
-
|
|
108
|
-
## Uninstallation
|
|
109
|
-
|
|
110
|
-
### Package managers
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
# npm
|
|
114
|
-
npm uninstall -g aws-lambda-layer-cli
|
|
115
|
-
|
|
116
|
-
# pip
|
|
117
|
-
python -m pip uninstall aws-lambda-layer-cli
|
|
118
|
-
|
|
119
|
-
# uv
|
|
120
|
-
uv tool uninstall aws-lambda-layer-cli
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Linux/macOS
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
sudo ./scripts/uninstall.sh
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### Windows
|
|
130
|
-
|
|
131
|
-
#### Using PowerShell
|
|
132
|
-
|
|
133
|
-
```powershell
|
|
134
|
-
# Download and run the uninstaller
|
|
135
|
-
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/uninstall.ps1" -OutFile "uninstall.ps1"
|
|
136
|
-
.\uninstall.ps1
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Or run directly without downloading:
|
|
140
|
-
|
|
141
|
-
```powershell
|
|
142
|
-
powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/uninstall.ps1 | iex"
|
|
143
|
-
```
|
|
144
|
-
#### Troubleshooting Windows Installation
|
|
145
|
-
|
|
146
|
-
If you encounter issues:
|
|
147
|
-
|
|
148
|
-
1. **"bash: command not found"**
|
|
149
|
-
- Install [Git for Windows](https://gitforwindows.org/) or [WSL](https://docs.microsoft.com/en-us/windows/wsl/install)
|
|
150
|
-
- Restart PowerShell/Command Prompt after installation
|
|
151
|
-
|
|
152
|
-
2. **"No such file or directory"**
|
|
153
|
-
- Try running: `bash "$env:USERPROFILE\.aws-lambda-layer-cli\aws-lambda-layer-cli" --help`
|
|
154
|
-
- Or reinstall: `powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/yukcw/aws-lambda-layer-cli/main/scripts/install.ps1 | iex"`
|
|
155
|
-
|
|
156
|
-
3. **Permission issues**
|
|
157
|
-
- Run PowerShell as Administrator
|
|
158
|
-
- Or run: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`
|
|
159
30
|
## Usage
|
|
160
31
|
|
|
161
|
-
### Basic Syntax
|
|
162
|
-
|
|
163
32
|
```bash
|
|
164
|
-
|
|
165
|
-
aws-lambda-layer zip --nodejs <packages> [options]
|
|
166
|
-
aws-lambda-layer zip --python <packages> [options]
|
|
167
|
-
|
|
168
|
-
# Publish directly to AWS
|
|
169
|
-
aws-lambda-layer publish --nodejs <packages> [options]
|
|
170
|
-
aws-lambda-layer publish --python <packages> [options]
|
|
33
|
+
aws-lambda-layer-cli <command> [options]
|
|
171
34
|
```
|
|
172
35
|
|
|
173
36
|
### Commands
|
|
174
|
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
- `--region`: AWS region (e.g., us-east-1, ap-east-1)
|
|
195
|
-
|
|
196
|
-
### Node.js Specific Options
|
|
197
|
-
|
|
198
|
-
- `--node-version`: Node.js version (default: 24)
|
|
199
|
-
|
|
200
|
-
### Python Specific Options
|
|
201
|
-
|
|
202
|
-
- `--python-version`: Python version (default: 3.14)
|
|
203
|
-
- `--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 |
|
|
204
57
|
|
|
205
58
|
## Examples
|
|
206
59
|
|
|
207
|
-
### Node.js
|
|
208
|
-
|
|
209
|
-
#### Create Local Zip Files
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
# Single package with version
|
|
213
|
-
aws-lambda-layer zip --nodejs express@4.18.2
|
|
214
|
-
|
|
215
|
-
# Multiple packages with versions
|
|
216
|
-
aws-lambda-layer zip --nodejs express@4.18.2,axios@1.6.2,lodash@4.17.21
|
|
217
|
-
|
|
218
|
-
# With custom name
|
|
219
|
-
aws-lambda-layer zip --nodejs axios,lodash --name utility-layer
|
|
220
|
-
|
|
221
|
-
# With specific Node.js version
|
|
222
|
-
aws-lambda-layer zip --nodejs express@4.18.2 --node-version 20
|
|
223
|
-
|
|
224
|
-
# Scoped packages
|
|
225
|
-
aws-lambda-layer zip --nodejs @babel/core@7.23.0,@babel/types@7.23.0
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
#### Publish to AWS
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
# Basic publish
|
|
232
|
-
aws-lambda-layer publish --nodejs express@4.18.2 --description "Express layer"
|
|
233
|
-
|
|
234
|
-
# With custom layer name
|
|
235
|
-
aws-lambda-layer publish --nodejs date-fns,uuid --name utility-layer --description "Utility packages"
|
|
236
|
-
|
|
237
|
-
# Using specific AWS profile
|
|
238
|
-
aws-lambda-layer publish --nodejs express@4.18.2 --profile production --description "Express layer"
|
|
239
|
-
|
|
240
|
-
# Specify AWS region
|
|
241
|
-
aws-lambda-layer publish --nodejs axios --region ap-east-1 --description "Axios layer"
|
|
242
|
-
|
|
243
|
-
# With both profile and region
|
|
244
|
-
aws-lambda-layer publish --nodejs lodash --profile dev --region us-east-1 --description "Lodash layer"
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Python Examples
|
|
248
|
-
|
|
249
|
-
#### Create Local Zip Files
|
|
250
|
-
|
|
60
|
+
### Node.js
|
|
251
61
|
```bash
|
|
252
|
-
#
|
|
253
|
-
aws-lambda-layer zip --
|
|
254
|
-
|
|
255
|
-
# Multiple packages
|
|
256
|
-
aws-lambda-layer zip --python numpy==1.26.0,pandas==2.1.3,requests>=2.31.0
|
|
257
|
-
|
|
258
|
-
# With custom name
|
|
259
|
-
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
|
|
260
64
|
|
|
261
|
-
#
|
|
262
|
-
aws-lambda-layer
|
|
263
|
-
|
|
264
|
-
# Using pip instead of uv
|
|
265
|
-
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"
|
|
266
67
|
```
|
|
267
68
|
|
|
268
|
-
|
|
269
|
-
|
|
69
|
+
### Python
|
|
270
70
|
```bash
|
|
271
|
-
#
|
|
272
|
-
aws-lambda-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
|
|
273
73
|
|
|
274
|
-
#
|
|
275
|
-
aws-lambda-layer publish --python requests
|
|
276
|
-
|
|
277
|
-
# Using specific AWS profile
|
|
278
|
-
aws-lambda-layer publish --python pandas==2.1.3 --profile production --description "Pandas layer"
|
|
279
|
-
|
|
280
|
-
# Specify AWS region
|
|
281
|
-
aws-lambda-layer publish --python numpy==1.26.0 --region us-west-2 --description "NumPy layer"
|
|
282
|
-
|
|
283
|
-
# With both profile and region
|
|
284
|
-
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
|
|
285
76
|
```
|
|
286
77
|
|
|
287
|
-
## Package Version Formats
|
|
288
|
-
|
|
289
|
-
### Node.js
|
|
290
|
-
- `express@4.18.2` - Exact version
|
|
291
|
-
- `axios` - Latest version
|
|
292
|
-
- `lodash@^4.17.0` - Compatible version
|
|
293
|
-
- `@babel/core@7.23.0,@babel/types@7.23.0` - Multiple scoped packages
|
|
294
|
-
|
|
295
|
-
### Python
|
|
296
|
-
- `numpy==1.26.0` - Exact version
|
|
297
|
-
- `pandas` - Latest version
|
|
298
|
-
- `requests>=2.31.0` - Minimum version
|
|
299
|
-
- `pytz~=2023.3` - Compatible version
|
|
300
|
-
|
|
301
|
-
## Publishing to AWS
|
|
302
|
-
|
|
303
|
-
### Requirements
|
|
304
|
-
|
|
305
|
-
Before using the `publish` command, ensure you have:
|
|
306
|
-
|
|
307
|
-
1. **AWS CLI installed and configured**
|
|
308
|
-
```bash
|
|
309
|
-
aws configure
|
|
310
|
-
# or for specific profile
|
|
311
|
-
aws configure --profile production
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
2. **IAM Permissions**: Your IAM user/role needs:
|
|
315
|
-
- `lambda:PublishLayerVersion`
|
|
316
|
-
- `sts:GetCallerIdentity` (for account verification)
|
|
317
|
-
- `iam:ListAccountAliases` (optional, for account info)
|
|
318
|
-
|
|
319
|
-
3. **Region Configuration**: Either:
|
|
320
|
-
- Set default region: `aws configure set region us-east-1`
|
|
321
|
-
- Or use `--region` flag when publishing
|
|
322
|
-
|
|
323
|
-
4. **zip command installed**: Ensure the `zip` command is available on your system.
|
|
324
|
-
|
|
325
|
-
### Confirmation Prompt
|
|
326
|
-
|
|
327
|
-
When publishing, you'll see:
|
|
328
|
-
1. AWS Account ID
|
|
329
|
-
2. AWS Profile (if specified)
|
|
330
|
-
3. Account Aliases (if available)
|
|
331
|
-
4. Target Region
|
|
332
|
-
5. Confirmation prompt: `Do you want to proceed? [Y/n]:`
|
|
333
|
-
|
|
334
|
-
Press Y (or Enter for default Yes) to proceed, or N to cancel.
|
|
335
|
-
|
|
336
|
-
## Output
|
|
337
|
-
|
|
338
|
-
### Zip Command
|
|
339
|
-
Creates a zip file in the current directory with format:
|
|
340
|
-
- Node.js: `<package-name>-<version>-nodejs<node-version>.zip`
|
|
341
|
-
- Python: `<package-name>-<version>-python<python-version>.zip`
|
|
342
|
-
|
|
343
|
-
### Publish Command
|
|
344
|
-
- Uploads layer to AWS Lambda
|
|
345
|
-
- Returns Layer ARN
|
|
346
|
-
- Shows usage examples
|
|
347
|
-
- Provides command to attach to existing Lambda functions
|
|
348
|
-
|
|
349
|
-
## Troubleshooting
|
|
350
|
-
|
|
351
|
-
### Common Issues
|
|
352
|
-
|
|
353
|
-
1. **AWS credentials not configured**
|
|
354
|
-
```bash
|
|
355
|
-
aws configure
|
|
356
|
-
# or
|
|
357
|
-
aws configure --profile your-profile
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
2. **IAM permissions missing**
|
|
361
|
-
- Ensure your AWS credentials has `lambda:PublishLayerVersion` permission
|
|
362
|
-
|
|
363
|
-
3. **Layer name already exists**
|
|
364
|
-
- Use `--name` option to specify a different name
|
|
365
|
-
- Or delete the existing layer version
|
|
366
|
-
|
|
367
|
-
4. **Zip file too large**
|
|
368
|
-
- AWS limit: 50MB for direct upload
|
|
369
|
-
- Consider using fewer packages or S3 upload for larger layers
|
|
370
|
-
|
|
371
|
-
5. **Region not configured**
|
|
372
|
-
- Use `--region` flag or configure default region:
|
|
373
|
-
```bash
|
|
374
|
-
aws configure set region us-east-1
|
|
375
|
-
```
|
|
376
|
-
|
|
377
78
|
## Shell Completion
|
|
378
79
|
|
|
379
|
-
|
|
80
|
+
Add to your shell config (`~/.bashrc` or `~/.zshrc`):
|
|
380
81
|
|
|
381
82
|
```bash
|
|
382
83
|
# Bash
|
|
383
|
-
source
|
|
84
|
+
source <(aws-lambda-layer-cli completion --bash)
|
|
384
85
|
|
|
385
86
|
# Zsh
|
|
386
|
-
source
|
|
87
|
+
source <(aws-lambda-layer-cli completion --zsh)
|
|
387
88
|
```
|
|
388
89
|
|
|
389
90
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aws-lambda-layer-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "CLI tool for creating and publishing AWS Lambda layers for Node.js and Python.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"homepage": "https://github.com/yukcw/aws-lambda-layer-cli#readme",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"sync-version": "node scripts/sync_version.js",
|
|
28
|
+
"prepare": "npm run sync-version",
|
|
28
29
|
"prepublishOnly": "npm run sync-version",
|
|
29
30
|
"postinstall": "node scripts/install.js",
|
|
30
31
|
"preuninstall": "node scripts/uninstall.js"
|
|
@@ -47,7 +47,7 @@ COMPLETION_DIR="/etc/bash_completion.d"
|
|
|
47
47
|
# Show help
|
|
48
48
|
show_help() {
|
|
49
49
|
local version_file="$SCRIPT_DIR/VERSION.txt"
|
|
50
|
-
local version="
|
|
50
|
+
local version="2.0.3"
|
|
51
51
|
if [ -f "$version_file" ]; then
|
|
52
52
|
version=$(cat "$version_file")
|
|
53
53
|
fi
|
|
@@ -82,6 +82,7 @@ show_help() {
|
|
|
82
82
|
printf " ${YELLOW}--profile${NC} AWS CLI profile to use (default: default profile)\n"
|
|
83
83
|
printf " ${YELLOW}--region${NC} AWS region (e.g., us-east-1, ap-east-1)\n"
|
|
84
84
|
printf "${BLUE}Other Options:${NC}\n"
|
|
85
|
+
printf " ${YELLOW}--version, -v${NC} Show tool version information\n"
|
|
85
86
|
printf " ${YELLOW}--node-version${NC} Node.js version (default: 24)\n"
|
|
86
87
|
printf " ${YELLOW}--python-version${NC} Python version (default: 3.14)\n"
|
|
87
88
|
printf " ${YELLOW}--no-uv${NC} Use pip/venv instead of uv\n\n"
|
|
@@ -112,7 +113,7 @@ show_version() {
|
|
|
112
113
|
echo "v$version"
|
|
113
114
|
else
|
|
114
115
|
# Fallback if VERSION file is missing (e.g. during development or if moved)
|
|
115
|
-
echo "
|
|
116
|
+
echo "v2.0.3"
|
|
116
117
|
fi
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -232,7 +233,7 @@ get_aws_account_info() {
|
|
|
232
233
|
# Determine compatible runtimes for AWS
|
|
233
234
|
get_compatible_runtimes() {
|
|
234
235
|
local runtime="$1"
|
|
235
|
-
local version="
|
|
236
|
+
local version="2.0.3"
|
|
236
237
|
|
|
237
238
|
case "$runtime" in
|
|
238
239
|
nodejs)
|
package/scripts/install.ps1
CHANGED
|
@@ -44,7 +44,7 @@ if ([string]::IsNullOrEmpty($InstallDir)) {
|
|
|
44
44
|
# Configuration
|
|
45
45
|
$RepoUrl = "https://github.com/yukcw/aws-lambda-layer-cli"
|
|
46
46
|
$ToolName = "aws-lambda-layer-cli"
|
|
47
|
-
$Version = "
|
|
47
|
+
$Version = "2.0.3" # Fallback version
|
|
48
48
|
|
|
49
49
|
# Colors for output
|
|
50
50
|
$Green = "Green"
|
package/scripts/sync_version.js
CHANGED
|
@@ -7,16 +7,49 @@ const rootDir = path.resolve(__dirname, '..');
|
|
|
7
7
|
const versionFile = path.join(rootDir, 'VERSION.txt');
|
|
8
8
|
const packageJsonFile = path.join(rootDir, 'package.json');
|
|
9
9
|
|
|
10
|
+
// Files that need version updates
|
|
11
|
+
const scriptFiles = [
|
|
12
|
+
path.join(rootDir, 'scripts', 'aws-lambda-layer-cli'),
|
|
13
|
+
path.join(rootDir, 'aws_lambda_layer_cli', 'assets', 'aws-lambda-layer-cli'),
|
|
14
|
+
path.join(rootDir, 'scripts', 'install.ps1')
|
|
15
|
+
];
|
|
16
|
+
|
|
10
17
|
try {
|
|
11
18
|
const version = fs.readFileSync(versionFile, 'utf8').trim();
|
|
12
|
-
|
|
19
|
+
let updated = false;
|
|
13
20
|
|
|
21
|
+
// Update package.json
|
|
22
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonFile, 'utf8'));
|
|
14
23
|
if (packageJson.version !== version) {
|
|
15
24
|
console.log(`Updating package.json version from ${packageJson.version} to ${version}`);
|
|
16
25
|
packageJson.version = version;
|
|
17
26
|
fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2) + '\n');
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
updated = true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Update bash scripts
|
|
31
|
+
scriptFiles.forEach(file => {
|
|
32
|
+
if (fs.existsSync(file)) {
|
|
33
|
+
let content = fs.readFileSync(file, 'utf8');
|
|
34
|
+
let originalContent = content;
|
|
35
|
+
|
|
36
|
+
// Update version in bash scripts
|
|
37
|
+
content = content.replace(/local version="[^"]+"/g, `local version="${version}"`);
|
|
38
|
+
content = content.replace(/echo "v[0-9]+\.[0-9]+\.[0-9]+"/g, `echo "v${version}"`);
|
|
39
|
+
|
|
40
|
+
// Update version in PowerShell script
|
|
41
|
+
content = content.replace(/\$Version = "[^"]+"/g, `$Version = "${version}"`);
|
|
42
|
+
|
|
43
|
+
if (content !== originalContent) {
|
|
44
|
+
fs.writeFileSync(file, content);
|
|
45
|
+
console.log(`Updated version in ${path.relative(rootDir, file)}`);
|
|
46
|
+
updated = true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (!updated) {
|
|
52
|
+
console.log('All versions are already up to date.');
|
|
20
53
|
}
|
|
21
54
|
} catch (error) {
|
|
22
55
|
console.error('Error syncing version:', error);
|
package/scripts/uninstall.ps1
CHANGED
|
@@ -160,6 +160,16 @@ function Main {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
# Check uv
|
|
164
|
+
if (Get-Command uv -ErrorAction SilentlyContinue) {
|
|
165
|
+
$uvList = uv tool list 2>$null
|
|
166
|
+
if ($uvList -match "aws-lambda-layer-cli") {
|
|
167
|
+
Write-ColorOutput "Detected uv installation." $Yellow
|
|
168
|
+
Write-ColorOutput "Removing uv tool..." $White
|
|
169
|
+
uv tool uninstall aws-lambda-layer-cli
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
163
173
|
# Check if tool is installed
|
|
164
174
|
$isInstalled = Test-Installation
|
|
165
175
|
if (-not $isInstalled) {
|
package/scripts/uninstall.sh
CHANGED
|
@@ -52,6 +52,15 @@ if command -v pip &> /dev/null || command -v pip3 &> /dev/null; then
|
|
|
52
52
|
$PIP_CMD uninstall -y aws-lambda-layer-cli
|
|
53
53
|
fi
|
|
54
54
|
fi
|
|
55
|
+
aws-lambda-layer-cli --version
|
|
56
|
+
# Check uv
|
|
57
|
+
if command -v uv &> /dev/null; then
|
|
58
|
+
if uv tool list | grep -q "aws-lambda-layer-cli"; then
|
|
59
|
+
printf "${YELLOW}Detected uv installation.${NC}\n"
|
|
60
|
+
printf " Removing uv tool...\n"
|
|
61
|
+
uv tool uninstall aws-lambda-layer-cli
|
|
62
|
+
fi
|
|
63
|
+
fi
|
|
55
64
|
|
|
56
65
|
# Check Native (System)
|
|
57
66
|
if [ -d "/usr/local/lib/aws-lambda-layer-cli" ]; then
|