virmator 3.0.6 → 4.0.1

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 (175) hide show
  1. package/README.md +1 -14
  2. package/base-configs/base-cspell.js +85 -0
  3. package/base-configs/base-mocharc.js +14 -0
  4. package/{configs/.virmator/prettierrc-base.js → base-configs/base-prettierrc.js} +11 -16
  5. package/{configs/.virmator/tsconfig-base.json → base-configs/base-tsconfig.json} +1 -8
  6. package/{configs/.virmator/vite-base.ts → base-configs/base-vite.ts} +0 -0
  7. package/base-configs/test-files-glob.js +5 -0
  8. package/{configs/.virmator → base-configs}/vite-always-reload-plugin.ts +5 -3
  9. package/{configs/.virmator → base-configs}/web-test-runner-base.mjs +4 -5
  10. package/configs/.gitattributes +1 -0
  11. package/configs/.nvmrc +1 -0
  12. package/configs/.prettierignore +1 -1
  13. package/configs/.prettierrc.js +1 -1
  14. package/configs/{.mocharc.js → configs/.mocharc.js} +1 -1
  15. package/configs/{.virmator → configs}/vite.config.ts +1 -1
  16. package/configs/{.virmator → configs}/web-test-runner.config.mjs +1 -1
  17. package/configs/cspell.config.js +9 -0
  18. package/configs/gitignore.txt +1 -0
  19. package/configs/npmignore.txt +1 -0
  20. package/configs/package.json +8 -5
  21. package/configs/tsconfig.json +11 -1
  22. package/cspell.config.js +11 -0
  23. package/dist/{cli → api}/cli-color.d.ts +1 -0
  24. package/dist/{cli → api}/cli-color.js +1 -0
  25. package/dist/api/command/command-configs.d.ts +3 -0
  26. package/dist/api/command/command-configs.js +11 -0
  27. package/dist/api/command/command-description.d.ts +8 -0
  28. package/dist/{cli/cli-command/cli-command-help.js → api/command/command-description.js} +0 -0
  29. package/dist/api/command/command-executor.d.ts +28 -0
  30. package/dist/api/command/command-executor.js +7 -0
  31. package/dist/api/command/command-help.d.ts +8 -0
  32. package/dist/{package-name.js → api/command/command-help.js} +0 -2
  33. package/dist/api/command/command-logging.d.ts +11 -0
  34. package/dist/api/command/command-logging.js +17 -0
  35. package/dist/api/command/command-mapping.d.ts +7 -0
  36. package/dist/api/command/command-mapping.js +10 -0
  37. package/dist/api/command/command-messages.d.ts +1 -0
  38. package/dist/api/command/command-messages.js +10 -0
  39. package/dist/api/command/command-to-help-message.d.ts +9 -0
  40. package/dist/{cli/cli-command/cli-command-to-help-message.js → api/command/command-to-help-message.js} +41 -48
  41. package/dist/api/command/define-command-inputs.d.ts +14 -0
  42. package/dist/api/command/define-command-inputs.js +2 -0
  43. package/dist/api/command/define-command.d.ts +8 -0
  44. package/dist/api/command/define-command.js +25 -0
  45. package/dist/api/config/config-file-definition.d.ts +16 -0
  46. package/dist/api/config/config-file-definition.js +2 -0
  47. package/dist/api/config/config-paths.d.ts +7 -0
  48. package/dist/api/config/config-paths.js +8 -0
  49. package/dist/{cli → api}/config/copy-config.d.ts +5 -4
  50. package/dist/{cli → api}/config/copy-config.js +26 -28
  51. package/dist/api/create-virmator.d.ts +8 -0
  52. package/dist/api/create-virmator.js +65 -0
  53. package/dist/api/run-command/check-npm-deps.d.ts +7 -0
  54. package/dist/api/run-command/check-npm-deps.js +107 -0
  55. package/dist/api/run-command/extract-arguments.d.ts +6 -0
  56. package/dist/api/run-command/extract-arguments.js +37 -0
  57. package/dist/api/run-command/run-command-executor.d.ts +5 -0
  58. package/dist/api/run-command/run-command-executor.js +51 -0
  59. package/dist/api/run-command/run-extended-virmator.d.ts +10 -0
  60. package/dist/api/run-command/run-extended-virmator.js +53 -0
  61. package/dist/{cli/cli-command → api/run-command}/run-shell-command.d.ts +3 -3
  62. package/dist/{cli/cli-command → api/run-command}/run-shell-command.js +3 -3
  63. package/dist/api/virmator-types.d.ts +18 -0
  64. package/dist/api/virmator-types.js +2 -0
  65. package/dist/augments/fs.d.ts +5 -2
  66. package/dist/augments/fs.js +20 -8
  67. package/dist/augments/object.d.ts +3 -0
  68. package/dist/augments/object.js +33 -2
  69. package/dist/augments/path.d.ts +1 -0
  70. package/dist/augments/path.js +14 -0
  71. package/dist/augments/prettier.d.ts +1 -0
  72. package/dist/augments/prettier.js +53 -0
  73. package/dist/augments/string.d.ts +2 -0
  74. package/dist/augments/string.js +10 -0
  75. package/dist/augments/test.d.ts +2 -1
  76. package/dist/augments/test.js +7 -3
  77. package/dist/cli.d.ts +2 -0
  78. package/dist/cli.js +5 -0
  79. package/dist/{cli/cli-command-implementations → commands}/code-in-markdown.command.d.ts +3 -1
  80. package/dist/{cli/cli-command-implementations → commands}/code-in-markdown.command.js +23 -24
  81. package/dist/commands/compile.command.d.ts +14 -0
  82. package/dist/commands/compile.command.js +54 -0
  83. package/dist/commands/extra-configs/all-extra-configs.d.ts +2 -0
  84. package/dist/commands/extra-configs/all-extra-configs.js +45 -0
  85. package/dist/commands/extra-configs/combine-json-config.d.ts +2 -0
  86. package/dist/commands/extra-configs/combine-json-config.js +22 -0
  87. package/dist/commands/extra-configs/combine-text-config.d.ts +2 -0
  88. package/dist/{cli/config → commands/extra-configs}/combine-text-config.js +5 -5
  89. package/dist/{cli/config → commands/extra-configs}/create-default-package-json.d.ts +0 -0
  90. package/dist/{cli/config → commands/extra-configs}/create-default-package-json.js +27 -18
  91. package/dist/commands/format.command.d.ts +19 -0
  92. package/dist/{cli/cli-command-implementations → commands}/format.command.js +59 -33
  93. package/dist/commands/frontend.command.d.ts +15 -0
  94. package/dist/commands/frontend.command.js +78 -0
  95. package/dist/commands/init.command.d.ts +8 -0
  96. package/dist/commands/init.command.js +53 -0
  97. package/dist/commands/spellcheck.command.d.ts +12 -0
  98. package/dist/commands/spellcheck.command.js +54 -0
  99. package/dist/commands/test-web.command.d.ts +12 -0
  100. package/dist/commands/test-web.command.js +69 -0
  101. package/dist/commands/test.command.d.ts +12 -0
  102. package/dist/commands/test.command.js +67 -0
  103. package/dist/{cli/cli-command-implementations → commands}/update-configs.command.d.ts +3 -1
  104. package/dist/{cli/cli-command-implementations → commands}/update-configs.command.js +14 -10
  105. package/dist/file-paths/{virmator-package-paths.d.ts → package-paths.d.ts} +1 -1
  106. package/dist/file-paths/{virmator-package-paths.js → package-paths.js} +3 -4
  107. package/dist/index.d.ts +134 -1
  108. package/dist/index.js +55 -0
  109. package/dist/scripts/save-help-message.d.ts +1 -0
  110. package/dist/scripts/save-help-message.js +33 -0
  111. package/package.json +28 -22
  112. package/.gitattributes +0 -1
  113. package/.github/workflows/virmator-build-for-gh-pages.yml +0 -24
  114. package/.github/workflows/virmator-tagged-release.yml +0 -42
  115. package/.github/workflows/virmator-tests.yml +0 -26
  116. package/.mocharc.js +0 -9
  117. package/.prettierignore +0 -5
  118. package/configs/.cspell.json +0 -4
  119. package/configs/.virmator/.cspell-base.json +0 -81
  120. package/configs/.virmator/mocharc-base.js +0 -15
  121. package/configs/src/global.d.ts +0 -5
  122. package/dist/api/virmator-wrapper.d.ts +0 -5
  123. package/dist/api/virmator-wrapper.js +0 -9
  124. package/dist/cli/all-cli-command-definitions.d.ts +0 -56
  125. package/dist/cli/all-cli-command-definitions.js +0 -76
  126. package/dist/cli/cli-command/cli-command-help.d.ts +0 -8
  127. package/dist/cli/cli-command/cli-command-to-help-message.d.ts +0 -11
  128. package/dist/cli/cli-command/define-cli-command.d.ts +0 -41
  129. package/dist/cli/cli-command/define-cli-command.js +0 -29
  130. package/dist/cli/cli-command-implementations/compile.command.d.ts +0 -6
  131. package/dist/cli/cli-command-implementations/compile.command.js +0 -44
  132. package/dist/cli/cli-command-implementations/format.command.d.ts +0 -6
  133. package/dist/cli/cli-command-implementations/frontend.command.d.ts +0 -7
  134. package/dist/cli/cli-command-implementations/frontend.command.js +0 -45
  135. package/dist/cli/cli-command-implementations/init.command.d.ts +0 -6
  136. package/dist/cli/cli-command-implementations/init.command.js +0 -42
  137. package/dist/cli/cli-command-implementations/spellcheck.command.d.ts +0 -4
  138. package/dist/cli/cli-command-implementations/spellcheck.command.js +0 -40
  139. package/dist/cli/cli-command-implementations/test-web.command.d.ts +0 -4
  140. package/dist/cli/cli-command-implementations/test-web.command.js +0 -50
  141. package/dist/cli/cli-command-implementations/test.command.d.ts +0 -4
  142. package/dist/cli/cli-command-implementations/test.command.js +0 -53
  143. package/dist/cli/cli-flags/cli-flag-name.d.ts +0 -4
  144. package/dist/cli/cli-flags/cli-flag-name.js +0 -8
  145. package/dist/cli/cli-flags/cli-flag-values.d.ts +0 -4
  146. package/dist/cli/cli-flags/cli-flag-values.js +0 -19
  147. package/dist/cli/cli-messages.d.ts +0 -6
  148. package/dist/cli/cli-messages.js +0 -19
  149. package/dist/cli/cli.d.ts +0 -2
  150. package/dist/cli/cli.js +0 -54
  151. package/dist/cli/config/combine-text-config.d.ts +0 -2
  152. package/dist/cli/config/config-files.d.ts +0 -133
  153. package/dist/cli/config/config-files.js +0 -138
  154. package/dist/cli/is-global.d.ts +0 -1
  155. package/dist/cli/is-global.js +0 -10
  156. package/dist/cli/parse-arguments.d.ts +0 -8
  157. package/dist/cli/parse-arguments.js +0 -42
  158. package/dist/cli/run-cli-command.d.ts +0 -13
  159. package/dist/cli/run-cli-command.js +0 -52
  160. package/dist/cli/run-command.test-helper.d.ts +0 -28
  161. package/dist/cli/run-command.test-helper.js +0 -87
  162. package/dist/errors/virmator-cli.error.d.ts +0 -3
  163. package/dist/errors/virmator-cli.error.js +0 -10
  164. package/dist/errors/virmator-config-file.error.d.ts +0 -4
  165. package/dist/errors/virmator-config-file.error.js +0 -11
  166. package/dist/errors/virmator-invalid-command.error.d.ts +0 -5
  167. package/dist/errors/virmator-invalid-command.error.js +0 -11
  168. package/dist/errors/virmator-invalid-flags.error.d.ts +0 -5
  169. package/dist/errors/virmator-invalid-flags.error.js +0 -13
  170. package/dist/file-paths/repo-paths.d.ts +0 -2
  171. package/dist/file-paths/repo-paths.js +0 -6
  172. package/dist/file-paths/virmator-test-file-paths.d.ts +0 -44
  173. package/dist/logging.d.ts +0 -10
  174. package/dist/logging.js +0 -9
  175. package/dist/package-name.d.ts +0 -1
@@ -1,81 +0,0 @@
1
- {
2
- "globRoot": "..",
3
- "ignorePaths": [
4
- ".DS_Store",
5
- ".git/",
6
- "dist/",
7
- "coverage/",
8
- "node_modules/",
9
- "package-lock.json",
10
- ".cspell-base.json",
11
- ".cspell.json"
12
- ],
13
- "version": "0.2",
14
- "words": [
15
- "accum",
16
- "argb",
17
- "autofix",
18
- "autofixable",
19
- "autofixing",
20
- "browserconfig",
21
- "combinator",
22
- "combinators",
23
- "config's",
24
- "cpsell",
25
- "derp",
26
- "derpy",
27
- "electrovir",
28
- "entrypoint",
29
- "entrypoints",
30
- "esbenp",
31
- "esbuild",
32
- "esbuild",
33
- "estree",
34
- "fleek",
35
- "gitattributes",
36
- "globbing",
37
- "globstar",
38
- "inconsolata",
39
- "lexend",
40
- "lfsr",
41
- "locationchange",
42
- "marvinpinto",
43
- "mmultiline",
44
- "mocharc",
45
- "monospace",
46
- "msapplication",
47
- "mstile",
48
- "nojekyll",
49
- "noopener",
50
- "noreferrer",
51
- "npmignore",
52
- "packagejson",
53
- "parens",
54
- "pdfs",
55
- "postupgrade",
56
- "prettierignore",
57
- "prettierrc",
58
- "preupgrade",
59
- "protobuf",
60
- "pushstate",
61
- "replacestate",
62
- "repo's",
63
- "repos",
64
- "rgba",
65
- "stackoverflow",
66
- "stylelint",
67
- "stylelintrc",
68
- "tabbable",
69
- "tabindex",
70
- "thingie",
71
- "threejs",
72
- "transpiled",
73
- "transpiling",
74
- "typeof",
75
- "virmator's",
76
- "virmator",
77
- "vite",
78
- "vitejs",
79
- "xlink"
80
- ]
81
- }
@@ -1,15 +0,0 @@
1
- const allTestFiles = 'src/**/!(*.type).test.ts?(x)';
2
- const isTestingOtherFiles = process.argv.some((arg) => arg.match(/\.tsx?$/));
3
-
4
- /** @type {import('mocha').MochaOptions} */
5
- const mochaConfig = {
6
- checkLeaks: true,
7
- color: true,
8
- parallel: true,
9
- require: 'ts-node/register',
10
- slow: '1500', // ms
11
- timeout: '60000', // ms
12
- ...(isTestingOtherFiles ? {} : {spec: allTestFiles}),
13
- };
14
-
15
- module.exports = mochaConfig;
@@ -1,5 +0,0 @@
1
- /** This file helps ensure that test calls are imported from the correct package. */
2
-
3
- declare var it: "Don't use this directly, instead import it from Mocha.";
4
- declare var expect: "Don't use this directly, instead import this from Chai.";
5
- declare var describe: "Don't use this directly, instead import describe from Mocha.";
@@ -1,5 +0,0 @@
1
- /**
2
- * Creates a wrapped instance of virmator from which all its CLI commands can be called. Arguments
3
- * can be passed in to
4
- */
5
- export declare function createVirmatorWrapper(): void;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createVirmatorWrapper = void 0;
4
- /**
5
- * Creates a wrapped instance of virmator from which all its CLI commands can be called. Arguments
6
- * can be passed in to
7
- */
8
- function createVirmatorWrapper() { }
9
- exports.createVirmatorWrapper = createVirmatorWrapper;
@@ -1,56 +0,0 @@
1
- import { ArrayElement } from 'augment-vir';
2
- import { CliCommandDefinition } from './cli-command/define-cli-command';
3
- declare const allCommandsArray: readonly [CliCommandDefinition<{
4
- commandName: "code-in-markdown";
5
- subCommandDescriptions: {
6
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
7
- };
8
- }>, CliCommandDefinition<{
9
- commandName: "compile";
10
- subCommandDescriptions: {
11
- readonly check: "Run type checking without emitting compiled files.";
12
- };
13
- }>, CliCommandDefinition<{
14
- commandName: "help";
15
- subCommandDescriptions: {};
16
- }>, CliCommandDefinition<{
17
- commandName: "format";
18
- subCommandDescriptions: {
19
- readonly check: "check formatting without overwriting files.";
20
- };
21
- }>, CliCommandDefinition<{
22
- commandName: "spellcheck";
23
- subCommandDescriptions: {};
24
- }>, CliCommandDefinition<{
25
- commandName: "test";
26
- subCommandDescriptions: {};
27
- }>, CliCommandDefinition<{
28
- commandName: "test-web";
29
- subCommandDescriptions: {};
30
- }>, CliCommandDefinition<{
31
- commandName: "init";
32
- subCommandDescriptions: {
33
- readonly force: "force overwrite files even if they already exist.";
34
- };
35
- }>, CliCommandDefinition<{
36
- commandName: "update-configs";
37
- subCommandDescriptions: {};
38
- }>, CliCommandDefinition<{
39
- commandName: "frontend";
40
- subCommandDescriptions: {
41
- readonly build: "Builds and bundles the frontend for deployment.";
42
- readonly preview: "Builds and previews the built output.";
43
- };
44
- }>];
45
- export declare type BuiltInCommandName = ArrayElement<typeof allCommandsArray>['commandName'];
46
- export declare const builtInCliCommandDefinitions: Readonly<Record<"code-in-markdown" | "compile" | "format" | "test" | "frontend" | "init" | "spellcheck" | "test-web" | "update-configs" | "help", CliCommandDefinition<Readonly<{
47
- commandName: string;
48
- subCommandDescriptions: Readonly<Record<string, string>>;
49
- }>>>>;
50
- export declare const allCliCommandDefinitions: Record<string, CliCommandDefinition<Readonly<{
51
- commandName: string;
52
- subCommandDescriptions: Readonly<Record<string, string>>;
53
- }>>>;
54
- export declare const builtInCommandNames: Record<BuiltInCommandName, BuiltInCommandName>;
55
- export declare const allowedInGlobalInstallation: Set<"code-in-markdown" | "compile" | "format" | "test" | "frontend" | "init" | "spellcheck" | "test-web" | "update-configs" | "help">;
56
- export {};
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.allowedInGlobalInstallation = exports.builtInCommandNames = exports.allCliCommandDefinitions = exports.builtInCliCommandDefinitions = void 0;
4
- const augment_vir_1 = require("augment-vir");
5
- const code_in_markdown_command_1 = require("./cli-command-implementations/code-in-markdown.command");
6
- const compile_command_1 = require("./cli-command-implementations/compile.command");
7
- const format_command_1 = require("./cli-command-implementations/format.command");
8
- const frontend_command_1 = require("./cli-command-implementations/frontend.command");
9
- const init_command_1 = require("./cli-command-implementations/init.command");
10
- const spellcheck_command_1 = require("./cli-command-implementations/spellcheck.command");
11
- const test_web_command_1 = require("./cli-command-implementations/test-web.command");
12
- const test_command_1 = require("./cli-command-implementations/test.command");
13
- const update_configs_command_1 = require("./cli-command-implementations/update-configs.command");
14
- const cli_command_to_help_message_1 = require("./cli-command/cli-command-to-help-message");
15
- const define_cli_command_1 = require("./cli-command/define-cli-command");
16
- function createUnimplementedCommand(commandName) {
17
- return (0, define_cli_command_1.defineCliCommand)({
18
- commandName,
19
- subCommandDescriptions: {},
20
- }, () => {
21
- return {
22
- sections: [
23
- {
24
- content: 'This command has not been implemented yet',
25
- title: '',
26
- },
27
- ],
28
- examples: [],
29
- };
30
- }, () => {
31
- throw new Error(`The "${commandName}" command has not been implemented yet.`);
32
- });
33
- }
34
- const helpCommandDefinition = (0, define_cli_command_1.defineCliCommand)({
35
- commandName: 'help',
36
- subCommandDescriptions: {},
37
- }, () => {
38
- return {
39
- sections: [
40
- {
41
- title: '',
42
- content: 'Prints this help output.',
43
- },
44
- ],
45
- examples: [],
46
- };
47
- }, (inputs) => {
48
- inputs.logging.stdout((0, cli_command_to_help_message_1.wrapLines)((0, cli_command_to_help_message_1.generateHelpMessage)(exports.allCliCommandDefinitions, cli_command_to_help_message_1.MessageSyntax.Bash), 100));
49
- return {
50
- fullExecutedCommand: '',
51
- success: true,
52
- };
53
- });
54
- const allCommandsArray = [
55
- code_in_markdown_command_1.codeInMarkdownCommandDefinition,
56
- compile_command_1.compileCommandDefinition,
57
- helpCommandDefinition,
58
- format_command_1.formatCommandDefinition,
59
- spellcheck_command_1.spellcheckCommandDefinition,
60
- test_command_1.testCommandDefinition,
61
- test_web_command_1.testWebCommandDefinition,
62
- init_command_1.initCommandDefinition,
63
- update_configs_command_1.updateConfigsCommandDefinition,
64
- frontend_command_1.frontendCommandDefinition,
65
- // createUnimplementedCommand('publish'),
66
- ];
67
- exports.builtInCliCommandDefinitions = allCommandsArray.reduce((accum, entry) => {
68
- accum[entry.commandName] = entry;
69
- return accum;
70
- }, {});
71
- exports.allCliCommandDefinitions = exports.builtInCliCommandDefinitions;
72
- exports.builtInCommandNames = (0, augment_vir_1.mapObject)(exports.builtInCliCommandDefinitions, (key) => key);
73
- exports.allowedInGlobalInstallation = new Set([
74
- helpCommandDefinition,
75
- init_command_1.initCommandDefinition,
76
- ].map((commandDefinition) => commandDefinition.commandName));
@@ -1,8 +0,0 @@
1
- export declare type CliHelpSection = Readonly<{
2
- title: string;
3
- content: string;
4
- }>;
5
- export declare type CliCommandDescription = Readonly<{
6
- sections: Readonly<CliHelpSection[]>;
7
- examples: Readonly<CliHelpSection[]>;
8
- }>;
@@ -1,11 +0,0 @@
1
- import { CliCommandDefinition } from './define-cli-command';
2
- export declare function generateHelpMessage(commandDefinitions: Record<string, CliCommandDefinition>, syntax: MessageSyntax): string;
3
- export declare enum MessageSyntax {
4
- Bash = "bash",
5
- Markdown = "markdown"
6
- }
7
- export declare function flagToHelpString(flagName: string, description: string, syntax: MessageSyntax): string;
8
- export declare function commandToHelpString(commandDefinition: CliCommandDefinition, syntax: MessageSyntax): string;
9
- export declare function combineHelpMessage(flagsText: string, commandsText: string, syntax: MessageSyntax): string;
10
- export declare function getIndent(line: string): string;
11
- export declare function wrapLines(input: string, limit: number): string;
@@ -1,41 +0,0 @@
1
- import { CliLogging } from '../../logging';
2
- import { CliCommandDescription } from './cli-command-help';
3
- export declare type CliCommandExecutorInputs<InputsGeneric extends DefineCliCommandInputs = DefineCliCommandInputs> = {
4
- filteredInputArgs: string[];
5
- inputSubCommands: (keyof InputsGeneric['subCommandDescriptions'])[];
6
- repoDir: string;
7
- logging: CliLogging;
8
- };
9
- export declare type FullCliCommandExecutorInputs<InputsGeneric extends DefineCliCommandInputs> = {
10
- filteredInputArgs: string[];
11
- inputSubCommands: (keyof InputsGeneric['subCommandDescriptions'])[];
12
- repoDir: string;
13
- logging: CliLogging;
14
- } & SharedExecutorInputsAndCommandDefinition<InputsGeneric>;
15
- export declare type CliCommandExecutor<InputsGeneric extends DefineCliCommandInputs> = (inputs: CliCommandExecutorInputs<InputsGeneric>) => Promise<CliCommandExecutorOutput> | CliCommandExecutorOutput;
16
- export declare type FullCliCommandExecutor<InputsGeneric extends DefineCliCommandInputs> = (inputs: FullCliCommandExecutorInputs<InputsGeneric>) => Promise<CliCommandExecutorOutput> | CliCommandExecutorOutput;
17
- export declare type CliCommandExecutorOutput = {
18
- fullExecutedCommand: string;
19
- success: boolean;
20
- };
21
- export declare type DefineCliCommandInputs<CommandName extends string = string> = Readonly<{
22
- commandName: CommandName;
23
- subCommandDescriptions: Readonly<Record<string, string>>;
24
- }>;
25
- declare type SubCommandsMap<InputsGeneric extends DefineCliCommandInputs> = {
26
- [Prop in keyof InputsGeneric['subCommandDescriptions']]: Prop;
27
- };
28
- declare type SharedExecutorInputsAndCommandDefinition<InputsGeneric extends DefineCliCommandInputs> = InputsGeneric & {
29
- allAvailableSubCommands: (keyof InputsGeneric['subCommandDescriptions'])[];
30
- subCommands: SubCommandsMap<InputsGeneric>;
31
- };
32
- export declare type CliCommandDefinition<InputsGeneric extends DefineCliCommandInputs = DefineCliCommandInputs> = SharedExecutorInputsAndCommandDefinition<InputsGeneric> & {
33
- executor: CliCommandExecutor<InputsGeneric>;
34
- commandDescription: CliCommandDescription;
35
- };
36
- declare type CreateDescriptionsInputs<InputsGeneric extends DefineCliCommandInputs> = Pick<InputsGeneric, 'commandName'> & {
37
- subCommands: SubCommandsMap<InputsGeneric>;
38
- };
39
- declare type CreateDescriptionsCallback<InputsGeneric extends DefineCliCommandInputs> = (inputs: CreateDescriptionsInputs<InputsGeneric>) => CliCommandDescription;
40
- export declare function defineCliCommand<InputsGeneric extends DefineCliCommandInputs>(inputs: Readonly<InputsGeneric>, createDescription: CreateDescriptionsCallback<InputsGeneric>, inputExecutor: FullCliCommandExecutor<InputsGeneric>): CliCommandDefinition<InputsGeneric>;
41
- export {};
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defineCliCommand = void 0;
4
- const augment_vir_1 = require("augment-vir");
5
- function defineCliCommand(inputs, createDescription, inputExecutor) {
6
- const allAvailableSubCommands = (0, augment_vir_1.getObjectTypedKeys)(inputs.subCommandDescriptions);
7
- const subCommands = (0, augment_vir_1.mapObject)(inputs.subCommandDescriptions, (key) => key);
8
- const init = {
9
- ...inputs,
10
- allAvailableSubCommands,
11
- subCommands,
12
- };
13
- const executor = (executorInputs) => {
14
- return inputExecutor({
15
- ...executorInputs,
16
- ...init,
17
- });
18
- };
19
- const commandDescription = createDescription({
20
- commandName: init.commandName,
21
- subCommands: init.subCommands,
22
- });
23
- return {
24
- ...init,
25
- commandDescription,
26
- executor,
27
- };
28
- }
29
- exports.defineCliCommand = defineCliCommand;
@@ -1,6 +0,0 @@
1
- export declare const compileCommandDefinition: import("../cli-command/define-cli-command").CliCommandDefinition<{
2
- commandName: "compile";
3
- subCommandDescriptions: {
4
- readonly check: "Run type checking without emitting compiled files.";
5
- };
6
- }>;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compileCommandDefinition = void 0;
4
- const virmator_package_paths_1 = require("../../file-paths/virmator-package-paths");
5
- const package_name_1 = require("../../package-name");
6
- const define_cli_command_1 = require("../cli-command/define-cli-command");
7
- const run_shell_command_1 = require("../cli-command/run-shell-command");
8
- exports.compileCommandDefinition = (0, define_cli_command_1.defineCliCommand)({
9
- commandName: 'compile',
10
- subCommandDescriptions: {
11
- check: 'Run type checking without emitting compiled files.',
12
- },
13
- }, ({ commandName }) => {
14
- return {
15
- sections: [
16
- {
17
- title: '',
18
- content: `compile typescript files
19
- Pass any extra tsc flags to this command.`,
20
- },
21
- ],
22
- examples: [
23
- {
24
- title: `no extra flags`,
25
- content: `${package_name_1.packageName} ${commandName}`,
26
- },
27
- {
28
- title: `one extra flag`,
29
- content: `${package_name_1.packageName} ${commandName} --noEmit`,
30
- },
31
- ],
32
- };
33
- }, async (inputs) => {
34
- const shouldNotEmit = inputs.filteredInputArgs.join(' ').includes('--noEmit') ||
35
- inputs.inputSubCommands.includes(inputs.subCommands.check);
36
- const resetCommand = shouldNotEmit ? '' : 'rm -rf dist && ';
37
- const noEmit = shouldNotEmit ? ' --noEmit' : '';
38
- const compileCommand = `${resetCommand}${(0, virmator_package_paths_1.getNpmBinPath)('tsc')} --pretty ${noEmit}${inputs.filteredInputArgs.map((arg) => `"${arg}"`).join(' ')}`;
39
- const results = await (0, run_shell_command_1.runVirmatorShellCommand)(compileCommand, inputs);
40
- return {
41
- fullExecutedCommand: compileCommand,
42
- success: !results.exitCode,
43
- };
44
- });
@@ -1,6 +0,0 @@
1
- export declare const formatCommandDefinition: import("../cli-command/define-cli-command").CliCommandDefinition<{
2
- commandName: "format";
3
- subCommandDescriptions: {
4
- readonly check: "check formatting without overwriting files.";
5
- };
6
- }>;
@@ -1,7 +0,0 @@
1
- export declare const frontendCommandDefinition: import("../cli-command/define-cli-command").CliCommandDefinition<{
2
- commandName: "frontend";
3
- subCommandDescriptions: {
4
- readonly build: "Builds and bundles the frontend for deployment.";
5
- readonly preview: "Builds and previews the built output.";
6
- };
7
- }>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.frontendCommandDefinition = void 0;
4
- const virmator_package_paths_1 = require("../../file-paths/virmator-package-paths");
5
- const define_cli_command_1 = require("../cli-command/define-cli-command");
6
- const run_shell_command_1 = require("../cli-command/run-shell-command");
7
- const config_files_1 = require("../config/config-files");
8
- exports.frontendCommandDefinition = (0, define_cli_command_1.defineCliCommand)({
9
- commandName: 'frontend',
10
- subCommandDescriptions: {
11
- build: 'Builds and bundles the frontend for deployment.',
12
- preview: 'Builds and previews the built output.',
13
- },
14
- }, () => {
15
- return {
16
- sections: [
17
- {
18
- title: '',
19
- content: `Runs a frontend. Currently uses vite.`,
20
- },
21
- ],
22
- examples: [],
23
- };
24
- }, async (inputs) => {
25
- const vitePath = (0, virmator_package_paths_1.getNpmBinPath)('vite');
26
- const joinedArgs = inputs.filteredInputArgs.join(' ');
27
- const useDefaultConfigArgs = !joinedArgs.includes('--config');
28
- const configString = useDefaultConfigArgs
29
- ? `--config ${(0, config_files_1.getCopyToPath)(config_files_1.configFiles.vite, inputs.repoDir)}`
30
- : '';
31
- let viteCommand = `${vitePath} --force ${configString} ${joinedArgs}`;
32
- // insert the build command in either sub command
33
- if (inputs.inputSubCommands.length) {
34
- viteCommand = `rm -rf dist && ${vitePath} build ${configString} ${joinedArgs} && cp dist/index.html dist/404.html`;
35
- }
36
- if (inputs.inputSubCommands.includes('preview')) {
37
- const hostString = joinedArgs.includes('--host') ? '' : `--host`;
38
- viteCommand += ` && ${vitePath} preview ${configString} ${joinedArgs} ${hostString}`;
39
- }
40
- const results = await (0, run_shell_command_1.runVirmatorShellCommand)(viteCommand, inputs);
41
- return {
42
- fullExecutedCommand: viteCommand,
43
- success: !results.error,
44
- };
45
- });
@@ -1,6 +0,0 @@
1
- export declare const initCommandDefinition: import("../cli-command/define-cli-command").CliCommandDefinition<{
2
- commandName: "init";
3
- subCommandDescriptions: {
4
- readonly force: "force overwrite files even if they already exist.";
5
- };
6
- }>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initCommandDefinition = void 0;
4
- const package_name_1 = require("../../package-name");
5
- const define_cli_command_1 = require("../cli-command/define-cli-command");
6
- const config_files_1 = require("../config/config-files");
7
- const copy_config_1 = require("../config/copy-config");
8
- exports.initCommandDefinition = (0, define_cli_command_1.defineCliCommand)({
9
- commandName: 'init',
10
- subCommandDescriptions: {
11
- force: 'force overwrite files even if they already exist.',
12
- },
13
- }, ({ commandName, subCommands }) => {
14
- return {
15
- sections: [
16
- {
17
- title: '',
18
- content: `Initialize a repo with all virmator config files.`,
19
- },
20
- ],
21
- examples: [
22
- {
23
- title: 'run init and force all configs to be written',
24
- content: `${package_name_1.packageName} ${commandName} ${subCommands.force}`,
25
- },
26
- ],
27
- };
28
- }, async (inputs) => {
29
- const copyStyle = inputs.inputSubCommands.includes(inputs.subCommands.force)
30
- ? copy_config_1.CopyConfigOperation.Overwrite
31
- : copy_config_1.CopyConfigOperation.Init;
32
- const success = await (0, copy_config_1.copyAllConfigFiles)({
33
- configFiles: config_files_1.configFiles,
34
- logging: inputs.logging,
35
- operation: copyStyle,
36
- repoDir: inputs.repoDir,
37
- });
38
- return {
39
- fullExecutedCommand: '',
40
- success: success,
41
- };
42
- });
@@ -1,4 +0,0 @@
1
- export declare const spellcheckCommandDefinition: import("../cli-command/define-cli-command").CliCommandDefinition<{
2
- commandName: "spellcheck";
3
- subCommandDescriptions: {};
4
- }>;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.spellcheckCommandDefinition = void 0;
4
- const virmator_package_paths_1 = require("../../file-paths/virmator-package-paths");
5
- const define_cli_command_1 = require("../cli-command/define-cli-command");
6
- const run_shell_command_1 = require("../cli-command/run-shell-command");
7
- function spellcheckLogTransform(log) {
8
- return log.replace(/\r/g, '\n').replace(/\n$/, '');
9
- }
10
- exports.spellcheckCommandDefinition = (0, define_cli_command_1.defineCliCommand)({
11
- commandName: 'spellcheck',
12
- subCommandDescriptions: {},
13
- }, () => {
14
- return {
15
- sections: [
16
- {
17
- title: '',
18
- content: `Spellcheck code with cspell. By default this spellchecks every file in the entire repo (except for those ignored in the config file), including .dot files. If any arguments are passed to this command, the default cspell args that this command applies are ignored, you'll have to supply them via your args.`,
19
- },
20
- ],
21
- examples: [],
22
- };
23
- }, async (inputs) => {
24
- const cSpellPath = (0, virmator_package_paths_1.getNpmBinPath)('cspell');
25
- const extraArgs = inputs.filteredInputArgs.join(' ');
26
- const containsNonFlagArgs = inputs.filteredInputArgs.some((arg) => !arg.startsWith('-'));
27
- const args = containsNonFlagArgs ? '' : '"**/*"';
28
- const spellcheckCommand = `${cSpellPath} --color --unique --no-progress --relative --dot ${extraArgs} ${args}`;
29
- const results = await (0, run_shell_command_1.runVirmatorShellCommand)(spellcheckCommand, {
30
- ...inputs,
31
- logTransforms: {
32
- stderr: spellcheckLogTransform,
33
- stdout: spellcheckLogTransform,
34
- },
35
- });
36
- return {
37
- fullExecutedCommand: spellcheckCommand,
38
- success: !results.exitCode,
39
- };
40
- });
@@ -1,4 +0,0 @@
1
- export declare const testWebCommandDefinition: import("../cli-command/define-cli-command").CliCommandDefinition<{
2
- commandName: "test-web";
3
- subCommandDescriptions: {};
4
- }>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.testWebCommandDefinition = void 0;
4
- const path_1 = require("path");
5
- const virmator_package_paths_1 = require("../../file-paths/virmator-package-paths");
6
- const package_name_1 = require("../../package-name");
7
- const define_cli_command_1 = require("../cli-command/define-cli-command");
8
- const run_shell_command_1 = require("../cli-command/run-shell-command");
9
- const config_files_1 = require("../config/config-files");
10
- const test_command_1 = require("./test.command");
11
- exports.testWebCommandDefinition = (0, define_cli_command_1.defineCliCommand)({
12
- commandName: 'test-web',
13
- subCommandDescriptions: {},
14
- }, ({ commandName }) => {
15
- return {
16
- sections: [
17
- {
18
- title: '',
19
- content: `Runs tests within browsers rather than inside of Node.js. Test files fed into this command cannot be mixed with test files run by the "${package_name_1.packageName} ${test_command_1.testCommandDefinition.commandName}" command, as the run-time environment is quite different (Node.js vs browser). However, just like the ${test_command_1.testCommandDefinition.commandName} command, this command will all ".test.ts" files in the current directory (recursively) that are not ".type.test.ts" files. To override this behavior, override the "files" property in ${(0, path_1.basename)(config_files_1.configFiles.webTestRunner.path)}.`,
20
- },
21
- {
22
- title: '',
23
- content: `By default this command runs all tests three times: in Chromium (Chrome), Firefox, and Webkit (Safari) using playwright.`,
24
- },
25
- ],
26
- examples: [
27
- {
28
- title: 'Test all .test.ts and .test.tsx files',
29
- content: `${package_name_1.packageName} ${commandName}`,
30
- },
31
- {
32
- title: 'Test a specific file',
33
- content: `${package_name_1.packageName} ${commandName} path/to/file.test.ts`,
34
- },
35
- ],
36
- };
37
- }, async (inputs) => {
38
- const webTestRunnerPath = (0, virmator_package_paths_1.getNpmBinPath)('web-test-runner');
39
- const joinedArgs = inputs.filteredInputArgs.join(' ');
40
- const shouldUseConfig = !joinedArgs.includes('--config');
41
- const configString = shouldUseConfig
42
- ? `--config ./.virmator/web-test-runner.config.mjs`
43
- : '';
44
- const testCommand = `${webTestRunnerPath} --color ${configString} ${joinedArgs}`;
45
- const results = await (0, run_shell_command_1.runVirmatorShellCommand)(testCommand, inputs);
46
- return {
47
- fullExecutedCommand: testCommand,
48
- success: !results.exitCode,
49
- };
50
- });
@@ -1,4 +0,0 @@
1
- export declare const testCommandDefinition: import("../cli-command/define-cli-command").CliCommandDefinition<{
2
- commandName: "test";
3
- subCommandDescriptions: {};
4
- }>;