@virmator/core 13.16.1 → 14.0.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.
@@ -28,8 +28,8 @@ export async function copyPluginConfigs(usedCommands, resolvedConfigs, packageTy
28
28
  return;
29
29
  }
30
30
  else if (packageType === PackageType.MonoRoot &&
31
- !config.packageType.includes(PackageType.MonoRoot) &&
32
- config.packageType.includes(PackageType.MonoPackage)) {
31
+ !config.packageType[PackageType.MonoRoot] &&
32
+ config.packageType[PackageType.MonoPackage]) {
33
33
  await Promise.all(monoRepoPackages.map(async (repoPackage) => {
34
34
  await copyConfigFile({
35
35
  ...config,
@@ -37,7 +37,7 @@ export async function copyPluginConfigs(usedCommands, resolvedConfigs, packageTy
37
37
  }, log);
38
38
  }));
39
39
  }
40
- else if (!config.required || !config.packageType.includes(packageType)) {
40
+ else if (!config.required || !config.packageType[packageType]) {
41
41
  return;
42
42
  }
43
43
  else {
@@ -1,14 +1,11 @@
1
1
  import { check } from '@augment-vir/assert';
2
- import { awaitedBlockingMap, extractErrorMessage, filterMap, log, logColors, log as logImport, LogOutputType, mapObjectValues, wrapInTry, } from '@augment-vir/common';
2
+ import { awaitedBlockingMap, extractErrorMessage, log, logColors, log as logImport, LogOutputType, mapObjectValues, wrapInTry, } from '@augment-vir/common';
3
3
  import { readPackageJson, runShellCommand } from '@augment-vir/node';
4
- import chalk from 'chalk';
5
- import concurrently from 'concurrently';
6
- import { getRelativePosixPackagePathsInDependencyOrder } from 'mono-vir';
4
+ import { getRelativePosixPackagePathTreeInDependencyOrder } from 'mono-vir';
7
5
  import { cpus } from 'node:os';
8
- import { join, resolve } from 'node:path';
6
+ import { join } from 'node:path';
7
+ import { createCommandLogPrefix, getColorKeyByIndex, KillOn, runCommandMatrix, runCommands, } from 'runstorm';
9
8
  import { findClosestPackageDir } from '../augments/index.js';
10
- import { CallbackWritable } from '../augments/stream/callback-writable.js';
11
- import { getTerminalColor } from '../colors.js';
12
9
  import { hideNoTraceTraces, VirmatorNoTraceError } from '../errors/virmator-no-trace.error.js';
13
10
  import { PackageType } from '../plugin/plugin-env.js';
14
11
  import { copyPluginConfigs } from './copy-configs.js';
@@ -39,7 +36,7 @@ async function determinePackageType(cwdPackagePath, monoRepoRootPath, cwdPackage
39
36
  else {
40
37
  if (monoRepoRootPath !== cwdPackagePath) {
41
38
  const parentPackages = await getMonoRepoPackages(monoRepoRootPath);
42
- if (parentPackages.some((monoPackage) => {
39
+ if (parentPackages.flat().some((monoPackage) => {
43
40
  return join(monoRepoRootPath, monoPackage.relativePath) === cwdPackagePath;
44
41
  })) {
45
42
  return PackageType.MonoPackage;
@@ -55,36 +52,55 @@ async function determinePackageType(cwdPackagePath, monoRepoRootPath, cwdPackage
55
52
  }
56
53
  }
57
54
  async function getMonoRepoPackages(cwdPackagePath) {
58
- const relativePackagePathsInOrder = await wrapInTry(() => getRelativePosixPackagePathsInDependencyOrder(cwdPackagePath), {
55
+ const relativePackagePathsInOrder = await wrapInTry(() => getRelativePosixPackagePathTreeInDependencyOrder(cwdPackagePath), {
59
56
  handleError(error) {
60
57
  log.error(extractErrorMessage(error) + '\n');
61
58
  return [];
62
59
  },
63
60
  });
64
- return await Promise.all(relativePackagePathsInOrder.map(async (packagePath) => {
65
- const packageJson = await wrapInTry(() => readPackageJson(packagePath), {
66
- fallbackValue: undefined,
67
- });
61
+ return await Promise.all(relativePackagePathsInOrder.map(async (dependencyLayer) => {
62
+ return await Promise.all(dependencyLayer.map(async (packagePath) => {
63
+ const packageJson = await wrapInTry(() => readPackageJson(packagePath), {
64
+ fallbackValue: undefined,
65
+ });
66
+ return {
67
+ packageName: packageJson?.name || packagePath,
68
+ relativePath: packagePath,
69
+ fullPath: join(cwdPackagePath, packagePath),
70
+ };
71
+ }));
72
+ }));
73
+ }
74
+ async function getMonoRepoDetails(cwdPackagePath, cwdPackageJson) {
75
+ const monoRepoRootPath = await findMonoRepoDir(cwdPackagePath);
76
+ const packageType = await determinePackageType(cwdPackagePath, monoRepoRootPath, cwdPackageJson);
77
+ const monoRepoPackages = packageType === PackageType.MonoRoot ? await getMonoRepoPackages(cwdPackagePath) : [];
78
+ const isPartOfMonoRepo = monoRepoPackages
79
+ .flat()
80
+ .some(({ fullPath }) => fullPath === cwdPackagePath);
81
+ if (isPartOfMonoRepo || packageType === PackageType.MonoRoot) {
82
+ return {
83
+ monoRepoPackages,
84
+ monoRepoRootPath,
85
+ packageType,
86
+ };
87
+ }
88
+ else {
68
89
  return {
69
- packageName: packageJson?.name || packagePath,
70
- relativePath: packagePath,
71
- fullPath: join(cwdPackagePath, packagePath),
90
+ monoRepoPackages: [],
91
+ monoRepoRootPath: cwdPackagePath,
92
+ packageType,
72
93
  };
73
- }));
94
+ }
74
95
  }
75
96
  async function findMonoRepoDir(cwdPackagePath) {
76
- const parentPackageDir = wrapInTry(() => findClosestPackageDir(resolve(cwdPackagePath, '..')), {
97
+ const parentPackageDir = await wrapInTry(() => findClosestPackageDir({
98
+ startDirPath: cwdPackagePath,
99
+ requireWorkspaces: true,
100
+ }), {
77
101
  fallbackValue: undefined,
78
102
  });
79
- if (parentPackageDir) {
80
- const parentPackages = await getMonoRepoPackages(parentPackageDir);
81
- if (parentPackages.some((monoPackage) => {
82
- return join(parentPackageDir, monoPackage.relativePath) === cwdPackagePath;
83
- })) {
84
- return parentPackageDir;
85
- }
86
- }
87
- return cwdPackagePath;
103
+ return parentPackageDir || cwdPackagePath;
88
104
  }
89
105
  function writeLog(arg, log, logType, extraOptions) {
90
106
  const transformed = extraOptions?.logTransform?.[logType]
@@ -116,13 +132,14 @@ export async function executeVirmatorCommand({ log: logParam, entryPointFilePath
116
132
  if (!args.commands.length || !plugin) {
117
133
  throw new VirmatorNoTraceError(`Missing valid command.`);
118
134
  }
119
- const cwdPackagePath = findClosestPackageDir(cwd);
135
+ const cwdPackagePath = await findClosestPackageDir({
136
+ startDirPath: cwd,
137
+ requireWorkspaces: false,
138
+ });
120
139
  const cwdPackageJson = await readPackageJson(cwdPackagePath);
121
140
  const pluginPackagePath = plugin.pluginPackageRootPath;
122
141
  const resolvedConfigs = resolveConfigs({ cwdPackagePath, pluginPackagePath }, plugin.cliCommands);
123
- const monoRepoRootPath = await findMonoRepoDir(cwdPackagePath);
124
- const packageType = await determinePackageType(cwdPackagePath, monoRepoRootPath, cwdPackageJson);
125
- const monoRepoPackages = packageType === PackageType.MonoRoot ? await getMonoRepoPackages(cwdPackagePath) : [];
142
+ const { monoRepoPackages, monoRepoRootPath, packageType } = await getMonoRepoDetails(cwdPackagePath, cwdPackageJson);
126
143
  const outerMaxProcesses = params.concurrency || cpus().length - 1 || 1;
127
144
  const filteredArgs = args.filteredCommandArgs.filter(check.isTruthy);
128
145
  const executorParams = {
@@ -134,7 +151,7 @@ export async function executeVirmatorCommand({ log: logParam, entryPointFilePath
134
151
  cwd,
135
152
  package: {
136
153
  cwdPackagePath,
137
- monoRepoPackages,
154
+ monoRepoPackages: monoRepoPackages.flat(),
138
155
  packageType,
139
156
  monoRepoRootPath,
140
157
  cwdPackageJson,
@@ -166,13 +183,14 @@ export async function executeVirmatorCommand({ log: logParam, entryPointFilePath
166
183
  }
167
184
  return result;
168
185
  },
169
- async runInstallDeps(deps) {
186
+ async runInstallDeps(deps, packageEnv) {
170
187
  await installNpmDeps({
171
188
  deps,
172
189
  cwdPackageJson,
173
190
  cwdPackagePath,
174
191
  log,
175
192
  packageType,
193
+ packageEnv,
176
194
  pluginName: plugin.name,
177
195
  pluginPackagePath,
178
196
  });
@@ -184,63 +202,90 @@ export async function executeVirmatorCommand({ log: logParam, entryPointFilePath
184
202
  else if (!monoRepoPackages.length) {
185
203
  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'.`);
186
204
  }
187
- const commands = (await awaitedBlockingMap(monoRepoPackages, async (monoRepoPackage, index) => {
188
- const colorString = getTerminalColor(index);
189
- const color = chalk[colorString];
190
- const absolutePackagePath = join(cwd, monoRepoPackage.relativePath);
191
- const command = await generateCliCommandString({
192
- packageCwd: absolutePackagePath,
193
- packageName: monoRepoPackage.packageName,
194
- color,
205
+ if (maxProcesses === 'tree') {
206
+ const commands = await awaitedBlockingMap(monoRepoPackages, async (packageLayer) => {
207
+ return (await awaitedBlockingMap(packageLayer, async (monoRepoPackage, index) => {
208
+ const color = getColorKeyByIndex(index);
209
+ const absolutePackagePath = join(cwd, monoRepoPackage.relativePath);
210
+ const command = await generateCliCommandString({
211
+ packageCwd: absolutePackagePath,
212
+ packageName: monoRepoPackage.packageName,
213
+ color,
214
+ });
215
+ if (!command) {
216
+ return undefined;
217
+ }
218
+ const prefix = createCommandLogPrefix({
219
+ color,
220
+ name: monoRepoPackage.packageName,
221
+ });
222
+ log.faint(`${prefix}${logColors.faint}> ${command}`);
223
+ return {
224
+ command,
225
+ cwd: absolutePackagePath,
226
+ name: monoRepoPackage.packageName,
227
+ color,
228
+ };
229
+ })).filter(check.isTruthy);
195
230
  });
196
- if (!command) {
197
- return undefined;
231
+ if (!commands.length) {
232
+ return;
198
233
  }
199
- const prefix = color(`[${monoRepoPackage.packageName}]`);
200
- log.faint(`${prefix}${logColors.faint} > ${command}`);
201
- return {
202
- command,
203
- cwd: absolutePackagePath,
204
- name: monoRepoPackage.packageName,
205
- prefixColor: colorString,
206
- };
207
- })).filter(check.isTruthy);
208
- const writeStream = new CallbackWritable(log);
209
- /** Force concurrently to use color even though it's being run as a subscript. */
210
- process.env.FORCE_COLOR = '2';
211
- let concurrentlyResults = [];
212
- let failed = false;
213
- try {
214
- if (commands.length) {
215
- concurrentlyResults = await concurrently(commands, {
216
- killOthers: 'failure',
217
- outputStream: writeStream,
218
- maxProcesses: maxProcesses || outerMaxProcesses,
219
- }).result;
234
+ const { highestExitCode } = await runCommandMatrix(commands, {
235
+ killOn: KillOn.Failure,
236
+ loggers: {
237
+ stderr: log.error,
238
+ stdout: log.plain,
239
+ },
240
+ maxConcurrency: outerMaxProcesses,
241
+ });
242
+ if (highestExitCode) {
243
+ throw new VirmatorNoTraceError(`Exited with ${highestExitCode}.`);
220
244
  }
221
245
  }
222
- catch (error) {
223
- failed = true;
224
- if (Array.isArray(error)) {
225
- concurrentlyResults = error;
246
+ else {
247
+ const commands = (await awaitedBlockingMap(monoRepoPackages.flat(), async (monoRepoPackage, index) => {
248
+ const color = getColorKeyByIndex(index);
249
+ const absolutePackagePath = join(cwd, monoRepoPackage.relativePath);
250
+ const command = await generateCliCommandString({
251
+ packageCwd: absolutePackagePath,
252
+ packageName: monoRepoPackage.packageName,
253
+ color,
254
+ });
255
+ if (!command) {
256
+ return undefined;
257
+ }
258
+ const prefix = createCommandLogPrefix({
259
+ color,
260
+ name: monoRepoPackage.packageName,
261
+ });
262
+ log.faint(`${prefix}${logColors.faint}> ${command}`);
263
+ return {
264
+ command,
265
+ cwd: absolutePackagePath,
266
+ name: monoRepoPackage.packageName,
267
+ color,
268
+ };
269
+ })).filter(check.isTruthy);
270
+ if (!commands.length) {
271
+ return;
226
272
  }
227
- else {
228
- throw error;
273
+ const { highestExitCode } = await runCommands(commands, {
274
+ killOn: KillOn.Failure,
275
+ loggers: {
276
+ stderr: log.error,
277
+ stdout: log.plain,
278
+ },
279
+ maxConcurrency: maxProcesses || outerMaxProcesses,
280
+ });
281
+ if (highestExitCode) {
282
+ throw new VirmatorNoTraceError(`Exited with ${highestExitCode}.`);
229
283
  }
230
284
  }
231
- if (!failed) {
232
- return;
233
- }
234
- const failedCommandNames = filterMap(concurrentlyResults, (result) => result.command.name, (commandName, result) => {
235
- return result.exitCode !== 0 && !result.killed;
236
- });
237
- if (failedCommandNames.length) {
238
- throw new VirmatorNoTraceError(`${failedCommandNames.join(', ')} failed.`);
239
- }
240
285
  },
241
286
  };
242
287
  if (!args.virmatorFlags['--no-configs']) {
243
- await copyPluginConfigs(args.usedCommands, resolvedConfigs, packageType, monoRepoPackages, log, filteredArgs);
288
+ await copyPluginConfigs(args.usedCommands, resolvedConfigs, packageType, monoRepoPackages.flat(), log, filteredArgs);
244
289
  }
245
290
  if (!args.virmatorFlags['--no-deps']) {
246
291
  await installPluginNpmDeps({
@@ -251,6 +296,7 @@ export async function executeVirmatorCommand({ log: logParam, entryPointFilePath
251
296
  pluginName: plugin.name,
252
297
  pluginPackagePath,
253
298
  usedCommands: args.usedCommands,
299
+ packageEnv: undefined,
254
300
  });
255
301
  }
256
302
  const result = await wrapInTry(() => plugin.executor(executorParams));
@@ -1,4 +1,4 @@
1
- import { type Logger } from '@augment-vir/common';
1
+ import { type Logger, type RuntimeEnv } from '@augment-vir/common';
2
2
  import { type PackageJson } from 'type-fest';
3
3
  import { type PackageType } from '../plugin/plugin-env.js';
4
4
  import { type UsedVirmatorPluginCommands } from '../plugin/plugin-executor.js';
@@ -11,6 +11,7 @@ export declare function installPluginNpmDeps({ usedCommands, ...params }: {
11
11
  pluginName: string;
12
12
  packageType: PackageType;
13
13
  log: Logger;
14
+ packageEnv: RuntimeEnv | undefined;
14
15
  usedCommands: Readonly<UsedVirmatorPluginCommands>;
15
16
  }): Promise<void>;
16
17
  /**
@@ -18,12 +19,13 @@ export declare function installPluginNpmDeps({ usedCommands, ...params }: {
18
19
  *
19
20
  * @returns `true` if new deps were installed, otherwise `false`.
20
21
  */
21
- export declare function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPackagePath, pluginName, packageType, log, deps, }: {
22
+ export declare function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPackagePath, pluginName, packageType, packageEnv, log, deps, }: {
22
23
  cwdPackagePath: string;
23
24
  cwdPackageJson: PackageJson;
24
25
  pluginPackagePath: string;
25
26
  pluginName: string;
26
27
  packageType: PackageType;
28
+ packageEnv: RuntimeEnv | undefined;
27
29
  log: Logger;
28
30
  deps: Partial<PluginNpmDeps>;
29
31
  }): Promise<boolean>;
@@ -24,7 +24,7 @@ export async function installPluginNpmDeps({ usedCommands, ...params }) {
24
24
  *
25
25
  * @returns `true` if new deps were installed, otherwise `false`.
26
26
  */
27
- export async function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPackagePath, pluginName, packageType, log, deps, }) {
27
+ export async function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPackagePath, pluginName, packageType, packageEnv, log, deps, }) {
28
28
  const neededDeps = getObjectTypedEntries(deps);
29
29
  if (!neededDeps.length) {
30
30
  return false;
@@ -33,7 +33,9 @@ export async function installNpmDeps({ cwdPackagePath, cwdPackageJson, pluginPac
33
33
  const pluginPackageJson = await readPackageJson(pluginPackagePath);
34
34
  const currentPluginPackageDeps = combineDeps(pluginPackageJson);
35
35
  const depsThatNeedInstalling = neededDeps.reduce((accum, [depName, depOptions,]) => {
36
- if (!depOptions.packageType.includes(packageType)) {
36
+ const matchesPackageType = depOptions.packageType[packageType];
37
+ const matchesPackageEnv = packageEnv ? depOptions.env[packageEnv] : true;
38
+ if (!matchesPackageType || !matchesPackageEnv) {
37
39
  return accum;
38
40
  }
39
41
  const baselineVersion = semver.coerce(currentPluginPackageDeps[depName] || '');
@@ -1,4 +1,7 @@
1
1
  /** Finds the closest ancestor directory with a `package.json` file. */
2
- export declare function findClosestPackageDir(startDirPath: string): string;
2
+ export declare function findClosestPackageDir({ requireWorkspaces, startDirPath, }: {
3
+ startDirPath: string;
4
+ requireWorkspaces: boolean;
5
+ }): Promise<string>;
3
6
  /** Finds the closest ancestor `node_modules` directory. */
4
7
  export declare function findClosestNodeModulesDir(startDirPath: string): string;
@@ -1,11 +1,21 @@
1
- import { assert } from '@augment-vir/assert';
2
- import { findAncestor } from '@augment-vir/node';
1
+ import { assert, check } from '@augment-vir/assert';
2
+ import { findAncestor, readJsonFile } from '@augment-vir/node';
3
3
  import { existsSync } from 'node:fs';
4
4
  import { join } from 'node:path';
5
5
  /** Finds the closest ancestor directory with a `package.json` file. */
6
- export function findClosestPackageDir(startDirPath) {
7
- const ancestor = findAncestor(startDirPath, (dir) => {
8
- return existsSync(join(dir, 'package.json'));
6
+ export async function findClosestPackageDir({ requireWorkspaces, startDirPath, }) {
7
+ const ancestor = await findAncestor(startDirPath, async (dir) => {
8
+ const jsonFilePath = join(dir, 'package.json');
9
+ if (!existsSync(jsonFilePath)) {
10
+ return false;
11
+ }
12
+ else if (requireWorkspaces) {
13
+ const contents = await readJsonFile(jsonFilePath);
14
+ return check.isObject(contents) ? 'workspaces' in contents : false;
15
+ }
16
+ else {
17
+ return true;
18
+ }
9
19
  });
10
20
  assert.isDefined(ancestor, 'Failed to find ancestor package root.');
11
21
  return ancestor;
@@ -1,4 +1,3 @@
1
1
  export * from './fs/search.js';
2
2
  export * from './object/access.js';
3
- export * from './stream/callback-writable.js';
4
3
  export * from './tsconfig/parse-tsconfig.js';
@@ -1,4 +1,3 @@
1
1
  export * from './fs/search.js';
2
2
  export * from './object/access.js';
3
- export * from './stream/callback-writable.js';
4
3
  export * from './tsconfig/parse-tsconfig.js';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './api/index.js';
2
2
  export * from './augments/index.js';
3
- export * from './colors.js';
4
3
  export * from './errors/index.js';
5
4
  export * from './plugin/index.js';
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './api/index.js';
2
2
  export * from './augments/index.js';
3
- export * from './colors.js';
4
3
  export * from './errors/index.js';
5
4
  export * from './plugin/index.js';
@@ -13,9 +13,9 @@ export type VirmatorPluginConfigFile = {
13
13
  */
14
14
  copyToPath: string;
15
15
  /** The environments in which this config should be used. */
16
- env: RuntimeEnv[];
16
+ env: Partial<Record<RuntimeEnv, boolean>>;
17
17
  /** The package type for which this config should be used. */
18
- packageType: PackageType[];
18
+ packageType: Partial<Record<PackageType, boolean>>;
19
19
  /**
20
20
  * If set to `true`, this config will be copied over every time the command is run, if the
21
21
  * config doesn't exist, unless `'--no-configs'` was set.
@@ -1,6 +1,6 @@
1
- import { type AnyObject, type Logger, type LogOutputType, type MaybePromise, type PartialWithUndefined, type TypedFunction } from '@augment-vir/common';
1
+ import { type AnyObject, type Logger, type LogOutputType, type MaybePromise, type PartialWithUndefined, type RuntimeEnv, type TypedFunction } from '@augment-vir/common';
2
2
  import { type runShellCommand } from '@augment-vir/node';
3
- import { type ChalkInstance } from 'chalk';
3
+ import { type ColorKey } from 'runstorm';
4
4
  import { type EmptyObject, type PackageJson, type SetRequired } from 'type-fest';
5
5
  import { type VirmatorPluginResolvedConfigFile } from './plugin-configs.js';
6
6
  import { type PackageType } from './plugin-env.js';
@@ -37,8 +37,8 @@ export type MonoRepoPackage = {
37
37
  export type RunPerPackage = (generateCliCommandString: (params: {
38
38
  packageCwd: string;
39
39
  packageName: string;
40
- color: ChalkInstance;
41
- }) => MaybePromise<string | undefined>, maxProcesses?: number | undefined) => Promise<void>;
40
+ color: ColorKey;
41
+ }) => MaybePromise<string | undefined>, maxProcesses?: number | undefined | 'tree') => Promise<void>;
42
42
  /** Extra, optional options for a plugin's `runShellCommand` param. */
43
43
  export type ExtraRunShellCommandOptions = {
44
44
  /** Optional prefix before every log. */
@@ -87,7 +87,7 @@ export type VirmatorPluginExecutorParams<Commands extends VirmatorPluginCliComma
87
87
  /** Runs the given command for each package within a mono repo, if it has any. */
88
88
  runPerPackage: RunPerPackage;
89
89
  /** Installs the given list of deps within the current package directory. */
90
- runInstallDeps: (deps: Readonly<Partial<PluginNpmDeps>>) => Promise<void>;
90
+ runInstallDeps: (deps: Readonly<Partial<PluginNpmDeps>>, packageEnv: RuntimeEnv) => Promise<void>;
91
91
  log: Logger;
92
92
  configs: VirmatorPluginResolvedConfigs<Commands>;
93
93
  virmator: Readonly<{
@@ -14,8 +14,8 @@ export type PluginCommandDocs = {
14
14
  /** A list of npm deps. Used for virmator plugin command lists. */
15
15
  export type PluginNpmDeps = Record<string, {
16
16
  type: NpmDepType;
17
- packageType: ReadonlyArray<PackageType>;
18
- env: ReadonlyArray<RuntimeEnv>;
17
+ packageType: Partial<Record<PackageType, boolean>>;
18
+ env: Partial<Record<RuntimeEnv, boolean>>;
19
19
  }>;
20
20
  /** An individual virmator plugin cli command definition. Can nest recursive commands. */
21
21
  export type IndividualPluginCommand = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virmator/core",
3
- "version": "13.16.1",
3
+ "version": "14.0.0",
4
4
  "description": "Shared core functionality for all virmator plugins and the virmator CLI.",
5
5
  "keywords": [
6
6
  "automation",
@@ -32,21 +32,20 @@
32
32
  "test:update": "npm test update"
33
33
  },
34
34
  "dependencies": {
35
- "@augment-vir/assert": "^31.31.0",
36
- "@augment-vir/common": "^31.31.0",
37
- "@augment-vir/node": "^31.31.0",
38
- "chalk": "^5.5.0",
39
- "concurrently": "^9.2.0",
40
- "mono-vir": "^2.0.6",
35
+ "@augment-vir/assert": "^31.32.3",
36
+ "@augment-vir/common": "^31.32.3",
37
+ "@augment-vir/node": "^31.32.3",
38
+ "mono-vir": "^2.2.1",
39
+ "runstorm": "^0.6.1",
41
40
  "semver": "^7.7.2",
42
41
  "type-fest": "^4.41.0",
43
42
  "typescript": "^5.9.2"
44
43
  },
45
44
  "devDependencies": {
46
- "@augment-vir/test": "^31.31.0",
47
- "@types/node": "^24.2.0",
45
+ "@augment-vir/test": "^31.32.3",
46
+ "@types/node": "^24.3.0",
48
47
  "@types/semver": "^7.7.0",
49
- "esbuild": "^0.25.8"
48
+ "esbuild": "^0.25.9"
50
49
  },
51
50
  "engines": {
52
51
  "node": ">=22"
@@ -1,13 +0,0 @@
1
- import { type Logger } from '@augment-vir/common';
2
- import { Writable } from 'node:stream';
3
- /**
4
- * A [Writable](https://nodejs.org/api/stream.html#class-streamwritable) implementation that writes
5
- * to the provided plugin logger.
6
- */
7
- export declare class CallbackWritable extends Writable {
8
- private readonly logger;
9
- private chunks;
10
- /** Special write implementation that writs to the given logger. */
11
- _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
12
- constructor(logger: Logger);
13
- }
@@ -1,24 +0,0 @@
1
- import { Writable } from 'node:stream';
2
- /**
3
- * A [Writable](https://nodejs.org/api/stream.html#class-streamwritable) implementation that writes
4
- * to the provided plugin logger.
5
- */
6
- export class CallbackWritable extends Writable {
7
- logger;
8
- chunks = [];
9
- /** Special write implementation that writs to the given logger. */
10
- _write(chunk, encoding, callback) {
11
- const chunkString = String(chunk);
12
- this.chunks.push(chunkString);
13
- if (chunkString.endsWith('\n')) {
14
- const fullString = this.chunks.join('');
15
- this.chunks = [];
16
- this.logger.faint(fullString.trim());
17
- }
18
- callback();
19
- }
20
- constructor(logger) {
21
- super();
22
- this.logger = logger;
23
- }
24
- }
package/dist/colors.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { type ArrayElement } from '@augment-vir/common';
2
- /**
3
- * All terminal colors passed to concurrently and other concurrent operations used within virmator
4
- * plugins.
5
- */
6
- export declare const terminalColors: readonly ["red", "yellow", "greenBright", "cyan", "blueBright", "magentaBright", "grey"];
7
- /** The supported terminal colors for virmator concurrent commands. */
8
- export type TerminalColor = ArrayElement<typeof terminalColors>;
9
- /** Gets a supported virmator terminal color, with support for overflowing indexes. */
10
- export declare function getTerminalColor(index: number): TerminalColor;
package/dist/colors.js DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * All terminal colors passed to concurrently and other concurrent operations used within virmator
3
- * plugins.
4
- */
5
- export const terminalColors = [
6
- // Text colors
7
- 'red',
8
- 'yellow',
9
- 'greenBright',
10
- 'cyan',
11
- 'blueBright',
12
- 'magentaBright',
13
- 'grey',
14
- ];
15
- /** Gets a supported virmator terminal color, with support for overflowing indexes. */
16
- export function getTerminalColor(index) {
17
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
18
- return terminalColors[index % terminalColors.length];
19
- }