@virmator/core 14.12.2 → 14.13.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.
|
@@ -144,7 +144,7 @@ export async function executeVirmatorCommand({ log: logParam, entryPointFilePath
|
|
|
144
144
|
});
|
|
145
145
|
const plugin = args.plugin;
|
|
146
146
|
if (!args.commands.length || !plugin) {
|
|
147
|
-
throw new VirmatorNoTraceError(
|
|
147
|
+
throw new VirmatorNoTraceError('Missing valid command.');
|
|
148
148
|
}
|
|
149
149
|
const cwdPackagePath = await findClosestPackageDir({
|
|
150
150
|
startDirPath: cwd,
|
|
@@ -214,10 +214,10 @@ export async function executeVirmatorCommand({ log: logParam, entryPointFilePath
|
|
|
214
214
|
},
|
|
215
215
|
async runPerPackage(generateCliCommandString, maxProcesses) {
|
|
216
216
|
if (packageType !== PackageType.MonoRoot) {
|
|
217
|
-
throw new Error(
|
|
217
|
+
throw new Error('Cannot run "runPerPackage" on non-mono-repo.');
|
|
218
218
|
}
|
|
219
219
|
else if (!monoRepoPackages.length) {
|
|
220
|
-
throw new Error(
|
|
220
|
+
throw new Error("No mono-repo packages found. Make sure to set the 'workspaces' field in your mono-repo package.json and run 'npm i'.");
|
|
221
221
|
}
|
|
222
222
|
if (maxProcesses === 'tree') {
|
|
223
223
|
const commands = await awaitedBlockingMap(monoRepoPackages, async (packageLayer) => {
|
package/dist/api/install-deps.js
CHANGED
|
@@ -35,13 +35,19 @@ export async function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPac
|
|
|
35
35
|
const cwdPackageDeps = combineDeps(cwdPackageJson);
|
|
36
36
|
const pluginPackageJson = await readPackageJson(pluginPackagePath);
|
|
37
37
|
const currentPluginPackageDeps = combineDeps(pluginPackageJson);
|
|
38
|
+
const emptyDepsByPrefix = {
|
|
39
|
+
'^': [],
|
|
40
|
+
'~': [],
|
|
41
|
+
'': [],
|
|
42
|
+
};
|
|
38
43
|
const depsThatNeedInstalling = neededDeps.reduce((accum, [depName, depOptions,]) => {
|
|
39
44
|
const matchesPackageType = depOptions.packageType[packageType];
|
|
40
45
|
const matchesPackageEnv = packageEnv ? depOptions.env[packageEnv] : true;
|
|
41
46
|
if (!matchesPackageType || !matchesPackageEnv) {
|
|
42
47
|
return accum;
|
|
43
48
|
}
|
|
44
|
-
const
|
|
49
|
+
const pluginVersionString = currentPluginPackageDeps[depName] || '';
|
|
50
|
+
const baselineVersion = semver.coerce(pluginVersionString);
|
|
45
51
|
if (!baselineVersion) {
|
|
46
52
|
throw new VirmatorNoTraceError(`No baseline version found for npm dep '${depName}' in virmator plugin '${pluginName}'.`);
|
|
47
53
|
}
|
|
@@ -49,14 +55,36 @@ export async function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPac
|
|
|
49
55
|
if (currentVersion && baselineVersion.compare(currentVersion) !== 1) {
|
|
50
56
|
return accum;
|
|
51
57
|
}
|
|
58
|
+
const versionPrefix = extractVersionPrefix(pluginVersionString);
|
|
52
59
|
const depNameWithVersion = `${depName}@${baselineVersion.raw}`;
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
return {
|
|
61
|
+
...accum,
|
|
62
|
+
[depOptions.type]: {
|
|
63
|
+
...accum[depOptions.type],
|
|
64
|
+
[versionPrefix]: [
|
|
65
|
+
...accum[depOptions.type][versionPrefix],
|
|
66
|
+
depNameWithVersion,
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
55
70
|
}, {
|
|
56
|
-
[NpmDepType.Dev]:
|
|
57
|
-
|
|
71
|
+
[NpmDepType.Dev]: {
|
|
72
|
+
...emptyDepsByPrefix,
|
|
73
|
+
},
|
|
74
|
+
[NpmDepType.Regular]: {
|
|
75
|
+
...emptyDepsByPrefix,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
const installGroups = getObjectTypedEntries(depsThatNeedInstalling).flatMap(([depType, depsByPrefix,]) => {
|
|
79
|
+
return getObjectTypedEntries(depsByPrefix).map(([prefix, deps,]) => {
|
|
80
|
+
return {
|
|
81
|
+
depType,
|
|
82
|
+
prefix,
|
|
83
|
+
deps,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
58
86
|
});
|
|
59
|
-
const installed = await awaitedBlockingMap(
|
|
87
|
+
const installed = await awaitedBlockingMap(installGroups, async ({ depType, prefix, deps }) => {
|
|
60
88
|
if (!deps.length) {
|
|
61
89
|
return false;
|
|
62
90
|
}
|
|
@@ -65,6 +93,8 @@ export async function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPac
|
|
|
65
93
|
'npm',
|
|
66
94
|
'i',
|
|
67
95
|
depType === NpmDepType.Dev ? '-D' : '',
|
|
96
|
+
prefix === '' ? '--save-exact' : '',
|
|
97
|
+
prefix === '~' ? '--save-prefix=~' : '',
|
|
68
98
|
installDeps,
|
|
69
99
|
]
|
|
70
100
|
.filter(check.isTruthy)
|
|
@@ -79,6 +109,15 @@ export async function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPac
|
|
|
79
109
|
});
|
|
80
110
|
return installed.some(check.isTrue);
|
|
81
111
|
}
|
|
112
|
+
function extractVersionPrefix(versionString) {
|
|
113
|
+
if (versionString.startsWith('^')) {
|
|
114
|
+
return '^';
|
|
115
|
+
}
|
|
116
|
+
else if (versionString.startsWith('~')) {
|
|
117
|
+
return '~';
|
|
118
|
+
}
|
|
119
|
+
return '';
|
|
120
|
+
}
|
|
82
121
|
function combineDeps(packageJson) {
|
|
83
122
|
return {
|
|
84
123
|
...packageJson.peerDependencies,
|
package/dist/api/parse-args.d.ts
CHANGED
|
@@ -6,7 +6,10 @@ import { type SetVirmatorFlags } from './virmator-flags.js';
|
|
|
6
6
|
/** All supported sets of args for virmator. */
|
|
7
7
|
export type ParsedArgs = {
|
|
8
8
|
virmatorFlags: SetVirmatorFlags;
|
|
9
|
-
commands: [
|
|
9
|
+
commands: [
|
|
10
|
+
string,
|
|
11
|
+
...string[]
|
|
12
|
+
];
|
|
10
13
|
filteredCommandArgs: string[];
|
|
11
14
|
plugin: Readonly<VirmatorPlugin> | undefined;
|
|
12
15
|
usedCommands: UsedVirmatorPluginCommands;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virmator/core",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.13.0",
|
|
4
4
|
"description": "Shared core functionality for all virmator plugins and the virmator CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"test:update": "npm test update"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@augment-vir/assert": "^31.
|
|
36
|
-
"@augment-vir/common": "^31.
|
|
37
|
-
"@augment-vir/node": "^31.
|
|
35
|
+
"@augment-vir/assert": "^31.69.0",
|
|
36
|
+
"@augment-vir/common": "^31.69.0",
|
|
37
|
+
"@augment-vir/node": "^31.69.0",
|
|
38
38
|
"mono-vir": "^2.5.0",
|
|
39
39
|
"runstorm": "^1.0.0",
|
|
40
40
|
"semver": "^7.7.4",
|
|
41
|
-
"type-fest": "^5.
|
|
41
|
+
"type-fest": "^5.6.0",
|
|
42
42
|
"typescript": "^5.9.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@augment-vir/test": "^31.
|
|
46
|
-
"@types/node": "^25.
|
|
45
|
+
"@augment-vir/test": "^31.69.0",
|
|
46
|
+
"@types/node": "^25.6.0",
|
|
47
47
|
"@types/semver": "^7.7.1",
|
|
48
48
|
"esbuild": "^0.28.0"
|
|
49
49
|
},
|