update-versions 5.0.7 → 5.0.10

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/README.md +4 -3
  2. package/cli.js +21 -21
  3. package/package.json +19 -44
package/README.md CHANGED
@@ -32,15 +32,16 @@ This package is ESM only: Node 12+ is needed to use it and it must be imported i
32
32
  npm i -g update-versions
33
33
  ```
34
34
 
35
+
36
+
35
37
  Then, call it from the command line using keyword:
36
38
 
37
39
  ```bash
38
40
  upd
39
41
  ```
40
-
41
42
  ## Documentation
42
43
 
43
- Please [visit codsen.com](https://codsen.com/os/update-versions/) for a full description of the API and examples.
44
+ Please [visit codsen.com](https://codsen.com/os/update-versions/) for a full description of the API.
44
45
 
45
46
  ## Contributing
46
47
 
@@ -52,6 +53,6 @@ MIT License
52
53
 
53
54
  Copyright (c) 2010-2021 Roy Revelt and other contributors
54
55
 
55
- uses adapted p-progress, MIT Licence, Copyright (c) Sindre Sorhus https://github.com/sindresorhus/p-progress/blob/master/license
56
56
 
57
57
  <img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
58
+
package/cli.js CHANGED
@@ -4,7 +4,6 @@
4
4
  // -----------------------------------------------------------------------------
5
5
 
6
6
  import { promises, readFileSync } from "fs";
7
- const { readFile } = promises;
8
7
  import write from "write-file-atomic";
9
8
  import { globby } from "globby";
10
9
  import pReduce from "p-reduce";
@@ -15,11 +14,12 @@ import isObj from "lodash.isplainobject";
15
14
  import pacote from "pacote";
16
15
  import objectPath from "object-path";
17
16
  import diff1 from "ansi-diff-stream";
18
- const diff = diff1();
19
-
20
17
  import { set, del } from "edit-package-json";
21
18
  import isOnline from "is-online";
22
19
 
20
+ const { readFile } = promises;
21
+ const diff = diff1();
22
+
23
23
  const { log } = console;
24
24
  const sparkles = "\u2728"; // https://emojipedia.org/sparkles/
25
25
  const messagePrefix = `\u001b[${90}m${`${sparkles} update-versions: `}\u001b[${39}m`;
@@ -74,7 +74,7 @@ if (cli.flags) {
74
74
 
75
75
  (async () => {
76
76
  // we'll use the object below to distill all unique package updates
77
- const updatedPackages = {};
77
+ let updatedPackages = {};
78
78
  function printUpdated() {
79
79
  return Object.keys(updatedPackages)
80
80
  .sort()
@@ -88,14 +88,14 @@ if (cli.flags) {
88
88
  return versNum;
89
89
  }
90
90
 
91
- const confLocation = "./upd.config.json";
91
+ let confLocation = "./upd.config.json";
92
92
  let config;
93
93
  let newConfig = {
94
94
  noMajorBumping: [],
95
95
  };
96
96
  newConfig.noMajorBumping = new Set(newConfig.noMajorBumping);
97
97
 
98
- const online = await isOnline();
98
+ let online = await isOnline();
99
99
  if (!online) {
100
100
  console.error(
101
101
  `\n${messagePrefix}${`\u001b[${31}m${`Please check your internet connection.`}\u001b[${39}m`}\n`
@@ -114,7 +114,7 @@ if (cli.flags) {
114
114
  );
115
115
  }
116
116
 
117
- const pathsPromise = await globby([
117
+ let pathsPromise = await globby([
118
118
  "**/package.json",
119
119
  "!**/node_modules/**",
120
120
  "!**/test/**",
@@ -124,7 +124,7 @@ if (cli.flags) {
124
124
  (mapReceived, currentPath) =>
125
125
  readFile(currentPath, "utf8")
126
126
  .then((packContentsStr) => {
127
- const parsedContents = JSON.parse(packContentsStr);
127
+ let parsedContents = JSON.parse(packContentsStr);
128
128
  mapReceived.namesList.push(parsedContents.name);
129
129
  mapReceived.pathsList.push(currentPath);
130
130
  mapReceived.pathsByName[parsedContents.name] = currentPath;
@@ -148,16 +148,16 @@ if (cli.flags) {
148
148
  )
149
149
  );
150
150
 
151
- const allProgressPromise = PProgress.all(
151
+ let allProgressPromise = PProgress.all(
152
152
  pathsPromise.pathsList.map((oneOfPaths) =>
153
153
  pProgress(async (progress) => {
154
154
  // call progress() like progress(0.14);
155
155
 
156
156
  let amended = false;
157
157
  let finalContents = pathsPromise.contentsStr[oneOfPaths];
158
- const parsedContents = pathsPromise.contentsObj[oneOfPaths];
158
+ let parsedContents = pathsPromise.contentsObj[oneOfPaths];
159
159
 
160
- const totalDeps = (
160
+ let totalDeps = (
161
161
  isObj(parsedContents.dependencies)
162
162
  ? Object.keys(parsedContents.dependencies)
163
163
  : []
@@ -190,8 +190,8 @@ if (cli.flags) {
190
190
  // this is the first 75% of per-package progress
191
191
  // https://github.com/sindresorhus/p-progress#pprogressallpromises-options
192
192
 
193
- const compiledDepNameVersionPairs = {};
194
- const allProgressPromise2 = PProgress.all(
193
+ let compiledDepNameVersionPairs = {};
194
+ let allProgressPromise2 = PProgress.all(
195
195
  totalDeps.map(async (singleDepName) => {
196
196
  if (pathsPromise.namesList.includes(singleDepName)) {
197
197
  compiledDepNameVersionPairs[singleDepName] =
@@ -259,7 +259,7 @@ if (cli.flags) {
259
259
  //
260
260
 
261
261
  if (isObj(parsedContents.dependencies)) {
262
- const keys = Object.keys(parsedContents.dependencies);
262
+ let keys = Object.keys(parsedContents.dependencies);
263
263
  for (let y = 0, len2 = keys.length; y < len2; y++) {
264
264
  // delete this dependency from lect.various.devDependencies if present
265
265
  // ---------------------
@@ -269,7 +269,7 @@ if (cli.flags) {
269
269
  parsedContents.lect.various.devDependencies.includes(keys[y])
270
270
  ) {
271
271
  let foundIdx;
272
- const newVal = parsedContents.lect.various.devDependencies.filter(
272
+ let newVal = parsedContents.lect.various.devDependencies.filter(
273
273
  (dep, z) => {
274
274
  if (dep === keys[y]) {
275
275
  foundIdx = z;
@@ -288,12 +288,12 @@ if (cli.flags) {
288
288
  // tackle the deps list:
289
289
  // ---------------------
290
290
 
291
- const singleDepName = keys[y];
292
- const singleDepValue = parsedContents.dependencies[keys[y]];
291
+ let singleDepName = keys[y];
292
+ let singleDepValue = parsedContents.dependencies[keys[y]];
293
293
  if (singleDepValue.startsWith("file:")) {
294
294
  continue;
295
295
  }
296
- const workspacePrefix = singleDepValue.startsWith("workspace:")
296
+ let workspacePrefix = singleDepValue.startsWith("workspace:")
297
297
  ? "workspace:"
298
298
  : "";
299
299
 
@@ -370,12 +370,12 @@ if (cli.flags) {
370
370
  });
371
371
  }
372
372
  for (let y = 0, len2 = keys.length; y < len2; y++) {
373
- const singleDepName = keys[y];
374
- const singleDepValue = parsedContents.devDependencies[keys[y]];
373
+ let singleDepName = keys[y];
374
+ let singleDepValue = parsedContents.devDependencies[keys[y]];
375
375
  if (singleDepValue.startsWith("file:")) {
376
376
  continue;
377
377
  }
378
- const workspacePrefix = singleDepValue.startsWith("workspace:")
378
+ let workspacePrefix = singleDepValue.startsWith("workspace:")
379
379
  ? "workspace:"
380
380
  : "";
381
381
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "update-versions",
3
- "version": "5.0.7",
3
+ "version": "5.0.10",
4
4
  "description": "Like npm-check-updates but supports Lerna monorepos and enforces strict semver values",
5
5
  "keywords": [
6
6
  "app",
@@ -40,47 +40,34 @@
40
40
  "upd": "cli.js"
41
41
  },
42
42
  "scripts": {
43
- "build": "echo 'skip build step for a CLI'",
44
- "ci_test": "npm run format && tap --no-only --reporter=silent",
45
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
46
- "dev": "echo\"\"",
47
- "devunittest": "npm run dev && tap --only -R 'base'",
48
- "format": "npm run lect && npm run prettier && npm run lint",
49
- "lect": "lect",
50
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --fix --config \"../../.eslintrc.json\" --quiet",
51
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
52
- "republish": "npm publish || :",
53
- "tap": "tap",
54
- "test": "npm run test:ci",
55
- "test:ci": "npm run lint && npm run unittest && npm run format",
56
- "unittest": "tap --no-only --reporter=terse"
43
+ "build": "echo 'no build needed'",
44
+ "dev": "echo 'no build needed'",
45
+ "lect": "node '../../ops/lect/lect.js'",
46
+ "letspublish": "yarn publish || :",
47
+ "lint": "eslint . --fix",
48
+ "prepare": "echo 'ready'",
49
+ "test": "c8 yarn run unit && yarn run lint",
50
+ "unit": "uvu test"
57
51
  },
58
- "tap": {
52
+ "engines": {
53
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
54
+ },
55
+ "c8": {
59
56
  "check-coverage": false,
60
- "node-arg": [
61
- "--no-warnings",
62
- "--experimental-loader",
63
- "@istanbuljs/esm-loader-hook"
64
- ],
65
- "timeout": 0
57
+ "exclude": [
58
+ "**/test/**/*.*"
59
+ ]
66
60
  },
67
61
  "lect": {
68
62
  "licence": {
69
63
  "extras": [
70
- "uses adapted p-progress, MIT Licence, Copyright (c) Sindre Sorhus https://github.com/sindresorhus/p-progress/blob/master/license"
71
- ]
72
- },
73
- "various": {
74
- "devDependencies": [
75
- "@types/lodash.isplainobject",
76
- "fs-extra",
77
- "lodash.clonedeep"
64
+ ""
78
65
  ]
79
66
  }
80
67
  },
81
68
  "dependencies": {
82
69
  "ansi-diff-stream": "^1.2.1",
83
- "edit-package-json": "^0.5.7",
70
+ "edit-package-json": "^0.5.10",
84
71
  "globby": "^12.0.2",
85
72
  "is-online": "^9.0.1",
86
73
  "lodash.isplainobject": "^4.0.6",
@@ -95,20 +82,8 @@
95
82
  "write-file-atomic": "^3.0.3"
96
83
  },
97
84
  "devDependencies": {
98
- "@istanbuljs/esm-loader-hook": "^0.1.2",
99
85
  "@types/lodash.isplainobject": "^4.0.6",
100
- "core-js": "^3.19.2",
101
- "cross-env": "^7.0.3",
102
- "eslint": "^8.3.0",
103
- "execa": "^6.0.0",
104
86
  "fs-extra": "^10.0.0",
105
- "lect": "^0.18.7",
106
- "lodash.clonedeep": "^4.5.0",
107
- "tap": "^15.1.5",
108
- "tempy": "^2.0.0",
109
- "tslib": "^2.3.1"
110
- },
111
- "engines": {
112
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
87
+ "lodash.clonedeep": "^4.5.0"
113
88
  }
114
89
  }