virmator 2.0.7 → 3.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 (183) hide show
  1. package/.github/workflows/virmator-build-for-gh-pages.yml +24 -0
  2. package/.github/workflows/virmator-tagged-release.yml +6 -4
  3. package/.github/workflows/virmator-tests.yml +4 -3
  4. package/.mocharc.js +9 -0
  5. package/.prettierignore +2 -3
  6. package/README.md +67 -82
  7. package/configs/.cspell.json +4 -0
  8. package/configs/.gitattributes +1 -0
  9. package/configs/.mocharc.js +8 -0
  10. package/configs/.prettierignore +6 -0
  11. package/configs/.prettierrc.js +13 -0
  12. package/{.cspell.json → configs/.virmator/.cspell-base.json} +5 -0
  13. package/configs/.virmator/mocharc-base.js +15 -0
  14. package/configs/.virmator/prettierrc-base.js +62 -0
  15. package/{tsconfig.json → configs/.virmator/tsconfig-base.json} +12 -8
  16. package/configs/.virmator/vite-always-reload-plugin.ts +90 -0
  17. package/configs/.virmator/vite-base.ts +11 -0
  18. package/configs/.virmator/vite.config.ts +8 -0
  19. package/configs/.virmator/web-test-runner-base.mjs +29 -0
  20. package/configs/.virmator/web-test-runner.config.mjs +8 -0
  21. package/{.vscode → configs/.vscode}/settings.json +12 -0
  22. package/configs/gitignore.txt +6 -0
  23. package/configs/npmignore.txt +13 -0
  24. package/configs/package.json +16 -0
  25. package/configs/src/global.d.ts +5 -0
  26. package/configs/tsconfig.json +3 -0
  27. package/dist/api/virmator-wrapper.d.ts +5 -0
  28. package/dist/api/virmator-wrapper.js +9 -0
  29. package/dist/augments/array.d.ts +1 -0
  30. package/dist/augments/array.js +7 -0
  31. package/dist/augments/fs.d.ts +5 -0
  32. package/dist/augments/fs.js +30 -0
  33. package/dist/augments/json.d.ts +1 -0
  34. package/dist/augments/json.js +12 -0
  35. package/dist/augments/object.d.ts +1 -0
  36. package/dist/augments/object.js +14 -0
  37. package/dist/augments/regexp.d.ts +1 -0
  38. package/dist/augments/regexp.js +7 -0
  39. package/dist/augments/test.d.ts +2 -0
  40. package/dist/augments/test.js +8 -0
  41. package/dist/augments/type.d.ts +1 -0
  42. package/dist/augments/type.js +2 -0
  43. package/dist/cli/all-cli-command-definitions.d.ts +54 -0
  44. package/dist/cli/all-cli-command-definitions.js +76 -0
  45. package/dist/cli/cli-color.d.ts +8 -0
  46. package/dist/cli/cli-color.js +12 -0
  47. package/dist/cli/cli-command/cli-command-help.d.ts +8 -0
  48. package/dist/cli/cli-command/cli-command-help.js +2 -0
  49. package/dist/cli/{commands/description-printing.d.ts → cli-command/cli-command-to-help-message.d.ts} +3 -2
  50. package/dist/cli/{commands/description-printing.js → cli-command/cli-command-to-help-message.js} +55 -21
  51. package/dist/cli/cli-command/define-cli-command.d.ts +41 -0
  52. package/dist/cli/cli-command/define-cli-command.js +29 -0
  53. package/dist/cli/cli-command/run-shell-command.d.ts +8 -0
  54. package/dist/cli/cli-command/run-shell-command.js +23 -0
  55. package/dist/cli/cli-command-implementations/code-in-markdown.command.d.ts +6 -0
  56. package/dist/cli/cli-command-implementations/code-in-markdown.command.js +67 -0
  57. package/dist/cli/cli-command-implementations/compile.command.d.ts +6 -0
  58. package/dist/cli/cli-command-implementations/compile.command.js +44 -0
  59. package/dist/cli/cli-command-implementations/format.command.d.ts +6 -0
  60. package/dist/cli/cli-command-implementations/format.command.js +116 -0
  61. package/dist/cli/cli-command-implementations/frontend.command.d.ts +7 -0
  62. package/dist/cli/cli-command-implementations/frontend.command.js +45 -0
  63. package/dist/cli/cli-command-implementations/init.command.d.ts +4 -0
  64. package/dist/cli/cli-command-implementations/init.command.js +31 -0
  65. package/dist/cli/cli-command-implementations/spellcheck.command.d.ts +4 -0
  66. package/dist/cli/cli-command-implementations/spellcheck.command.js +40 -0
  67. package/dist/cli/cli-command-implementations/test-web.command.d.ts +4 -0
  68. package/dist/cli/cli-command-implementations/test-web.command.js +50 -0
  69. package/dist/cli/cli-command-implementations/test.command.d.ts +4 -0
  70. package/dist/cli/cli-command-implementations/test.command.js +53 -0
  71. package/dist/cli/cli-command-implementations/update-configs.command.d.ts +4 -0
  72. package/dist/cli/cli-command-implementations/update-configs.command.js +31 -0
  73. package/dist/cli/cli-flags/cli-flag-name.d.ts +4 -0
  74. package/dist/cli/cli-flags/cli-flag-name.js +8 -0
  75. package/dist/cli/cli-flags/cli-flag-values.d.ts +4 -0
  76. package/dist/cli/cli-flags/cli-flag-values.js +19 -0
  77. package/dist/cli/cli-messages.d.ts +6 -0
  78. package/dist/cli/cli-messages.js +19 -0
  79. package/dist/cli/cli.js +27 -20
  80. package/dist/cli/config/combine-text-config.d.ts +2 -0
  81. package/dist/cli/config/combine-text-config.js +27 -0
  82. package/dist/cli/config/config-files.d.ts +133 -0
  83. package/dist/cli/config/config-files.js +138 -0
  84. package/dist/cli/config/copy-config.d.ts +25 -13
  85. package/dist/cli/config/copy-config.js +86 -86
  86. package/dist/cli/config/create-default-package-json.d.ts +1 -16
  87. package/dist/cli/config/create-default-package-json.js +37 -12
  88. package/dist/cli/is-global.d.ts +1 -0
  89. package/dist/cli/is-global.js +10 -0
  90. package/dist/cli/parse-arguments.d.ts +8 -0
  91. package/dist/cli/parse-arguments.js +42 -0
  92. package/dist/cli/run-cli-command.d.ts +13 -0
  93. package/dist/cli/run-cli-command.js +52 -0
  94. package/dist/cli/run-command.test-helper.d.ts +28 -0
  95. package/dist/cli/run-command.test-helper.js +87 -0
  96. package/dist/errors/virmator-cli.error.d.ts +3 -0
  97. package/dist/errors/virmator-cli.error.js +10 -0
  98. package/dist/errors/virmator-config-file.error.d.ts +4 -0
  99. package/dist/errors/virmator-config-file.error.js +11 -0
  100. package/dist/errors/virmator-invalid-command.error.d.ts +5 -0
  101. package/dist/errors/virmator-invalid-command.error.js +11 -0
  102. package/dist/errors/virmator-invalid-flags.error.d.ts +5 -0
  103. package/dist/errors/virmator-invalid-flags.error.js +13 -0
  104. package/dist/file-paths/virmator-package-paths.d.ts +11 -0
  105. package/dist/file-paths/virmator-package-paths.js +31 -0
  106. package/dist/file-paths/virmator-test-file-paths.d.ts +17 -7
  107. package/dist/index.d.ts +1 -2
  108. package/dist/index.js +0 -4
  109. package/dist/logging.d.ts +10 -0
  110. package/dist/logging.js +9 -0
  111. package/package.json +26 -20
  112. package/.prettierrc.js +0 -40
  113. package/dist/augments/ansi-regex.d.ts +0 -1
  114. package/dist/augments/ansi-regex.js +0 -27
  115. package/dist/augments/string.d.ts +0 -1
  116. package/dist/augments/string.js +0 -8
  117. package/dist/cli/cli-util/cli-color.d.ts +0 -8
  118. package/dist/cli/cli-util/cli-color.js +0 -35
  119. package/dist/cli/cli-util/cli-command-name.d.ts +0 -11
  120. package/dist/cli/cli-util/cli-command-name.js +0 -15
  121. package/dist/cli/cli-util/cli-flags.d.ts +0 -18
  122. package/dist/cli/cli-util/cli-flags.js +0 -63
  123. package/dist/cli/cli-util/cli-messages.d.ts +0 -7
  124. package/dist/cli/cli-util/cli-messages.js +0 -19
  125. package/dist/cli/cli-util/get-all-command-output.d.ts +0 -7
  126. package/dist/cli/cli-util/get-all-command-output.js +0 -21
  127. package/dist/cli/cli-util/shell-command-wrapper.d.ts +0 -8
  128. package/dist/cli/cli-util/shell-command-wrapper.js +0 -25
  129. package/dist/cli/cli-util/update-configs.d.ts +0 -3
  130. package/dist/cli/cli-util/update-configs.js +0 -54
  131. package/dist/cli/commands/all-cli-commands.d.ts +0 -13
  132. package/dist/cli/commands/all-cli-commands.js +0 -99
  133. package/dist/cli/commands/cli-command.d.ts +0 -35
  134. package/dist/cli/commands/cli-command.js +0 -40
  135. package/dist/cli/commands/implementations/code-in-markdown.command.d.ts +0 -3
  136. package/dist/cli/commands/implementations/code-in-markdown.command.js +0 -54
  137. package/dist/cli/commands/implementations/compile.command.d.ts +0 -3
  138. package/dist/cli/commands/implementations/compile.command.js +0 -49
  139. package/dist/cli/commands/implementations/format.command.d.ts +0 -16
  140. package/dist/cli/commands/implementations/format.command.js +0 -143
  141. package/dist/cli/commands/implementations/init.command.d.ts +0 -3
  142. package/dist/cli/commands/implementations/init.command.js +0 -55
  143. package/dist/cli/commands/implementations/spellcheck.command.d.ts +0 -3
  144. package/dist/cli/commands/implementations/spellcheck.command.js +0 -35
  145. package/dist/cli/commands/implementations/test.command.d.ts +0 -3
  146. package/dist/cli/commands/implementations/test.command.js +0 -49
  147. package/dist/cli/commands/implementations/update-all-configs.command.d.ts +0 -3
  148. package/dist/cli/commands/implementations/update-all-configs.command.js +0 -46
  149. package/dist/cli/commands/implementations/update-bare-configs.command.d.ts +0 -3
  150. package/dist/cli/commands/implementations/update-bare-configs.command.js +0 -46
  151. package/dist/cli/commands/run-command.d.ts +0 -3
  152. package/dist/cli/commands/run-command.js +0 -65
  153. package/dist/cli/config/config-key.d.ts +0 -35
  154. package/dist/cli/config/config-key.js +0 -25
  155. package/dist/cli/config/config-paths.d.ts +0 -3
  156. package/dist/cli/config/config-paths.js +0 -69
  157. package/dist/cli/config/config-read.d.ts +0 -7
  158. package/dist/cli/config/config-read.js +0 -91
  159. package/dist/cli/config/extendable-config.d.ts +0 -12
  160. package/dist/cli/config/extendable-config.js +0 -45
  161. package/dist/errors/cli-command-error.d.ts +0 -4
  162. package/dist/errors/cli-command-error.js +0 -12
  163. package/dist/errors/cli-flag-error.d.ts +0 -4
  164. package/dist/errors/cli-flag-error.js +0 -12
  165. package/dist/errors/config-file-error.d.ts +0 -3
  166. package/dist/errors/config-file-error.js +0 -7
  167. package/dist/exportable-jest-config/jest-config.d.ts +0 -3
  168. package/dist/exportable-jest-config/jest-config.js +0 -23
  169. package/dist/exportable-jest-config/jest-setup.d.ts +0 -1
  170. package/dist/exportable-jest-config/jest-setup.js +0 -11
  171. package/dist/file-paths/virmator-repo-paths.d.ts +0 -5
  172. package/dist/file-paths/virmator-repo-paths.js +0 -19
  173. package/dist/jest/jest-config.d.ts +0 -3
  174. package/dist/jest/jest-config.js +0 -13
  175. package/extender-configs/.cspell.json +0 -3
  176. package/extender-configs/.prettierrc.js +0 -3
  177. package/extender-configs/tsconfig.json +0 -3
  178. package/separate-configs/.prettierignore +0 -3
  179. package/separate-configs/gitignore.txt +0 -4
  180. package/separate-configs/jest/jest-config.ts +0 -24
  181. package/separate-configs/jest/jest-setup.ts +0 -12
  182. package/separate-configs/npmignore.txt +0 -20
  183. package/separate-configs/package.json +0 -9
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVirmatorConfigFilePath = exports.getRepoConfigFilePath = void 0;
4
- const path_1 = require("path");
5
- const virmator_repo_paths_1 = require("../../file-paths/virmator-repo-paths");
6
- const package_name_1 = require("../../package-name");
7
- const config_key_1 = require("./config-key");
8
- const extendable_config_1 = require("./extendable-config");
9
- var DifferentConfigPathTypes;
10
- (function (DifferentConfigPathTypes) {
11
- /** The path the config file within virmator */
12
- DifferentConfigPathTypes["Virmator"] = "virmator";
13
- /** The path that the config file should be written to when virmator is being used. */
14
- DifferentConfigPathTypes["Repo"] = "repo";
15
- })(DifferentConfigPathTypes || (DifferentConfigPathTypes = {}));
16
- const hiddenVirmatorDirectory = `.${package_name_1.packageName}`;
17
- const configFileMap = {
18
- [config_key_1.ConfigKey.Cspell]: '.cspell.json',
19
- [config_key_1.ConfigKey.GitAttributes]: '.gitattributes',
20
- [config_key_1.ConfigKey.GitHubActionsTaggedRelease]: (0, path_1.join)('.github', 'workflows', 'virmator-tagged-release.yml'),
21
- [config_key_1.ConfigKey.GitHubActionsTest]: (0, path_1.join)('.github', 'workflows', 'virmator-tests.yml'),
22
- [config_key_1.ConfigKey.GitIgnore]: {
23
- virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'gitignore.txt'),
24
- repo: '.gitignore',
25
- },
26
- [config_key_1.ConfigKey.JestConfig]: {
27
- virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'jest', 'jest-config.ts'),
28
- repo: (0, path_1.join)(hiddenVirmatorDirectory, 'jest', 'jest-config.ts'),
29
- },
30
- [config_key_1.ConfigKey.JestSetup]: {
31
- virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'jest', 'jest-setup.ts'),
32
- repo: (0, path_1.join)(hiddenVirmatorDirectory, 'jest', 'jest-setup.ts'),
33
- },
34
- [config_key_1.ConfigKey.NpmIgnore]: {
35
- virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'npmignore.txt'),
36
- repo: '.npmignore',
37
- },
38
- [config_key_1.ConfigKey.PackageJson]: {
39
- virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, 'package.json'),
40
- repo: 'package.json',
41
- },
42
- [config_key_1.ConfigKey.Prettier]: '.prettierrc.js',
43
- [config_key_1.ConfigKey.PrettierIgnore]: {
44
- virmator: (0, path_1.join)(virmator_repo_paths_1.relativeSeparateConfigsDir, '.prettierignore'),
45
- repo: '.prettierignore',
46
- },
47
- [config_key_1.ConfigKey.TsConfig]: 'tsconfig.json',
48
- [config_key_1.ConfigKey.VsCodeSettings]: (0, path_1.join)('.vscode', 'settings.json'),
49
- };
50
- function getConfigPath(configKey, key) {
51
- const configMap = configFileMap[configKey];
52
- const path = typeof configMap === 'string' ? configMap : configMap[key];
53
- return path;
54
- }
55
- function getRepoConfigFilePath(configKey, extendable) {
56
- return extendable
57
- ? (0, extendable_config_1.getExtendableBaseConfigName)(configKey)
58
- : getConfigPath(configKey, DifferentConfigPathTypes.Repo);
59
- }
60
- exports.getRepoConfigFilePath = getRepoConfigFilePath;
61
- function getVirmatorConfigFilePath(configKey, extender) {
62
- if (extender && !(0, extendable_config_1.isExtendableConfig)(configKey)) {
63
- throw new Error(`Cannot get path for extendable config "${configKey}", this config is not extendable.`);
64
- }
65
- const relativePath = getConfigPath(configKey, DifferentConfigPathTypes.Virmator);
66
- const basePath = extender ? virmator_repo_paths_1.extenderConfigsDir : virmator_repo_paths_1.virmatorRootDir;
67
- return (0, path_1.join)(basePath, relativePath);
68
- }
69
- exports.getVirmatorConfigFilePath = getVirmatorConfigFilePath;
@@ -1,7 +0,0 @@
1
- import { ConfigKey } from './config-key';
2
- export declare function readRepoConfigFile(configKey: ConfigKey, repoDir: string, extendable: boolean): Promise<string>;
3
- /**
4
- * Read the virmator copy of a config file and, in special cases where the configs cannot be
5
- * extended, merges it with the current repo's copy of the config file, when it exists.
6
- */
7
- export declare function readUpdatedVirmatorConfigFile(configKey: ConfigKey, repoDir: string, extendable: boolean): Promise<string>;
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readUpdatedVirmatorConfigFile = exports.readRepoConfigFile = void 0;
4
- const fs_extra_1 = require("fs-extra");
5
- const path_1 = require("path");
6
- const prettier_1 = require("prettier");
7
- const config_key_1 = require("./config-key");
8
- const config_paths_1 = require("./config-paths");
9
- const create_default_package_json_1 = require("./create-default-package-json");
10
- async function readRepoConfigFile(configKey, repoDir, extendable) {
11
- const configPath = (0, path_1.join)(repoDir, (0, config_paths_1.getRepoConfigFilePath)(configKey, extendable));
12
- const fileContents = (await (0, fs_extra_1.readFile)(configPath)).toString();
13
- return fileContents;
14
- }
15
- exports.readRepoConfigFile = readRepoConfigFile;
16
- async function getPrettierConfig() {
17
- try {
18
- return ((await (0, prettier_1.resolveConfig)((0, config_paths_1.getRepoConfigFilePath)(config_key_1.ConfigKey.Prettier, false))) ||
19
- undefined);
20
- }
21
- catch (error) {
22
- return undefined;
23
- }
24
- }
25
- /**
26
- * Read the virmator copy of a config file and, in special cases where the configs cannot be
27
- * extended, merges it with the current repo's copy of the config file, when it exists.
28
- */
29
- async function readUpdatedVirmatorConfigFile(configKey, repoDir, extendable) {
30
- const updatedVirmatorConfigContents = await updateVirmatorConfig(configKey, repoDir, extendable);
31
- const filePath = (0, config_paths_1.getVirmatorConfigFilePath)(configKey, extendable);
32
- const prettierInfo = await (0, prettier_1.getFileInfo)(filePath);
33
- const prettierConfig = await getPrettierConfig();
34
- if (prettierInfo.inferredParser && prettierConfig) {
35
- const formatted = (0, prettier_1.format)(updatedVirmatorConfigContents, {
36
- ...prettierConfig,
37
- filepath: filePath,
38
- });
39
- return formatted;
40
- }
41
- else {
42
- return updatedVirmatorConfigContents;
43
- }
44
- }
45
- exports.readUpdatedVirmatorConfigFile = readUpdatedVirmatorConfigFile;
46
- async function updateVirmatorConfig(configKey, repoDir, extendable) {
47
- const virmatorConfigContents = await readVirmatorConfigFile(configKey, extendable);
48
- switch (configKey) {
49
- // in these special cases we want to merge the config files with what's already in the repo
50
- case config_key_1.ConfigKey.NpmIgnore:
51
- case config_key_1.ConfigKey.GitIgnore:
52
- case config_key_1.ConfigKey.PrettierIgnore:
53
- if (!extendable) {
54
- const repoPath = (0, path_1.join)(repoDir, (0, config_paths_1.getRepoConfigFilePath)(configKey, extendable));
55
- if ((0, fs_extra_1.existsSync)(repoPath)) {
56
- const repoConfigContents = (await (0, fs_extra_1.readFile)(repoPath)).toString();
57
- const repoFileLines = repoConfigContents.split('\n');
58
- const virmatorFileLines = virmatorConfigContents.split('\n');
59
- const filteredRepoFileLines = repoFileLines.filter((repoLine) => !virmatorFileLines.includes(repoLine));
60
- return [
61
- ...virmatorFileLines,
62
- ...filteredRepoFileLines,
63
- ].join('\n');
64
- }
65
- }
66
- break;
67
- case config_key_1.ConfigKey.PackageJson:
68
- if (!extendable) {
69
- const repoPath = (0, path_1.join)(repoDir, (0, config_paths_1.getRepoConfigFilePath)(config_key_1.ConfigKey.PackageJson, false));
70
- const repoPackageJson = (0, fs_extra_1.existsSync)(repoPath)
71
- ? JSON.parse((await (0, fs_extra_1.readFile)(repoPath)).toString())
72
- : {};
73
- const defaultPackageJson = await (0, create_default_package_json_1.createDefaultPackageJson)(repoDir);
74
- return JSON.stringify({
75
- ...defaultPackageJson,
76
- ...repoPackageJson,
77
- scripts: {
78
- ...defaultPackageJson.scripts,
79
- ...(repoPackageJson.scripts ?? {}),
80
- },
81
- });
82
- }
83
- break;
84
- }
85
- return virmatorConfigContents;
86
- }
87
- async function readVirmatorConfigFile(configKey, extendable) {
88
- const filePath = (0, config_paths_1.getVirmatorConfigFilePath)(configKey, extendable);
89
- const virmatorConfigContents = (await (0, fs_extra_1.readFile)(filePath)).toString();
90
- return virmatorConfigContents;
91
- }
@@ -1,12 +0,0 @@
1
- import { ConfigKey } from './config-key';
2
- declare const extendableConfigFileMap: {
3
- readonly Prettier: ".prettierrc-base.js";
4
- readonly Cspell: ".cspell-base.json";
5
- readonly TsConfig: "tsconfig-base.json";
6
- };
7
- export declare type ExtendableConfig = keyof typeof extendableConfigFileMap;
8
- export declare const ExtendableConfig: Record<import("./config-key").CommandConfigKey.Cspell | import("./config-key").CommandConfigKey.Prettier | import("./config-key").CommandConfigKey.TsConfig, import("./config-key").CommandConfigKey.Cspell | import("./config-key").CommandConfigKey.Prettier | import("./config-key").CommandConfigKey.TsConfig>;
9
- export declare function getExtendableBaseConfigName(key: ConfigKey): string;
10
- export declare function isExtendableConfig(ConfigKey?: ConfigKey): ConfigKey is ExtendableConfig;
11
- export declare function isConfigExtending(key: ExtendableConfig, contents: string): boolean;
12
- export {};
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isConfigExtending = exports.isExtendableConfig = exports.getExtendableBaseConfigName = exports.ExtendableConfig = void 0;
4
- const augment_vir_1 = require("augment-vir");
5
- const config_key_1 = require("./config-key");
6
- const extendableConfigFileMap = {
7
- [config_key_1.ConfigKey.Prettier]: '.prettierrc-base.js',
8
- [config_key_1.ConfigKey.Cspell]: '.cspell-base.json',
9
- [config_key_1.ConfigKey.TsConfig]: 'tsconfig-base.json',
10
- };
11
- exports.ExtendableConfig = (0, augment_vir_1.getObjectTypedKeys)(extendableConfigFileMap).reduce((accum, key) => {
12
- accum[key] = key;
13
- return accum;
14
- }, {});
15
- function getExtendableBaseConfigName(key) {
16
- if (!isExtendableConfig(key)) {
17
- throw new Error(`Given config key is not extendable: "${key}"`);
18
- }
19
- return extendableConfigFileMap[key];
20
- }
21
- exports.getExtendableBaseConfigName = getExtendableBaseConfigName;
22
- function isExtendableConfig(ConfigKey) {
23
- if (!ConfigKey) {
24
- return false;
25
- }
26
- return (0, augment_vir_1.isEnumValue)(ConfigKey, exports.ExtendableConfig);
27
- }
28
- exports.isExtendableConfig = isExtendableConfig;
29
- function isConfigExtending(key, contents) {
30
- switch (key) {
31
- case config_key_1.ConfigKey.Prettier: {
32
- const importName = extendableConfigFileMap[config_key_1.ConfigKey.Prettier].replace(/\.js$/, '');
33
- return contents.includes(`${importName}'`);
34
- }
35
- case config_key_1.ConfigKey.Cspell: {
36
- const importLine = `"import": "${extendableConfigFileMap[config_key_1.ConfigKey.Cspell]}"`;
37
- return contents.includes(importLine);
38
- }
39
- case config_key_1.ConfigKey.TsConfig: {
40
- const extendsLine = `"extends": "`;
41
- return contents.includes(extendsLine);
42
- }
43
- }
44
- }
45
- exports.isConfigExtending = isConfigExtending;
@@ -1,4 +0,0 @@
1
- export declare class VirmatorCliCommandError extends Error {
2
- readonly name = "VirmatorCliCommandError";
3
- constructor(message: string);
4
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VirmatorCliCommandError = void 0;
4
- const augment_vir_1 = require("augment-vir");
5
- const cli_command_name_1 = require("../cli/cli-util/cli-command-name");
6
- class VirmatorCliCommandError extends Error {
7
- name = 'VirmatorCliCommandError';
8
- constructor(message) {
9
- super(`${message}\nExpected one of the following: ${(0, augment_vir_1.getEnumTypedValues)(cli_command_name_1.CliCommandName).join(', ')}`);
10
- }
11
- }
12
- exports.VirmatorCliCommandError = VirmatorCliCommandError;
@@ -1,4 +0,0 @@
1
- export declare class CliFlagError extends Error {
2
- readonly name = "CliFlagError";
3
- constructor(invalidFlags: string[]);
4
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CliFlagError = void 0;
4
- const augment_vir_1 = require("augment-vir");
5
- const cli_flags_1 = require("../cli/cli-util/cli-flags");
6
- class CliFlagError extends Error {
7
- name = 'CliFlagError';
8
- constructor(invalidFlags) {
9
- super(`Invalid flags given: ${invalidFlags.join(',')}\nValid flags: ${(0, augment_vir_1.getObjectTypedKeys)(cli_flags_1.defaultCliFlags).join(',')}`);
10
- }
11
- }
12
- exports.CliFlagError = CliFlagError;
@@ -1,3 +0,0 @@
1
- export declare class ConfigFileError extends Error {
2
- readonly name = "ConfigFileError";
3
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigFileError = void 0;
4
- class ConfigFileError extends Error {
5
- name = 'ConfigFileError';
6
- }
7
- exports.ConfigFileError = ConfigFileError;
@@ -1,3 +0,0 @@
1
- import { InitialOptionsTsJest } from 'ts-jest';
2
- export declare const virmatorJestConfig: InitialOptionsTsJest;
3
- export default virmatorJestConfig;
@@ -1,23 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
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,5 +0,0 @@
1
- export declare const virmatorRootDir: string;
2
- export declare const virmatorDistDir: string;
3
- export declare const extenderConfigsDir: string;
4
- export declare const relativeSeparateConfigsDir = "separate-configs";
5
- export declare function getNpmBinPath(command: string): string;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNpmBinPath = exports.relativeSeparateConfigsDir = exports.extenderConfigsDir = exports.virmatorDistDir = exports.virmatorRootDir = void 0;
4
- const node_only_1 = require("augment-vir/dist/node-only");
5
- const fs_1 = require("fs");
6
- const path_1 = require("path");
7
- exports.virmatorRootDir = __dirname.replace(/(?:src|node_modules\/dist|dist).*/, '');
8
- exports.virmatorDistDir = (0, path_1.join)(exports.virmatorRootDir, 'dist');
9
- exports.extenderConfigsDir = (0, path_1.join)(exports.virmatorRootDir, 'extender-configs');
10
- exports.relativeSeparateConfigsDir = 'separate-configs';
11
- const virmatorNodeBin = (0, path_1.join)(exports.virmatorRootDir, 'node_modules', '.bin');
12
- function getNpmBinPath(command) {
13
- const virmatorBinPath = (0, path_1.join)(virmatorNodeBin, command);
14
- const actualBinPath = (0, fs_1.existsSync)(virmatorBinPath)
15
- ? virmatorBinPath
16
- : (0, path_1.join)(exports.virmatorRootDir, '..', '.bin', command);
17
- return (0, node_only_1.interpolationSafeWindowsPath)(actualBinPath);
18
- }
19
- exports.getNpmBinPath = getNpmBinPath;
@@ -1,3 +0,0 @@
1
- import { InitialOptionsTsJest } from 'ts-jest';
2
- declare const virmatorInternalTestingConfig: InitialOptionsTsJest;
3
- export default virmatorInternalTestingConfig;
@@ -1,13 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- {
2
- "import": ".cspell-base.json"
3
- }
@@ -1,3 +0,0 @@
1
- const baseConfig = require('./.prettierrc-base');
2
-
3
- module.exports = {...baseConfig};
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "./tsconfig-base.json"
3
- }
@@ -1,3 +0,0 @@
1
- dist/
2
- node_modules/
3
- package-lock.json
@@ -1,4 +0,0 @@
1
- .DS_Store
2
- node_modules
3
- dist
4
- /Icon?
@@ -1,24 +0,0 @@
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;
@@ -1,12 +0,0 @@
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);
@@ -1,20 +0,0 @@
1
- .cspell-base.json
2
- .cspell.json
3
- .gitattributes
4
- .github/
5
- .gitignore
6
- .prettierignore
7
- .prettierrc.js
8
- .virmator/
9
- .vscode/
10
- *.test.d.ts
11
- *.test.js
12
- *.test.ts
13
- dist/readme-examples/
14
- dist/scripts/
15
- dist/test/
16
- dist/vite/
17
- src/
18
- test-files/
19
- tsconfig-base.json
20
- tsconfig.json
@@ -1,9 +0,0 @@
1
- {
2
- "scripts": {
3
- "format": "virmator format write",
4
- "prepublishOnly": "npm run test:full",
5
- "spellcheck": "virmator spellcheck",
6
- "test": "virmator test",
7
- "test:full": "npm test && npm run spellcheck && virmator format check"
8
- }
9
- }