virmator 4.3.2 → 4.3.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,6 +8,7 @@ const mochaConfig = {
8
8
  parallel: true,
9
9
  require: ['ts-node/register'],
10
10
  slow: 1_500, // ms
11
+ fullTrace: true,
11
12
  timeout: 60_000, // 1 minute in ms
12
13
  reporter: SpecReporterWithFileNames.pathToThisReporter,
13
14
  ...testFiles,
@@ -5,19 +5,23 @@ function getBaseConfigWithCoveragePercent(percent) {
5
5
  extends: '@istanbuljs/nyc-config-typescript',
6
6
  all: true,
7
7
  branches: percent,
8
+ clean: true,
8
9
  cache: false,
9
10
  instrument: true,
10
- checkCoverage: true,
11
+ // use the reporter (istanbul-smart-text-reporter) to fail instead of printing errors for
12
+ // every message
13
+ checkCoverage: false,
11
14
  exclude: [
12
15
  '**/*.test.ts',
13
- 'src/readme-examples',
16
+ '**/*.example.ts',
14
17
  '**/*.type.test.ts',
15
18
  '**/*.test-helper.ts',
16
19
  ],
17
20
  functions: percent,
18
- include: 'src/*',
21
+ include: ['src/**/*.ts'],
19
22
  lines: percent,
20
- perFile: true,
23
+ // so we don't get error messages printed for every file
24
+ perFile: false,
21
25
  reporter: [
22
26
  'html',
23
27
  'istanbul-smart-text-reporter',
@@ -1,5 +1,5 @@
1
1
  .DS_Store
2
- /*.tgz
2
+ *.tgz
3
3
  /Icon?
4
4
  coverage/
5
5
  dist/
@@ -1,10 +1,10 @@
1
1
  .*
2
2
  *.test-helper.*
3
3
  *.test.*
4
+ *.tgz
4
5
  *.tsbuildinfo
5
6
  **/*/readme-examples/
6
7
  **/*/test/
7
- /*.tgz
8
8
  /configs/
9
9
  /coverage/
10
10
  /cspell.config.js
@@ -1,8 +1,8 @@
1
1
  import { CommandDescription } from './command-help';
2
2
  import { DefineCommandInputs, SubCommandsMap } from './define-command-inputs';
3
- export declare type CreateDescriptionsInputs<DefineCommandInputsGeneric extends DefineCommandInputs> = Pick<DefineCommandInputsGeneric, 'commandName'> & {
3
+ export type CreateDescriptionsInputs<DefineCommandInputsGeneric extends DefineCommandInputs> = Pick<DefineCommandInputsGeneric, 'commandName'> & {
4
4
  packageBinName: string;
5
5
  subCommands: SubCommandsMap<DefineCommandInputsGeneric>;
6
6
  configFiles: DefineCommandInputsGeneric['configFiles'];
7
7
  };
8
- export declare type CreateDescriptionsCallback<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CreateDescriptionsInputs<DefineCommandInputsGeneric>) => CommandDescription;
8
+ export type CreateDescriptionsCallback<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CreateDescriptionsInputs<DefineCommandInputsGeneric>) => CommandDescription;
@@ -1,7 +1,7 @@
1
1
  import { ConfigFileDefinition } from '../config/config-file-definition';
2
2
  import { CommandLogging, CommandLogTransforms } from './command-logging';
3
3
  import { DefineCommandInputs, SharedExecutorInputsAndCommandDefinition } from './define-command-inputs';
4
- export declare type CommandExecutorInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = {
4
+ export type CommandExecutorInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = {
5
5
  filteredInputArgs: string[];
6
6
  inputSubCommands: (keyof DefineCommandInputsGeneric['subCommandDescriptions'])[];
7
7
  repoDir: string;
@@ -9,20 +9,20 @@ export declare type CommandExecutorInputs<DefineCommandInputsGeneric extends Def
9
9
  packageDir: string;
10
10
  logging: CommandLogging;
11
11
  };
12
- export declare type CommandExecutorDefinitionInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = CommandExecutorInputs<DefineCommandInputsGeneric> & SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric>;
13
- export declare type DetailedArg = {
12
+ export type CommandExecutorDefinitionInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = CommandExecutorInputs<DefineCommandInputsGeneric> & SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric>;
13
+ export type DetailedArg = {
14
14
  arg: string;
15
15
  skipWindowsInterpolation: true;
16
16
  };
17
- export declare type SuccessOnlyExecutorOutput = {
17
+ export type SuccessOnlyExecutorOutput = {
18
18
  success: boolean;
19
19
  };
20
- export declare type BashCommandExecutorOutput = {
20
+ export type BashCommandExecutorOutput = {
21
21
  mainCommand: string;
22
22
  logTransforms?: CommandLogTransforms;
23
23
  args: (string | DetailedArg)[];
24
24
  };
25
25
  export declare function isCompletedExecutor(executorOutput: CommandExecutorOutput): executorOutput is SuccessOnlyExecutorOutput;
26
- export declare type CommandExecutorOutput = BashCommandExecutorOutput | SuccessOnlyExecutorOutput;
27
- export declare type CommandExecutorDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorDefinitionInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
28
- export declare type CommandExecutor<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
26
+ export type CommandExecutorOutput = BashCommandExecutorOutput | SuccessOnlyExecutorOutput;
27
+ export type CommandExecutorDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorDefinitionInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
28
+ export type CommandExecutor<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
@@ -1,8 +1,8 @@
1
- export declare type HelpSection = Readonly<{
1
+ export type HelpSection = Readonly<{
2
2
  title: string;
3
3
  content: string;
4
4
  }>;
5
- export declare type CommandDescription = Readonly<{
5
+ export type CommandDescription = Readonly<{
6
6
  sections: Readonly<HelpSection[]>;
7
7
  examples: Readonly<HelpSection[]>;
8
8
  }>;
@@ -1,11 +1,11 @@
1
- export declare type CommandLogCallback = (thingToLog: string) => void;
2
- export declare type CommandLogging = {
1
+ export type CommandLogCallback = (thingToLog: string) => void;
2
+ export type CommandLogging = {
3
3
  stdout: CommandLogCallback;
4
4
  stderr: CommandLogCallback;
5
5
  };
6
6
  export declare const noCommandLogging: Readonly<Required<CommandLogging>>;
7
7
  export declare const defaultConsoleLogging: Readonly<Required<CommandLogging>>;
8
- export declare type CommandLogs = Record<keyof CommandLogging, string>;
8
+ export type CommandLogs = Record<keyof CommandLogging, string>;
9
9
  export declare const identityCommandLogTransform: CommandLogTransform;
10
- export declare type CommandLogTransform = (thingToTransform: string) => string;
11
- export declare type CommandLogTransforms = Partial<Record<keyof CommandLogging, CommandLogTransform>>;
10
+ export type CommandLogTransform = (thingToTransform: string) => string;
11
+ export type CommandLogTransforms = Partial<Record<keyof CommandLogging, CommandLogTransform>>;
@@ -1,7 +1,7 @@
1
1
  import { ArrayElement } from 'augment-vir';
2
2
  import { CommandDefinition } from './define-command';
3
- export declare type CommandMapping = Record<string, CommandDefinition>;
3
+ export type CommandMapping = Record<string, CommandDefinition>;
4
4
  export declare function commandsToMapping(commands: ReadonlyArray<CommandDefinition>): Readonly<CommandMapping>;
5
- export declare type CommandDefinitionArrayToMapping<DefinitionArray extends ReadonlyArray<CommandDefinition>> = {
5
+ export type CommandDefinitionArrayToMapping<DefinitionArray extends ReadonlyArray<CommandDefinition>> = {
6
6
  [CommandName in ArrayElement<DefinitionArray>['commandName']]: CommandDefinition;
7
7
  };
@@ -1,14 +1,14 @@
1
1
  import { ConfigFileDefinition } from '../config/config-file-definition';
2
- export declare type DefineCommandInputs<CommandName extends string = string> = Readonly<{
2
+ export type DefineCommandInputs<CommandName extends string = string> = Readonly<{
3
3
  commandName: CommandName;
4
4
  subCommandDescriptions: Readonly<Record<string, string>>;
5
5
  configFiles: Readonly<Record<string, Readonly<ConfigFileDefinition>>>;
6
6
  npmDeps: ReadonlyArray<string>;
7
7
  }>;
8
- export declare type SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = DefineCommandInputsGeneric & {
8
+ export type SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = DefineCommandInputsGeneric & {
9
9
  allAvailableSubCommands: ReadonlyArray<keyof DefineCommandInputsGeneric['subCommandDescriptions']>;
10
10
  subCommands: SubCommandsMap<DefineCommandInputsGeneric>;
11
11
  };
12
- export declare type SubCommandsMap<DefineCommandInputsGeneric extends DefineCommandInputs> = {
12
+ export type SubCommandsMap<DefineCommandInputsGeneric extends DefineCommandInputs> = {
13
13
  [Prop in keyof DefineCommandInputsGeneric['subCommandDescriptions']]: Prop;
14
14
  };
@@ -1,7 +1,7 @@
1
1
  import { CreateDescriptionsCallback } from './command-description';
2
2
  import { CommandExecutor, CommandExecutorDefinition } from './command-executor';
3
3
  import { DefineCommandInputs, SharedExecutorInputsAndCommandDefinition } from './define-command-inputs';
4
- export declare type CommandDefinition<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs<string>> = SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric> & {
4
+ export type CommandDefinition<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs<string>> = SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric> & {
5
5
  executor: CommandExecutor<DefineCommandInputsGeneric>;
6
6
  createDescription: CreateDescriptionsCallback<DefineCommandInputsGeneric>;
7
7
  };
@@ -1,5 +1,5 @@
1
- export declare type UpdateConfigCallback = (copyFromContents: string, existingConfigContents: string, repoDir: string) => string | Promise<string>;
2
- export declare type ConfigFileDefinition = {
1
+ export type UpdateConfigCallback = (copyFromContents: string, existingConfigContents: string, repoDir: string) => string | Promise<string>;
2
+ export type ConfigFileDefinition = {
3
3
  /** Path to the config file to copy. */
4
4
  copyFromInternalPath: string;
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { ConfigFileDefinition } from './config-file-definition';
2
- export declare type GetCopyToPathInputs = {
2
+ export type GetCopyToPathInputs = {
3
3
  repoDir: string;
4
4
  packageDir: string;
5
5
  configFileDefinition: ConfigFileDefinition;
@@ -8,18 +8,18 @@ export declare enum CopyConfigOperation {
8
8
  /** Only write the config file if it doesn't exist already or if it can be updated. */
9
9
  Init = "init"
10
10
  }
11
- export declare type CopyConfigInputs = {
11
+ export type CopyConfigInputs = {
12
12
  configFileDefinition: ConfigFileDefinition;
13
13
  repoDir: string;
14
14
  packageDir: string;
15
15
  operation: CopyConfigOperation;
16
16
  };
17
- export declare type CopyConfigOutputs = {
17
+ export type CopyConfigOutputs = {
18
18
  copiedToPath: string;
19
19
  shouldWrite: boolean;
20
20
  };
21
21
  export declare function copyConfig(inputs: CopyConfigInputs): Promise<CopyConfigOutputs>;
22
- export declare type CopyAllConfigFilesInputs = Omit<CopyConfigInputs, 'configFileDefinition'> & {
22
+ export type CopyAllConfigFilesInputs = Omit<CopyConfigInputs, 'configFileDefinition'> & {
23
23
  logging: CommandLogging;
24
24
  configFiles: ReadonlyArray<ConfigFileDefinition>;
25
25
  };
@@ -1,4 +1,4 @@
1
- export declare type UpdateDepsInput = Readonly<{
1
+ export type UpdateDepsInput = Readonly<{
2
2
  repoDir: string;
3
3
  packageDir: string;
4
4
  npmDeps: ReadonlyArray<string>;
@@ -118,6 +118,9 @@ function parseCurrentDeps(objectInput, packageName) {
118
118
  }
119
119
  function readDeps(rawDeps, packageName) {
120
120
  var _a;
121
+ if (!rawDeps) {
122
+ return {};
123
+ }
121
124
  const depsAndVersions = {};
122
125
  const nestedDeps = (_a = rawDeps[packageName]) === null || _a === void 0 ? void 0 : _a.dependencies;
123
126
  const deps = nestedDeps !== null && nestedDeps !== void 0 ? nestedDeps : rawDeps;
@@ -1,5 +1,5 @@
1
1
  export declare function getRelevantArgs(allArgs: string[], binName: string): string[];
2
- export declare type ExtractSubCommandsOutput<T> = {
2
+ export type ExtractSubCommandsOutput<T> = {
3
3
  subCommands: T[];
4
4
  filteredArgs: string[];
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import { ShellOutput } from 'augment-vir/dist/cjs/node-only';
2
2
  import { CommandLogging, CommandLogTransforms } from '../command/command-logging';
3
- export declare type RunVirmatorShellCommandOptions = {
3
+ export type RunVirmatorShellCommandOptions = {
4
4
  repoDir: string;
5
5
  logging: CommandLogging;
6
6
  logTransforms?: CommandLogTransforms | undefined;
@@ -1,12 +1,12 @@
1
1
  import { CommandDefinitionArrayToMapping, CommandMapping } from './command/command-mapping';
2
2
  import { CommandDefinition } from './command/define-command';
3
3
  import { ConfigFileDefinition } from './config/config-file-definition';
4
- export declare type ExtendVirmatorInputs<CommandDefinitionsGeneric extends ReadonlyArray<CommandDefinition>> = Readonly<{
4
+ export type ExtendVirmatorInputs<CommandDefinitionsGeneric extends ReadonlyArray<CommandDefinition>> = Readonly<{
5
5
  packageBinName: string;
6
6
  packageRootDir: string;
7
7
  commandDefinitions?: CommandDefinitionsGeneric;
8
8
  }>;
9
- export declare type ExtendedVirmator<CommandMappingGeneric extends Readonly<CommandMapping>> = Readonly<{
9
+ export type ExtendedVirmator<CommandMappingGeneric extends Readonly<CommandMapping>> = Readonly<{
10
10
  packageBinName: string;
11
11
  cliHelpMessage: string;
12
12
  markdownHelpMessage: string;
@@ -1,6 +1,6 @@
1
1
  import { RequiredAndNotNullBy } from 'augment-vir';
2
2
  import { PackageJson } from 'type-fest';
3
- export declare type CleanPackageJson = Readonly<RequiredAndNotNullBy<PackageJson.PackageJsonStandard, 'name' | 'version'> & {
3
+ export type CleanPackageJson = Readonly<RequiredAndNotNullBy<PackageJson.PackageJsonStandard, 'name' | 'version'> & {
4
4
  workspaces?: ReadonlyArray<string>;
5
5
  }>;
6
6
  export declare function findTopLevelPackageJsonFile(startDir: string): string | undefined;
@@ -22,6 +22,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var _a;
25
26
  Object.defineProperty(exports, "__esModule", { value: true });
26
27
  exports.formatCode = void 0;
27
28
  const fs_1 = require("fs");
@@ -30,7 +31,7 @@ async function formatCode(text, filePath) {
30
31
  try {
31
32
  // if prettier isn't installed yet this will fail
32
33
  const { format: prettierFormat } = await Promise.resolve().then(() => __importStar(require('prettier')));
33
- const repoPrettierRc = await Promise.resolve().then(() => __importStar(require(findNearestConfig(process.cwd()))));
34
+ const repoPrettierRc = await (_a = findNearestConfig(process.cwd()), Promise.resolve().then(() => __importStar(require(_a))));
34
35
  const repoConfig = repoPrettierRc;
35
36
  return prettierFormat(text, {
36
37
  ...repoConfig,
@@ -1,2 +1,2 @@
1
- export declare type NonEmptyString<ExactStringGeneric extends string> = ExactStringGeneric extends '' ? never : ExactStringGeneric;
1
+ export type NonEmptyString<ExactStringGeneric extends string> = ExactStringGeneric extends '' ? never : ExactStringGeneric;
2
2
  export declare function ensureNonEmptyString<StringGeneric extends string>(inputString: NonEmptyString<StringGeneric>): StringGeneric;
@@ -1 +1 @@
1
- export declare type Constructor<T> = new (...args: any[]) => T;
1
+ export type Constructor<T> = new (...args: any[]) => T;
@@ -39,9 +39,8 @@ exports.compileCommandDefinition = (0, define_command_1.defineCommand)({
39
39
  }, async (inputs) => {
40
40
  const shouldNotEmit = inputs.filteredInputArgs.join(' ').includes('--noEmit') ||
41
41
  inputs.inputSubCommands.includes(inputs.subCommands.check);
42
- const resetCommand = shouldNotEmit ? '' : 'rm -rf dist && ';
43
42
  const noEmit = shouldNotEmit ? '--noEmit' : '';
44
- const mainCommand = `${resetCommand}${await (0, package_paths_1.getNpmBinPath)(inputs.repoDir, 'tsc')}`;
43
+ const mainCommand = await (0, package_paths_1.getNpmBinPath)(inputs.repoDir, 'tsc');
45
44
  return {
46
45
  mainCommand,
47
46
  args: [
@@ -41,10 +41,15 @@ exports.publishCommandDefinition = (0, define_command_1.defineCommand)({
41
41
  throw new Error(`git changes detected in "${packageJsonPath}". Cannot run publish command with changes, commit them first.`);
42
42
  }
43
43
  const workspaceDirs = getWorkspaceDirs(packageJson, packageJsonPath);
44
+ await updateWorkspaceVersions(packageJsonPath, workspaceDirs);
44
45
  if (await isCurrentVersionPublished(packageJson, workspaceDirs)) {
45
46
  await bumpPackageVersion(packageJson, packageJsonPath);
46
47
  }
47
48
  await updateWorkspaceVersions(packageJsonPath, workspaceDirs);
49
+ await (0, node_only_1.runShellCommand)(`npm i`, {
50
+ rejectOnError: true,
51
+ cwd: (0, path_1.dirname)(packageJsonPath),
52
+ });
48
53
  await publishPackages(workspaceDirs, packageJsonPath);
49
54
  await updateGit(packageJsonPath);
50
55
  return {
@@ -74,10 +79,6 @@ async function updateWorkspaceVersions(packageJsonPath, workspaceDirPaths) {
74
79
  newWorkspacePackageJson.version = newVersion;
75
80
  await (0, promises_1.writeFile)(workspacePackageJsonPath, JSON.stringify(newWorkspacePackageJson, null, 4) + '\n');
76
81
  });
77
- await (0, node_only_1.runShellCommand)(`npm i`, {
78
- rejectOnError: true,
79
- cwd: (0, path_1.dirname)(packageJsonPath),
80
- });
81
82
  }
82
83
  async function publishPackages(workspaceDirPaths, packageJsonPath) {
83
84
  const packagePath = (0, path_1.dirname)(packageJsonPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "4.3.2",
3
+ "version": "4.3.4",
4
4
  "description": "Handle all the stuffs in one package.",
5
5
  "keywords": [
6
6
  "automation",
@@ -63,14 +63,14 @@
63
63
  "ansi-colors": "^4.1.3",
64
64
  "augment-vir": "^3.1.2",
65
65
  "chai": "^4.3.7",
66
- "cspell": "^6.14.2",
66
+ "cspell": "^6.14.3",
67
67
  "fs-extra": "^10.1.0",
68
- "istanbul-smart-text-reporter": "^0.0.1",
68
+ "istanbul-smart-text-reporter": "^1.0.0",
69
69
  "markdown-code-example-inserter": "^0.1.11",
70
70
  "mocha": "^10.1.0",
71
71
  "mocha-spec-reporter-with-file-names": "^0.0.2",
72
72
  "nyc": "^15.1.0",
73
- "prettier": "^2.7.1",
73
+ "prettier": "^2.8.0",
74
74
  "prettier-plugin-jsdoc": "^0.4.2",
75
75
  "prettier-plugin-multiline-arrays": "^1.1.1",
76
76
  "prettier-plugin-organize-imports": "^3.2.0",
@@ -80,8 +80,8 @@
80
80
  "ts-node": "^10.9.1",
81
81
  "tsconfig-paths": "^4.1.0",
82
82
  "type-fest": "^3.2.0",
83
- "typescript": "^4.8.4",
84
- "vite": "^3.2.3"
83
+ "typescript": "^4.9.3",
84
+ "vite": "^3.2.4"
85
85
  },
86
86
  "engines": {
87
87
  "node": ">=16",