aws-lambda-layer-cli 2.0.3 → 2.0.4
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/package.json +1 -1
- package/scripts/aws-lambda-layer-cli +42 -6
- package/scripts/install.ps1 +662 -662
- package/scripts/uninstall.ps1 +209 -209
package/scripts/uninstall.ps1
CHANGED
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
#Requires -Version 5.1
|
|
2
|
-
|
|
3
|
-
<#
|
|
4
|
-
.SYNOPSIS
|
|
5
|
-
AWS Lambda Layer CLI Tool Uninstaller for Windows
|
|
6
|
-
|
|
7
|
-
.DESCRIPTION
|
|
8
|
-
Uninstalls the AWS Lambda Layer CLI tool from Windows systems.
|
|
9
|
-
|
|
10
|
-
.PARAMETER InstallDir
|
|
11
|
-
Directory where the tool is installed (default: $env:USERPROFILE\.aws-lambda-layer-cli)
|
|
12
|
-
|
|
13
|
-
.PARAMETER Force
|
|
14
|
-
Force uninstallation without confirmation
|
|
15
|
-
|
|
16
|
-
.EXAMPLE
|
|
17
|
-
# Uninstall with default settings
|
|
18
|
-
.\uninstall.ps1
|
|
19
|
-
|
|
20
|
-
.EXAMPLE
|
|
21
|
-
# Uninstall from custom directory
|
|
22
|
-
.\uninstall.ps1 -InstallDir "C:\Tools\aws-lambda-layer"
|
|
23
|
-
|
|
24
|
-
.EXAMPLE
|
|
25
|
-
# Force uninstall
|
|
26
|
-
.\uninstall.ps1 -Force
|
|
27
|
-
#>
|
|
28
|
-
|
|
29
|
-
param(
|
|
30
|
-
[string]$InstallDir = "",
|
|
31
|
-
[switch]$Force
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
# Determine InstallDir if not provided
|
|
35
|
-
if ([string]::IsNullOrEmpty($InstallDir)) {
|
|
36
|
-
if ($env:USERPROFILE) {
|
|
37
|
-
$InstallDir = Join-Path $env:USERPROFILE ".aws-lambda-layer-cli"
|
|
38
|
-
} elseif ($env:HOME) {
|
|
39
|
-
$InstallDir = Join-Path $env:HOME ".aws-lambda-layer-cli"
|
|
40
|
-
} else {
|
|
41
|
-
Write-Error "Could not determine home directory. Please specify -InstallDir."
|
|
42
|
-
exit 1
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# Colors for output
|
|
47
|
-
$Green = "Green"
|
|
48
|
-
$Yellow = "Yellow"
|
|
49
|
-
$Red = "Red"
|
|
50
|
-
$Cyan = "Cyan"
|
|
51
|
-
$White = "White"
|
|
52
|
-
|
|
53
|
-
function Write-ColorOutput {
|
|
54
|
-
param(
|
|
55
|
-
[string]$Message,
|
|
56
|
-
[string]$Color = $White
|
|
57
|
-
)
|
|
58
|
-
Write-Host $Message -ForegroundColor $Color
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function Write-Header {
|
|
62
|
-
Write-ColorOutput "`n=========================================" $Cyan
|
|
63
|
-
Write-ColorOutput "AWS Lambda Layer CLI Tool Uninstaller" $Green
|
|
64
|
-
Write-ColorOutput "=========================================" $Cyan
|
|
65
|
-
Write-ColorOutput "Install Directory: $InstallDir" $White
|
|
66
|
-
Write-ColorOutput ""
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function Test-Installation {
|
|
70
|
-
Write-ColorOutput "Checking installation..." $Yellow
|
|
71
|
-
|
|
72
|
-
if (-not (Test-Path $InstallDir)) {
|
|
73
|
-
Write-ColorOutput "Installation directory not found: $InstallDir" $Yellow
|
|
74
|
-
Write-ColorOutput "The tool doesn't appear to be installed." $White
|
|
75
|
-
return $false
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
$mainScript = Join-Path $InstallDir "aws-lambda-layer-cli"
|
|
79
|
-
if (-not (Test-Path $mainScript)) {
|
|
80
|
-
Write-ColorOutput "Main script not found: $mainScript" $Yellow
|
|
81
|
-
Write-ColorOutput "This doesn't look like a valid installation." $White
|
|
82
|
-
return $false
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
Write-ColorOutput "✓ Found installation at $InstallDir" $Green
|
|
86
|
-
return $true
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function Remove-FromPath {
|
|
90
|
-
Write-ColorOutput "Removing from PATH..." $Yellow
|
|
91
|
-
|
|
92
|
-
# Get current user PATH
|
|
93
|
-
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
94
|
-
|
|
95
|
-
# Remove our directory from PATH if present
|
|
96
|
-
if ($currentPath -like "*$InstallDir*") {
|
|
97
|
-
# Split PATH into array, filter out our directory, and rejoin
|
|
98
|
-
$pathArray = $currentPath -split ';' | Where-Object { $_ -ne $InstallDir -and $_ -ne "$InstallDir\" }
|
|
99
|
-
$newPath = $pathArray -join ';'
|
|
100
|
-
|
|
101
|
-
# Update PATH
|
|
102
|
-
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
|
|
103
|
-
Write-ColorOutput "✓ Removed $InstallDir from user PATH" $Green
|
|
104
|
-
Write-ColorOutput " Note: Restart your terminal for PATH changes to take effect" $Yellow
|
|
105
|
-
} else {
|
|
106
|
-
Write-ColorOutput "✓ $InstallDir not found in user PATH" $Green
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function Remove-Installation {
|
|
111
|
-
Write-ColorOutput "Removing installation files..." $Yellow
|
|
112
|
-
|
|
113
|
-
try {
|
|
114
|
-
# Remove the entire installation directory
|
|
115
|
-
Remove-Item $InstallDir -Recurse -Force
|
|
116
|
-
Write-ColorOutput "✓ Removed installation directory" $Green
|
|
117
|
-
return $true
|
|
118
|
-
} catch {
|
|
119
|
-
Write-ColorOutput "✗ Failed to remove installation directory" $Red
|
|
120
|
-
Write-ColorOutput "Error: $($_.Exception.Message)" $Red
|
|
121
|
-
return $false
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function Show-PostUninstall {
|
|
126
|
-
Write-ColorOutput "`n=========================================" $Cyan
|
|
127
|
-
Write-ColorOutput "Uninstallation Complete!" $Green
|
|
128
|
-
Write-ColorOutput "=========================================" $Cyan
|
|
129
|
-
Write-ColorOutput ""
|
|
130
|
-
Write-ColorOutput "The AWS Lambda Layer CLI tool has been removed from your system." $White
|
|
131
|
-
Write-ColorOutput ""
|
|
132
|
-
Write-ColorOutput "What was removed:" $Yellow
|
|
133
|
-
Write-ColorOutput " • Installation directory: $InstallDir" $White
|
|
134
|
-
Write-ColorOutput " • PATH entry (if present)" $White
|
|
135
|
-
Write-ColorOutput ""
|
|
136
|
-
Write-ColorOutput "Note: You may need to restart your terminal for PATH changes to take effect." $Yellow
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
# Main uninstallation process
|
|
140
|
-
function Main {
|
|
141
|
-
Write-Header
|
|
142
|
-
|
|
143
|
-
# Check NPM
|
|
144
|
-
if (Get-Command npm -ErrorAction SilentlyContinue) {
|
|
145
|
-
$npmList = npm list -g aws-lambda-layer-cli --depth=0 2>$null
|
|
146
|
-
if ($npmList -match "aws-lambda-layer-cli@") {
|
|
147
|
-
Write-ColorOutput "Detected NPM installation." $Yellow
|
|
148
|
-
Write-ColorOutput "Removing NPM package..." $White
|
|
149
|
-
npm uninstall -g aws-lambda-layer-cli
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
# Check PyPI
|
|
154
|
-
if (Get-Command pip -ErrorAction SilentlyContinue) {
|
|
155
|
-
pip show aws-lambda-layer-cli 2>$null | Out-Null
|
|
156
|
-
if ($LASTEXITCODE -eq 0) {
|
|
157
|
-
Write-ColorOutput "Detected PyPI installation." $Yellow
|
|
158
|
-
Write-ColorOutput "Removing PyPI package..." $White
|
|
159
|
-
pip uninstall -y aws-lambda-layer-cli
|
|
160
|
-
}
|
|
161
|
-
}
|
|
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
|
-
|
|
173
|
-
# Check if tool is installed
|
|
174
|
-
$isInstalled = Test-Installation
|
|
175
|
-
if (-not $isInstalled) {
|
|
176
|
-
if (-not $Force) {
|
|
177
|
-
$continue = Read-Host "Continue with uninstallation anyway? (y/N)"
|
|
178
|
-
if ($continue -notmatch "^[Yy]$") {
|
|
179
|
-
Write-ColorOutput "Uninstallation cancelled." $Red
|
|
180
|
-
exit 0
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
# Confirm uninstallation unless forced
|
|
186
|
-
if (-not $Force) {
|
|
187
|
-
Write-ColorOutput "This will remove the AWS Lambda Layer CLI tool from your system." $Yellow
|
|
188
|
-
$confirm = Read-Host "Are you sure you want to continue? (y/N)"
|
|
189
|
-
if ($confirm -notmatch "^[Yy]$") {
|
|
190
|
-
Write-ColorOutput "Uninstallation cancelled." $Red
|
|
191
|
-
exit 0
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
# Remove from PATH
|
|
196
|
-
Remove-FromPath
|
|
197
|
-
|
|
198
|
-
# Remove installation files
|
|
199
|
-
$uninstallSuccess = Remove-Installation
|
|
200
|
-
if (-not $uninstallSuccess) {
|
|
201
|
-
Write-ColorOutput "`nUninstallation failed!" $Red
|
|
202
|
-
exit 1
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
# Show post-uninstallation information
|
|
206
|
-
Show-PostUninstall
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
# Run main function
|
|
1
|
+
#Requires -Version 5.1
|
|
2
|
+
|
|
3
|
+
<#
|
|
4
|
+
.SYNOPSIS
|
|
5
|
+
AWS Lambda Layer CLI Tool Uninstaller for Windows
|
|
6
|
+
|
|
7
|
+
.DESCRIPTION
|
|
8
|
+
Uninstalls the AWS Lambda Layer CLI tool from Windows systems.
|
|
9
|
+
|
|
10
|
+
.PARAMETER InstallDir
|
|
11
|
+
Directory where the tool is installed (default: $env:USERPROFILE\.aws-lambda-layer-cli)
|
|
12
|
+
|
|
13
|
+
.PARAMETER Force
|
|
14
|
+
Force uninstallation without confirmation
|
|
15
|
+
|
|
16
|
+
.EXAMPLE
|
|
17
|
+
# Uninstall with default settings
|
|
18
|
+
.\uninstall.ps1
|
|
19
|
+
|
|
20
|
+
.EXAMPLE
|
|
21
|
+
# Uninstall from custom directory
|
|
22
|
+
.\uninstall.ps1 -InstallDir "C:\Tools\aws-lambda-layer"
|
|
23
|
+
|
|
24
|
+
.EXAMPLE
|
|
25
|
+
# Force uninstall
|
|
26
|
+
.\uninstall.ps1 -Force
|
|
27
|
+
#>
|
|
28
|
+
|
|
29
|
+
param(
|
|
30
|
+
[string]$InstallDir = "",
|
|
31
|
+
[switch]$Force
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
# Determine InstallDir if not provided
|
|
35
|
+
if ([string]::IsNullOrEmpty($InstallDir)) {
|
|
36
|
+
if ($env:USERPROFILE) {
|
|
37
|
+
$InstallDir = Join-Path $env:USERPROFILE ".aws-lambda-layer-cli"
|
|
38
|
+
} elseif ($env:HOME) {
|
|
39
|
+
$InstallDir = Join-Path $env:HOME ".aws-lambda-layer-cli"
|
|
40
|
+
} else {
|
|
41
|
+
Write-Error "Could not determine home directory. Please specify -InstallDir."
|
|
42
|
+
exit 1
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Colors for output
|
|
47
|
+
$Green = "Green"
|
|
48
|
+
$Yellow = "Yellow"
|
|
49
|
+
$Red = "Red"
|
|
50
|
+
$Cyan = "Cyan"
|
|
51
|
+
$White = "White"
|
|
52
|
+
|
|
53
|
+
function Write-ColorOutput {
|
|
54
|
+
param(
|
|
55
|
+
[string]$Message,
|
|
56
|
+
[string]$Color = $White
|
|
57
|
+
)
|
|
58
|
+
Write-Host $Message -ForegroundColor $Color
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function Write-Header {
|
|
62
|
+
Write-ColorOutput "`n=========================================" $Cyan
|
|
63
|
+
Write-ColorOutput "AWS Lambda Layer CLI Tool Uninstaller" $Green
|
|
64
|
+
Write-ColorOutput "=========================================" $Cyan
|
|
65
|
+
Write-ColorOutput "Install Directory: $InstallDir" $White
|
|
66
|
+
Write-ColorOutput ""
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function Test-Installation {
|
|
70
|
+
Write-ColorOutput "Checking installation..." $Yellow
|
|
71
|
+
|
|
72
|
+
if (-not (Test-Path $InstallDir)) {
|
|
73
|
+
Write-ColorOutput "Installation directory not found: $InstallDir" $Yellow
|
|
74
|
+
Write-ColorOutput "The tool doesn't appear to be installed." $White
|
|
75
|
+
return $false
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
$mainScript = Join-Path $InstallDir "aws-lambda-layer-cli"
|
|
79
|
+
if (-not (Test-Path $mainScript)) {
|
|
80
|
+
Write-ColorOutput "Main script not found: $mainScript" $Yellow
|
|
81
|
+
Write-ColorOutput "This doesn't look like a valid installation." $White
|
|
82
|
+
return $false
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
Write-ColorOutput "✓ Found installation at $InstallDir" $Green
|
|
86
|
+
return $true
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function Remove-FromPath {
|
|
90
|
+
Write-ColorOutput "Removing from PATH..." $Yellow
|
|
91
|
+
|
|
92
|
+
# Get current user PATH
|
|
93
|
+
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
94
|
+
|
|
95
|
+
# Remove our directory from PATH if present
|
|
96
|
+
if ($currentPath -like "*$InstallDir*") {
|
|
97
|
+
# Split PATH into array, filter out our directory, and rejoin
|
|
98
|
+
$pathArray = $currentPath -split ';' | Where-Object { $_ -ne $InstallDir -and $_ -ne "$InstallDir\" }
|
|
99
|
+
$newPath = $pathArray -join ';'
|
|
100
|
+
|
|
101
|
+
# Update PATH
|
|
102
|
+
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
|
|
103
|
+
Write-ColorOutput "✓ Removed $InstallDir from user PATH" $Green
|
|
104
|
+
Write-ColorOutput " Note: Restart your terminal for PATH changes to take effect" $Yellow
|
|
105
|
+
} else {
|
|
106
|
+
Write-ColorOutput "✓ $InstallDir not found in user PATH" $Green
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function Remove-Installation {
|
|
111
|
+
Write-ColorOutput "Removing installation files..." $Yellow
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
# Remove the entire installation directory
|
|
115
|
+
Remove-Item $InstallDir -Recurse -Force
|
|
116
|
+
Write-ColorOutput "✓ Removed installation directory" $Green
|
|
117
|
+
return $true
|
|
118
|
+
} catch {
|
|
119
|
+
Write-ColorOutput "✗ Failed to remove installation directory" $Red
|
|
120
|
+
Write-ColorOutput "Error: $($_.Exception.Message)" $Red
|
|
121
|
+
return $false
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function Show-PostUninstall {
|
|
126
|
+
Write-ColorOutput "`n=========================================" $Cyan
|
|
127
|
+
Write-ColorOutput "Uninstallation Complete!" $Green
|
|
128
|
+
Write-ColorOutput "=========================================" $Cyan
|
|
129
|
+
Write-ColorOutput ""
|
|
130
|
+
Write-ColorOutput "The AWS Lambda Layer CLI tool has been removed from your system." $White
|
|
131
|
+
Write-ColorOutput ""
|
|
132
|
+
Write-ColorOutput "What was removed:" $Yellow
|
|
133
|
+
Write-ColorOutput " • Installation directory: $InstallDir" $White
|
|
134
|
+
Write-ColorOutput " • PATH entry (if present)" $White
|
|
135
|
+
Write-ColorOutput ""
|
|
136
|
+
Write-ColorOutput "Note: You may need to restart your terminal for PATH changes to take effect." $Yellow
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# Main uninstallation process
|
|
140
|
+
function Main {
|
|
141
|
+
Write-Header
|
|
142
|
+
|
|
143
|
+
# Check NPM
|
|
144
|
+
if (Get-Command npm -ErrorAction SilentlyContinue) {
|
|
145
|
+
$npmList = npm list -g aws-lambda-layer-cli --depth=0 2>$null
|
|
146
|
+
if ($npmList -match "aws-lambda-layer-cli@") {
|
|
147
|
+
Write-ColorOutput "Detected NPM installation." $Yellow
|
|
148
|
+
Write-ColorOutput "Removing NPM package..." $White
|
|
149
|
+
npm uninstall -g aws-lambda-layer-cli
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
# Check PyPI
|
|
154
|
+
if (Get-Command pip -ErrorAction SilentlyContinue) {
|
|
155
|
+
pip show aws-lambda-layer-cli 2>$null | Out-Null
|
|
156
|
+
if ($LASTEXITCODE -eq 0) {
|
|
157
|
+
Write-ColorOutput "Detected PyPI installation." $Yellow
|
|
158
|
+
Write-ColorOutput "Removing PyPI package..." $White
|
|
159
|
+
pip uninstall -y aws-lambda-layer-cli
|
|
160
|
+
}
|
|
161
|
+
}
|
|
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
|
+
|
|
173
|
+
# Check if tool is installed
|
|
174
|
+
$isInstalled = Test-Installation
|
|
175
|
+
if (-not $isInstalled) {
|
|
176
|
+
if (-not $Force) {
|
|
177
|
+
$continue = Read-Host "Continue with uninstallation anyway? (y/N)"
|
|
178
|
+
if ($continue -notmatch "^[Yy]$") {
|
|
179
|
+
Write-ColorOutput "Uninstallation cancelled." $Red
|
|
180
|
+
exit 0
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
# Confirm uninstallation unless forced
|
|
186
|
+
if (-not $Force) {
|
|
187
|
+
Write-ColorOutput "This will remove the AWS Lambda Layer CLI tool from your system." $Yellow
|
|
188
|
+
$confirm = Read-Host "Are you sure you want to continue? (y/N)"
|
|
189
|
+
if ($confirm -notmatch "^[Yy]$") {
|
|
190
|
+
Write-ColorOutput "Uninstallation cancelled." $Red
|
|
191
|
+
exit 0
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
# Remove from PATH
|
|
196
|
+
Remove-FromPath
|
|
197
|
+
|
|
198
|
+
# Remove installation files
|
|
199
|
+
$uninstallSuccess = Remove-Installation
|
|
200
|
+
if (-not $uninstallSuccess) {
|
|
201
|
+
Write-ColorOutput "`nUninstallation failed!" $Red
|
|
202
|
+
exit 1
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
# Show post-uninstallation information
|
|
206
|
+
Show-PostUninstall
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
# Run main function
|
|
210
210
|
Main
|