@virmator/deps 14.17.1 → 14.19.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 CHANGED
@@ -30,12 +30,13 @@ A default plugin for [virmator](https://www.npmjs.com/package/virmator).
30
30
 
31
31
  Upgrades dependencies using npm-check-update. Does not automatically run 'npm i'. It is recommended to run 'virmator deps regen' instead.
32
32
 
33
- If a package name or glob is passed as an argument, only the matching direct dependencies are upgraded via 'npm i <extra-args> <name>@latest'. Any flags or args supplied after the pattern are forwarded to npm verbatim (e.g. '--min-release-age 0'). In a mono-repo, this scans the root package.json as well as every workspace package.json, running an install in each one that has a match. Outside a mono-repo, it scans the current package only. The command errors out if no direct deps match in any package.json.
33
+ If a package name or glob is passed as an argument, only the matching direct dependencies are upgraded via 'npm i <extra-args> <name>@<version>'. An optional '@<version>' suffix on the argument selects which version to install (defaulting to 'latest' when omitted). Any flags or args supplied after the pattern are forwarded to npm verbatim (e.g. '--min-release-age 0'). In a mono-repo, this scans the root package.json as well as every workspace package.json, running an install in each one that has a match. Outside a mono-repo, it scans the current package only. The command errors out if no direct deps match in any package.json.
34
34
 
35
35
  - Examples
36
36
  - `virmator deps upgrade`
37
37
  - upgrade a single package across the mono-repo: `virmator deps upgrade @augment-vir/common`
38
38
  - upgrade all packages matching a glob: `virmator deps upgrade "@augment-vir/*"`
39
+ - upgrade matches to a specific version: `virmator deps upgrade "my-package@^2.0.0"`
39
40
  - forward npm flags (e.g. bypass min-release-age): `virmator deps upgrade "@augment-vir/*" --min-release-age 0`
40
41
  - Configs
41
42
  - configs/ncu.config.ts
package/dist/deps.d.ts CHANGED
@@ -68,7 +68,7 @@ export declare const virmatorDepsPlugin: Readonly<Readonly<{
68
68
  };
69
69
  readonly upgrade: {
70
70
  readonly doc: {
71
- readonly sections: readonly ["\n Upgrades dependencies using npm-check-update.\n Does not automatically run 'npm i'.\n It is recommended to run 'virmator deps regen' instead.\n ", "\n If a package name or glob is passed as an argument, only the\n matching direct dependencies are upgraded via\n 'npm i <extra-args> <name>@latest'. Any flags or args supplied\n after the pattern are forwarded to npm verbatim\n (e.g. '--min-release-age 0'). In a mono-repo, this scans the\n root package.json as well as every workspace package.json,\n running an install in each one that has a match. Outside a\n mono-repo, it scans the current package only. The command\n errors out if no direct deps match in any package.json.\n "];
71
+ readonly sections: readonly ["\n Upgrades dependencies using npm-check-update.\n Does not automatically run 'npm i'.\n It is recommended to run 'virmator deps regen' instead.\n ", "\n If a package name or glob is passed as an argument, only the\n matching direct dependencies are upgraded via\n 'npm i <extra-args> <name>@<version>'. An optional\n '@<version>' suffix on the argument selects which version to\n install (defaulting to 'latest' when omitted). Any flags or\n args supplied after the pattern are forwarded to npm verbatim\n (e.g. '--min-release-age 0'). In a mono-repo, this scans the\n root package.json as well as every workspace package.json,\n running an install in each one that has a match. Outside a\n mono-repo, it scans the current package only. The command\n errors out if no direct deps match in any package.json.\n "];
72
72
  readonly examples: readonly [{
73
73
  readonly content: "virmator deps upgrade";
74
74
  }, {
@@ -77,6 +77,9 @@ export declare const virmatorDepsPlugin: Readonly<Readonly<{
77
77
  }, {
78
78
  readonly title: "upgrade all packages matching a glob";
79
79
  readonly content: "virmator deps upgrade \"@augment-vir/*\"";
80
+ }, {
81
+ readonly title: "upgrade matches to a specific version";
82
+ readonly content: "virmator deps upgrade \"my-package@^2.0.0\"";
80
83
  }, {
81
84
  readonly title: "forward npm flags (e.g. bypass min-release-age)";
82
85
  readonly content: "virmator deps upgrade \"@augment-vir/*\" --min-release-age 0";
@@ -196,7 +199,7 @@ export declare const virmatorDepsPlugin: Readonly<Readonly<{
196
199
  };
197
200
  readonly upgrade: {
198
201
  readonly doc: {
199
- readonly sections: readonly ["\n Upgrades dependencies using npm-check-update.\n Does not automatically run 'npm i'.\n It is recommended to run 'virmator deps regen' instead.\n ", "\n If a package name or glob is passed as an argument, only the\n matching direct dependencies are upgraded via\n 'npm i <extra-args> <name>@latest'. Any flags or args supplied\n after the pattern are forwarded to npm verbatim\n (e.g. '--min-release-age 0'). In a mono-repo, this scans the\n root package.json as well as every workspace package.json,\n running an install in each one that has a match. Outside a\n mono-repo, it scans the current package only. The command\n errors out if no direct deps match in any package.json.\n "];
202
+ readonly sections: readonly ["\n Upgrades dependencies using npm-check-update.\n Does not automatically run 'npm i'.\n It is recommended to run 'virmator deps regen' instead.\n ", "\n If a package name or glob is passed as an argument, only the\n matching direct dependencies are upgraded via\n 'npm i <extra-args> <name>@<version>'. An optional\n '@<version>' suffix on the argument selects which version to\n install (defaulting to 'latest' when omitted). Any flags or\n args supplied after the pattern are forwarded to npm verbatim\n (e.g. '--min-release-age 0'). In a mono-repo, this scans the\n root package.json as well as every workspace package.json,\n running an install in each one that has a match. Outside a\n mono-repo, it scans the current package only. The command\n errors out if no direct deps match in any package.json.\n "];
200
203
  readonly examples: readonly [{
201
204
  readonly content: "virmator deps upgrade";
202
205
  }, {
@@ -205,6 +208,9 @@ export declare const virmatorDepsPlugin: Readonly<Readonly<{
205
208
  }, {
206
209
  readonly title: "upgrade all packages matching a glob";
207
210
  readonly content: "virmator deps upgrade \"@augment-vir/*\"";
211
+ }, {
212
+ readonly title: "upgrade matches to a specific version";
213
+ readonly content: "virmator deps upgrade \"my-package@^2.0.0\"";
208
214
  }, {
209
215
  readonly title: "forward npm flags (e.g. bypass min-release-age)";
210
216
  readonly content: "virmator deps upgrade \"@augment-vir/*\" --min-release-age 0";
package/dist/deps.js CHANGED
@@ -106,8 +106,10 @@ export const virmatorDepsPlugin = defineVirmatorPlugin(import.meta.dirname, {
106
106
  `
107
107
  If a package name or glob is passed as an argument, only the
108
108
  matching direct dependencies are upgraded via
109
- 'npm i <extra-args> <name>@latest'. Any flags or args supplied
110
- after the pattern are forwarded to npm verbatim
109
+ 'npm i <extra-args> <name>@<version>'. An optional
110
+ '@<version>' suffix on the argument selects which version to
111
+ install (defaulting to 'latest' when omitted). Any flags or
112
+ args supplied after the pattern are forwarded to npm verbatim
111
113
  (e.g. '--min-release-age 0'). In a mono-repo, this scans the
112
114
  root package.json as well as every workspace package.json,
113
115
  running an install in each one that has a match. Outside a
@@ -127,6 +129,10 @@ export const virmatorDepsPlugin = defineVirmatorPlugin(import.meta.dirname, {
127
129
  title: 'upgrade all packages matching a glob',
128
130
  content: 'virmator deps upgrade "@augment-vir/*"',
129
131
  },
132
+ {
133
+ title: 'upgrade matches to a specific version',
134
+ content: 'virmator deps upgrade "my-package@^2.0.0"',
135
+ },
130
136
  {
131
137
  title: 'forward npm flags (e.g. bypass min-release-age)',
132
138
  content: 'virmator deps upgrade "@augment-vir/*" --min-release-age 0',
@@ -239,9 +245,17 @@ export const virmatorDepsPlugin = defineVirmatorPlugin(import.meta.dirname, {
239
245
  const depPattern = upgradeArgs._[0];
240
246
  if (depPattern) {
241
247
  const passthroughArgs = filteredArgs.toSpliced(filteredArgs.indexOf(depPattern), 1);
248
+ /**
249
+ * Split off an optional trailing '@<version>'. The first '@' in a scoped name like
250
+ * '@augment-vir/*' is part of the name, so only a non-leading '@' separates name
251
+ * from version.
252
+ */
253
+ const lastAtIndex = depPattern.lastIndexOf('@');
254
+ const namePattern = lastAtIndex > 0 ? depPattern.slice(0, lastAtIndex) : depPattern;
255
+ const versionSpecifier = lastAtIndex > 0 ? depPattern.slice(lastAtIndex + 1) : 'latest';
242
256
  const allDirectDeps = await listAllDirectNpmDeps(monoRepoRootPath);
243
257
  const matchedDepsByPackageAndKey = Object.entries(allDirectDeps).reduce((accum, [depName, usages,]) => {
244
- if (!matchesGlob(depName, depPattern)) {
258
+ if (!matchesGlob(depName, namePattern)) {
245
259
  return accum;
246
260
  }
247
261
  return usages.reduce((innerAccumulator, usage) => {
@@ -285,7 +299,7 @@ export const virmatorDepsPlugin = defineVirmatorPlugin(import.meta.dirname, {
285
299
  'i',
286
300
  flag,
287
301
  ...passthroughArgs,
288
- ...depNames.map((depName) => `${depName}@latest`),
302
+ ...depNames.map((depName) => `${depName}@${versionSpecifier}`),
289
303
  ]
290
304
  .filter(check.isTruthy)
291
305
  .join(' ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virmator/deps",
3
- "version": "14.17.1",
3
+ "version": "14.19.0",
4
4
  "description": "Default TS deps plugin for virmator.",
5
5
  "keywords": [
6
6
  "virmator",
@@ -38,7 +38,7 @@
38
38
  "@augment-vir/common": "^31.69.0",
39
39
  "@augment-vir/node": "^31.69.0",
40
40
  "@npm/types": "^2.1.0",
41
- "@virmator/core": "^14.17.1",
41
+ "@virmator/core": "^14.19.0",
42
42
  "mri": "^1.2.0"
43
43
  },
44
44
  "devDependencies": {