virmator 4.3.3 → 5.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.
Files changed (57) hide show
  1. package/README.md +4 -3
  2. package/base-configs/base-mocharc.js +2 -1
  3. package/base-configs/base-nyc.js +8 -4
  4. package/base-configs/base-tsconfig.json +0 -5
  5. package/configs/gitignore.txt +1 -1
  6. package/configs/npmignore.txt +1 -1
  7. package/dist/api/command/command-configs.js +3 -3
  8. package/dist/api/command/command-description.d.ts +2 -2
  9. package/dist/api/command/command-executor.d.ts +8 -8
  10. package/dist/api/command/command-help.d.ts +2 -2
  11. package/dist/api/command/command-logging.d.ts +5 -5
  12. package/dist/api/command/command-mapping.d.ts +3 -3
  13. package/dist/api/command/command-messages.js +3 -3
  14. package/dist/api/command/command-to-help-message.js +11 -10
  15. package/dist/api/command/define-command-inputs.d.ts +3 -3
  16. package/dist/api/command/define-command.d.ts +1 -1
  17. package/dist/api/command/define-command.js +3 -3
  18. package/dist/api/config/config-file-definition.d.ts +2 -2
  19. package/dist/api/config/config-paths.d.ts +1 -1
  20. package/dist/api/config/copy-config.d.ts +3 -3
  21. package/dist/api/config/copy-config.js +5 -5
  22. package/dist/api/create-virmator.js +2 -2
  23. package/dist/api/run-command/check-npm-deps.d.ts +1 -1
  24. package/dist/api/run-command/check-npm-deps.js +12 -10
  25. package/dist/api/run-command/extract-arguments.d.ts +1 -1
  26. package/dist/api/run-command/run-command-executor.js +6 -7
  27. package/dist/api/run-command/run-extended-virmator.js +3 -3
  28. package/dist/api/run-command/run-shell-command.d.ts +2 -2
  29. package/dist/api/run-command/run-shell-command.js +2 -2
  30. package/dist/api/virmator-types.d.ts +2 -2
  31. package/dist/augments/fs.js +2 -2
  32. package/dist/augments/git.js +2 -2
  33. package/dist/augments/npm.d.ts +3 -3
  34. package/dist/augments/npm.js +2 -2
  35. package/dist/augments/object.d.ts +1 -1
  36. package/dist/augments/object.js +7 -7
  37. package/dist/augments/prettier.js +2 -1
  38. package/dist/augments/string.d.ts +1 -1
  39. package/dist/augments/type.d.ts +1 -1
  40. package/dist/commands/compile.command.js +1 -2
  41. package/dist/commands/extra-configs/combine-json-config.js +2 -2
  42. package/dist/commands/extra-configs/combine-text-config.js +2 -2
  43. package/dist/commands/extra-configs/create-default-package-json.js +4 -4
  44. package/dist/commands/format.command.js +3 -3
  45. package/dist/commands/frontend.command.d.ts +1 -1
  46. package/dist/commands/frontend.command.js +1 -1
  47. package/dist/commands/publish.command.js +13 -13
  48. package/dist/commands/test.command.d.ts +1 -1
  49. package/dist/commands/test.command.js +1 -1
  50. package/dist/compiled-base-configs/vite-always-reload-plugin.js +2 -2
  51. package/dist/file-paths/package-paths.js +4 -4
  52. package/dist/index.d.ts +2 -3
  53. package/dist/index.js +0 -1
  54. package/dist/scripts/save-help-message.js +2 -2
  55. package/package.json +25 -24
  56. package/dist/api/cli-color.d.ts +0 -9
  57. package/dist/api/cli-color.js +0 -13
@@ -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,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.recursivelyUpwardsSearchForDir = exports.writeFiles = exports.readAllDirContents = exports.systemRootPath = void 0;
4
- const augment_vir_1 = require("augment-vir");
4
+ const common_1 = require("@augment-vir/common");
5
5
  const fs_1 = require("fs");
6
6
  const promises_1 = require("fs/promises");
7
7
  const path_1 = require("path");
@@ -27,7 +27,7 @@ async function readAllDirContents({ dir, recursive = false, }) {
27
27
  }
28
28
  exports.readAllDirContents = readAllDirContents;
29
29
  async function writeFiles(dir, allFileContents) {
30
- await (0, augment_vir_1.awaitedForEach)(Object.keys(allFileContents), async (fileOrDirName) => {
30
+ await (0, common_1.awaitedForEach)(Object.keys(allFileContents), async (fileOrDirName) => {
31
31
  const value = allFileContents[fileOrDirName];
32
32
  const currentPath = (0, path_1.join)(dir, fileOrDirName);
33
33
  if (typeof value === 'string') {
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doChangesExist = void 0;
4
- const node_only_1 = require("augment-vir/dist/cjs/node-only");
4
+ const node_js_1 = require("@augment-vir/node-js");
5
5
  async function doChangesExist(repoDirPath) {
6
6
  const getChangesCommand = `git status --porcelain=v1 2>/dev/null`;
7
- const getChangesOutput = await (0, node_only_1.runShellCommand)(getChangesCommand, {
7
+ const getChangesOutput = await (0, node_js_1.runShellCommand)(getChangesCommand, {
8
8
  cwd: repoDirPath,
9
9
  rejectOnError: true,
10
10
  });
@@ -1,6 +1,6 @@
1
- import { RequiredAndNotNullBy } from 'augment-vir';
2
- import { PackageJson } from 'type-fest';
3
- export declare type CleanPackageJson = Readonly<RequiredAndNotNullBy<PackageJson.PackageJsonStandard, 'name' | 'version'> & {
1
+ import { RequiredAndNotNullBy } from '@augment-vir/common';
2
+ import type { PackageJson } from 'type-fest';
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;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readTopLevelPackageJson = exports.readPackageJson = exports.findTopLevelPackageJsonFile = void 0;
4
- const augment_vir_1 = require("augment-vir");
4
+ const common_1 = require("@augment-vir/common");
5
5
  const fs_1 = require("fs");
6
6
  const promises_1 = require("fs/promises");
7
7
  const path_1 = require("path");
@@ -29,7 +29,7 @@ async function readPackageJson(packageJsonPath) {
29
29
  parsed = JSON.parse((await (0, promises_1.readFile)(packageJsonPath)).toString());
30
30
  }
31
31
  catch (error) {
32
- throw new Error(`Failed to read package json file "${packageJsonPath}": ${(0, augment_vir_1.extractErrorMessage)(error)}`);
32
+ throw new Error(`Failed to read package json file "${packageJsonPath}": ${(0, common_1.extractErrorMessage)(error)}`);
33
33
  }
34
34
  if (!parsed.name) {
35
35
  throw new Error(`Missing package name from "${packageJsonPath}"`);
@@ -1,4 +1,4 @@
1
- import { Overwrite } from 'augment-vir';
1
+ import { Overwrite } from '@augment-vir/common';
2
2
  export declare function filterObject<T extends object>(fullObject: Readonly<T>, callback: (value: T[keyof T], key: keyof T, fullObject: Readonly<T>) => boolean): Partial<T>;
3
3
  export declare function deeplyCombineObjects<OriginalObjectGeneric extends object, OverwriteObjectGeneric extends object>(originalObject: OriginalObjectGeneric, overwriteObject: OverwriteObjectGeneric): Overwrite<OriginalObjectGeneric, OverwriteObjectGeneric>;
4
4
  export declare function filterToDifferentValues<T extends object>(baseObject: T, changedObject: T): Partial<T>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.filterToDifferentValues = exports.deeplyCombineObjects = exports.filterObject = void 0;
4
- const augment_vir_1 = require("augment-vir");
4
+ const common_1 = require("@augment-vir/common");
5
5
  function filterObject(fullObject, callback) {
6
- return (0, augment_vir_1.getObjectTypedKeys)(fullObject).reduce((accum, key) => {
6
+ return (0, common_1.getObjectTypedKeys)(fullObject).reduce((accum, key) => {
7
7
  const value = fullObject[key];
8
8
  if (callback(value, key, fullObject)) {
9
9
  accum[key] = value;
@@ -13,10 +13,10 @@ function filterObject(fullObject, callback) {
13
13
  }
14
14
  exports.filterObject = filterObject;
15
15
  function deeplyCombineObjects(originalObject, overwriteObject) {
16
- return (0, augment_vir_1.getObjectTypedKeys)(overwriteObject).reduce((accum, currentKey) => {
16
+ return (0, common_1.getObjectTypedKeys)(overwriteObject).reduce((accum, currentKey) => {
17
17
  const currentNewValue = overwriteObject[currentKey];
18
- const currentOldValue = (0, augment_vir_1.typedHasProperty)(originalObject, currentKey) && originalObject[currentKey];
19
- if ((0, augment_vir_1.isObject)(currentOldValue) && (0, augment_vir_1.isObject)(currentNewValue)) {
18
+ const currentOldValue = (0, common_1.typedHasProperty)(originalObject, currentKey) && originalObject[currentKey];
19
+ if ((0, common_1.isObject)(currentOldValue) && (0, common_1.isObject)(currentNewValue)) {
20
20
  accum[currentKey] = deeplyCombineObjects(currentOldValue, currentNewValue);
21
21
  }
22
22
  else {
@@ -27,10 +27,10 @@ function deeplyCombineObjects(originalObject, overwriteObject) {
27
27
  }
28
28
  exports.deeplyCombineObjects = deeplyCombineObjects;
29
29
  function filterToDifferentValues(baseObject, changedObject) {
30
- return (0, augment_vir_1.getObjectTypedKeys)(baseObject).reduce((accum, key) => {
30
+ return (0, common_1.getObjectTypedKeys)(baseObject).reduce((accum, key) => {
31
31
  const beforeValue = baseObject[key];
32
32
  const afterValue = changedObject[key];
33
- if ((0, augment_vir_1.isObject)(beforeValue) && (0, augment_vir_1.isObject)(afterValue)) {
33
+ if ((0, common_1.isObject)(beforeValue) && (0, common_1.isObject)(afterValue)) {
34
34
  const innerDiff = filterToDifferentValues(beforeValue, afterValue);
35
35
  if (Object.keys(innerDiff).length) {
36
36
  accum[key] = filterToDifferentValues(beforeValue, afterValue);
@@ -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))))).default;
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: [
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.combineJsonConfig = void 0;
4
- const augment_vir_1 = require("augment-vir");
4
+ const common_1 = require("@augment-vir/common");
5
5
  const object_1 = require("../../augments/object");
6
6
  const prettier_1 = require("../../augments/prettier");
7
7
  async function combineJsonConfig(...[newConfigContents, existingConfigContents,]) {
@@ -11,7 +11,7 @@ async function combineJsonConfig(...[newConfigContents, existingConfigContents,]
11
11
  }
12
12
  catch (error) { }
13
13
  const newJson = JSON.parse(newConfigContents);
14
- if (!oldJson || !(0, augment_vir_1.isObject)(oldJson)) {
14
+ if (!oldJson || !(0, common_1.isObject)(oldJson)) {
15
15
  return stringify(newJson);
16
16
  }
17
17
  return stringify((0, object_1.deeplyCombineObjects)(oldJson, newJson));
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.combineTextConfig = void 0;
4
- const augment_vir_1 = require("augment-vir");
4
+ const common_1 = require("@augment-vir/common");
5
5
  function splitContentsIntoArrayOfLines(input) {
6
6
  return input
7
7
  .split('\n')
8
8
  .map((line) => line.trim())
9
- .filter(augment_vir_1.isTruthy)
9
+ .filter(common_1.isTruthy)
10
10
  .sort();
11
11
  }
12
12
  function combineTextConfig(...[newConfigContents, existingConfigContents,]) {
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createDefaultPackageJson = void 0;
7
- const augment_vir_1 = require("augment-vir");
7
+ const common_1 = require("@augment-vir/common");
8
8
  const path_1 = require("path");
9
9
  const simple_git_1 = __importDefault(require("simple-git"));
10
10
  const json_1 = require("../../augments/json");
@@ -12,11 +12,11 @@ const prettier_1 = require("../../augments/prettier");
12
12
  async function createDefaultPackageJson(copyFromContents, existingConfigContents, repoDir) {
13
13
  var _a;
14
14
  const baseVirmatorPackageJson = JSON.parse(copyFromContents);
15
- if (!(0, augment_vir_1.isObject)(baseVirmatorPackageJson)) {
15
+ if (!(0, common_1.isObject)(baseVirmatorPackageJson)) {
16
16
  throw new Error(`Failed to parse virmator's config version of package json file.`);
17
17
  }
18
18
  const currentRepoPackageJson = (_a = (0, json_1.jsonParseOrUndefined)(existingConfigContents)) !== null && _a !== void 0 ? _a : {};
19
- if (!(0, augment_vir_1.isObject)(currentRepoPackageJson)) {
19
+ if (!(0, common_1.isObject)(currentRepoPackageJson)) {
20
20
  throw new Error(`Failed to parse current repo's package json file.`);
21
21
  }
22
22
  const combinedScripts = combineScripts(baseVirmatorPackageJson, currentRepoPackageJson);
@@ -35,7 +35,7 @@ function combineScripts(virmatorPackageJson, currentRepoPackageJson) {
35
35
  const scripts = {
36
36
  ...currentRepoPackageJson.scripts,
37
37
  };
38
- (0, augment_vir_1.getObjectTypedKeys)(virmatorPackageJson.scripts).forEach((key) => {
38
+ (0, common_1.getObjectTypedKeys)(virmatorPackageJson.scripts).forEach((key) => {
39
39
  const virmatorValue = virmatorPackageJson.scripts[key];
40
40
  const currentRepoValue = scripts[key];
41
41
  if (virmatorValue &&
@@ -79,13 +79,13 @@ exports.formatCommandDefinition = (0, define_command_1.defineCommand)({
79
79
  {
80
80
  title: 'fixes formatting for files',
81
81
  content: `${packageBinName} ${commandName}
82
- ${packageBinName} ${commandName}`,
82
+ ${packageBinName} ${commandName}`,
83
83
  },
84
84
  {
85
85
  title: `examples with extra Prettier flags`,
86
86
  content: `${packageBinName} ${commandName} --ignore-path .prettierignore
87
- ${packageBinName} ${commandName} --ignore-path .prettierignore
88
- ${packageBinName} ${commandName} --ignore-path .prettierignore ${filesMarkerArg} md json`,
87
+ ${packageBinName} ${commandName} --ignore-path .prettierignore
88
+ ${packageBinName} ${commandName} --ignore-path .prettierignore ${filesMarkerArg} md json`,
89
89
  },
90
90
  ],
91
91
  };
@@ -10,5 +10,5 @@ export declare const frontendCommandDefinition: import("../api/command/define-co
10
10
  readonly copyToPathRelativeToRepoDir: string;
11
11
  };
12
12
  };
13
- npmDeps: readonly ["vite", "ansi-colors"];
13
+ npmDeps: readonly ["vite", "@augment-vir/node-js"];
14
14
  }>;
@@ -19,7 +19,7 @@ exports.frontendCommandDefinition = (0, define_command_1.defineCommand)({
19
19
  },
20
20
  npmDeps: [
21
21
  'vite',
22
- 'ansi-colors',
22
+ '@augment-vir/node-js',
23
23
  ],
24
24
  }, () => {
25
25
  return {
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.publishCommandDefinition = void 0;
7
- const augment_vir_1 = require("augment-vir");
8
- const node_only_1 = require("augment-vir/dist/cjs/node-only");
7
+ const common_1 = require("@augment-vir/common");
8
+ const node_js_1 = require("@augment-vir/node-js");
9
9
  const fs_1 = require("fs");
10
10
  const promises_1 = require("fs/promises");
11
11
  const glob_1 = __importDefault(require("glob"));
@@ -46,7 +46,7 @@ exports.publishCommandDefinition = (0, define_command_1.defineCommand)({
46
46
  await bumpPackageVersion(packageJson, packageJsonPath);
47
47
  }
48
48
  await updateWorkspaceVersions(packageJsonPath, workspaceDirs);
49
- await (0, node_only_1.runShellCommand)(`npm i`, {
49
+ await (0, node_js_1.runShellCommand)(`npm i`, {
50
50
  rejectOnError: true,
51
51
  cwd: (0, path_1.dirname)(packageJsonPath),
52
52
  });
@@ -60,19 +60,19 @@ async function updateGit(packageJsonPath) {
60
60
  const newVersion = (await (0, npm_1.readPackageJson)(packageJsonPath)).version;
61
61
  const packageDirPath = (0, path_1.dirname)(packageJsonPath);
62
62
  if (await (0, git_1.doChangesExist)(packageDirPath)) {
63
- await (0, node_only_1.runShellCommand)(`git commit -a --amend --no-edit`, {
63
+ await (0, node_js_1.runShellCommand)(`git commit -a --amend --no-edit`, {
64
64
  cwd: packageDirPath,
65
65
  rejectOnError: true,
66
66
  });
67
67
  }
68
- await (0, node_only_1.runShellCommand)(`git tag v${newVersion} && git push && git push --tags`, {
68
+ await (0, node_js_1.runShellCommand)(`git tag v${newVersion} && git push && git push --tags`, {
69
69
  cwd: packageDirPath,
70
70
  rejectOnError: true,
71
71
  });
72
72
  }
73
73
  async function updateWorkspaceVersions(packageJsonPath, workspaceDirPaths) {
74
74
  const newVersion = (await (0, npm_1.readPackageJson)(packageJsonPath)).version;
75
- await (0, augment_vir_1.awaitedForEach)(workspaceDirPaths, async (workspacePath) => {
75
+ await (0, common_1.awaitedForEach)(workspaceDirPaths, async (workspacePath) => {
76
76
  const workspacePackageJsonPath = (0, path_1.join)(workspacePath, 'package.json');
77
77
  const workspacePackageJson = await (0, npm_1.readPackageJson)(workspacePackageJsonPath);
78
78
  const newWorkspacePackageJson = { ...workspacePackageJson };
@@ -83,11 +83,11 @@ async function updateWorkspaceVersions(packageJsonPath, workspaceDirPaths) {
83
83
  async function publishPackages(workspaceDirPaths, packageJsonPath) {
84
84
  const packagePath = (0, path_1.dirname)(packageJsonPath);
85
85
  if (workspaceDirPaths.length) {
86
- await (0, augment_vir_1.awaitedForEach)(workspaceDirPaths, async (workspaceDirPath) => {
86
+ await (0, common_1.awaitedForEach)(workspaceDirPaths, async (workspaceDirPath) => {
87
87
  const workspacePackageJson = await (0, npm_1.readPackageJson)((0, path_1.join)(workspaceDirPath, 'package.json'));
88
88
  if (!workspacePackageJson.private) {
89
89
  console.info(`\nPublishing ${(0, path_1.basename)(workspaceDirPath)}`);
90
- await (0, node_only_1.runShellCommand)(`npm publish`, {
90
+ await (0, node_js_1.runShellCommand)(`npm publish`, {
91
91
  rejectOnError: true,
92
92
  cwd: workspaceDirPath,
93
93
  hookUpToConsole: true,
@@ -100,7 +100,7 @@ async function publishPackages(workspaceDirPaths, packageJsonPath) {
100
100
  });
101
101
  }
102
102
  else {
103
- await (0, node_only_1.runShellCommand)(`npm publish`, {
103
+ await (0, node_js_1.runShellCommand)(`npm publish`, {
104
104
  rejectOnError: true,
105
105
  cwd: packagePath,
106
106
  hookUpToConsole: true,
@@ -119,7 +119,7 @@ async function isCurrentVersionPublished(packageJson, workspaceDirs) {
119
119
  return arePublished.some((entry) => entry) || (await isPublished(packageJson));
120
120
  }
121
121
  async function isPublished({ name, version }) {
122
- const output = await (0, node_only_1.runShellCommand)(`npm show ${name}@${version}`);
122
+ const output = await (0, node_js_1.runShellCommand)(`npm show ${name}@${version}`);
123
123
  return output.exitCode === 0;
124
124
  }
125
125
  // this is just used to ensure we have every release type
@@ -132,14 +132,14 @@ const releaseTypesObject = {
132
132
  prepatch: 'prepatch',
133
133
  prerelease: 'prerelease',
134
134
  };
135
- const releaseTypeOptions = (0, augment_vir_1.getObjectTypedKeys)(releaseTypesObject);
136
- const releaseTypeMessage = `Choose a release type: ${(0, augment_vir_1.joinWithFinalConjunction)(releaseTypeOptions, 'or')}:`;
135
+ const releaseTypeOptions = (0, common_1.getObjectTypedKeys)(releaseTypesObject);
136
+ const releaseTypeMessage = `Choose a release type: ${(0, common_1.joinWithFinalConjunction)(releaseTypeOptions, 'or')}:`;
137
137
  async function bumpPackageVersion(packageJson, packageJsonPath) {
138
138
  const releaseType = (await (0, console_1.askQuestionUntilConditionMet)({
139
139
  conditionCallback: (input) => {
140
140
  return releaseTypeOptions.includes(input.toLowerCase());
141
141
  },
142
- invalidInputMessage: `Invalid release type. Expected ${(0, augment_vir_1.joinWithFinalConjunction)(releaseTypeOptions, 'or')}.`,
142
+ invalidInputMessage: `Invalid release type. Expected ${(0, common_1.joinWithFinalConjunction)(releaseTypeOptions, 'or')}.`,
143
143
  questionToAsk: releaseTypeMessage,
144
144
  timeoutMs: 0,
145
145
  }));
@@ -11,5 +11,5 @@ export declare const testCommandDefinition: import("../api/command/define-comman
11
11
  readonly copyToPathRelativeToRepoDir: string;
12
12
  };
13
13
  };
14
- npmDeps: readonly ["@istanbuljs/nyc-config-typescript", "@types/chai", "@types/mocha", "chai", "istanbul-smart-text-reporter", "mocha-spec-reporter-with-file-names", "mocha", "nyc", "ts-node"];
14
+ npmDeps: readonly ["@istanbuljs/nyc-config-typescript", "@types/chai", "@types/mocha", "chai", "istanbul-smart-text-reporter", "mocha-spec-reporter-with-file-names", "mocha", "nyc", "tsx"];
15
15
  }>;
@@ -26,7 +26,7 @@ exports.testCommandDefinition = (0, define_command_1.defineCommand)({
26
26
  'mocha-spec-reporter-with-file-names',
27
27
  'mocha',
28
28
  'nyc',
29
- 'ts-node',
29
+ 'tsx',
30
30
  ],
31
31
  }, ({ commandName, packageBinName }) => {
32
32
  return {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.alwaysReloadPlugin = void 0;
4
- const ansi_colors_1 = require("ansi-colors");
4
+ const node_js_1 = require("@augment-vir/node-js");
5
5
  const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
7
  /**
@@ -53,7 +53,7 @@ function alwaysReloadPlugin(config = {}) {
53
53
  type: 'full-reload',
54
54
  path: '*',
55
55
  });
56
- logger.info(`${ansi_colors_1.styles.green.open}page reload ${ansi_colors_1.styles.dim.open}${(0, path_1.relative)(root, path)}${ansi_colors_1.styles.reset.open}`, { clear: true, timestamp: true });
56
+ logger.info(`${node_js_1.logColors.success}page reload ${node_js_1.logColors.faint}${(0, path_1.relative)(root, path)}${node_js_1.logColors.reset}`, { clear: true, timestamp: true });
57
57
  /**
58
58
  * Debounce reloads calls so that they don't get spammed. If you're saving
59
59
  * faster than this, then what the heck are you doing anyway?
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNpmBinPath = exports.virmatorConfigs = exports.virmatorConfigsDir = exports.virmatorPackageDir = void 0;
4
- const augment_vir_1 = require("augment-vir");
5
- const node_only_1 = require("augment-vir/dist/cjs/node-only");
4
+ const common_1 = require("@augment-vir/common");
5
+ const node_js_1 = require("@augment-vir/node-js");
6
6
  const fs_1 = require("fs");
7
7
  const path_1 = require("path");
8
8
  const fs_2 = require("../augments/fs");
@@ -34,10 +34,10 @@ async function getNpmBinPath(repoDir, command) {
34
34
  if (!(0, fs_1.existsSync)(actualBinPath)) {
35
35
  throw new Error(`Discovered bin path for "${command}" does not actually exist: "${actualBinPath}". Started at "${startSearchDirPath}".`);
36
36
  }
37
- return (0, node_only_1.interpolationSafeWindowsPath)(actualBinPath);
37
+ return (0, node_js_1.interpolationSafeWindowsPath)(actualBinPath);
38
38
  }
39
39
  catch (error) {
40
- throw new Error(`Failed to find npm bin path for "${command}": ${(0, augment_vir_1.extractErrorMessage)(error)}. Started at "${startSearchDirPath}".`);
40
+ throw new Error(`Failed to find npm bin path for "${command}": ${(0, common_1.extractErrorMessage)(error)}. Started at "${startSearchDirPath}".`);
41
41
  }
42
42
  }
43
43
  exports.getNpmBinPath = getNpmBinPath;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './api/cli-color';
2
1
  export * from './api/command/command-description';
3
2
  export * from './api/command/command-executor';
4
3
  export * from './api/command/command-help';
@@ -63,7 +62,7 @@ export declare const virmator: Readonly<{
63
62
  readonly copyToPathRelativeToRepoDir: string;
64
63
  };
65
64
  };
66
- npmDeps: readonly ["vite", "ansi-colors"];
65
+ npmDeps: readonly ["vite", "@augment-vir/node-js"];
67
66
  }> | import("./api/command/define-command").CommandDefinition<{
68
67
  commandName: "init";
69
68
  subCommandDescriptions: {
@@ -99,7 +98,7 @@ export declare const virmator: Readonly<{
99
98
  readonly copyToPathRelativeToRepoDir: string;
100
99
  };
101
100
  };
102
- npmDeps: readonly ["@istanbuljs/nyc-config-typescript", "@types/chai", "@types/mocha", "chai", "istanbul-smart-text-reporter", "mocha-spec-reporter-with-file-names", "mocha", "nyc", "ts-node"];
101
+ npmDeps: readonly ["@istanbuljs/nyc-config-typescript", "@types/chai", "@types/mocha", "chai", "istanbul-smart-text-reporter", "mocha-spec-reporter-with-file-names", "mocha", "nyc", "tsx"];
103
102
  }> | import("./api/command/define-command").CommandDefinition<{
104
103
  commandName: "test-web";
105
104
  subCommandDescriptions: {};
package/dist/index.js CHANGED
@@ -27,7 +27,6 @@ const test_web_command_1 = require("./commands/test-web.command");
27
27
  const test_command_1 = require("./commands/test.command");
28
28
  const update_configs_command_1 = require("./commands/update-configs.command");
29
29
  const package_paths_1 = require("./file-paths/package-paths");
30
- __exportStar(require("./api/cli-color"), exports);
31
30
  __exportStar(require("./api/command/command-description"), exports);
32
31
  __exportStar(require("./api/command/command-executor"), exports);
33
32
  __exportStar(require("./api/command/command-help"), exports);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_js_1 = require("@augment-vir/node-js");
3
4
  const promises_1 = require("fs/promises");
4
5
  const __1 = require("..");
5
- const cli_color_1 = require("../api/cli-color");
6
6
  const command_to_help_message_1 = require("../api/command/command-to-help-message");
7
7
  const prettier_1 = require("../augments/prettier");
8
8
  const virmator_test_file_paths_1 = require("../test/virmator-test-file-paths");
@@ -22,7 +22,7 @@ async function main(args) {
22
22
  const wasReadmeChanged = formattedReadme !== originalReadme;
23
23
  await (0, promises_1.writeFile)(virmator_test_file_paths_1.virmatorReadme, originalReadme);
24
24
  if (wasReadmeChanged) {
25
- console.info(`${cli_color_1.Color.Bold}${cli_color_1.Color.Fail}README usage message is not up to date.${cli_color_1.Color.Reset}\nRun ${cli_color_1.Color.Info}npm run readme:update${cli_color_1.Color.Reset} to update.\n`);
25
+ console.info(`${node_js_1.logColors.bold}${node_js_1.logColors.error}README usage message is not up to date.${node_js_1.logColors.reset}\nRun ${node_js_1.logColors.info}npm run docs:update${node_js_1.logColors.reset} to update.\n`);
26
26
  throw new Error(`README not up to date.`);
27
27
  }
28
28
  }
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "4.3.3",
4
- "description": "Handle all the stuffs in one package.",
3
+ "version": "5.0.0",
4
+ "description": "Handle common package configs, commands, and dependencies.",
5
5
  "keywords": [
6
6
  "automation",
7
- "template",
8
- "vir",
7
+ "config",
8
+ "configs",
9
9
  "formatting",
10
+ "publish",
10
11
  "spellcheck",
11
- "config"
12
+ "template",
13
+ "vir"
12
14
  ],
13
15
  "homepage": "https://github.com/electrovir/virmator",
14
16
  "bugs": {
@@ -28,8 +30,8 @@
28
30
  "bin": "dist/cli.js",
29
31
  "scripts": {
30
32
  "compile": "rm -rf dist && tsc",
31
- "docs:check": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts check && md-code --check README.md",
32
- "docs:update": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts && md-code README.md",
33
+ "docs:check": "npm run compile && tsx src/scripts/save-help-message.ts check && md-code --check README.md",
34
+ "docs:update": "npm run compile && tsx src/scripts/save-help-message.ts && md-code README.md",
33
35
  "format": "npm run format:base -- --write --list-different",
34
36
  "format:base": "prettier \"./**/*.+(ts|json|html|css|md|js)\"",
35
37
  "prepublishOnly": "npm run test:all",
@@ -37,15 +39,16 @@
37
39
  "test": "bash src/scripts/run-tests.sh",
38
40
  "test:all": "npm run test && npm run spellcheck -- --no-progress && npm run test:format && npm run docs:check",
39
41
  "test:format": "npm run format:base -- --check",
40
- "test:help": "ts-node -r tsconfig-paths/register src/cli/cli.ts --help",
42
+ "test:help": "tsx src/cli/cli.ts --help",
41
43
  "test:types": "tsc --noEmit"
42
44
  },
43
45
  "dependencies": {
46
+ "@augment-vir/common": "^4.6.1",
47
+ "@augment-vir/node-js": "^4.6.1",
44
48
  "ansi-colors": "^4.1.3",
45
- "augment-vir": "^3.1.2",
46
49
  "glob": "^8.0.3",
47
50
  "semver": "^7.3.8",
48
- "simple-git": "^3.15.0"
51
+ "simple-git": "^3.15.1"
49
52
  },
50
53
  "devDependencies": {
51
54
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
@@ -53,35 +56,33 @@
53
56
  "@types/chai": "^4.3.4",
54
57
  "@types/fs-extra": "^9.0.13",
55
58
  "@types/glob": "^8.0.0",
56
- "@types/mocha": "^10.0.0",
57
- "@types/node": "^18.11.9",
59
+ "@types/mocha": "^10.0.1",
60
+ "@types/node": "^18.11.10",
58
61
  "@types/semver": "^7.3.13",
59
62
  "@web/dev-server-esbuild": "^0.3.3",
60
63
  "@web/test-runner": "^0.15.0",
61
64
  "@web/test-runner-commands": "^0.6.5",
62
65
  "@web/test-runner-playwright": "^0.9.0",
63
- "ansi-colors": "^4.1.3",
64
- "augment-vir": "^3.1.2",
65
66
  "chai": "^4.3.7",
66
- "cspell": "^6.14.2",
67
- "fs-extra": "^10.1.0",
68
- "istanbul-smart-text-reporter": "^0.0.1",
67
+ "cspell": "^6.15.1",
68
+ "fs-extra": "^11.1.0",
69
+ "istanbul-smart-text-reporter": "^1.0.0",
69
70
  "markdown-code-example-inserter": "^0.1.11",
70
71
  "mocha": "^10.1.0",
71
72
  "mocha-spec-reporter-with-file-names": "^0.0.2",
72
73
  "nyc": "^15.1.0",
73
- "prettier": "^2.7.1",
74
+ "prettier": "^2.8.0",
74
75
  "prettier-plugin-jsdoc": "^0.4.2",
75
76
  "prettier-plugin-multiline-arrays": "^1.1.1",
76
- "prettier-plugin-organize-imports": "^3.2.0",
77
+ "prettier-plugin-organize-imports": "^3.2.1",
77
78
  "prettier-plugin-packagejson": "^2.3.0",
78
79
  "prettier-plugin-sort-json": "^0.0.3",
79
80
  "prettier-plugin-toml": "^0.3.1",
80
- "ts-node": "^10.9.1",
81
- "tsconfig-paths": "^4.1.0",
82
- "type-fest": "^3.2.0",
83
- "typescript": "^4.8.4",
84
- "vite": "^3.2.3"
81
+ "tsconfig-paths": "^4.1.1",
82
+ "tsx": "^3.12.1",
83
+ "type-fest": "^3.3.0",
84
+ "typescript": "^4.9.3",
85
+ "vite": "^3.2.4"
85
86
  },
86
87
  "engines": {
87
88
  "node": ">=16",
@@ -1,9 +0,0 @@
1
- export declare const Color: {
2
- Info: string;
3
- Faint: string;
4
- Fail: string;
5
- Warn: string;
6
- Success: string;
7
- Reset: string;
8
- Bold: string;
9
- };
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Color = void 0;
4
- const ansi_colors_1 = require("ansi-colors");
5
- exports.Color = {
6
- Info: ansi_colors_1.styles.blue.open,
7
- Faint: ansi_colors_1.styles.gray.open,
8
- Fail: ansi_colors_1.styles.red.open,
9
- Warn: ansi_colors_1.styles.yellow.open,
10
- Success: ansi_colors_1.styles.green.open,
11
- Reset: ansi_colors_1.styles.reset.open,
12
- Bold: ansi_colors_1.styles.bold.open,
13
- };