virmator 1.4.5 → 2.0.2

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/.cspell.json +1 -0
  2. package/.github/workflows/virmator-prerelease.yml +9 -4
  3. package/.github/workflows/virmator-tests.yml +1 -1
  4. package/.prettierignore +3 -2
  5. package/README.md +161 -1
  6. package/dist/augments/ansi-regex.d.ts +1 -0
  7. package/dist/augments/ansi-regex.js +27 -0
  8. package/dist/augments/string.d.ts +1 -0
  9. package/dist/augments/string.js +8 -0
  10. package/dist/cli/cli-util/cli-flags.js +7 -10
  11. package/dist/cli/cli-util/get-all-command-output.d.ts +4 -3
  12. package/dist/cli/cli-util/shell-command-wrapper.d.ts +1 -1
  13. package/dist/cli/cli-util/shell-command-wrapper.js +2 -2
  14. package/dist/cli/cli-util/update-configs.js +6 -5
  15. package/dist/cli/cli.js +1 -1
  16. package/dist/cli/commands/all-cli-commands.d.ts +2 -0
  17. package/dist/cli/commands/all-cli-commands.js +31 -27
  18. package/dist/cli/commands/cli-command.d.ts +10 -1
  19. package/dist/cli/commands/cli-command.js +1 -1
  20. package/dist/cli/commands/description-printing.d.ts +10 -0
  21. package/dist/cli/commands/description-printing.js +149 -0
  22. package/dist/cli/commands/implementations/code-in-markdown.command.js +29 -22
  23. package/dist/cli/commands/implementations/compile.command.js +20 -8
  24. package/dist/cli/commands/implementations/format.command.js +54 -40
  25. package/dist/cli/commands/implementations/init.command.js +13 -4
  26. package/dist/cli/commands/implementations/spellcheck.command.js +10 -1
  27. package/dist/cli/commands/implementations/test.command.js +30 -27
  28. package/dist/cli/commands/implementations/update-all-configs.command.js +23 -14
  29. package/dist/cli/commands/implementations/update-bare-configs.command.js +23 -15
  30. package/dist/cli/commands/run-command.js +2 -3
  31. package/dist/cli/config/config-key.d.ts +13 -9
  32. package/dist/cli/config/config-key.js +6 -4
  33. package/dist/cli/config/config-paths.js +11 -1
  34. package/dist/cli/config/config-read.js +1 -2
  35. package/dist/cli/config/copy-config.js +3 -3
  36. package/dist/cli/config/create-default-package-json.js +2 -2
  37. package/dist/cli/config/extendable-config.js +3 -3
  38. package/dist/errors/cli-command-error.js +3 -3
  39. package/dist/errors/cli-flag-error.js +3 -3
  40. package/dist/errors/config-file-error.js +1 -4
  41. package/dist/exportable-jest-config/jest-config.d.ts +3 -0
  42. package/dist/exportable-jest-config/jest-config.js +23 -0
  43. package/dist/exportable-jest-config/jest-setup.d.ts +1 -0
  44. package/dist/exportable-jest-config/jest-setup.js +11 -0
  45. package/dist/file-paths/virmator-repo-paths.js +4 -4
  46. package/dist/file-paths/{virmator-test-repos-paths.d.ts → virmator-test-file-paths.d.ts} +2 -0
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +6 -0
  49. package/dist/jest/jest-config.d.ts +3 -0
  50. package/dist/jest/jest-config.js +13 -0
  51. package/package.json +29 -23
  52. package/separate-configs/gitignore.txt +2 -0
  53. package/separate-configs/jest/jest-config.ts +24 -0
  54. package/separate-configs/jest/jest-setup.ts +12 -0
  55. package/separate-configs/npmignore.txt +7 -4
  56. package/tsconfig.json +13 -6
  57. package/dist/file-paths/virmator-test-repos-paths.js +0 -56
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runUpdateBareConfigsCommand = exports.updateBareConfigsCommandImplementation = void 0;
4
- const node_1 = require("augment-vir/dist/node");
4
+ const augment_vir_1 = require("augment-vir");
5
5
  const package_name_1 = require("../../../package-name");
6
6
  const cli_command_name_1 = require("../../cli-util/cli-command-name");
7
7
  const cli_flags_1 = require("../../cli-util/cli-flags");
@@ -13,20 +13,28 @@ const exampleFlags = [
13
13
  ];
14
14
  exports.updateBareConfigsCommandImplementation = {
15
15
  commandName: cli_command_name_1.CliCommandName.UpdateBareConfigs,
16
- description: `Update config files that aren't used in any ${package_name_1.packageName} commands,
17
- like GitHub actions tests or VS Code Settings.
18
-
19
- This command accepts a list of bare config file keys as arguments.
20
- If no arguments are given, this command copies all the bare config files.
21
-
22
- list of possible arguments:
23
- ${(0, node_1.getEnumTypedValues)(config_key_1.BareConfigKey).join('\n ')}
24
-
25
- examples:
26
- update all bare config files:
27
- ${package_name_1.packageName} ${cli_command_name_1.CliCommandName.UpdateBareConfigs}
28
- update only ${(0, node_1.joinWithFinalConjunction)(exampleFlags)} files:
29
- ${package_name_1.packageName} ${cli_command_name_1.CliCommandName.UpdateBareConfigs} ${exampleFlags.join(' ')}`,
16
+ description: {
17
+ sections: [
18
+ {
19
+ title: '',
20
+ content: `Update config files that aren't used in any ${package_name_1.packageName} commands, like GitHub actions tests or VS Code Settings. This command accepts a list of bare config file keys as arguments. If no arguments are given, this command copies all the bare config files.`,
21
+ },
22
+ {
23
+ title: 'list of possible arguments',
24
+ content: (0, augment_vir_1.getEnumTypedValues)(config_key_1.BareConfigKey).join('\n'),
25
+ },
26
+ ],
27
+ examples: [
28
+ {
29
+ title: `update all bare config files`,
30
+ content: `${package_name_1.packageName} ${cli_command_name_1.CliCommandName.UpdateBareConfigs}`,
31
+ },
32
+ {
33
+ title: `update only ${(0, augment_vir_1.joinWithFinalConjunction)(exampleFlags)} files`,
34
+ content: `${package_name_1.packageName} ${cli_command_name_1.CliCommandName.UpdateBareConfigs} ${exampleFlags.join(' ')},`,
35
+ },
36
+ ],
37
+ },
30
38
  implementation: runUpdateBareConfigsCommand,
31
39
  configFlagSupport: {
32
40
  [cli_flags_1.CliFlagName.NoWriteConfig]: false,
@@ -11,13 +11,12 @@ const extendable_config_1 = require("../config/extendable-config");
11
11
  const all_cli_commands_1 = require("./all-cli-commands");
12
12
  const cli_command_1 = require("./cli-command");
13
13
  async function runCommand(command, commandInput) {
14
- var _a, _b;
15
14
  const commandImplementation = all_cli_commands_1.allCliCommands[command];
16
15
  const cliFlags = (0, cli_flags_1.fillInCliFlags)(commandInput.rawCliFlags);
17
16
  const defaultFlagSupport = {
18
17
  [cli_flags_1.CliFlagName.Silent]: true,
19
18
  [cli_flags_1.CliFlagName.Help]: true,
20
- [cli_flags_1.CliFlagName.ExtendableConfig]: !!((_a = commandImplementation.configKeys) === null || _a === void 0 ? void 0 : _a.some((configKey) => (0, extendable_config_1.isExtendableConfig)(configKey))),
19
+ [cli_flags_1.CliFlagName.ExtendableConfig]: !!commandImplementation.configKeys?.some((configKey) => (0, extendable_config_1.isExtendableConfig)(configKey)),
21
20
  };
22
21
  const unsupportedFlagsInUse = (0, all_cli_commands_1.getUnsupportedFlags)(cliFlags, {
23
22
  ...defaultFlagSupport,
@@ -26,7 +25,7 @@ async function runCommand(command, commandInput) {
26
25
  if (command !== cli_command_name_1.CliCommandName.Help && unsupportedFlagsInUse.length) {
27
26
  throw new cli_command_error_1.VirmatorCliCommandError(cli_messages_1.cliErrorMessages.unsupportedCliFlag(command, unsupportedFlagsInUse));
28
27
  }
29
- if (((_b = commandImplementation.configKeys) === null || _b === void 0 ? void 0 : _b.length) && !cliFlags[cli_flags_1.CliFlagName.NoWriteConfig]) {
28
+ if (commandImplementation.configKeys?.length && !cliFlags[cli_flags_1.CliFlagName.NoWriteConfig]) {
30
29
  await Promise.all(commandImplementation.configKeys.map(async (configKey) => {
31
30
  const copyOutput = await (0, copy_config_1.copyConfig)({
32
31
  configKey: configKey,
@@ -1,9 +1,9 @@
1
1
  /** These config files are not used by any virmator commands but they are still helpful. */
2
2
  export declare enum BareConfigKey {
3
3
  GitAttributes = "GitAttributes",
4
- GitHubActionsTest = "GitHubActionsTest",
5
- GitHubActionsTaggedRelease = "GitHubActionsTaggedRelease",
6
4
  GitHubActionsPrerelease = "GitHubActionsPrerelease",
5
+ GitHubActionsTaggedRelease = "GitHubActionsTaggedRelease",
6
+ GitHubActionsTest = "GitHubActionsTest",
7
7
  GitIgnore = "GitIgnore",
8
8
  NpmIgnore = "NpmIgnore",
9
9
  VsCodeSettings = "VsCodeSettings"
@@ -11,23 +11,27 @@ export declare enum BareConfigKey {
11
11
  /** These are config files used by virmator commands. */
12
12
  export declare enum CommandConfigKey {
13
13
  Cspell = "Cspell",
14
- Prettier = "Prettier",
15
- TsConfig = "TsConfig",
14
+ JestConfig = "JestConfig",
15
+ JestSetup = "JestSetup",
16
16
  PackageJson = "PackageJson",
17
- PrettierIgnore = "PrettierIgnore"
17
+ Prettier = "Prettier",
18
+ PrettierIgnore = "PrettierIgnore",
19
+ TsConfig = "TsConfig"
18
20
  }
19
21
  export declare const ConfigKey: {
20
22
  GitAttributes: BareConfigKey.GitAttributes;
21
- GitHubActionsTest: BareConfigKey.GitHubActionsTest;
22
- GitHubActionsTaggedRelease: BareConfigKey.GitHubActionsTaggedRelease;
23
23
  GitHubActionsPrerelease: BareConfigKey.GitHubActionsPrerelease;
24
+ GitHubActionsTaggedRelease: BareConfigKey.GitHubActionsTaggedRelease;
25
+ GitHubActionsTest: BareConfigKey.GitHubActionsTest;
24
26
  GitIgnore: BareConfigKey.GitIgnore;
25
27
  NpmIgnore: BareConfigKey.NpmIgnore;
26
28
  VsCodeSettings: BareConfigKey.VsCodeSettings;
27
29
  Cspell: CommandConfigKey.Cspell;
28
- Prettier: CommandConfigKey.Prettier;
29
- TsConfig: CommandConfigKey.TsConfig;
30
+ JestConfig: CommandConfigKey.JestConfig;
31
+ JestSetup: CommandConfigKey.JestSetup;
30
32
  PackageJson: CommandConfigKey.PackageJson;
33
+ Prettier: CommandConfigKey.Prettier;
31
34
  PrettierIgnore: CommandConfigKey.PrettierIgnore;
35
+ TsConfig: CommandConfigKey.TsConfig;
32
36
  };
33
37
  export declare type ConfigKey = CommandConfigKey | BareConfigKey;
@@ -5,9 +5,9 @@ exports.ConfigKey = exports.CommandConfigKey = exports.BareConfigKey = void 0;
5
5
  var BareConfigKey;
6
6
  (function (BareConfigKey) {
7
7
  BareConfigKey["GitAttributes"] = "GitAttributes";
8
- BareConfigKey["GitHubActionsTest"] = "GitHubActionsTest";
9
- BareConfigKey["GitHubActionsTaggedRelease"] = "GitHubActionsTaggedRelease";
10
8
  BareConfigKey["GitHubActionsPrerelease"] = "GitHubActionsPrerelease";
9
+ BareConfigKey["GitHubActionsTaggedRelease"] = "GitHubActionsTaggedRelease";
10
+ BareConfigKey["GitHubActionsTest"] = "GitHubActionsTest";
11
11
  BareConfigKey["GitIgnore"] = "GitIgnore";
12
12
  BareConfigKey["NpmIgnore"] = "NpmIgnore";
13
13
  BareConfigKey["VsCodeSettings"] = "VsCodeSettings";
@@ -16,9 +16,11 @@ var BareConfigKey;
16
16
  var CommandConfigKey;
17
17
  (function (CommandConfigKey) {
18
18
  CommandConfigKey["Cspell"] = "Cspell";
19
- CommandConfigKey["Prettier"] = "Prettier";
20
- CommandConfigKey["TsConfig"] = "TsConfig";
19
+ CommandConfigKey["JestConfig"] = "JestConfig";
20
+ CommandConfigKey["JestSetup"] = "JestSetup";
21
21
  CommandConfigKey["PackageJson"] = "PackageJson";
22
+ CommandConfigKey["Prettier"] = "Prettier";
22
23
  CommandConfigKey["PrettierIgnore"] = "PrettierIgnore";
24
+ CommandConfigKey["TsConfig"] = "TsConfig";
23
25
  })(CommandConfigKey = exports.CommandConfigKey || (exports.CommandConfigKey = {}));
24
26
  exports.ConfigKey = { ...CommandConfigKey, ...BareConfigKey };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getVirmatorConfigFilePath = exports.getRepoConfigFilePath = void 0;
4
4
  const path_1 = require("path");
5
5
  const virmator_repo_paths_1 = require("../../file-paths/virmator-repo-paths");
6
+ const package_name_1 = require("../../package-name");
6
7
  const config_key_1 = require("./config-key");
7
8
  const extendable_config_1 = require("./extendable-config");
8
9
  var DifferentConfigPathTypes;
@@ -12,16 +13,25 @@ var DifferentConfigPathTypes;
12
13
  /** The path that the config file should be written to when virmator is being used. */
13
14
  DifferentConfigPathTypes["Repo"] = "repo";
14
15
  })(DifferentConfigPathTypes || (DifferentConfigPathTypes = {}));
16
+ const hiddenVirmatorDirectory = `.${package_name_1.packageName}`;
15
17
  const configFileMap = {
16
18
  [config_key_1.ConfigKey.Cspell]: '.cspell.json',
17
19
  [config_key_1.ConfigKey.GitAttributes]: '.gitattributes',
18
- [config_key_1.ConfigKey.GitHubActionsTest]: (0, path_1.join)('.github', 'workflows', 'virmator-tests.yml'),
19
20
  [config_key_1.ConfigKey.GitHubActionsPrerelease]: (0, path_1.join)('.github', 'workflows', 'virmator-prerelease.yml'),
20
21
  [config_key_1.ConfigKey.GitHubActionsTaggedRelease]: (0, path_1.join)('.github', 'workflows', 'virmator-tagged-release.yml'),
22
+ [config_key_1.ConfigKey.GitHubActionsTest]: (0, path_1.join)('.github', 'workflows', 'virmator-tests.yml'),
21
23
  [config_key_1.ConfigKey.GitIgnore]: {
22
24
  virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'gitignore.txt'),
23
25
  repo: '.gitignore',
24
26
  },
27
+ [config_key_1.ConfigKey.JestConfig]: {
28
+ virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'jest', 'jest-config.ts'),
29
+ repo: (0, path_1.join)(hiddenVirmatorDirectory, 'jest', 'jest-config.ts'),
30
+ },
31
+ [config_key_1.ConfigKey.JestSetup]: {
32
+ virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'jest', 'jest-setup.ts'),
33
+ repo: (0, path_1.join)(hiddenVirmatorDirectory, 'jest', 'jest-setup.ts'),
34
+ },
25
35
  [config_key_1.ConfigKey.NpmIgnore]: {
26
36
  virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'npmignore.txt'),
27
37
  repo: '.npmignore',
@@ -44,7 +44,6 @@ async function readUpdatedVirmatorConfigFile(configKey, repoDir, extendable) {
44
44
  }
45
45
  exports.readUpdatedVirmatorConfigFile = readUpdatedVirmatorConfigFile;
46
46
  async function updateVirmatorConfig(configKey, repoDir, extendable) {
47
- var _a;
48
47
  const virmatorConfigContents = await readVirmatorConfigFile(configKey, extendable);
49
48
  switch (configKey) {
50
49
  // in these special cases we want to merge the config files with what's already in the repo
@@ -77,7 +76,7 @@ async function updateVirmatorConfig(configKey, repoDir, extendable) {
77
76
  ...repoPackageJson,
78
77
  scripts: {
79
78
  ...defaultPackageJson.scripts,
80
- ...((_a = repoPackageJson.scripts) !== null && _a !== void 0 ? _a : {}),
79
+ ...(repoPackageJson.scripts ?? {}),
81
80
  },
82
81
  });
83
82
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.copyConfig = void 0;
4
- const node_1 = require("augment-vir/dist/node");
4
+ const node_only_1 = require("augment-vir/dist/node-only");
5
5
  const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
7
  const config_file_error_1 = require("../../errors/config-file-error");
@@ -39,7 +39,7 @@ async function copyConfig({ configKey, forceExtendableConfig, repoDir, }) {
39
39
  if (!repoConfigExists) {
40
40
  // if extender config file does not exist, create it
41
41
  const extenderContents = await (0, config_read_1.readUpdatedVirmatorConfigFile)(configKey, repoDir, true);
42
- await (0, node_1.writeFileAndDir)(repoConfigPath, extenderContents);
42
+ await (0, node_only_1.writeFileAndDir)(repoConfigPath, extenderContents);
43
43
  }
44
44
  const repoExtendableConfigPath = (0, path_1.join)(repoDir, (0, extendable_config_1.getExtendableBaseConfigName)(configKey));
45
45
  const repoExtendableConfigExists = (0, fs_extra_1.existsSync)(repoExtendableConfigPath);
@@ -89,7 +89,7 @@ async function copyConfig({ configKey, forceExtendableConfig, repoDir, }) {
89
89
  outputFilePath = repoConfigPath;
90
90
  }
91
91
  if (shouldWriteConfig) {
92
- await (0, node_1.writeFileAndDir)(outputFilePath, virmatorConfigContents);
92
+ await (0, node_only_1.writeFileAndDir)(outputFilePath, virmatorConfigContents);
93
93
  }
94
94
  return {
95
95
  logs,
@@ -4,13 +4,13 @@ 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 fs_extra_1 = require("fs-extra");
7
+ const promises_1 = require("fs/promises");
8
8
  const path_1 = require("path");
9
9
  const simple_git_1 = __importDefault(require("simple-git"));
10
10
  const config_key_1 = require("./config-key");
11
11
  const config_paths_1 = require("./config-paths");
12
12
  async function createDefaultPackageJson(repoDir) {
13
- const virmatorPackageJson = JSON.parse((await (0, fs_extra_1.readFile)((0, config_paths_1.getVirmatorConfigFilePath)(config_key_1.ConfigKey.PackageJson, false))).toString());
13
+ const virmatorPackageJson = JSON.parse((await (0, promises_1.readFile)((0, config_paths_1.getVirmatorConfigFilePath)(config_key_1.ConfigKey.PackageJson, false))).toString());
14
14
  const gitProperties = await getGitProperties(repoDir);
15
15
  return {
16
16
  ...virmatorPackageJson,
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isConfigExtending = exports.isExtendableConfig = exports.getExtendableBaseConfigName = exports.ExtendableConfig = void 0;
4
- const node_1 = require("augment-vir/dist/node");
4
+ const augment_vir_1 = require("augment-vir");
5
5
  const config_key_1 = require("./config-key");
6
6
  const extendableConfigFileMap = {
7
7
  [config_key_1.ConfigKey.Prettier]: '.prettierrc-base.js',
8
8
  [config_key_1.ConfigKey.Cspell]: '.cspell-base.json',
9
9
  [config_key_1.ConfigKey.TsConfig]: 'tsconfig-base.json',
10
10
  };
11
- exports.ExtendableConfig = (0, node_1.getObjectTypedKeys)(extendableConfigFileMap).reduce((accum, key) => {
11
+ exports.ExtendableConfig = (0, augment_vir_1.getObjectTypedKeys)(extendableConfigFileMap).reduce((accum, key) => {
12
12
  accum[key] = key;
13
13
  return accum;
14
14
  }, {});
@@ -23,7 +23,7 @@ function isExtendableConfig(ConfigKey) {
23
23
  if (!ConfigKey) {
24
24
  return false;
25
25
  }
26
- return (0, node_1.isEnumValue)(ConfigKey, exports.ExtendableConfig);
26
+ return (0, augment_vir_1.isEnumValue)(ConfigKey, exports.ExtendableConfig);
27
27
  }
28
28
  exports.isExtendableConfig = isExtendableConfig;
29
29
  function isConfigExtending(key, contents) {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VirmatorCliCommandError = void 0;
4
- const node_1 = require("augment-vir/dist/node");
4
+ const augment_vir_1 = require("augment-vir");
5
5
  const cli_command_name_1 = require("../cli/cli-util/cli-command-name");
6
6
  class VirmatorCliCommandError extends Error {
7
+ name = 'VirmatorCliCommandError';
7
8
  constructor(message) {
8
- super(`${message}\nExpected one of the following: ${(0, node_1.getEnumTypedValues)(cli_command_name_1.CliCommandName).join(', ')}`);
9
- this.name = 'VirmatorCliCommandError';
9
+ super(`${message}\nExpected one of the following: ${(0, augment_vir_1.getEnumTypedValues)(cli_command_name_1.CliCommandName).join(', ')}`);
10
10
  }
11
11
  }
12
12
  exports.VirmatorCliCommandError = VirmatorCliCommandError;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CliFlagError = void 0;
4
- const node_1 = require("augment-vir/dist/node");
4
+ const augment_vir_1 = require("augment-vir");
5
5
  const cli_flags_1 = require("../cli/cli-util/cli-flags");
6
6
  class CliFlagError extends Error {
7
+ name = 'CliFlagError';
7
8
  constructor(invalidFlags) {
8
- super(`Invalid flags given: ${invalidFlags.join(',')}\nValid flags: ${(0, node_1.getObjectTypedKeys)(cli_flags_1.defaultCliFlags).join(',')}`);
9
- this.name = 'CliFlagError';
9
+ super(`Invalid flags given: ${invalidFlags.join(',')}\nValid flags: ${(0, augment_vir_1.getObjectTypedKeys)(cli_flags_1.defaultCliFlags).join(',')}`);
10
10
  }
11
11
  }
12
12
  exports.CliFlagError = CliFlagError;
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConfigFileError = void 0;
4
4
  class ConfigFileError extends Error {
5
- constructor() {
6
- super(...arguments);
7
- this.name = 'ConfigFileError';
8
- }
5
+ name = 'ConfigFileError';
9
6
  }
10
7
  exports.ConfigFileError = ConfigFileError;
@@ -0,0 +1,3 @@
1
+ import { InitialOptionsTsJest } from 'ts-jest';
2
+ export declare const virmatorJestConfig: InitialOptionsTsJest;
3
+ export default virmatorJestConfig;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.virmatorJestConfig = void 0;
4
+ const path_1 = require("path");
5
+ const cwd = process.cwd();
6
+ exports.virmatorJestConfig = {
7
+ preset: 'ts-jest',
8
+ testEnvironment: 'node',
9
+ rootDir: cwd,
10
+ modulePathIgnorePatterns: ['.*.type.test.ts$'],
11
+ roots: [(0, path_1.join)(cwd, 'src')],
12
+ setupFilesAfterEnv: [(0, path_1.join)(__dirname, 'jest-setup.ts')],
13
+ globals: {
14
+ 'ts-jest': {
15
+ tsconfig: (0, path_1.join)(cwd, 'tsconfig.json'),
16
+ diagnostics: {
17
+ warnOnly: true,
18
+ ignoreCodes: ['TS151001'],
19
+ },
20
+ },
21
+ },
22
+ };
23
+ exports.default = exports.virmatorJestConfig;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const console_1 = require("@jest/console");
4
+ function simpleFormatter(type, message) {
5
+ const consoleIndent = ' ';
6
+ return message
7
+ .split(/\n/)
8
+ .map((line) => consoleIndent + line)
9
+ .join('\n');
10
+ }
11
+ global.console = new console_1.CustomConsole(process.stdout, process.stderr, simpleFormatter);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNpmBinPath = exports.relativeSeparateConfigsDir = exports.extenderConfigsDir = exports.virmatorDistDir = exports.virmatorRootDir = void 0;
4
- const node_1 = require("augment-vir/dist/node");
5
- const fs_extra_1 = require("fs-extra");
4
+ const node_only_1 = require("augment-vir/dist/node-only");
5
+ const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
7
  exports.virmatorRootDir = __dirname.replace(/(?:src|node_modules\/dist|dist).*/, '');
8
8
  exports.virmatorDistDir = (0, path_1.join)(exports.virmatorRootDir, 'dist');
@@ -11,9 +11,9 @@ exports.relativeSeparateConfigsDir = 'separate-configs';
11
11
  const virmatorNodeBin = (0, path_1.join)(exports.virmatorRootDir, 'node_modules', '.bin');
12
12
  function getNpmBinPath(command) {
13
13
  const virmatorBinPath = (0, path_1.join)(virmatorNodeBin, command);
14
- const actualBinPath = (0, fs_extra_1.existsSync)(virmatorBinPath)
14
+ const actualBinPath = (0, fs_1.existsSync)(virmatorBinPath)
15
15
  ? virmatorBinPath
16
16
  : (0, path_1.join)(exports.virmatorRootDir, '..', '.bin', command);
17
- return (0, node_1.interpolationSafeWindowsPath)(actualBinPath);
17
+ return (0, node_only_1.interpolationSafeWindowsPath)(actualBinPath);
18
18
  }
19
19
  exports.getNpmBinPath = getNpmBinPath;
@@ -18,6 +18,7 @@ export declare const testTestPaths: {
18
18
  validRepo: string;
19
19
  invalidRepo: string;
20
20
  multiRepo: string;
21
+ runInBandTestRepo: string;
21
22
  };
22
23
  export declare const spellcheckTestPaths: {
23
24
  validRepo: string;
@@ -30,3 +31,4 @@ export declare const updateBareConfigsTestPaths: {
30
31
  export declare const updateAllConfigsTestPaths: {
31
32
  fullPackageJsonRepo: string;
32
33
  };
34
+ export declare const virmatorReadme: string;
@@ -0,0 +1,2 @@
1
+ /** This is exported so that it can be extended if needed. */
2
+ export { virmatorJestConfig } from './exportable-jest-config/jest-config';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.virmatorJestConfig = void 0;
4
+ /** This is exported so that it can be extended if needed. */
5
+ var jest_config_1 = require("./exportable-jest-config/jest-config");
6
+ Object.defineProperty(exports, "virmatorJestConfig", { enumerable: true, get: function () { return jest_config_1.virmatorJestConfig; } });
@@ -0,0 +1,3 @@
1
+ import { InitialOptionsTsJest } from 'ts-jest';
2
+ declare const virmatorInternalTestingConfig: InitialOptionsTsJest;
3
+ export default virmatorInternalTestingConfig;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jest_config_1 = require("../exportable-jest-config/jest-config");
4
+ const virmatorInternalTestingConfig = {
5
+ ...jest_config_1.virmatorJestConfig,
6
+ // this insanely high timeout is for GitHub Actions, which takes an eternity to run
7
+ testTimeout: 60000,
8
+ modulePathIgnorePatterns: [
9
+ ...jest_config_1.virmatorJestConfig.modulePathIgnorePatterns,
10
+ 'test-files',
11
+ ],
12
+ };
13
+ exports.default = virmatorInternalTestingConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "1.4.5",
3
+ "version": "2.0.2",
4
4
  "description": "Handle all the stuffs in one package.",
5
5
  "keywords": [
6
6
  "automation",
@@ -23,6 +23,8 @@
23
23
  "name": "electrovir",
24
24
  "url": "https://github.com/electrovir"
25
25
  },
26
+ "main": "dist/index.js",
27
+ "types": "dist/index.d.ts",
26
28
  "bin": "dist/cli/cli.js",
27
29
  "scripts": {
28
30
  "compile": "rm -rf dist && tsc && chmod +x dist/cli/cli.js",
@@ -30,35 +32,39 @@
30
32
  "format:base": "prettier \"./**/*.+(ts|json|html|css|md|js)\"",
31
33
  "format:check": "npm run format:base -- --check",
32
34
  "prepublishOnly": "npm install && npm run test:full",
33
- "spellcheck": "cspell \"{*,.*,**/{.*,*}/**/{.*,*}}\" --exclude \"test-repos/spellcheck/invalid-spellcheck-repo/**/*\" --exclude \"extender-configs\"",
34
- "test": "npm run compile && test-vir \"./dist/**/!(*.type).test.js\"",
35
- "test:file": "ts-node ./scripts/test-specific-file.ts",
36
- "test:full": "npm run test && npm run spellcheck -- --no-progress && npm run format:check && md-code --check README.md",
37
- "test:help": "npm run compile && node dist/cli/cli.js --help"
35
+ "readme:check": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts check && md-code --check README.md",
36
+ "readme:update": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts && md-code README.md",
37
+ "spellcheck": "cspell \"{*,.*,**/{.*,*}/**/{.*,*}}\" --exclude \"test-files/spellcheck/invalid-spellcheck-repo/**/*\" --exclude \"extender-configs\"",
38
+ "test": "npm install && npm run compile && jest --runInBand --config ./src/jest/jest-config.ts",
39
+ "test:full": "npm run test && npm run spellcheck -- --no-progress && npm run format:check && npm run readme:check",
40
+ "test:help": "ts-node -r tsconfig-paths/register src/cli/cli.ts --help"
38
41
  },
39
42
  "dependencies": {
43
+ "@types/jest": "27.4.1",
40
44
  "ansi-styles": "5.2.0",
41
- "augment-vir": "^1.5.1",
42
- "cspell": "^5.19.2",
43
- "fs-extra": "^10.0.1",
44
- "markdown-code-example-inserter": "^0.1.5",
45
- "prettier": "^2.5.1",
46
- "prettier-plugin-jsdoc": "^0.3.31",
47
- "prettier-plugin-multiline-arrays": "^0.0.3",
48
- "prettier-plugin-organize-imports": "^2.3.4",
49
- "prettier-plugin-packagejson": "^2.2.16",
50
- "prettier-plugin-sort-json": "^0.0.2",
51
- "simple-git": "^3.4.0",
52
- "test-vir": "^0.2.3",
53
- "typescript": "^4.6.2"
45
+ "augment-vir": "1.7.0",
46
+ "cspell": "5.19.2",
47
+ "fs-extra": "10.0.1",
48
+ "jest": "27.5.1",
49
+ "markdown-code-example-inserter": "0.1.7",
50
+ "prettier": "2.6.0",
51
+ "prettier-plugin-jsdoc": "0.3.31",
52
+ "prettier-plugin-multiline-arrays": "0.0.4",
53
+ "prettier-plugin-organize-imports": "2.3.4",
54
+ "prettier-plugin-packagejson": "2.2.16",
55
+ "prettier-plugin-sort-json": "0.0.2",
56
+ "simple-git": "3.4.0",
57
+ "ts-jest": "27.1.3",
58
+ "ts-node": "10.7.0",
59
+ "tsconfig-paths": "3.14.0",
60
+ "typescript": "4.6.2"
54
61
  },
55
62
  "devDependencies": {
56
- "@types/fs-extra": "^9.0.13",
57
- "@types/node": "^17.0.21",
58
- "ts-node": "^10.7.0"
63
+ "@types/fs-extra": "9.0.13",
64
+ "@types/node": "17.0.22"
59
65
  },
60
66
  "engines": {
61
- "node": ">=12",
67
+ "node": ">=14",
62
68
  "npm": ">=7"
63
69
  }
64
70
  }
@@ -1,2 +1,4 @@
1
+ .DS_Store
1
2
  node_modules
2
3
  dist
4
+ Icon?
@@ -0,0 +1,24 @@
1
+ import {join} from 'path';
2
+ import {InitialOptionsTsJest} from 'ts-jest';
3
+
4
+ const cwd = process.cwd();
5
+
6
+ export const virmatorJestConfig: InitialOptionsTsJest = {
7
+ preset: 'ts-jest',
8
+ testEnvironment: 'node',
9
+ rootDir: cwd,
10
+ modulePathIgnorePatterns: ['.*.type.test.ts$'],
11
+ roots: [join(cwd, 'src')],
12
+ setupFilesAfterEnv: [join(__dirname, 'jest-setup.ts')],
13
+ globals: {
14
+ 'ts-jest': {
15
+ tsconfig: join(cwd, 'tsconfig.json'),
16
+ diagnostics: {
17
+ warnOnly: true,
18
+ ignoreCodes: ['TS151001'],
19
+ },
20
+ },
21
+ },
22
+ };
23
+
24
+ export default virmatorJestConfig;
@@ -0,0 +1,12 @@
1
+ import {CustomConsole, LogMessage, LogType} from '@jest/console';
2
+
3
+ function simpleFormatter(type: LogType, message: LogMessage): string {
4
+ const consoleIndent = ' ';
5
+
6
+ return message
7
+ .split(/\n/)
8
+ .map((line) => consoleIndent + line)
9
+ .join('\n');
10
+ }
11
+
12
+ global.console = new CustomConsole(process.stdout, process.stderr, simpleFormatter);
@@ -8,12 +8,15 @@
8
8
  .vscode/
9
9
  *.test.d.ts
10
10
  *.test.js
11
+ *.test.ts
12
+ dist/readme-examples/
13
+ dist/scripts/
11
14
  dist/test/
15
+ dist/vite/
16
+ index.html
17
+ public/
12
18
  scripts/
13
- snowpack.config.js
14
- snowpack.config.mjs
15
19
  src/
16
- static/
17
- test-repos/
20
+ test-files/
18
21
  tsconfig-base.json
19
22
  tsconfig.json
package/tsconfig.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "alwaysStrict": true,
4
+ "baseUrl": ".",
4
5
  "declaration": true,
5
6
  "esModuleInterop": true,
6
7
  "exactOptionalPropertyTypes": true,
7
8
  "forceConsistentCasingInFileNames": true,
8
- "module": "commonjs",
9
+ "module": "CommonJS",
10
+ "moduleResolution": "Node",
9
11
  "noImplicitAny": true,
10
12
  "noImplicitOverride": true,
11
13
  "noImplicitReturns": true,
@@ -16,13 +18,18 @@
16
18
  "skipDefaultLibCheck": true,
17
19
  "skipLibCheck": true,
18
20
  "strict": true,
19
- "target": "ES2018",
21
+ "target": "ESNext",
20
22
  "useUnknownInCatchVariables": true
21
23
  },
22
24
  "exclude": [
23
- "node_modules",
24
25
  "dist",
25
- "test-repos",
26
- "scripts"
27
- ]
26
+ "node_modules",
27
+ "separate-configs",
28
+ "test-files"
29
+ ],
30
+ "ts-node": {
31
+ "compilerOptions": {
32
+ "module": "CommonJS"
33
+ }
34
+ }
28
35
  }