@virmator/core 14.30.2 → 14.30.4

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.
@@ -8,13 +8,16 @@ import { type MonoRepoPackage, type UsedVirmatorPluginCommands, type VirmatorPlu
8
8
  */
9
9
  export declare function flattenConfigs(usedCommands: Readonly<UsedVirmatorPluginCommands<any>>, resolvedConfigs: Readonly<VirmatorPluginResolvedConfigs<any>>): VirmatorPluginResolvedConfigFile[];
10
10
  /** Copies a plugin's entire set of configs based on the used command. */
11
- export declare function copyPluginConfigs({ usedCommands, resolvedConfigs, packageType, monoRepoPackages, log, filteredArgs, }: Readonly<{
11
+ export declare function copyPluginConfigs({ usedCommands, resolvedConfigs, packageType, monoRepoPackages, log, filteredArgs, isCwdPackagePrivate, }: Readonly<{
12
12
  usedCommands: Readonly<UsedVirmatorPluginCommands>;
13
13
  resolvedConfigs: Readonly<VirmatorPluginResolvedConfigs<any>>;
14
14
  packageType: PackageType;
15
15
  monoRepoPackages: MonoRepoPackage[];
16
16
  log: Logger;
17
17
  filteredArgs: string[];
18
+ }> & PartialWithUndefined<{
19
+ /** `true` if the current package's `package.json` has `"private": true`. */
20
+ isCwdPackagePrivate: boolean;
18
21
  }>): Promise<void>;
19
22
  /** Inputs for {@link copyConfigFile}. */
20
23
  export type CopyConfigFileParams = {
@@ -21,8 +21,10 @@ export function flattenConfigs(usedCommands, resolvedConfigs) {
21
21
  });
22
22
  }
23
23
  /** Copies a plugin's entire set of configs based on the used command. */
24
- export async function copyPluginConfigs({ usedCommands, resolvedConfigs, packageType, monoRepoPackages, log, filteredArgs, }) {
25
- const configs = flattenConfigs(usedCommands, resolvedConfigs).sort((a, b) => basename(a.copyToPath).localeCompare(basename(b.copyToPath)));
24
+ export async function copyPluginConfigs({ usedCommands, resolvedConfigs, packageType, monoRepoPackages, log, filteredArgs, isCwdPackagePrivate = false, }) {
25
+ const configs = flattenConfigs(usedCommands, resolvedConfigs).sort((a, b) => {
26
+ return basename(a.copyToPath).localeCompare(basename(b.copyToPath));
27
+ });
26
28
  await awaitedForEach(Object.values(configs), async (config) => {
27
29
  if ((config.configFlags || []).some((configFlag) => filteredArgs.includes(configFlag))) {
28
30
  return;
@@ -38,7 +40,9 @@ export async function copyPluginConfigs({ usedCommands, resolvedConfigs, package
38
40
  config.required &&
39
41
  !config.packageType[PackageType.MonoRoot] &&
40
42
  config.packageType[PackageType.MonoPackage]) {
41
- await Promise.all(monoRepoPackages.map(async (repoPackage) => {
43
+ await Promise.all(monoRepoPackages
44
+ .filter((repoPackage) => !config.skipPrivatePackages || !repoPackage.isPrivate)
45
+ .map(async (repoPackage) => {
42
46
  await copyConfigFile({
43
47
  config: {
44
48
  ...config,
@@ -51,6 +55,9 @@ export async function copyPluginConfigs({ usedCommands, resolvedConfigs, package
51
55
  else if (!config.required || !config.packageType[packageType]) {
52
56
  return;
53
57
  }
58
+ else if (config.skipPrivatePackages && isCwdPackagePrivate) {
59
+ return;
60
+ }
54
61
  else {
55
62
  await copyConfigFile({
56
63
  config,
@@ -76,13 +76,15 @@ async function getMonoRepoPackages(cwdPackagePath) {
76
76
  });
77
77
  return await Promise.all(relativePackagePathsInOrder.map(async (dependencyLayer) => {
78
78
  return await Promise.all(dependencyLayer.map(async (packagePath) => {
79
- const packageJson = await wrapInTry(() => readPackageJson(packagePath), {
79
+ const fullPath = join(cwdPackagePath, packagePath);
80
+ const packageJson = await wrapInTry(() => readPackageJson(fullPath), {
80
81
  fallbackValue: undefined,
81
82
  });
82
83
  return {
83
84
  packageName: packageJson?.name || packagePath,
84
85
  relativePath: packagePath,
85
- fullPath: join(cwdPackagePath, packagePath),
86
+ fullPath,
87
+ isPrivate: !!packageJson?.private,
86
88
  };
87
89
  }));
88
90
  }));
@@ -112,10 +114,12 @@ async function getMonoRepoDetails(cwdPackagePath, cwdPackageJson) {
112
114
  }
113
115
  }
114
116
  async function findMonoRepoDir(cwdPackagePath) {
115
- const parentPackageDir = await wrapInTry(() => findClosestPackageDir({
116
- startDirPath: cwdPackagePath,
117
- requireWorkspaces: true,
118
- }), {
117
+ const parentPackageDir = await wrapInTry(() => {
118
+ return findClosestPackageDir({
119
+ startDirPath: cwdPackagePath,
120
+ requireWorkspaces: true,
121
+ });
122
+ }, {
119
123
  fallbackValue: undefined,
120
124
  });
121
125
  return parentPackageDir || cwdPackagePath;
@@ -329,6 +333,7 @@ export async function executeVirmatorCommand({ log: logParam, entryPointFilePath
329
333
  monoRepoPackages: monoRepoPackages.flat(),
330
334
  log,
331
335
  filteredArgs,
336
+ isCwdPackagePrivate: !!cwdPackageJson.private,
332
337
  });
333
338
  }
334
339
  if (!args.virmatorFlags['--no-deps']) {
@@ -56,12 +56,14 @@ export function parseCliArgs({ cliCommand, entryPointFilePath, plugins, log, })
56
56
  const rawArgs = check.isArray(cliCommand)
57
57
  ? cliCommand
58
58
  : cliCommand.split(' ');
59
- const relevantArgs = wrapInTry(() => extractRelevantArgs({
60
- binName: 'virmator',
61
- rawArgs,
62
- fileName: entryPointFilePath,
63
- errorIfNotFound: true,
64
- }), {
59
+ const relevantArgs = wrapInTry(() => {
60
+ return extractRelevantArgs({
61
+ binName: 'virmator',
62
+ rawArgs,
63
+ fileName: entryPointFilePath,
64
+ errorIfNotFound: true,
65
+ });
66
+ }, {
65
67
  fallbackValue: rawArgs,
66
68
  });
67
69
  const mappedPlugins = mapPluginsByCommand(plugins);
@@ -18,9 +18,11 @@ export async function withImportedTsFile({ inputPath, outputPath }, moduleType,
18
18
  return await callback(loadedConfig);
19
19
  }
20
20
  finally {
21
- await wrapInTry(() => rm(compiledPath, {
22
- force: true,
23
- }));
21
+ await wrapInTry(() => {
22
+ return rm(compiledPath, {
23
+ force: true,
24
+ });
25
+ });
24
26
  }
25
27
  }
26
28
  /**
@@ -37,9 +39,11 @@ export async function withCompiledTsFile({ inputPath, outputPath }, moduleType,
37
39
  return await callback(compiledPath);
38
40
  }
39
41
  finally {
40
- await wrapInTry(() => rm(compiledPath, {
41
- force: true,
42
- }));
42
+ await wrapInTry(() => {
43
+ return rm(compiledPath, {
44
+ force: true,
45
+ });
46
+ });
43
47
  }
44
48
  }
45
49
  function createOutfilePath(inputFilePath, moduleType) {
@@ -21,6 +21,13 @@ export type VirmatorPluginConfigFile = {
21
21
  * config doesn't exist, unless `'--no-configs'` was set.
22
22
  */
23
23
  required: boolean;
24
+ /**
25
+ * If set to `true`, this config will not be copied into packages whose `package.json` has
26
+ * `"private": true`. Use this for configs that only support commands which skip private
27
+ * packages (such as typedoc, since private packages are never published and thus never
28
+ * documented).
29
+ */
30
+ skipPrivatePackages?: boolean | undefined;
24
31
  configFlags?: string[];
25
32
  };
26
33
  /** {@link VirmatorPluginConfigFile} but with resolved paths too. */
@@ -31,6 +31,8 @@ export type MonoRepoPackage = {
31
31
  packageName: string;
32
32
  relativePath: string;
33
33
  fullPath: string;
34
+ /** `true` if the package's `package.json` has `"private": true`. */
35
+ isPrivate: boolean;
34
36
  };
35
37
  /** Run a command per npm package nested within a mono repo. */
36
38
  export type RunPerPackage = (generateCliCommandString: (params: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virmator/core",
3
- "version": "14.30.2",
3
+ "version": "14.30.4",
4
4
  "description": "Shared core functionality for all virmator plugins and the virmator CLI.",
5
5
  "keywords": [
6
6
  "automation",
@@ -35,15 +35,15 @@
35
35
  "@augment-vir/assert": "^32.2.1",
36
36
  "@augment-vir/common": "^32.2.1",
37
37
  "@augment-vir/node": "^32.2.1",
38
- "mono-vir": "^2.5.0",
39
- "runstorm": "^1.0.5",
38
+ "mono-vir": "^2.5.1",
39
+ "runstorm": "^1.0.6",
40
40
  "semver": "^7.8.5",
41
41
  "typescript": "^6.0.3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@augment-vir/test": "^32.2.1",
45
- "@types/node": "^26.1.1",
46
- "@types/semver": "^7.7.1",
45
+ "@types/node": "^26.1.2",
46
+ "@types/semver": "^7.8.0",
47
47
  "esbuild": "^0.28.1"
48
48
  },
49
49
  "peerDependencies": {