update-versions 5.2.11 → 6.0.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/cli.js +40 -32
  3. package/package.json +9 -7
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 6.0.0 (2022-12-01)
7
+
8
+ ### Features
9
+
10
+ - drop Node v12 support; minimum version requirement now is v14.18 and above ([c8049e8](https://github.com/codsen/codsen/commit/c8049e82a5844d3f72587740f1cc74e3c9020d22))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ - Minimum supported Node version is v14.18; we're dropping v12 support
15
+
6
16
  # 5.2.0 (2022-08-12)
7
17
 
8
18
  ### Features
package/cli.js CHANGED
@@ -36,7 +36,7 @@ const cli = meow(
36
36
  $ upd YOURFILE.json
37
37
 
38
38
  Options:
39
- -m, --module Blaclist against bumping major any type=module packages
39
+ -m, --module Blacklist against bumping major any type=module packages
40
40
  -h, --help Shows this help
41
41
  -v, --version Shows the current installed version
42
42
  `,
@@ -93,11 +93,10 @@ if (cli.flags) {
93
93
  }
94
94
 
95
95
  let confLocation = "./upd.config.json";
96
- let config;
97
96
  let newConfig = {
98
97
  noMajorBumping: [],
98
+ pin: {},
99
99
  };
100
- newConfig.noMajorBumping = new Set(newConfig.noMajorBumping);
101
100
 
102
101
  let online = await isOnline();
103
102
  if (!online) {
@@ -109,9 +108,7 @@ if (cli.flags) {
109
108
 
110
109
  // try to read the local config if it's present
111
110
  try {
112
- config = JSON.parse(readFileSync(confLocation, "utf8"));
113
- newConfig = Object.assign({}, newConfig, config);
114
- newConfig.noMajorBumping = new Set(newConfig.noMajorBumping);
111
+ newConfig = JSON.parse(readFileSync(confLocation, "utf8"));
115
112
  } catch (err) {
116
113
  console.log(
117
114
  `\n${messagePrefix}${`\u001b[${90}m${`No config found, moving on.`}\u001b[${39}m`}\n`
@@ -221,7 +218,7 @@ if (cli.flags) {
221
218
  (cli.flags.m || cli.flags.module) &&
222
219
  pkg1.type === "module"
223
220
  ) {
224
- newConfig.noMajorBumping.add(pkg1.name);
221
+ newConfig.noMajorBumping.push(pkg1.name);
225
222
  }
226
223
  }
227
224
  });
@@ -301,12 +298,27 @@ if (cli.flags) {
301
298
  ? "workspace:"
302
299
  : "";
303
300
 
304
- if (
301
+ if (Array.isArray(newConfig?.pin) && newConfig.pin[singleDepName]) {
302
+ finalContents = set(
303
+ finalContents,
304
+ `dependencies.${singleDepName}`,
305
+ newConfig.pin[singleDepName]
306
+ );
307
+ amended = true;
308
+ if (
309
+ !Object.prototype.hasOwnProperty.call(
310
+ updatedPackages,
311
+ singleDepName
312
+ )
313
+ ) {
314
+ updatedPackages[singleDepName] = newConfig.pin[singleDepName];
315
+ }
316
+ } else if (
305
317
  compiledDepNameVersionPairs[singleDepName] !== null &&
306
318
  singleDepValue !==
307
319
  `${workspacePrefix}^${compiledDepNameVersionPairs[singleDepName]}` &&
308
320
  // either dependency is not blacklisted (so we don't care)
309
- (!newConfig.noMajorBumping.has(singleDepName) ||
321
+ (!newConfig.noMajorBumping.includes(singleDepName) ||
310
322
  // or it is blacklisted but the bump is within the same major semver digit
311
323
  major(compiledDepNameVersionPairs[singleDepName]) ===
312
324
  major(singleDepValue))
@@ -323,9 +335,8 @@ if (cli.flags) {
323
335
  singleDepName
324
336
  )
325
337
  ) {
326
- updatedPackages[
327
- singleDepName
328
- ] = `${compiledDepNameVersionPairs[singleDepName]}`;
338
+ updatedPackages[singleDepName] =
339
+ compiledDepNameVersionPairs[singleDepName];
329
340
  }
330
341
  }
331
342
 
@@ -383,12 +394,27 @@ if (cli.flags) {
383
394
  ? "workspace:"
384
395
  : "";
385
396
 
386
- if (
397
+ if (Array.isArray(newConfig?.pin) && newConfig.pin[singleDepName]) {
398
+ finalContents = set(
399
+ finalContents,
400
+ `dependencies.${singleDepName}`,
401
+ newConfig.pin[singleDepName]
402
+ );
403
+ amended = true;
404
+ if (
405
+ !Object.prototype.hasOwnProperty.call(
406
+ updatedPackages,
407
+ singleDepName
408
+ )
409
+ ) {
410
+ updatedPackages[singleDepName] = newConfig.pin[singleDepName];
411
+ }
412
+ } else if (
387
413
  compiledDepNameVersionPairs[singleDepName] !== null &&
388
414
  singleDepValue !==
389
415
  `${workspacePrefix}^${compiledDepNameVersionPairs[singleDepName]}` &&
390
416
  // either dependency is not blacklisted (so we don't care)
391
- (!newConfig.noMajorBumping.has(singleDepName) ||
417
+ (!newConfig.noMajorBumping.includes(singleDepName) ||
392
418
  // or it is blacklisted but the bump is within the same major semver digit
393
419
  major(compiledDepNameVersionPairs[singleDepName]) ===
394
420
  major(singleDepValue))
@@ -457,22 +483,4 @@ if (cli.flags) {
457
483
  diff.pipe(process.stdout);
458
484
 
459
485
  await allProgressPromise;
460
-
461
- // write the config back
462
- if (
463
- config &&
464
- JSON.stringify(newConfig, null, 0) !== JSON.stringify(config, null, 0)
465
- ) {
466
- newConfig.noMajorBumping = [...newConfig.noMajorBumping].sort();
467
- try {
468
- await write(
469
- confLocation,
470
- `${JSON.stringify(newConfig, null, 2).trim()}\n`
471
- );
472
- } catch (e) {
473
- console.error(
474
- `${messagePrefix}error happened when writing upd.config.json:\n${e}`
475
- );
476
- }
477
- }
478
486
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "update-versions",
3
- "version": "5.2.11",
3
+ "version": "6.0.0",
4
4
  "description": "Like npm-check-updates but supports Lerna monorepos and enforces strict semver values",
5
5
  "keywords": [
6
6
  "app",
@@ -40,8 +40,10 @@
40
40
  "upd": "cli.js"
41
41
  },
42
42
  "scripts": {
43
- "build": "echo 'no build needed'",
44
- "dev": "echo 'no build needed'",
43
+ "build": "exit 0",
44
+ "cjs-off": "exit 0",
45
+ "cjs-on": "exit 0",
46
+ "dev": "exit 0",
45
47
  "lect": "node '../../ops/lect/lect.js'",
46
48
  "letspublish": "yarn publish || :",
47
49
  "lint": "eslint . --ext .js --ext .ts --fix",
@@ -51,7 +53,7 @@
51
53
  "unit": "uvu test"
52
54
  },
53
55
  "engines": {
54
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
56
+ "node": ">=14.18.0"
55
57
  },
56
58
  "c8": {
57
59
  "check-coverage": false,
@@ -68,7 +70,7 @@
68
70
  },
69
71
  "dependencies": {
70
72
  "ansi-diff-stream": "^1.2.1",
71
- "edit-package-json": "^0.7.11",
73
+ "edit-package-json": "^0.8.0",
72
74
  "globby": "^13.1.2",
73
75
  "is-online": "^10.0.0",
74
76
  "lodash.isplainobject": "^4.0.6",
@@ -78,13 +80,13 @@
78
80
  "p-map": "^5.5.0",
79
81
  "p-progress": "^0.6.0",
80
82
  "p-reduce": "^3.0.0",
81
- "pacote": "^15.0.4",
83
+ "pacote": "^15.0.6",
82
84
  "update-notifier": "^6.0.2",
83
85
  "write-file-atomic": "^5.0.0"
84
86
  },
85
87
  "devDependencies": {
86
88
  "@types/lodash.isplainobject": "^4.0.7",
87
- "fs-extra": "^10.1.0",
89
+ "fs-extra": "^11.1.0",
88
90
  "lodash.clonedeep": "^4.5.0"
89
91
  }
90
92
  }