@under_koen/bsm 0.0.2 → 0.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/README.md +456 -8
- package/dist/index.js +1 -1
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -3,23 +3,471 @@
|
|
|
3
3
|
BSM is a tool that enhances the functionality of NPM by allowing users to define their scripts in a separate files. This
|
|
4
4
|
makes it easier to create and manage complex scripts using JavaScript, without cluttering your `package.json` file.
|
|
5
5
|
|
|
6
|
+
## Getting started
|
|
7
|
+
|
|
8
|
+
### Installation
|
|
9
|
+
|
|
10
|
+
Install BSM as a dev dependency or globally.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install --save-dev bsm
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g bsm
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Usage
|
|
21
|
+
|
|
22
|
+
Create a `package.scripts.js` or `package.scripts.json` file in the root of your project. This file will contain all of
|
|
23
|
+
your scripts.
|
|
24
|
+
|
|
25
|
+
When using `package.scripts.js`, you can use the following syntax:
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
module.exports = {
|
|
29
|
+
scripts: {
|
|
30
|
+
build: {
|
|
31
|
+
_default: "bsm clean ~.* --",
|
|
32
|
+
esbuild: "esbuild ...",
|
|
33
|
+
},
|
|
34
|
+
clean: "rimraf dist/",
|
|
35
|
+
lint: {
|
|
36
|
+
_default: "bsm ~.* --",
|
|
37
|
+
eslint: "eslint --ext .ts,.js .",
|
|
38
|
+
prettier: "prettier --check .",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
When using `package.scripts.json`, you can use the following syntax:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": {
|
|
50
|
+
"_default": "bsm clean ~.*",
|
|
51
|
+
"esbuild": "esbuild ..."
|
|
52
|
+
},
|
|
53
|
+
"clean": "rimraf dist/",
|
|
54
|
+
"lint": {
|
|
55
|
+
"_default": "bsm ~.*",
|
|
56
|
+
"eslint": "eslint --ext .ts,.js .",
|
|
57
|
+
"prettier": "prettier --check ."
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
You can then run your scripts using the `bsm` command.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
bsm build
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
bsm lint
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
You can also run sub-scripts.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
bsm lint.eslint
|
|
77
|
+
```
|
|
78
|
+
|
|
6
79
|
## Features
|
|
7
80
|
|
|
8
|
-
|
|
81
|
+
### Script groups
|
|
9
82
|
|
|
10
|
-
|
|
83
|
+
You can group scripts by using an object or array.
|
|
11
84
|
|
|
12
|
-
|
|
85
|
+
```javascript
|
|
86
|
+
module.exports = {
|
|
87
|
+
scripts: {
|
|
88
|
+
example: {
|
|
89
|
+
test: "echo test script",
|
|
90
|
+
variant: "echo variant script",
|
|
91
|
+
subgroups: {
|
|
92
|
+
test: "echo test script",
|
|
93
|
+
variant: "echo variant script",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
```
|
|
13
99
|
|
|
14
|
-
|
|
15
|
-
|
|
100
|
+
In this example the following scripts are available:
|
|
101
|
+
- `bsm example.test`
|
|
102
|
+
- `bsm example.variant`
|
|
103
|
+
- `bsm example.subgroups.test`
|
|
104
|
+
- `bsm example.subgroups.variant`
|
|
16
105
|
|
|
106
|
+
```javascript
|
|
107
|
+
module.exports = {
|
|
108
|
+
scripts: {
|
|
109
|
+
example: ["echo test script", "echo variant script"],
|
|
110
|
+
},
|
|
111
|
+
};
|
|
17
112
|
```
|
|
18
|
-
|
|
113
|
+
|
|
114
|
+
In this example the following scripts are available:
|
|
115
|
+
- `bsm example` (will run all scripts in the array)
|
|
116
|
+
- `bsm example.0`
|
|
117
|
+
- `bsm example.1`
|
|
118
|
+
|
|
119
|
+
### Default scripts
|
|
120
|
+
|
|
121
|
+
You can define a default script for a group of scripts by using the `_default` key.
|
|
122
|
+
|
|
123
|
+
```javascript
|
|
124
|
+
module.exports = {
|
|
125
|
+
scripts: {
|
|
126
|
+
example: {
|
|
127
|
+
_default: "echo default script",
|
|
128
|
+
variant: "echo variant script",
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
};
|
|
19
132
|
```
|
|
20
133
|
|
|
21
|
-
|
|
22
|
-
|
|
134
|
+
`bsm example` will execute the default script, while `bsm example.variant` will execute the variant script.
|
|
135
|
+
|
|
136
|
+
### Specified scripts
|
|
137
|
+
|
|
138
|
+
Specified scripts replace the default script when an condition is met.
|
|
139
|
+
|
|
140
|
+
The order of precedence is as follows:
|
|
141
|
+
- _ci
|
|
142
|
+
- _[os]
|
|
143
|
+
- _default
|
|
144
|
+
|
|
145
|
+
#### CI Specified scripts
|
|
146
|
+
|
|
147
|
+
You can specify CI specific scripts with `_ci` key.
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
module.exports = {
|
|
151
|
+
scripts: {
|
|
152
|
+
example: {
|
|
153
|
+
_default: "echo default script",
|
|
154
|
+
_ci: "echo ci script",
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`bsm example` will execute the `example._ci` when running on a CI environment. When no CI specific script is found, the
|
|
161
|
+
default script will be executed.
|
|
162
|
+
|
|
163
|
+
#### OS Specified scripts
|
|
164
|
+
|
|
165
|
+
You can specify OS specific scripts with `_win32`, `_darwin`, and `_linux` keys.
|
|
166
|
+
All platforms can be seen [here](https://nodejs.org/api/os.html#os_os_platform).
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
module.exports = {
|
|
170
|
+
scripts: {
|
|
171
|
+
example: {
|
|
172
|
+
_default: "echo default script",
|
|
173
|
+
_win32: "echo windows script",
|
|
174
|
+
_darwin: "echo macos script",
|
|
175
|
+
_linux: "echo linux script",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`bsm example` will execute the `example._win32` on Windows, `example._darwin` on MacOS, and `example._linux` on Linux.
|
|
182
|
+
When no OS specific script is found, the default script will be executed.
|
|
183
|
+
|
|
184
|
+
### Script arguments
|
|
185
|
+
|
|
186
|
+
All arguments passed to the `bsm` command after `--` will be passed to all specified scripts.
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
module.exports = {
|
|
190
|
+
scripts: {
|
|
191
|
+
example: "echo",
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
bsm example -- Hello World!
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The above command will execute `echo Hello World!`.
|
|
201
|
+
|
|
202
|
+
### Relative scripts
|
|
203
|
+
|
|
204
|
+
You can run scripts relative to the current script by using the `~` prefix.
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
module.exports = {
|
|
208
|
+
scripts: {
|
|
209
|
+
example: {
|
|
210
|
+
_default: "bsm ~.variant",
|
|
211
|
+
variant: "echo variant script",
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
bsm example
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The above command will execute `example.variant`.
|
|
222
|
+
|
|
223
|
+
### All scripts
|
|
224
|
+
|
|
225
|
+
You can run all scripts in a group by using a `*`.
|
|
226
|
+
Ignores scripts that start with `_`.
|
|
227
|
+
|
|
228
|
+
```javascript
|
|
229
|
+
module.exports = {
|
|
230
|
+
scripts: {
|
|
231
|
+
example: {
|
|
232
|
+
test: "echo test script",
|
|
233
|
+
variant: "echo variant script",
|
|
234
|
+
_ignore: "echo ignore script",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
bsm example.*
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
The above command will execute `example.test` and `example.variant`.
|
|
245
|
+
|
|
246
|
+
### Hooks
|
|
247
|
+
|
|
248
|
+
#### Pre hooks
|
|
249
|
+
|
|
250
|
+
You can run scripts before a script by using `_pre`.
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
module.exports = {
|
|
254
|
+
scripts: {
|
|
255
|
+
example: {
|
|
256
|
+
_pre: "echo pre script",
|
|
257
|
+
_default: "echo default script",
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
bsm example
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
The above command will execute `example._pre` and `example._default`.
|
|
268
|
+
|
|
269
|
+
#### Post hooks
|
|
270
|
+
|
|
271
|
+
You can run scripts after a script by using `_post`.
|
|
272
|
+
Does not run when a script fails.
|
|
273
|
+
|
|
274
|
+
```javascript
|
|
275
|
+
module.exports = {
|
|
276
|
+
scripts: {
|
|
277
|
+
example: {
|
|
278
|
+
_default: "echo default script",
|
|
279
|
+
_post: "echo post script",
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
bsm example
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
The above command will execute `example._default` and `example._post`.
|
|
290
|
+
|
|
291
|
+
#### On error hooks
|
|
292
|
+
|
|
293
|
+
You can run scripts when a script fails by using `_onError`.
|
|
294
|
+
|
|
295
|
+
```javascript
|
|
296
|
+
module.exports = {
|
|
297
|
+
scripts: {
|
|
298
|
+
example: {
|
|
299
|
+
_default: "exit 1",
|
|
300
|
+
_onError: "echo error script",
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
bsm example
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
The above command will execute `example._default` and `example._onError`.
|
|
311
|
+
This will also exit with code `1`.
|
|
312
|
+
|
|
313
|
+
#### Catch hooks
|
|
314
|
+
|
|
315
|
+
You can run scripts when a script fails by using `_catch`.
|
|
316
|
+
|
|
317
|
+
```javascript
|
|
318
|
+
module.exports = {
|
|
319
|
+
scripts: {
|
|
320
|
+
example: {
|
|
321
|
+
_default: "exit 1",
|
|
322
|
+
_catch: "echo catch script",
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
bsm example
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
The above command will execute `example._default` and `example._catch`.
|
|
333
|
+
|
|
334
|
+
#### Finally hooks
|
|
335
|
+
|
|
336
|
+
You can run scripts when a script fails by using `_finally`.
|
|
337
|
+
|
|
338
|
+
```javascript
|
|
339
|
+
module.exports = {
|
|
340
|
+
scripts: {
|
|
341
|
+
example: {
|
|
342
|
+
_default: "echo default script",
|
|
343
|
+
error: "exit 1",
|
|
344
|
+
_finally: "echo finally script",
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
bsm example
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
The above command will execute `example._default` and `example._finally`.
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
bsm example.error
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
The above command will execute `example.error` and `example._finally`.
|
|
361
|
+
And exit with code `1`.
|
|
362
|
+
|
|
363
|
+
### Functions
|
|
364
|
+
|
|
365
|
+
You can use functions in your scripts. This only work in javascript files.
|
|
366
|
+
|
|
367
|
+
```javascript
|
|
368
|
+
module.exports = {
|
|
369
|
+
scripts: {
|
|
370
|
+
example: () => {
|
|
371
|
+
console.log("Hello World!");
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
};
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
bsm example
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
The above command will execute the function and log `Hello World!`.
|
|
382
|
+
|
|
383
|
+
#### Async functions
|
|
384
|
+
|
|
385
|
+
You can use async functions in your scripts. This only work in javascript files.
|
|
386
|
+
|
|
387
|
+
```javascript
|
|
388
|
+
import { setTimeout } from "timers/promises";
|
|
389
|
+
|
|
390
|
+
module.exports = {
|
|
391
|
+
scripts: {
|
|
392
|
+
example: async () => {
|
|
393
|
+
await setTimeout(5000);
|
|
394
|
+
console.log("Hello World!");
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
bsm example
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
The above command will execute the function and log `Hello World!` after 5 seconds.
|
|
405
|
+
|
|
406
|
+
#### Arguments
|
|
407
|
+
|
|
408
|
+
The function is passed an array of all arguments passed to the script after `--`.
|
|
409
|
+
|
|
410
|
+
```javascript
|
|
411
|
+
module.exports = {
|
|
412
|
+
scripts: {
|
|
413
|
+
example: (args) => {
|
|
414
|
+
console.log(args);
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
bsm example -- Hello World!
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
The above command will execute the function and log `["Hello", "World!"]`.
|
|
425
|
+
|
|
426
|
+
#### Return value
|
|
427
|
+
|
|
428
|
+
The function can return scripts, these will handled as if function was not used.
|
|
429
|
+
Return value can be a string, an array, an object or another function.
|
|
430
|
+
|
|
431
|
+
```javascript
|
|
432
|
+
module.exports = {
|
|
433
|
+
scripts: {
|
|
434
|
+
example: () => {
|
|
435
|
+
return "echo Hello World!";
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
};
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
bsm example
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
The above command will execute `echo Hello World!`.
|
|
446
|
+
|
|
447
|
+
### Extending
|
|
448
|
+
|
|
449
|
+
You can extend scripts by using the `extends` key. You can import scripts from other files or packages.
|
|
450
|
+
|
|
451
|
+
```javascript
|
|
452
|
+
module.exports = {
|
|
453
|
+
extends: ['@under_koen/bsm/package.scripts.js', './test.js'],
|
|
454
|
+
scripts: {},
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
bsm lint
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
The above command will execute `lint` coming from the `package.scripts.js` of `@under_koen/bsm`.
|
|
463
|
+
|
|
464
|
+
## Future plans
|
|
465
|
+
|
|
466
|
+
- [ ] Have support for workspaces / lerna
|
|
467
|
+
- [ ] Have support for running scripts in parallel
|
|
468
|
+
- [ ] Have support for specifying environment variables
|
|
469
|
+
- [ ] Have support for an interactive mode
|
|
470
|
+
- [ ] Jetbrains and VSCode integration
|
|
23
471
|
|
|
24
472
|
## License
|
|
25
473
|
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
"use strict";var X=Object.create;var K=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var nn=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var en=(n,i,e,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of Y(i))!k.call(n,t)&&t!==e&&K(n,t,{get:()=>i[t],enumerable:!(o=Q(i,t))||o.enumerable});return n};var E=(n,i,e)=>(e=n!=null?X(V(n)):{},en(i||!n||!n.__esModule?K(e,"default",{value:n,enumerable:!0}):e,n));var q=nn((pn,W)=>{"use strict";function on(n,i){var e=n;i.slice(0,-1).forEach(function(t){e=e[t]||{}});var o=i[i.length-1];return o in e}function D(n){return typeof n=="number"||/^0x[0-9a-f]+$/i.test(n)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(n)}function G(n,i){return i==="constructor"&&typeof n[i]=="function"||i==="__proto__"}W.exports=function(n,i){i||(i={});var e={bools:{},strings:{},unknownFn:null};typeof i.unknown=="function"&&(e.unknownFn=i.unknown),typeof i.boolean=="boolean"&&i.boolean?e.allBools=!0:[].concat(i.boolean).filter(Boolean).forEach(function(r){e.bools[r]=!0});var o={};function t(r){return o[r].some(function(a){return e.bools[a]})}Object.keys(i.alias||{}).forEach(function(r){o[r]=[].concat(i.alias[r]),o[r].forEach(function(a){o[a]=[r].concat(o[r].filter(function(S){return a!==S}))})}),[].concat(i.string).filter(Boolean).forEach(function(r){e.strings[r]=!0,o[r]&&[].concat(o[r]).forEach(function(a){e.strings[a]=!0})});var s=i.default||{},u={_:[]};function P(r,a){return e.allBools&&/^--[^=]+$/.test(a)||e.strings[r]||e.bools[r]||o[r]}function $(r,a,S){for(var c=r,A=0;A<a.length-1;A++){var v=a[A];if(G(c,v))return;c[v]===void 0&&(c[v]={}),(c[v]===Object.prototype||c[v]===Number.prototype||c[v]===String.prototype)&&(c[v]={}),c[v]===Array.prototype&&(c[v]=[]),c=c[v]}var g=a[a.length-1];G(c,g)||((c===Object.prototype||c===Number.prototype||c===String.prototype)&&(c={}),c===Array.prototype&&(c=[]),c[g]===void 0||e.bools[g]||typeof c[g]=="boolean"?c[g]=S:Array.isArray(c[g])?c[g].push(S):c[g]=[c[g],S])}function p(r,a,S){if(!(S&&e.unknownFn&&!P(r,S)&&e.unknownFn(S)===!1)){var c=!e.strings[r]&&D(a)?Number(a):a;$(u,r.split("."),c),(o[r]||[]).forEach(function(A){$(u,A.split("."),c)})}}Object.keys(e.bools).forEach(function(r){p(r,s[r]===void 0?!1:s[r])});var B=[];n.indexOf("--")!==-1&&(B=n.slice(n.indexOf("--")+1),n=n.slice(0,n.indexOf("--")));for(var d=0;d<n.length;d++){var f=n[d],l,w;if(/^--.+=/.test(f)){var R=f.match(/^--([^=]+)=([\s\S]*)$/);l=R[1];var y=R[2];e.bools[l]&&(y=y!=="false"),p(l,y,f)}else if(/^--no-.+/.test(f))l=f.match(/^--no-(.+)/)[1],p(l,!1,f);else if(/^--.+/.test(f))l=f.match(/^--(.+)/)[1],w=n[d+1],w!==void 0&&!/^(-|--)[^-]/.test(w)&&!e.bools[l]&&!e.allBools&&(!o[l]||!t(l))?(p(l,w,f),d+=1):/^(true|false)$/.test(w)?(p(l,w==="true",f),d+=1):p(l,e.strings[l]?"":!0,f);else if(/^-[^-]+/.test(f)){for(var m=f.slice(1,-1).split(""),O=!1,b=0;b<m.length;b++){if(w=f.slice(b+2),w==="-"){p(m[b],w,f);continue}if(/[A-Za-z]/.test(m[b])&&w[0]==="="){p(m[b],w.slice(1),f),O=!0;break}if(/[A-Za-z]/.test(m[b])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(w)){p(m[b],w,f),O=!0;break}if(m[b+1]&&m[b+1].match(/\W/)){p(m[b],f.slice(b+2),f),O=!0;break}else p(m[b],e.strings[m[b]]?"":!0,f)}l=f.slice(-1)[0],!O&&l!=="-"&&(n[d+1]&&!/^(-|--)[^-]/.test(n[d+1])&&!e.bools[l]&&(!o[l]||!t(l))?(p(l,n[d+1],f),d+=1):n[d+1]&&/^(true|false)$/.test(n[d+1])?(p(l,n[d+1]==="true",f),d+=1):p(l,e.strings[l]?"":!0,f))}else if((!e.unknownFn||e.unknownFn(f)!==!1)&&u._.push(e.strings._||!D(f)?f:Number(f)),i.stopEarly){u._.push.apply(u._,n.slice(d+1));break}}return Object.keys(s).forEach(function(r){on(u,r.split("."))||($(u,r.split("."),s[r]),(o[r]||[]).forEach(function(a){$(u,a.split("."),s[r])}))}),i["--"]?u["--"]=B.slice():B.forEach(function(r){u._.push(r)}),u}});var J=E(q());function j(n){return n!==null&&typeof n=="object"}function x(n,i,e=".",o){if(!j(i))return x(n,{},e,o);let t=Object.assign({},i);for(let s in n){if(s==="__proto__"||s==="constructor")continue;let u=n[s];u!=null&&(o&&o(t,s,u,e)||(Array.isArray(u)&&Array.isArray(t[s])?t[s]=[...u,...t[s]]:j(u)&&j(t[s])?t[s]=x(u,t[s],(e?`${e}.`:"")+s.toString(),o):t[s]=u))}return t}function N(n){return(...i)=>i.reduce((e,o)=>x(e,o,"",n),{})}var I=N(),bn=N((n,i,e)=>{if(typeof n[i]<"u"&&typeof e=="function")return n[i]=e(n[i]),!0}),wn=N((n,i,e)=>{if(Array.isArray(n[i])&&typeof e=="function")return n[i]=e(n[i]),!0});var Z=E(require("node:child_process")),C=E(require("node:fs")),F=E(require("path")),h=(0,J.default)(process.argv.slice(2),{"--":!0}),L=h.config?[h.config]:[process.env.BSM_CONFIG,"./package.scripts.js","./package.scripts.json"],{config:M,file:rn}=L.reduce((n,i)=>{if(n||!i)return n;let e=U(i);if(e)return{config:e,file:i}},void 0)??{};process.env.BSM_CONFIG=rn;var z={scripts:{},config:{allowFunction:!1}};function U(n){if(n)try{n=require.resolve(n,{paths:[process.cwd()]});let i=require(n);if(Object.hasOwn(i,"extends")&&i.extends){let e=[];for(let o of i.extends){let t=U(o);t?e.push(t):(console.error(`\x1B[31mCannot find config '${o}' to extend\x1B[0m`),process.exit(1))}return I(i,...e,z)}else return I(i,z)}catch{return}}async function tn(){M||(console.error(`\x1B[31mCannot find config ${L.filter(n=>n!==void 0).map(n=>`'${n}'`).join(" or ")}\x1B[0m`),process.exit(1)),sn(process.env,await fn());for(let n of h._){if(n.startsWith("~")&&process.env.BSM_PATH){let i=process.env.BSM_PATH.split("."),e=H(M.scripts,i);if(e){await T(e,n.split(".").splice(1),i);continue}}await T(M.scripts,n.split("."))}}function sn(n,i){if(i)if(process.platform==="win32"){if(!process.env.Path||process.env.Path.includes(i))return;n.Path=`${process.env.Path};${i}`}else{if(!process.env.PATH||process.env.PATH.includes(i))return;n.PATH=`${process.env.PATH}:${i}`}}async function fn(){let n=process.cwd();for(;await C.promises.access(F.default.join(n,"node_modules/.bin"),C.constants.X_OK).then(()=>!1,()=>!0);){let i=F.default.join(n,"../");if(i===n)return null;n=i}return F.default.join(n,"node_modules/.bin")}function H(n,i){if(i.length===0)return n;let e=i[0];if(typeof n=="object"&&Object.hasOwn(n,e))if(Array.isArray(n)){let o=parseInt(e);return H(n[o],i.slice(1))}else return H(n[e],i.slice(1))}async function T(n,i,e=[],o=!0){try{if(typeof n=="function"){let s=await un(n,i,e);if(!s&&i.length===0)return;await T(s??{},i,e,o);return}await _(n,["_pre"],e,!1,!0);let t=i.slice(1);if(i.length===0)await ln(n,e,o);else if(i[0]==="*")await cn(n,t,e);else if(!await _(n,i,e))return console.error(`\x1B[31mScript '${[...e,...i].join(".")}' not found\x1B[0m`),process.exit(127);await _(n,["_post"],e,!1,!0)}catch(t){if(process.env.BSM_ERROR=t.code.toString(),await _(n,["_onError"],e,!1,!0),!await _(n,["_catch"],e,!1))throw t}finally{await _(n,["_finally"],e,!1,!0)}}async function cn(n,i,e){if(typeof n=="string")await T(n,i,e);else if(typeof n=="function")process.exit(100);else if(Array.isArray(n))for(let o=0;o<n.length;o++)await T(n[o],i,[...e,o.toString()]);else for(let o in n)o.startsWith("_")||Object.hasOwn(n,o)&&await T(n[o],i,[...e,o])}async function un(n,i,e){return console.log(`> \x1B[93mExecuting JavaScript function\x1B[0m \x1B[90m(${[...e].join(".")})\x1B[0m`),await n.call(null,h["--"])}async function _(n,i,e,o=!0,t=!1){if(t&&process.env.BSM_SCRIPT===[...e,...i].join("."))return!1;let s=i[0];if(typeof n!="object"||!Object.hasOwn(n,s))return!1;if(Array.isArray(n)){let u=parseInt(s);await T(n[u],i.slice(1),[...e,s],o)}else await T(n[s],i.slice(1),[...e,s],o);return!0}async function ln(n,i,e){switch(typeof n){case"string":await an(n,i,e);return;case"object":if(Array.isArray(n))for(let o=0;o<n.length;o++)await T(n[o],[],[...i,o.toString()]);else if(!await _(n,[`_${process.platform}`],i)){if(!await _(n,["_default"],i))return console.error(`\x1B[31mScript '${[...i].join(".")}' is not executable\x1B[0m`),process.exit(127)}return}}async function an(n,i,e){var o;if(e&&((o=h["--"])!=null&&o.length)&&(n+=" "+h["--"].join(" ")),console.log(`> ${n} \x1B[90m(${i.join(".")})\x1B[0m`),n!=="")return await new Promise((t,s)=>{Z.default.spawn(n,[],{stdio:"inherit",shell:!0,env:{...process.env,BSM_PATH:i.slice(0,-1).join("."),BSM_SCRIPT:i.join(".")}}).on("close",P=>{P===0?t():s({code:P,script:i.join(".")})})})}tn().catch(n=>{console.error(`\x1B[31mScript failed with code ${n.code}\x1B[0m \x1B[90m(${n.script})\x1B[0m`),process.exit(n.code)});
|
|
2
|
+
"use strict";var rn=Object.create;var V=Object.defineProperty;var on=Object.getOwnPropertyDescriptor;var sn=Object.getOwnPropertyNames;var cn=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var h=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var fn=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of sn(e))!an.call(n,o)&&o!==t&&V(n,o,{get:()=>e[o],enumerable:!(r=on(e,o))||r.enumerable});return n};var P=(n,e,t)=>(t=n!=null?rn(cn(n)):{},fn(e||!n||!n.__esModule?V(t,"default",{value:n,enumerable:!0}):t,n));var W=h((mn,Y)=>{"use strict";function un(n,e){var t=n;e.slice(0,-1).forEach(function(o){t=t[o]||{}});var r=e[e.length-1];return r in t}function x(n){return typeof n=="number"||/^0x[0-9a-f]+$/i.test(n)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(n)}function K(n,e){return e==="constructor"&&typeof n[e]=="function"||e==="__proto__"}Y.exports=function(n,e){e||(e={});var t={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(t.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?t.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(i){t.bools[i]=!0});var r={};function o(i){return r[i].some(function(l){return t.bools[l]})}Object.keys(e.alias||{}).forEach(function(i){r[i]=[].concat(e.alias[i]),r[i].forEach(function(l){r[l]=[i].concat(r[i].filter(function(d){return l!==d}))})}),[].concat(e.string).filter(Boolean).forEach(function(i){t.strings[i]=!0,r[i]&&[].concat(r[i]).forEach(function(l){t.strings[l]=!0})});var c=e.default||{},s={_:[]};function L(i,l){return t.allBools&&/^--[^=]+$/.test(l)||t.strings[i]||t.bools[i]||r[i]}function O(i,l,d){for(var f=i,D=0;D<l.length-1;D++){var T=l[D];if(K(f,T))return;f[T]===void 0&&(f[T]={}),(f[T]===Object.prototype||f[T]===Number.prototype||f[T]===String.prototype)&&(f[T]={}),f[T]===Array.prototype&&(f[T]=[]),f=f[T]}var m=l[l.length-1];K(f,m)||((f===Object.prototype||f===Number.prototype||f===String.prototype)&&(f={}),f===Array.prototype&&(f=[]),f[m]===void 0||t.bools[m]||typeof f[m]=="boolean"?f[m]=d:Array.isArray(f[m])?f[m].push(d):f[m]=[f[m],d])}function I(i,l,d){if(!(d&&t.unknownFn&&!L(i,d)&&t.unknownFn(d)===!1)){var f=!t.strings[i]&&x(l)?Number(l):l;O(s,i.split("."),f),(r[i]||[]).forEach(function(D){O(s,D.split("."),f)})}}Object.keys(t.bools).forEach(function(i){I(i,c[i]===void 0?!1:c[i])});var w=[];n.indexOf("--")!==-1&&(w=n.slice(n.indexOf("--")+1),n=n.slice(0,n.indexOf("--")));for(var _=0;_<n.length;_++){var a=n[_],u,S;if(/^--.+=/.test(a)){var Q=a.match(/^--([^=]+)=([\s\S]*)$/);u=Q[1];var g=Q[2];t.bools[u]&&(g=g!=="false"),I(u,g,a)}else if(/^--no-.+/.test(a))u=a.match(/^--no-(.+)/)[1],I(u,!1,a);else if(/^--.+/.test(a))u=a.match(/^--(.+)/)[1],S=n[_+1],S!==void 0&&!/^(-|--)[^-]/.test(S)&&!t.bools[u]&&!t.allBools&&(!r[u]||!o(u))?(I(u,S,a),_+=1):/^(true|false)$/.test(S)?(I(u,S==="true",a),_+=1):I(u,t.strings[u]?"":!0,a);else if(/^-[^-]+/.test(a)){for(var C=a.slice(1,-1).split(""),B=!1,p=0;p<C.length;p++){if(S=a.slice(p+2),S==="-"){I(C[p],S,a);continue}if(/[A-Za-z]/.test(C[p])&&S[0]==="="){I(C[p],S.slice(1),a),B=!0;break}if(/[A-Za-z]/.test(C[p])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(S)){I(C[p],S,a),B=!0;break}if(C[p+1]&&C[p+1].match(/\W/)){I(C[p],a.slice(p+2),a),B=!0;break}else I(C[p],t.strings[C[p]]?"":!0,a)}u=a.slice(-1)[0],!B&&u!=="-"&&(n[_+1]&&!/^(-|--)[^-]/.test(n[_+1])&&!t.bools[u]&&(!r[u]||!o(u))?(I(u,n[_+1],a),_+=1):n[_+1]&&/^(true|false)$/.test(n[_+1])?(I(u,n[_+1]==="true",a),_+=1):I(u,t.strings[u]?"":!0,a))}else if((!t.unknownFn||t.unknownFn(a)!==!1)&&s._.push(t.strings._||!x(a)?a:Number(a)),e.stopEarly){s._.push.apply(s._,n.slice(_+1));break}}return Object.keys(c).forEach(function(i){un(s,i.split("."))||(O(s,i.split("."),c[i]),(r[i]||[]).forEach(function(l){O(s,l.split("."),c[i])}))}),e["--"]?s["--"]=w.slice():w.forEach(function(i){s._.push(i)}),s}});var j=h((An,ln)=>{ln.exports=[{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]}},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var q=h(R=>{"use strict";var J=j(),E=process.env;Object.defineProperty(R,"_vendors",{value:J.map(function(n){return n.constant})});R.name=null;R.isPR=null;J.forEach(function(n){let t=(Array.isArray(n.env)?n.env:[n.env]).every(function(r){return X(r)});if(R[n.constant]=t,!!t)switch(R.name=n.name,typeof n.pr){case"string":R.isPR=!!E[n.pr];break;case"object":"env"in n.pr?R.isPR=n.pr.env in E&&E[n.pr.env]!==n.pr.ne:"any"in n.pr?R.isPR=n.pr.any.some(function(r){return!!E[r]}):R.isPR=X(n.pr);break;default:R.isPR=null}});R.isCI=!!(E.CI!=="false"&&(E.BUILD_ID||E.BUILD_NUMBER||E.CI||E.CI_APP_ID||E.CI_BUILD_ID||E.CI_BUILD_NUMBER||E.CI_NAME||E.CONTINUOUS_INTEGRATION||E.RUN_ID||R.name));function X(n){return typeof n=="string"?!!E[n]:"env"in n?E[n.env]&&E[n.env].includes(n.includes):"any"in n?n.any.some(function(e){return!!E[e]}):Object.keys(n).every(function(e){return E[e]===n[e]})}});var Z=P(W());function M(n){return n!==null&&typeof n=="object"}function y(n,e,t=".",r){if(!M(e))return y(n,{},t,r);let o=Object.assign({},e);for(let c in n){if(c==="__proto__"||c==="constructor")continue;let s=n[c];s!=null&&(r&&r(o,c,s,t)||(Array.isArray(s)&&Array.isArray(o[c])?o[c]=[...s,...o[c]]:M(s)&&M(o[c])?o[c]=y(s,o[c],(t?`${t}.`:"")+c.toString(),r):o[c]=s))}return o}function H(n){return(...e)=>e.reduce((t,r)=>y(t,r,"",n),{})}var F=H(),Un=H((n,e,t)=>{if(typeof n[e]<"u"&&typeof t=="function")return n[e]=t(n[e]),!0}),vn=H((n,e,t)=>{if(Array.isArray(n[e])&&typeof t=="function")return n[e]=t(n[e]),!0});var k=P(require("node:child_process")),N=P(require("node:fs")),b=P(require("path")),nn=P(q()),A=(0,Z.default)(process.argv.slice(2),{"--":!0}),en=A.config?[A.config]:[process.env.BSM_CONFIG,"./package.scripts.js","./package.scripts.json"],{config:G,file:En}=en.reduce((n,e)=>{if(n||!e)return n;let t=tn(e);if(t)return{config:t,file:e}},void 0)??{};process.env.BSM_CONFIG=En;var z={scripts:{},config:{allowFunction:!1}};function tn(n){if(n)try{n=require.resolve(n,{paths:[process.cwd()]});let e=require(n);if(Object.hasOwn(e,"extends")&&e.extends){let t=[];for(let r of e.extends){let o=tn(r);o?t.push(o):(console.error(`\x1B[31mCannot find config '${r}' to extend\x1B[0m`),process.exit(1))}return F(e,...t,z)}else return F(e,z)}catch(e){if((e==null?void 0:e.code)==="MODULE_NOT_FOUND")return;console.error(e),console.error(`\x1B[31mError loading config '${n}'\x1B[0m`),process.exit(1)}}async function _n(){G||(console.error(`\x1B[31mCannot find config ${en.filter(n=>n!==void 0).map(n=>`'${n}'`).join(" or ")}\x1B[0m`),process.exit(1)),In(process.env,await pn());for(let n of A._){if(n.startsWith("~")&&process.env.BSM_PATH){let e=process.env.BSM_PATH.split("."),t=$(G.scripts,e);if(t){await v(t,n.split(".").splice(1),e);continue}}await v(G.scripts,n.split("."))}}function In(n,e){if(e)if(process.platform==="win32"){if(!process.env.Path||process.env.Path.includes(e))return;n.Path=`${process.env.Path};${e}`}else{if(!process.env.PATH||process.env.PATH.includes(e))return;n.PATH=`${process.env.PATH}:${e}`}}async function pn(){let n=process.cwd();for(;await N.promises.access(b.default.join(n,"node_modules/.bin"),N.constants.X_OK).then(()=>!1,()=>!0);){let e=b.default.join(n,"../");if(e===n)return null;n=e}return b.default.join(n,"node_modules/.bin")}function $(n,e){if(e.length===0)return n;let t=e[0];if(typeof n=="object"&&Object.hasOwn(n,t))if(Array.isArray(n)){let r=parseInt(t);return $(n[r],e.slice(1))}else return $(n[t],e.slice(1))}async function v(n,e,t=[],r=!0,o=!1){try{if(typeof n=="function")try{let s=await Rn(n,e,t);if(!s&&e.length===0)return;await v(s??{},e,t,r);return}catch(s){throw console.error(s),console.error(`\x1B[31mError executing function '${t.join(".")}'\x1B[0m`),{code:1,script:t.join(".")}}await U(n,["_pre"],t,!1,!0);let c=e.slice(1);if(e.length===0)await Cn(n,t,r,o);else if(e[0]==="*")await Sn(n,c,t);else if(!await U(n,e,t,!0,!1,!1))return console.error(`\x1B[31mScript '${[...t,...e].join(".")}' not found\x1B[0m`),process.exit(127);await U(n,["_post"],t,!1,!0)}catch(c){if(process.env.BSM_ERROR=c.code.toString(),await U(n,["_onError"],t,!1,!0),!await U(n,["_catch"],t,!1))throw c}finally{await U(n,["_finally"],t,!1,!0)}}async function Sn(n,e,t){if(typeof n=="string")await v(n,e,t);else if(typeof n=="function")process.exit(100);else if(Array.isArray(n))for(let r=0;r<n.length;r++)await v(n[r],e,[...t,r.toString()],!0,!0);else for(let r in n)r.startsWith("_")||Object.hasOwn(n,r)&&await v(n[r],e,[...t,r],!0,!0)}async function Rn(n,e,t){return console.log(`> \x1B[93mExecuting JavaScript function\x1B[0m \x1B[90m(${[...t].join(".")})\x1B[0m`),await n.call(null,A["--"])}async function U(n,e,t,r=!0,o=!1,c=!0){if(o&&process.env.BSM_SCRIPT===[...t,...e].join("."))return!1;let s=e[0];if(typeof n!="object"||!Object.hasOwn(n,s))return!1;if(Array.isArray(n)){let L=parseInt(s);await v(n[L],e.slice(1),[...t,s],r,c)}else await v(n[s],e.slice(1),[...t,s],r,c);return!0}async function Cn(n,e,t,r){switch(typeof n){case"string":await Tn(n,e,t);return;case"object":if(Array.isArray(n))for(let o=0;o<n.length;o++)await v(n[o],[],[...e,o.toString()]);else if(!(nn.isCI&&await U(n,["_ci"],e))){if(!await U(n,[`_${process.platform}`],e)){if(!await U(n,["_default"],e)){if(!r)return console.error(`\x1B[31mScript '${[...e].join(".")}' is not executable\x1B[0m`),process.exit(127)}}}return}}async function Tn(n,e,t){var r;if(t&&((r=A["--"])!=null&&r.length)&&(n+=" "+A["--"].join(" ")),console.log(`> ${n} \x1B[90m(${e.join(".")})\x1B[0m`),n!=="")return await new Promise((o,c)=>{k.default.spawn(n,[],{stdio:"inherit",shell:!0,env:{...process.env,BSM_PATH:e.slice(0,-1).join("."),BSM_SCRIPT:e.join(".")}}).on("close",L=>{L===0?o():c({code:L,script:e.join(".")})})})}_n().catch(n=>{console.error(`\x1B[31mScript failed with code ${n.code}\x1B[0m \x1B[90m(${n.script})\x1B[0m`),process.exit(n.code)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@under_koen/bsm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "BSM (Basic Script Manager) is a useful tool that enables you to create clear and concise scripts without cluttering your `package.json` file.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Koen van Staveren <koen@underkoen.nl>",
|
|
@@ -28,18 +28,19 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/minimist": "^1.2.2",
|
|
31
|
-
"@types/node": "^
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
33
|
-
"@typescript-eslint/parser": "^5.
|
|
34
|
-
"@under_koen/bsm": "^0.0.
|
|
31
|
+
"@types/node": "^20.3.1",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
33
|
+
"@typescript-eslint/parser": "^5.60.0",
|
|
34
|
+
"@under_koen/bsm": "^0.0.3",
|
|
35
|
+
"ci-info": "^3.8.0",
|
|
35
36
|
"defu": "^6.1.2",
|
|
36
|
-
"esbuild": "0.
|
|
37
|
-
"eslint": "^8.
|
|
37
|
+
"esbuild": "^0.18.6",
|
|
38
|
+
"eslint": "^8.43.0",
|
|
38
39
|
"eslint-config-prettier": "^8.8.0",
|
|
39
40
|
"minimist": "^1.2.8",
|
|
40
41
|
"prettier": "2.8.8",
|
|
41
42
|
"prettier-package-json": "^2.8.0",
|
|
42
|
-
"typescript": "^5.
|
|
43
|
+
"typescript": "^5.1.3"
|
|
43
44
|
},
|
|
44
45
|
"keywords": [
|
|
45
46
|
"script",
|