@depup/serverless 4.33.0-depup.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.
- package/README.md +32 -0
- package/binary.js +231 -0
- package/changes.json +14 -0
- package/package.json +54 -0
- package/postInstall.js +4 -0
- package/run.js +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @depup/serverless
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [serverless](https://www.npmjs.com/package/serverless)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/serverless
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [serverless](https://www.npmjs.com/package/serverless) @ 4.33.0 |
|
|
17
|
+
| Processed | 2026-03-17 |
|
|
18
|
+
| Smoke test | failed |
|
|
19
|
+
| Deps updated | 2 |
|
|
20
|
+
|
|
21
|
+
## Dependency Changes
|
|
22
|
+
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| axios | ^1.13.5 | ^1.13.6 |
|
|
26
|
+
| rimraf | ^5.0.10 | ^6.1.3 |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/serverless
|
|
31
|
+
|
|
32
|
+
License inherited from the original package.
|
package/binary.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
const os = require('os')
|
|
2
|
+
const { configureProxy } = require('axios-proxy-builder')
|
|
3
|
+
const axios = require('axios')
|
|
4
|
+
|
|
5
|
+
const { existsSync, mkdirSync, rmSync, createWriteStream } = require('fs')
|
|
6
|
+
const { join } = require('path')
|
|
7
|
+
const { spawnSync } = require('child_process')
|
|
8
|
+
|
|
9
|
+
const rimraf = require('rimraf')
|
|
10
|
+
|
|
11
|
+
const error = (msg) => {
|
|
12
|
+
console.error(msg)
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class Binary {
|
|
17
|
+
constructor(name, url, version, config) {
|
|
18
|
+
const errors = []
|
|
19
|
+
if (typeof url !== 'string') {
|
|
20
|
+
errors.push('url must be a string')
|
|
21
|
+
} else {
|
|
22
|
+
try {
|
|
23
|
+
new URL(url)
|
|
24
|
+
} catch (e) {
|
|
25
|
+
errors.push(e)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (name && typeof name !== 'string') {
|
|
29
|
+
errors.push('name must be a string')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (version && typeof version !== 'string') {
|
|
33
|
+
errors.push('version must be a string')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!name) {
|
|
37
|
+
errors.push('You must specify the name of your binary')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!version) {
|
|
41
|
+
errors.push('You must specify the version of your binary')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (
|
|
45
|
+
config &&
|
|
46
|
+
config.installDirectory &&
|
|
47
|
+
typeof config.installDirectory !== 'string'
|
|
48
|
+
) {
|
|
49
|
+
errors.push('config.installDirectory must be a string')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (errors.length > 0) {
|
|
53
|
+
let errorMsg =
|
|
54
|
+
'One or more of the parameters you passed to the Binary constructor are invalid:\n'
|
|
55
|
+
errors.forEach((error) => {
|
|
56
|
+
errorMsg += error
|
|
57
|
+
})
|
|
58
|
+
errorMsg +=
|
|
59
|
+
'\n\nCorrect usage: new Binary("my-binary", "https://example.com/binary/download.tar.gz", "v1.0.0")'
|
|
60
|
+
error(errorMsg)
|
|
61
|
+
}
|
|
62
|
+
this.url = url
|
|
63
|
+
this.name = name
|
|
64
|
+
this.version = version
|
|
65
|
+
this.installDirectory =
|
|
66
|
+
config?.installDirectory || join(__dirname, 'node_modules', '.bin')
|
|
67
|
+
|
|
68
|
+
if (!existsSync(this.installDirectory)) {
|
|
69
|
+
mkdirSync(this.installDirectory, { recursive: true })
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.binaryPath = join(
|
|
73
|
+
this.installDirectory,
|
|
74
|
+
`${this.name}-${this.version}`,
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
exists() {
|
|
79
|
+
return existsSync(this.binaryPath)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
removeBinary() {
|
|
83
|
+
try {
|
|
84
|
+
rmSync(this.binaryPath)
|
|
85
|
+
} catch (err) {
|
|
86
|
+
/** Empty **/
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
install(fetchOptions, suppressLogs = false) {
|
|
91
|
+
if (this.exists()) {
|
|
92
|
+
if (!suppressLogs) {
|
|
93
|
+
console.error(
|
|
94
|
+
`${this.name} is already installed, skipping installation.`,
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
return Promise.resolve()
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (existsSync(this.installDirectory)) {
|
|
101
|
+
rimraf.sync(this.installDirectory)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
mkdirSync(this.installDirectory, { recursive: true })
|
|
105
|
+
|
|
106
|
+
if (!suppressLogs) {
|
|
107
|
+
console.error(`Downloading release from ${this.url}`)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
process.on('SIGINT', () => {
|
|
111
|
+
error('Could not download Serverless')
|
|
112
|
+
this.removeBinary()
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
process.on('SIGTERM', () => {
|
|
116
|
+
error('Could not download Serverless')
|
|
117
|
+
this.removeBinary()
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
return axios({ ...fetchOptions, url: this.url, responseType: 'stream' })
|
|
121
|
+
.then((res) => {
|
|
122
|
+
return new Promise((resolve, reject) => {
|
|
123
|
+
const writeStream = createWriteStream(this.binaryPath, {
|
|
124
|
+
mode: 0o755,
|
|
125
|
+
})
|
|
126
|
+
res.data.pipe(writeStream)
|
|
127
|
+
writeStream.on('error', (err) => {
|
|
128
|
+
writeStream.close()
|
|
129
|
+
reject(err)
|
|
130
|
+
})
|
|
131
|
+
writeStream.on('close', () => resolve())
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
.then(() => {
|
|
135
|
+
if (!suppressLogs) {
|
|
136
|
+
console.error(`${this.name} has been installed!`)
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
.catch((e) => {
|
|
140
|
+
error(`Error fetching release: ${e.message}`)
|
|
141
|
+
this.removeBinary()
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
run(fetchOptions) {
|
|
146
|
+
const promise = !this.exists()
|
|
147
|
+
? this.install(fetchOptions, true)
|
|
148
|
+
: Promise.resolve()
|
|
149
|
+
|
|
150
|
+
promise
|
|
151
|
+
.then(() => {
|
|
152
|
+
const [, , ...args] = process.argv
|
|
153
|
+
|
|
154
|
+
const options = { cwd: process.cwd(), stdio: 'inherit' }
|
|
155
|
+
|
|
156
|
+
// Ignore SIGINT and SIGTERM so the child process handles them
|
|
157
|
+
// and exits gracefully
|
|
158
|
+
process.on('SIGINT', () => {})
|
|
159
|
+
process.on('SIGTERM', () => {})
|
|
160
|
+
|
|
161
|
+
const result = spawnSync(this.binaryPath, args, options)
|
|
162
|
+
|
|
163
|
+
if (result.error) {
|
|
164
|
+
error(result.error)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
process.exit(result.status)
|
|
168
|
+
})
|
|
169
|
+
.catch((e) => {
|
|
170
|
+
error(e.message)
|
|
171
|
+
process.exit(1)
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const getOS = () => {
|
|
177
|
+
const osType = os.type()
|
|
178
|
+
|
|
179
|
+
if (osType === 'Darwin') {
|
|
180
|
+
return 'darwin'
|
|
181
|
+
} else if (osType === 'Linux') {
|
|
182
|
+
return 'linux'
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return 'windows'
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const getBinaryName = () => {
|
|
189
|
+
const osType = getOS()
|
|
190
|
+
let architecture = os.arch()
|
|
191
|
+
|
|
192
|
+
if (architecture !== 'arm64' && architecture !== 'x64') {
|
|
193
|
+
console.error(`Architecture ${architecture} is not supported.`)
|
|
194
|
+
process.exit(1)
|
|
195
|
+
} else if (architecture === 'arm64' && osType === 'windows') {
|
|
196
|
+
console.error(`Platform ${osType} - ${architecture} is not supported.`)
|
|
197
|
+
process.exit(1)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (architecture === 'x64') {
|
|
201
|
+
architecture = 'amd64'
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return `serverless-${osType}-${architecture}`
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const getBinary = () => {
|
|
208
|
+
const binaryName = getBinaryName()
|
|
209
|
+
const url = `https://install.serverless.com/installer-builds/${binaryName}`
|
|
210
|
+
const binary = new Binary(binaryName, url, '0.0.2')
|
|
211
|
+
return binary
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const install = async () => {
|
|
215
|
+
const binary = getBinary()
|
|
216
|
+
|
|
217
|
+
const proxy = configureProxy(binary.url)
|
|
218
|
+
|
|
219
|
+
return binary.install(proxy, true) // Suppresses logs from binary-install
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const run = async () => {
|
|
223
|
+
const binary = getBinary()
|
|
224
|
+
binary.run()
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
module.exports = {
|
|
228
|
+
install,
|
|
229
|
+
run,
|
|
230
|
+
getBinary,
|
|
231
|
+
}
|
package/changes.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@depup/serverless",
|
|
3
|
+
"version": "4.33.0-depup.0",
|
|
4
|
+
"description": "[DepUp] Dependency-bumped version of serverless",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"lint": "eslint",
|
|
8
|
+
"lint:fix": "eslint --fix",
|
|
9
|
+
"prettier": "prettier -c . --ignore-path ../../.prettierignore",
|
|
10
|
+
"prettier:fix": "prettier -w . --ignore-path ../../.prettierignore"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"depup",
|
|
14
|
+
"dependency-bumped",
|
|
15
|
+
"updated-deps",
|
|
16
|
+
"serverless"
|
|
17
|
+
],
|
|
18
|
+
"author": "Serverless Inc.",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/serverless/serverless.git"
|
|
22
|
+
},
|
|
23
|
+
"bin": {
|
|
24
|
+
"serverless": "run.js",
|
|
25
|
+
"sls": "run.js"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"axios": "^1.13.6",
|
|
29
|
+
"axios-proxy-builder": "^0.1.2",
|
|
30
|
+
"rimraf": "^6.1.3",
|
|
31
|
+
"xml2js": "0.6.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18.0.0"
|
|
36
|
+
},
|
|
37
|
+
"depup": {
|
|
38
|
+
"changes": {
|
|
39
|
+
"axios": {
|
|
40
|
+
"from": "^1.13.5",
|
|
41
|
+
"to": "^1.13.6"
|
|
42
|
+
},
|
|
43
|
+
"rimraf": {
|
|
44
|
+
"from": "^5.0.10",
|
|
45
|
+
"to": "^6.1.3"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"depsUpdated": 2,
|
|
49
|
+
"originalPackage": "serverless",
|
|
50
|
+
"originalVersion": "4.33.0",
|
|
51
|
+
"processedAt": "2026-03-17T18:44:30.856Z",
|
|
52
|
+
"smokeTest": "failed"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/postInstall.js
ADDED
package/run.js
ADDED