@virmator/deps 14.31.0 → 14.32.1
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/dist/deps.d.ts +7 -0
- package/dist/deps.js +40 -34
- package/package.json +8 -8
package/dist/deps.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ export declare function getUnusedPackageDirPaths({ cwdPackagePath, monoRepoPacka
|
|
|
6
6
|
monoRepoRootPath: string;
|
|
7
7
|
packageType: PackageType;
|
|
8
8
|
}>): string[];
|
|
9
|
+
/** @category Internal */
|
|
10
|
+
export declare function buildNcuCommand({ configPath, cwd, monoRepoPackages, monoRepoRootPath, }: Readonly<{
|
|
11
|
+
configPath: string;
|
|
12
|
+
cwd: string;
|
|
13
|
+
monoRepoPackages: ReadonlyArray<Readonly<MonoRepoPackage>>;
|
|
14
|
+
monoRepoRootPath: string;
|
|
15
|
+
}>): string;
|
|
9
16
|
/** A virmator plugin for checking package TS dependencies. */
|
|
10
17
|
export declare const virmatorDepsPlugin: Readonly<Readonly<{
|
|
11
18
|
name: string;
|
package/dist/deps.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { check } from '@augment-vir/assert';
|
|
2
2
|
import { awaitedBlockingMap, RuntimeEnv } from '@augment-vir/common';
|
|
3
3
|
import { toPosixPath } from '@augment-vir/node';
|
|
4
|
-
import { copyConfigFile, defineVirmatorPlugin, JsModuleType, NpmDepType, PackageType, VirmatorNoTraceError, withCompiledTsFile,
|
|
4
|
+
import { copyConfigFile, defineVirmatorPlugin, JsModuleType, NpmDepType, PackageType, VirmatorNoTraceError, withCompiledTsFile, } from '@virmator/core';
|
|
5
5
|
import mri from 'mri';
|
|
6
|
-
import { rm } from 'node:fs/promises';
|
|
6
|
+
import { appendFile, rm } from 'node:fs/promises';
|
|
7
7
|
import { join, relative } from 'node:path';
|
|
8
8
|
import { findUnusedPackageDependencies } from './find-unused-package-dependencies.js';
|
|
9
9
|
import { listRegenNodeModulesDirs } from './regen-node-modules.js';
|
|
@@ -32,6 +32,20 @@ export function getUnusedPackageDirPaths({ cwdPackagePath, monoRepoPackages, mon
|
|
|
32
32
|
]
|
|
33
33
|
: [cwdPackagePath];
|
|
34
34
|
}
|
|
35
|
+
/** @category Internal */
|
|
36
|
+
export function buildNcuCommand({ configPath, cwd, monoRepoPackages, monoRepoRootPath, }) {
|
|
37
|
+
return [
|
|
38
|
+
'npx',
|
|
39
|
+
'npm-check-updates',
|
|
40
|
+
'--configFileName',
|
|
41
|
+
toPosixPath(relative(cwd, configPath)),
|
|
42
|
+
'--cwd',
|
|
43
|
+
toPosixPath(relative(cwd, monoRepoRootPath)) || '.',
|
|
44
|
+
'--format',
|
|
45
|
+
'no-group',
|
|
46
|
+
...(monoRepoPackages.length ? ['--workspaces'] : []),
|
|
47
|
+
].join(' ');
|
|
48
|
+
}
|
|
35
49
|
/** A virmator plugin for checking package TS dependencies. */
|
|
36
50
|
export const virmatorDepsPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
37
51
|
name: 'Deps',
|
|
@@ -225,7 +239,7 @@ export const virmatorDepsPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
225
239
|
},
|
|
226
240
|
},
|
|
227
241
|
},
|
|
228
|
-
}, async ({ cliInputs: { filteredArgs, usedCommands }, package: { monoRepoRootPath, packageType, cwdPackagePath, monoRepoPackages }, configs, log,
|
|
242
|
+
}, async ({ cliInputs: { filteredArgs, usedCommands }, package: { monoRepoRootPath, packageType, cwdPackagePath, monoRepoPackages }, configs, log, runShellCommand, cwd, }) => {
|
|
229
243
|
if (usedCommands.deps?.subCommands.check) {
|
|
230
244
|
const args = mri(filteredArgs);
|
|
231
245
|
const pathToCheck = args._.length ? '' : 'src';
|
|
@@ -242,22 +256,19 @@ export const virmatorDepsPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
242
256
|
];
|
|
243
257
|
}
|
|
244
258
|
if (packageType === PackageType.MonoRoot) {
|
|
245
|
-
await
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
.filter(check.isTruthy)
|
|
259
|
-
.join(' ');
|
|
260
|
-
});
|
|
259
|
+
await runShellCommand([
|
|
260
|
+
'npx',
|
|
261
|
+
'depcruise',
|
|
262
|
+
...buildConfigFlags(cwd),
|
|
263
|
+
...monoRepoPackages.map(({ relativePath }) => {
|
|
264
|
+
return pathToCheck
|
|
265
|
+
? toPosixPath(join(relativePath, pathToCheck))
|
|
266
|
+
: '';
|
|
267
|
+
}),
|
|
268
|
+
...filteredArgs,
|
|
269
|
+
]
|
|
270
|
+
.filter(check.isTruthy)
|
|
271
|
+
.join(' '));
|
|
261
272
|
}
|
|
262
273
|
else {
|
|
263
274
|
await runShellCommand([
|
|
@@ -320,22 +331,17 @@ export const virmatorDepsPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
320
331
|
config: configs.deps.subCommands.upgrade.configs.ncu,
|
|
321
332
|
log,
|
|
322
333
|
});
|
|
323
|
-
await
|
|
334
|
+
await withCompiledTsFile({
|
|
324
335
|
inputPath: join(monoRepoRootPath, configs.deps.subCommands.upgrade.configs.ncu.copyToPath),
|
|
325
|
-
outputPath: join(cwdPackagePath, 'node_modules', '.virmator', '
|
|
326
|
-
}, JsModuleType.Esm, async (
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
workspaces: !!monoRepoPackages.length,
|
|
335
|
-
format: [],
|
|
336
|
-
}, {
|
|
337
|
-
cli: true,
|
|
338
|
-
});
|
|
336
|
+
outputPath: join(cwdPackagePath, 'node_modules', '.virmator', 'ncu.config.mjs'),
|
|
337
|
+
}, JsModuleType.Esm, async (configPath) => {
|
|
338
|
+
await appendFile(configPath, '\nconst {filter, ...ncuConfigWithoutFilter} = ncuConfig;\nexport default filter?.length ? ncuConfig : ncuConfigWithoutFilter;\n');
|
|
339
|
+
await runShellCommand(buildNcuCommand({
|
|
340
|
+
configPath,
|
|
341
|
+
cwd,
|
|
342
|
+
monoRepoPackages,
|
|
343
|
+
monoRepoRootPath,
|
|
344
|
+
}));
|
|
339
345
|
});
|
|
340
346
|
}
|
|
341
347
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virmator/deps",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.32.1",
|
|
4
4
|
"description": "Default TS deps plugin for virmator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"virmator",
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
"test:update": "npm test update"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@augment-vir/assert": "^32.2.
|
|
38
|
-
"@augment-vir/common": "^32.2.
|
|
39
|
-
"@augment-vir/node": "^32.2.
|
|
37
|
+
"@augment-vir/assert": "^32.2.3",
|
|
38
|
+
"@augment-vir/common": "^32.2.3",
|
|
39
|
+
"@augment-vir/node": "^32.2.3",
|
|
40
40
|
"@npm/types": "^2.1.0",
|
|
41
|
-
"@virmator/core": "^14.
|
|
42
|
-
"date-vir": "^9.1.
|
|
41
|
+
"@virmator/core": "^14.32.1",
|
|
42
|
+
"date-vir": "^9.1.1",
|
|
43
43
|
"mri": "^1.2.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@augment-vir/test": "^32.2.
|
|
46
|
+
"@augment-vir/test": "^32.2.3",
|
|
47
47
|
"@types/node": "^26.2.0",
|
|
48
48
|
"c8": "^12.0.0",
|
|
49
49
|
"dependency-cruiser": "^18.2.0",
|
|
50
50
|
"esbuild": "^0.28.2",
|
|
51
51
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
52
|
-
"npm-check-updates": "^23.0
|
|
52
|
+
"npm-check-updates": "^23.1.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"dependency-cruiser": ">=18",
|