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
package/README.md CHANGED
@@ -26,16 +26,6 @@ Below is full documentation for the cli, which is generated via the cli's `help`
26
26
 
27
27
  `npx` is needed when the command is run directly from the terminal (not scoped within an npm script) unless the package has been globally installed (which will work just fine but I wouldn't recommend, simply because I prefer explicit dependencies).
28
28
 
29
- # Available flags
30
-
31
- ## `--help`
32
-
33
- Prints this help message.
34
-
35
- ## `--silent`
36
-
37
- Turns off most logging.
38
-
39
29
  # Available commands
40
30
 
41
31
  ## code-in-markdown
@@ -118,16 +108,13 @@ Builds and bundles the frontend for deployment.
118
108
 
119
109
  Builds and previews the built output.
120
110
 
121
- ## help
122
-
123
- Prints this help output.
124
-
125
111
  ## init
126
112
 
127
113
  Initialize a repo with all virmator config files.
128
114
 
129
115
  ### Examples
130
116
 
117
+ - run init: `virmator init`
131
118
  - run init and force all configs to be written: `virmator init force`
132
119
 
133
120
  ### force
@@ -0,0 +1,85 @@
1
+ const baseConfig = {
2
+ ignorePaths: [
3
+ '.DS_Store',
4
+ '.git/',
5
+ '*.sqlite',
6
+ '*.tgz',
7
+ 'coverage/',
8
+ 'dist/',
9
+ 'node_modules/',
10
+ 'package-lock.json',
11
+ ],
12
+ version: '0.2',
13
+ words: [
14
+ 'accum',
15
+ 'argb',
16
+ 'autofix',
17
+ 'autofixable',
18
+ 'autofixing',
19
+ 'browserconfig',
20
+ 'combinator',
21
+ 'combinators',
22
+ 'cpsell',
23
+ 'derp',
24
+ 'derpy',
25
+ 'electrovir',
26
+ 'entrypoint',
27
+ 'entrypoints',
28
+ 'esbenp',
29
+ 'esbuild',
30
+ 'esbuild',
31
+ 'estree',
32
+ 'fleek',
33
+ 'gitattributes',
34
+ 'globbing',
35
+ 'globstar',
36
+ 'inconsolata',
37
+ 'jillsoffice',
38
+ 'lexend',
39
+ 'lfsr',
40
+ 'locationchange',
41
+ 'marvinpinto',
42
+ 'mmultiline',
43
+ 'mocharc',
44
+ 'monospace',
45
+ 'msapplication',
46
+ 'mstile',
47
+ 'nojekyll',
48
+ 'noopener',
49
+ 'noreferrer',
50
+ 'npmignore',
51
+ 'packagejson',
52
+ 'parens',
53
+ 'pdfs',
54
+ 'postpack',
55
+ 'postupgrade',
56
+ 'prettierignore',
57
+ 'prettierrc',
58
+ 'preupgrade',
59
+ 'protobuf',
60
+ 'pushstate',
61
+ 'replacestate',
62
+ 'repos',
63
+ 'rgba',
64
+ 'sonarjs',
65
+ 'stackoverflow',
66
+ 'stylelint',
67
+ 'stylelintrc',
68
+ 'tabbable',
69
+ 'tabindex',
70
+ 'thingie',
71
+ 'threejs',
72
+ 'transpiled',
73
+ 'transpiling',
74
+ 'typeof',
75
+ 'virmator',
76
+ 'vite',
77
+ 'vitejs',
78
+ 'xlink',
79
+ "config's",
80
+ "repo's",
81
+ "virmator's",
82
+ ],
83
+ };
84
+
85
+ module.exports = {baseConfig};
@@ -0,0 +1,14 @@
1
+ const testFiles = require('./test-files-glob.js');
2
+
3
+ /** @type {import('mocha').MochaOptions} */
4
+ const mochaConfig = {
5
+ checkLeaks: true,
6
+ color: true,
7
+ parallel: true,
8
+ require: 'ts-node/register',
9
+ slow: 1_500, // ms
10
+ timeout: 60_000, // 1 minute in ms
11
+ ...testFiles,
12
+ };
13
+
14
+ module.exports = mochaConfig;
@@ -6,20 +6,20 @@ function toPosixPath(input) {
6
6
  }
7
7
 
8
8
  const posixDirname = path.posix.dirname(toPosixPath(__dirname));
9
+ const packageRoot = path.parse(__dirname).root;
10
+
11
+ function findClosestPackagePath(dirPath, packageName) {
12
+ const currentAttempt = path.join(dirPath, 'node_modules', packageName);
9
13
 
10
- function findClosestNodeModulesPath(dirPath = __dirname) {
11
- const currentAttempt = path.join(dirPath, 'node_modules');
12
14
  if (fs.existsSync(currentAttempt)) {
13
15
  return currentAttempt;
14
- } else if (dirPath === '/') {
15
- throw new Error(`Could not find node_modules directory.`);
16
+ } else if (dirPath === packageRoot) {
17
+ throw new Error(`Could not find ${packageName} package.`);
16
18
  } else {
17
- return findClosestNodeModulesPath(path.dirname(dirPath));
19
+ return findClosestPackagePath(path.dirname(dirPath), packageName);
18
20
  }
19
21
  }
20
22
 
21
- const nodeModules = toPosixPath(findClosestNodeModulesPath());
22
-
23
23
  const plugins = [
24
24
  'prettier-plugin-toml',
25
25
  'prettier-plugin-sort-json',
@@ -28,15 +28,10 @@ const plugins = [
28
28
  'prettier-plugin-organize-imports',
29
29
  'prettier-plugin-jsdoc',
30
30
  ].map((pluginName) => {
31
- // account for installations where node_modules is flattened and installations where it's nested
32
- const flattenedPath = path.posix.join(nodeModules, pluginName);
33
- const nestedPath = path.posix.join(nodeModules, 'virmator', 'node_modules', pluginName);
34
-
35
- if (fs.existsSync(flattenedPath)) {
36
- return path.posix.resolve(posixDirname, flattenedPath);
37
- } else {
38
- return path.posix.resolve(posixDirname, nestedPath);
39
- }
31
+ return path.posix.resolve(
32
+ posixDirname,
33
+ toPosixPath(findClosestPackagePath(__dirname, pluginName)),
34
+ );
40
35
  });
41
36
 
42
37
  /**
@@ -4,6 +4,7 @@
4
4
  "declaration": true,
5
5
  "esModuleInterop": true,
6
6
  "exactOptionalPropertyTypes": true,
7
+ "experimentalDecorators": true,
7
8
  "forceConsistentCasingInFileNames": true,
8
9
  "isolatedModules": true,
9
10
  "module": "CommonJS",
@@ -15,22 +16,14 @@
15
16
  "noImplicitReturns": true,
16
17
  "noImplicitThis": true,
17
18
  "noUncheckedIndexedAccess": true,
18
- "outDir": "../dist",
19
19
  "pretty": true,
20
20
  "resolveJsonModule": true,
21
- "rootDir": "../src",
22
21
  "skipDefaultLibCheck": true,
23
22
  "skipLibCheck": true,
24
23
  "strict": true,
25
24
  "target": "ES2019",
26
25
  "useUnknownInCatchVariables": true
27
26
  },
28
- "exclude": [
29
- "../dist",
30
- "../node_modules",
31
- "../test-files",
32
- "../.virmator"
33
- ],
34
27
  "ts-node": {
35
28
  "compilerOptions": {
36
29
  "module": "CommonJS"
@@ -0,0 +1,5 @@
1
+ const isTestingOtherFiles = process.argv.some((arg) => arg.match(/\.tsx?$/));
2
+
3
+ const allTestFiles = 'src/**/!(*.type).test.ts?(x)';
4
+
5
+ module.exports = isTestingOtherFiles ? {} : {spec: allTestFiles};
@@ -1,4 +1,4 @@
1
- import chalk from 'chalk';
1
+ import {styles} from 'ansi-colors';
2
2
  import {existsSync, lstatSync, readlinkSync} from 'fs';
3
3
  import {relative} from 'path';
4
4
  import {PluginOption} from 'vite';
@@ -60,7 +60,9 @@ export function alwaysReloadPlugin(
60
60
  path: '*',
61
61
  });
62
62
  logger.info(
63
- `${chalk.green('page reload')} ${chalk.dim(relative(root, path))}`,
63
+ `${styles.green.open}page reload ${styles.dim.open}${relative(root, path)}${
64
+ styles.reset.open
65
+ }`,
64
66
  {clear: true, timestamp: true},
65
67
  );
66
68
  /**
@@ -76,8 +78,8 @@ export function alwaysReloadPlugin(
76
78
  if (exclusions.length) {
77
79
  watcher.unwatch(mapToActualPaths(exclusions));
78
80
  // ignore macOS file system metadata stuff
79
- watcher.unwatch('./**/.DS_Store');
80
81
  }
82
+ watcher.unwatch('./**/.DS_Store');
81
83
  if (inclusions.length) {
82
84
  watcher.add(inclusions);
83
85
  }
@@ -1,6 +1,6 @@
1
1
  import {esbuildPlugin} from '@web/dev-server-esbuild';
2
2
  import {playwrightLauncher} from '@web/test-runner-playwright';
3
- import mochaConfig from './mocharc-base.js';
3
+ import testFiles from './test-files-glob.js';
4
4
 
5
5
  /** @type {import('@web/test-runner').TestRunnerConfig} */
6
6
  const webTestRunnerConfig = {
@@ -10,18 +10,17 @@ const webTestRunnerConfig = {
10
10
  playwrightLauncher({product: 'webkit'}),
11
11
  ],
12
12
  // 2 minutes cause GitHub Actions be slow
13
- browserStartTimeout: 120000,
13
+ browserStartTimeout: 120_000,
14
14
  concurrentBrowsers: 3,
15
15
  coverage: true,
16
16
  files: [
17
- mochaConfig.spec,
17
+ testFiles.spec,
18
18
  ],
19
19
  nodeResolve: true,
20
20
  plugins: [esbuildPlugin({ts: true})],
21
21
  testFramework: {
22
22
  config: {
23
- // // uncomment for debugging
24
- // timeout: 100000,
23
+ timeout: 120_000,
25
24
  },
26
25
  },
27
26
  };
@@ -1 +1,2 @@
1
+ # helps with line endings for Windows in automated tests
1
2
  * text=auto eol=lf
package/configs/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 16
@@ -3,4 +3,4 @@ coverage/
3
3
  dist/
4
4
  graphics/
5
5
  node_modules/
6
- package-lock.json
6
+ package-lock.json
@@ -1,4 +1,4 @@
1
- const baseConfig = require('./.virmator/prettierrc-base.js');
1
+ const baseConfig = require('virmator/base-configs/base-prettierrc.js');
2
2
 
3
3
  /**
4
4
  * @typedef {import('prettier-plugin-multiline-arrays').MultilineArrayOptions} MultilineOptions
@@ -1,4 +1,4 @@
1
- const baseOptions = require('./.virmator/mocharc-base');
1
+ const baseOptions = require('virmator/base-configs/base-mocharc.js');
2
2
 
3
3
  /** @type {import('mocha').MochaOptions} */
4
4
  const mochaConfig = {
@@ -1,5 +1,5 @@
1
+ import baseConfig from 'virmator/base-configs/base-vite';
1
2
  import {UserConfig} from 'vite';
2
- import baseConfig from './vite-base';
3
3
 
4
4
  const viteConfig: UserConfig = {
5
5
  ...baseConfig,
@@ -1,4 +1,4 @@
1
- import baseConfig from './web-test-runner-base.mjs';
1
+ import baseConfig from 'virmator/base-configs/web-test-runner-base.mjs';
2
2
 
3
3
  /** @type {import('@web/test-runner').TestRunnerConfig} */
4
4
  const webTestRunnerConfig = {
@@ -0,0 +1,9 @@
1
+ const {baseConfig} = require('virmator/base-configs/base-cspell.js');
2
+
3
+ module.exports = {
4
+ ...baseConfig,
5
+ ignorePaths: [
6
+ ...baseConfig.ignorePaths,
7
+ ],
8
+ words: [...baseConfig.words],
9
+ };
@@ -1,4 +1,5 @@
1
1
  .DS_Store
2
+ /*.tgz
2
3
  /Icon?
3
4
  coverage/
4
5
  dist/
@@ -5,6 +5,7 @@
5
5
  *.test.ts
6
6
  **/*/readme-examples/
7
7
  **/*/test/
8
+ /*.tgz
8
9
  /Icon?
9
10
  coverage/
10
11
  graphics/
@@ -4,14 +4,17 @@
4
4
  "types": "dist/index.d.ts",
5
5
  "scripts": {
6
6
  "build": "virmator frontend build",
7
- "compile": "rm -rf dist && tsc --project tsconfig.json",
7
+ "compile": "rm -rf dist && virmator compile",
8
+ "docs:check": "virmator code-in-markdown check",
8
9
  "docs:update": "virmator code-in-markdown",
9
- "format": "virmator format write",
10
+ "format": "virmator format",
10
11
  "prepublishOnly": "npm run compile && npm run test:full",
12
+ "preview": "virmator frontend preview",
11
13
  "spellcheck": "virmator spellcheck",
12
- "start": "npm install && vite --force --config .virmator/vite/vite.config.ts",
14
+ "start": "npm install && virmator frontend",
13
15
  "test": "virmator test",
14
- "test:full": "npm run test:types && npm test && npm run spellcheck && virmator format check",
15
- "test:types": "tsc --noEmit"
16
+ "test:full": "npm run test:types && npm test && npm run spellcheck && virmator format check && npm run docs:check",
17
+ "test:types": "tsc --noEmit",
18
+ "test:web": "virmator test-web"
16
19
  }
17
20
  }
@@ -1,3 +1,13 @@
1
1
  {
2
- "extends": "./.virmator/tsconfig-base.json"
2
+ "extends": "./node_modules/virmator/base-configs/base-tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "exclude": [
8
+ "./configs/",
9
+ "./dist/",
10
+ "./node_modules/",
11
+ "./test-files/"
12
+ ]
3
13
  }
@@ -0,0 +1,11 @@
1
+ const {baseConfig} = require('./base-configs/base-cspell.js');
2
+
3
+ module.exports = {
4
+ ...baseConfig,
5
+ ignorePaths: [
6
+ ...baseConfig.ignorePaths,
7
+ './test-files/spellcheck/bad',
8
+ './test-files/expected-output.json',
9
+ ],
10
+ words: [...baseConfig.words],
11
+ };
@@ -1,5 +1,6 @@
1
1
  export declare const Color: {
2
2
  Info: string;
3
+ Faint: string;
3
4
  Fail: string;
4
5
  Warn: string;
5
6
  Success: string;
@@ -4,6 +4,7 @@ exports.Color = void 0;
4
4
  const ansi_colors_1 = require("ansi-colors");
5
5
  exports.Color = {
6
6
  Info: ansi_colors_1.styles.blue.open,
7
+ Faint: ansi_colors_1.styles.gray.open,
7
8
  Fail: ansi_colors_1.styles.red.open,
8
9
  Warn: ansi_colors_1.styles.yellow.open,
9
10
  Success: ansi_colors_1.styles.green.open,
@@ -0,0 +1,3 @@
1
+ import { ConfigFileDefinition } from '../config/config-file-definition';
2
+ import { CommandMapping } from './command-mapping';
3
+ export declare function extractAllConfigs(commandMapping: CommandMapping): ReadonlyArray<ConfigFileDefinition>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractAllConfigs = void 0;
4
+ const augment_vir_1 = require("augment-vir");
5
+ function extractAllConfigs(commandMapping) {
6
+ const configFiles = (0, augment_vir_1.getObjectTypedValues)(commandMapping)
7
+ .map((commandDefinition) => (0, augment_vir_1.getObjectTypedValues)(commandDefinition.configFiles))
8
+ .flat();
9
+ return configFiles;
10
+ }
11
+ exports.extractAllConfigs = extractAllConfigs;
@@ -0,0 +1,8 @@
1
+ import { CommandDescription } from './command-help';
2
+ import { DefineCommandInputs, SubCommandsMap } from './define-command-inputs';
3
+ export declare type CreateDescriptionsInputs<DefineCommandInputsGeneric extends DefineCommandInputs> = Pick<DefineCommandInputsGeneric, 'commandName'> & {
4
+ packageBinName: string;
5
+ subCommands: SubCommandsMap<DefineCommandInputsGeneric>;
6
+ configFiles: DefineCommandInputsGeneric['configFiles'];
7
+ };
8
+ export declare type CreateDescriptionsCallback<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CreateDescriptionsInputs<DefineCommandInputsGeneric>) => CommandDescription;
@@ -0,0 +1,28 @@
1
+ import { ConfigFileDefinition } from '../config/config-file-definition';
2
+ import { CommandLogging, CommandLogTransforms } from './command-logging';
3
+ import { DefineCommandInputs, SharedExecutorInputsAndCommandDefinition } from './define-command-inputs';
4
+ export declare type CommandExecutorInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = {
5
+ filteredInputArgs: string[];
6
+ inputSubCommands: (keyof DefineCommandInputsGeneric['subCommandDescriptions'])[];
7
+ repoDir: string;
8
+ allConfigs: ReadonlyArray<ConfigFileDefinition>;
9
+ packageDir: string;
10
+ logging: CommandLogging;
11
+ };
12
+ export declare type CommandExecutorDefinitionInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = CommandExecutorInputs<DefineCommandInputsGeneric> & SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric>;
13
+ export declare type DetailedArg = {
14
+ arg: string;
15
+ skipWindowsInterpolation: true;
16
+ };
17
+ export declare type SuccessOnlyExecutorOutput = {
18
+ success: boolean;
19
+ };
20
+ export declare type BashCommandExecutorOutput = {
21
+ mainCommand: string;
22
+ logTransforms?: CommandLogTransforms;
23
+ args: (string | DetailedArg)[];
24
+ };
25
+ export declare function isCompletedExecutor(executorOutput: CommandExecutorOutput): executorOutput is SuccessOnlyExecutorOutput;
26
+ export declare type CommandExecutorOutput = BashCommandExecutorOutput | SuccessOnlyExecutorOutput;
27
+ export declare type CommandExecutorDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorDefinitionInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
28
+ export declare type CommandExecutor<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCompletedExecutor = void 0;
4
+ function isCompletedExecutor(executorOutput) {
5
+ return 'success' in executorOutput;
6
+ }
7
+ exports.isCompletedExecutor = isCompletedExecutor;
@@ -0,0 +1,8 @@
1
+ export declare type HelpSection = Readonly<{
2
+ title: string;
3
+ content: string;
4
+ }>;
5
+ export declare type CommandDescription = Readonly<{
6
+ sections: Readonly<HelpSection[]>;
7
+ examples: Readonly<HelpSection[]>;
8
+ }>;
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.packageName = void 0;
4
- exports.packageName = 'virmator';
@@ -0,0 +1,11 @@
1
+ export declare type CommandLogCallback = (thingToLog: string) => void;
2
+ export declare type CommandLogging = {
3
+ stdout: CommandLogCallback;
4
+ stderr: CommandLogCallback;
5
+ };
6
+ export declare const noCommandLogging: Readonly<Required<CommandLogging>>;
7
+ export declare const defaultConsoleLogging: Readonly<Required<CommandLogging>>;
8
+ export declare type CommandLogs = Record<keyof CommandLogging, string>;
9
+ export declare const identityCommandLogTransform: CommandLogTransform;
10
+ export declare type CommandLogTransform = (thingToTransform: string) => string;
11
+ export declare type CommandLogTransforms = Partial<Record<keyof CommandLogging, CommandLogTransform>>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.identityCommandLogTransform = exports.defaultConsoleLogging = exports.noCommandLogging = void 0;
4
+ exports.noCommandLogging = {
5
+ stderr: () => { },
6
+ stdout: () => { },
7
+ };
8
+ exports.defaultConsoleLogging = {
9
+ stdout: (input) => {
10
+ console.log(input.replace(/\n$/, ''));
11
+ },
12
+ stderr: (input) => {
13
+ console.error(input.replace(/\n$/, ''));
14
+ },
15
+ };
16
+ const identityCommandLogTransform = (input) => input;
17
+ exports.identityCommandLogTransform = identityCommandLogTransform;
@@ -0,0 +1,7 @@
1
+ import { ArrayElement } from 'augment-vir';
2
+ import { CommandDefinition } from './define-command';
3
+ export declare type CommandMapping = Record<string, CommandDefinition>;
4
+ export declare function commandsToMapping(commands: ReadonlyArray<CommandDefinition>): Readonly<CommandMapping>;
5
+ export declare type CommandDefinitionArrayToMapping<DefinitionArray extends ReadonlyArray<CommandDefinition>> = {
6
+ [CommandName in ArrayElement<DefinitionArray>['commandName']]: CommandDefinition;
7
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commandsToMapping = void 0;
4
+ function commandsToMapping(commands) {
5
+ return commands.reduce((mapping, currentCommandDefinition) => {
6
+ mapping[currentCommandDefinition.commandName] = currentCommandDefinition;
7
+ return mapping;
8
+ }, {});
9
+ }
10
+ exports.commandsToMapping = commandsToMapping;
@@ -0,0 +1 @@
1
+ export declare function getCommandResultMessage(commandName: string, success: boolean): string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCommandResultMessage = void 0;
4
+ const cli_color_1 = require("../cli-color");
5
+ function getCommandResultMessage(commandName, success) {
6
+ const specificColor = success ? cli_color_1.Color.Success : cli_color_1.Color.Fail;
7
+ const specificPhrase = success ? 'succeeded' : 'failed';
8
+ return `${cli_color_1.Color.Bold}${specificColor}${commandName} ${specificPhrase}.${cli_color_1.Color.Reset}`;
9
+ }
10
+ exports.getCommandResultMessage = getCommandResultMessage;
@@ -0,0 +1,9 @@
1
+ import { CommandMapping } from './command-mapping';
2
+ import { CommandDefinition } from './define-command';
3
+ export declare enum HelpMessageSyntax {
4
+ Cli = "cli",
5
+ Markdown = "markdown"
6
+ }
7
+ export declare function generateHelpMessage(packageBinName: string, commandDefinitions: Readonly<CommandMapping>, syntax: HelpMessageSyntax, cliWrapIfMoreThanThisManyColumns?: number): string;
8
+ export declare function flagToHelpString(flagName: string, description: string, syntax: HelpMessageSyntax): string;
9
+ export declare function commandToHelpString(packageBinName: string, commandDefinition: CommandDefinition, syntax: HelpMessageSyntax): string;