@modernpoacher/deps 2.2.16 → 2.2.18
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/bin/node/wipe.mjs +2 -2
- package/package.json +2 -2
- package/src/common/index.mjs +54 -12
package/bin/node/wipe.mjs
CHANGED
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
join
|
|
9
9
|
} from 'node:path'
|
|
10
10
|
|
|
11
|
+
import '#deps/src/common/debug'
|
|
12
|
+
|
|
11
13
|
import {
|
|
12
14
|
PLATFORM,
|
|
13
15
|
BIN
|
|
@@ -17,8 +19,6 @@ import {
|
|
|
17
19
|
getOptions
|
|
18
20
|
} from '#deps/src/common/options'
|
|
19
21
|
|
|
20
|
-
import '#deps/src/common/debug'
|
|
21
|
-
|
|
22
22
|
import {
|
|
23
23
|
getArgs,
|
|
24
24
|
use,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.18",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"#deps/src": "./src/index.mjs",
|
|
80
80
|
"#deps/src/*": "./src/*.mjs",
|
|
81
81
|
"#deps/src/common": "./src/common/index.mjs",
|
|
82
|
-
"#deps/src/common/debug": "./src/common/debug.mjs",
|
|
83
82
|
"#deps/src/common/*": "./src/common/*/index.mjs",
|
|
83
|
+
"#deps/src/common/debug": "./src/common/debug.mjs",
|
|
84
84
|
"#deps/src/install": "./src/install/index.mjs",
|
|
85
85
|
"#where-am-i": "./where-am-i.mjs"
|
|
86
86
|
}
|
package/src/common/index.mjs
CHANGED
|
@@ -305,21 +305,48 @@ export const isPreRelease = (v) => /-/.test(v)
|
|
|
305
305
|
*/
|
|
306
306
|
export const isExact = (v) => /^\d/.test(v)
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
/**
|
|
309
|
+
* @param {[name: string, version: string]} entry
|
|
310
|
+
* @returns {boolean}
|
|
311
|
+
*/
|
|
312
|
+
function includeVersionIsExact ([name, version]) {
|
|
309
313
|
return isExact(version)
|
|
310
314
|
}
|
|
311
315
|
|
|
312
|
-
|
|
316
|
+
/**
|
|
317
|
+
* @param {[name: string, version: string]} entry
|
|
318
|
+
* @returns {boolean}
|
|
319
|
+
*/
|
|
320
|
+
function excludeVersionIsExact ([name, version]) {
|
|
313
321
|
return !isExact(version)
|
|
314
322
|
}
|
|
315
323
|
|
|
316
|
-
|
|
324
|
+
/**
|
|
325
|
+
* @function getMapToDepsExactVersionFromConfiguration
|
|
326
|
+
*
|
|
327
|
+
* Produces an array of objects from the entries of `packageDependencies` which have
|
|
328
|
+
* exact versions
|
|
329
|
+
*
|
|
330
|
+
* Entries have already been filtered to exclude non-exact versions
|
|
331
|
+
*
|
|
332
|
+
* Each entry is mapped to the same package name in `configurationDependencies` if it
|
|
333
|
+
* appears there. Otherwise, the `packageDependencies` version is used
|
|
334
|
+
*
|
|
335
|
+
* @param {Record<string, string>} configurationDependencies
|
|
336
|
+
* @returns {(entry: [name: string, version: string]) => {
|
|
337
|
+
* name: string,
|
|
338
|
+
* version: string
|
|
339
|
+
* }}
|
|
340
|
+
*/
|
|
341
|
+
function getMapToDepsExactVersionFromConfiguration (configurationDependencies) {
|
|
317
342
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
343
|
+
* @param {[name: string, version: string]} entry
|
|
344
|
+
* @returns {{
|
|
345
|
+
* name: string,
|
|
346
|
+
* version: string
|
|
347
|
+
* }}
|
|
321
348
|
*/
|
|
322
|
-
return function
|
|
349
|
+
return function mapToDepsExactVersionFromConfiguration (entry) {
|
|
323
350
|
const [
|
|
324
351
|
name,
|
|
325
352
|
version
|
|
@@ -336,7 +363,22 @@ function getMapConfigurationDependencies (configurationDependencies) {
|
|
|
336
363
|
}
|
|
337
364
|
}
|
|
338
365
|
|
|
339
|
-
|
|
366
|
+
/**
|
|
367
|
+
* @function mapToDepsVersion
|
|
368
|
+
*
|
|
369
|
+
* Produces an array of objects from the entries of `packageDependencies` which do not have
|
|
370
|
+
* exact versions
|
|
371
|
+
*
|
|
372
|
+
* Where the version is a pre-release, that version is used. Otherwise the version is
|
|
373
|
+
* set to `latest` to ensure that package is updated
|
|
374
|
+
*
|
|
375
|
+
* @param {[name: string, version: string]} entry
|
|
376
|
+
* @returns {{
|
|
377
|
+
* name: string,
|
|
378
|
+
* version: string
|
|
379
|
+
* }}
|
|
380
|
+
*/
|
|
381
|
+
function mapToDepsVersion (entry) {
|
|
340
382
|
const [
|
|
341
383
|
name,
|
|
342
384
|
version
|
|
@@ -369,8 +411,8 @@ export function getDepsExact (packageDependencies, configurationDependencies) {
|
|
|
369
411
|
|
|
370
412
|
return (
|
|
371
413
|
Object.entries(packageDependencies)
|
|
372
|
-
.filter(
|
|
373
|
-
.map(
|
|
414
|
+
.filter(includeVersionIsExact)
|
|
415
|
+
.map(getMapToDepsExactVersionFromConfiguration(configurationDependencies))
|
|
374
416
|
)
|
|
375
417
|
}
|
|
376
418
|
|
|
@@ -387,8 +429,8 @@ export function getDeps (packageDependencies) {
|
|
|
387
429
|
|
|
388
430
|
return (
|
|
389
431
|
Object.entries(packageDependencies)
|
|
390
|
-
.filter(
|
|
391
|
-
.map(
|
|
432
|
+
.filter(excludeVersionIsExact)
|
|
433
|
+
.map(mapToDepsVersion)
|
|
392
434
|
)
|
|
393
435
|
}
|
|
394
436
|
|