virmator 12.0.4 → 13.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 (158) hide show
  1. package/README.md +224 -129
  2. package/dist/cli.d.ts +1 -1
  3. package/dist/cli.js +21 -5
  4. package/dist/index.d.ts +1416 -1310
  5. package/dist/index.js +25 -63
  6. package/dist/tests/test-virmator.mock.d.ts +3 -0
  7. package/dist/tests/test-virmator.mock.js +5 -0
  8. package/package.json +25 -69
  9. package/src/cli.ts +29 -0
  10. package/src/index.ts +26 -0
  11. package/src/tests/test-virmator.mock.ts +13 -0
  12. package/base-configs/base-cspell.js +0 -272
  13. package/base-configs/base-mocharc.cjs +0 -20
  14. package/base-configs/base-nyc.js +0 -40
  15. package/base-configs/base-prettierrc.js +0 -32
  16. package/base-configs/base-web-test-runner.mjs +0 -137
  17. package/base-configs/test-files-glob.js +0 -13
  18. package/base-configs/tsconfig.base.json +0 -32
  19. package/configs/.gitattributes +0 -2
  20. package/configs/.github/workflows/build-for-gh-pages.yml +0 -24
  21. package/configs/.github/workflows/tagged-release.yml +0 -41
  22. package/configs/.github/workflows/tests.yml +0 -25
  23. package/configs/.nvmrc +0 -1
  24. package/configs/.prettierignore +0 -11
  25. package/configs/.prettierrc.js +0 -13
  26. package/configs/.vscode/settings.json +0 -50
  27. package/configs/LICENSE-CC0 +0 -121
  28. package/configs/LICENSE-MIT +0 -21
  29. package/configs/configs/dep-cruiser.config.ts +0 -22
  30. package/configs/configs/mocha.config.cjs +0 -8
  31. package/configs/configs/ncu.config.ts +0 -12
  32. package/configs/configs/nyc.config.js +0 -7
  33. package/configs/configs/typedoc.config.ts +0 -20
  34. package/configs/configs/vite.config.ts +0 -14
  35. package/configs/configs/web-test-runner.config.mjs +0 -21
  36. package/configs/cspell.config.cjs +0 -11
  37. package/configs/dep-cruiser.config.ts +0 -22
  38. package/configs/gitignore.txt +0 -13
  39. package/configs/ncu.config.ts +0 -13
  40. package/configs/npmignore.txt +0 -26
  41. package/configs/package.json +0 -23
  42. package/configs/src/index.html +0 -12
  43. package/configs/src/ui/elements/vir-app.element.ts +0 -10
  44. package/configs/tsconfig.json +0 -16
  45. package/configs/www-static/_redirects +0 -1
  46. package/configs/www-static/index.css +0 -7
  47. package/cspell.config.cjs +0 -13
  48. package/dist/api/command/command-configs.d.ts +0 -3
  49. package/dist/api/command/command-configs.js +0 -10
  50. package/dist/api/command/command-description.d.ts +0 -8
  51. package/dist/api/command/command-description.js +0 -2
  52. package/dist/api/command/command-executor.d.ts +0 -30
  53. package/dist/api/command/command-executor.js +0 -6
  54. package/dist/api/command/command-help.d.ts +0 -8
  55. package/dist/api/command/command-help.js +0 -2
  56. package/dist/api/command/command-logging.d.ts +0 -11
  57. package/dist/api/command/command-logging.js +0 -17
  58. package/dist/api/command/command-mapping.d.ts +0 -7
  59. package/dist/api/command/command-mapping.js +0 -9
  60. package/dist/api/command/command-messages.d.ts +0 -1
  61. package/dist/api/command/command-messages.js +0 -9
  62. package/dist/api/command/command-to-help-message.d.ts +0 -9
  63. package/dist/api/command/command-to-help-message.js +0 -175
  64. package/dist/api/command/define-command-inputs.d.ts +0 -22
  65. package/dist/api/command/define-command-inputs.js +0 -8
  66. package/dist/api/command/define-command.d.ts +0 -22
  67. package/dist/api/command/define-command.js +0 -41
  68. package/dist/api/config/config-file-definition.d.ts +0 -15
  69. package/dist/api/config/config-file-definition.js +0 -2
  70. package/dist/api/config/config-paths.d.ts +0 -7
  71. package/dist/api/config/config-paths.js +0 -7
  72. package/dist/api/config/copy-config.d.ts +0 -27
  73. package/dist/api/config/copy-config.js +0 -98
  74. package/dist/api/create-virmator.d.ts +0 -8
  75. package/dist/api/create-virmator.js +0 -67
  76. package/dist/api/run-command/check-npm-deps.d.ts +0 -8
  77. package/dist/api/run-command/check-npm-deps.js +0 -111
  78. package/dist/api/run-command/extract-arguments.d.ts +0 -6
  79. package/dist/api/run-command/extract-arguments.js +0 -36
  80. package/dist/api/run-command/run-command-executor.d.ts +0 -5
  81. package/dist/api/run-command/run-command-executor.js +0 -50
  82. package/dist/api/run-command/run-extended-virmator.d.ts +0 -10
  83. package/dist/api/run-command/run-extended-virmator.js +0 -53
  84. package/dist/api/run-command/run-shell-command.d.ts +0 -8
  85. package/dist/api/run-command/run-shell-command.js +0 -21
  86. package/dist/api/virmator-types.d.ts +0 -18
  87. package/dist/api/virmator-types.js +0 -2
  88. package/dist/augments/array.d.ts +0 -1
  89. package/dist/augments/array.js +0 -6
  90. package/dist/augments/console.d.ts +0 -9
  91. package/dist/augments/console.js +0 -43
  92. package/dist/augments/fs.d.ts +0 -11
  93. package/dist/augments/fs.js +0 -71
  94. package/dist/augments/git.d.ts +0 -1
  95. package/dist/augments/git.js +0 -12
  96. package/dist/augments/json.d.ts +0 -1
  97. package/dist/augments/json.js +0 -11
  98. package/dist/augments/npm.d.ts +0 -11
  99. package/dist/augments/npm.js +0 -52
  100. package/dist/augments/object.d.ts +0 -4
  101. package/dist/augments/object.js +0 -44
  102. package/dist/augments/path.d.ts +0 -1
  103. package/dist/augments/path.js +0 -12
  104. package/dist/augments/prettier.d.ts +0 -1
  105. package/dist/augments/prettier.js +0 -52
  106. package/dist/augments/regexp.d.ts +0 -1
  107. package/dist/augments/regexp.js +0 -6
  108. package/dist/augments/string.d.ts +0 -2
  109. package/dist/augments/string.js +0 -9
  110. package/dist/augments/type.d.ts +0 -1
  111. package/dist/augments/type.js +0 -2
  112. package/dist/augments/typescript-config-file.d.ts +0 -5
  113. package/dist/augments/typescript-config-file.js +0 -62
  114. package/dist/commands/compile.command.d.ts +0 -84
  115. package/dist/commands/compile.command.js +0 -58
  116. package/dist/commands/deps.command.d.ts +0 -144
  117. package/dist/commands/deps.command.js +0 -208
  118. package/dist/commands/docs.command.d.ts +0 -99
  119. package/dist/commands/docs.command.js +0 -192
  120. package/dist/commands/extra-configs/all-extra-configs.d.ts +0 -2
  121. package/dist/commands/extra-configs/all-extra-configs.js +0 -71
  122. package/dist/commands/extra-configs/combine-json-config.d.ts +0 -2
  123. package/dist/commands/extra-configs/combine-json-config.js +0 -21
  124. package/dist/commands/extra-configs/combine-text-config.d.ts +0 -2
  125. package/dist/commands/extra-configs/combine-text-config.js +0 -26
  126. package/dist/commands/extra-configs/create-default-package-json.d.ts +0 -1
  127. package/dist/commands/extra-configs/create-default-package-json.js +0 -86
  128. package/dist/commands/format.command.d.ts +0 -215
  129. package/dist/commands/format.command.js +0 -157
  130. package/dist/commands/frontend.command.d.ts +0 -149
  131. package/dist/commands/frontend.command.js +0 -140
  132. package/dist/commands/init.command.d.ts +0 -163
  133. package/dist/commands/init.command.js +0 -53
  134. package/dist/commands/publish.command.d.ts +0 -33
  135. package/dist/commands/publish.command.js +0 -193
  136. package/dist/commands/spellcheck.command.d.ts +0 -74
  137. package/dist/commands/spellcheck.command.js +0 -60
  138. package/dist/commands/test-web.command.d.ts +0 -189
  139. package/dist/commands/test-web.command.js +0 -125
  140. package/dist/commands/test.command.d.ts +0 -224
  141. package/dist/commands/test.command.js +0 -100
  142. package/dist/commands/update-configs.command.d.ts +0 -33
  143. package/dist/commands/update-configs.command.js +0 -35
  144. package/dist/compiled-base-configs/base-dep-cruiser.config.d.ts +0 -195
  145. package/dist/compiled-base-configs/base-dep-cruiser.config.js +0 -206
  146. package/dist/compiled-base-configs/base-ncu.d.ts +0 -6
  147. package/dist/compiled-base-configs/base-ncu.js +0 -16
  148. package/dist/compiled-base-configs/base-typedoc.d.ts +0 -3
  149. package/dist/compiled-base-configs/base-typedoc.js +0 -36
  150. package/dist/compiled-base-configs/base-vite.d.ts +0 -27
  151. package/dist/compiled-base-configs/base-vite.js +0 -74
  152. package/dist/compiled-base-configs/vite-always-reload-plugin.d.ts +0 -10
  153. package/dist/compiled-base-configs/vite-always-reload-plugin.js +0 -99
  154. package/dist/file-paths/package-paths.d.ts +0 -12
  155. package/dist/file-paths/package-paths.js +0 -46
  156. package/dist/scripts/save-help-message.d.ts +0 -1
  157. package/dist/scripts/save-help-message.js +0 -33
  158. package/mocha.config.cjs +0 -16
package/README.md CHANGED
@@ -1,208 +1,303 @@
1
- # virmator
1
+ # @virmator
2
2
 
3
- Centralize and automate all the things! So I don't have to copy pasta configs in every single project.
4
-
5
- # Install
6
-
7
- ```bash
8
- npm -i D virmator
9
- ```
10
-
11
- # Help
12
-
13
- ```bash
14
- npx virmator --help
15
- ```
16
-
17
- Below is full documentation for the cli, which is generated via the cli's `help` message:
18
-
19
- <!-- usage below -->
3
+ A package for centralizing and automating mind-numbingly repetitive repo tasks and checks. New commands can easily be added through a plugin system.
20
4
 
21
5
  # virmator usage
22
6
 
23
- ```
24
- [npx] virmator [--flags] command subCommand
25
- ```
26
-
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
-
29
- # Available commands
30
-
31
- ## compile
32
-
33
- compile typescript files
34
- Pass any extra tsc flags to this command.
35
-
36
- ### Examples
7
+ `[npx] virmator [--flags] command subCommand [...optional args]`
37
8
 
38
- - no extra flags: `virmator compile`
39
- - one extra flag: `virmator compile --noEmit`
9
+ - `npx` is needed when the command is run directly from the terminal (not called from within an npm script) unless virmator has been globally installed (which I recommend against).
10
+ - `[--flags]` is any of the optional virmator flags. See Virmator Flags below.
11
+ - `command`, `subCommand`, and `[...optional args]` depend on the specific command you're running. See Available Commands below.
40
12
 
41
- ### check
13
+ ## Available commands
42
14
 
43
- Run type checking without emitting compiled files.
15
+ - **compile**
44
16
 
45
- ## deps
17
+ Type checks TypeScript files and compiles them into JS outputs using the TypeScript compiler. Any extra args are passed directly to tsc.
46
18
 
47
- Either upgrade or check dependencies
19
+ Automatically compiles a mono-repo's sub packages in the correct order if called from a mono-repo root.
48
20
 
49
- ### check:
21
+ - Examples
22
+ - `virmator compile`
23
+ - With tsc flags: `virmator compile --noEmit`
24
+ - Configs
25
+ - tsconfig.json
26
+ - tsconfig.json
27
+ - configs/tsconfig.base.json
28
+ - Deps
29
+ - [typescript](https://npmjs.com/package/typescript)
30
+ - [mono-vir](https://npmjs.com/package/mono-vir)
50
31
 
51
- Check that dependencies are all good via a default set of rules in configs/dep-cruiser.config.ts and dependency-cruiser.
32
+ - **deps**
52
33
 
53
- ### upgrade:
34
+ Various dependency commands. A sub-command must be provided.
54
35
 
55
- Upgrade all packages using npm-check-updates and configs/ncu.config.ts.
36
+ - Examples
37
+ - check import dependencies: `virmator deps check`
38
+ - upgrade npm dependencies: `virmator deps upgrade`
39
+ - regenerate npm dependencies: `virmator deps regen`
40
+ - Sub Commands
56
41
 
57
- ### regen:
42
+ - **check**
58
43
 
59
- Regenerate all npm deps and package-lock.json
44
+ Checks that import dependencies pass your dependency cruiser config. The base configuration blocks typical import errors such as circular dependencies and importing test files.
60
45
 
61
- ### Examples
46
+ - Examples
47
+ - `virmator deps check`
48
+ - Configs
49
+ - configs/dep-cruiser.config.cts
50
+ - Deps
51
+ - [dependency-cruiser](https://npmjs.com/package/dependency-cruiser)
52
+ - [esbuild](https://npmjs.com/package/esbuild)
62
53
 
63
- - Upgrade deps: `virmator deps upgrade`
64
- - Check deps: `virmator deps check`
65
- - Check deps for a specific file: `virmator deps check ./src/my-file.ts`
66
- - Regen deps: `virmator deps regen`
54
+ - **upgrade**
67
55
 
68
- ### check
56
+ Upgrades dependencies using npm-check-update. Does not automatically run 'npm i'. It is recommended to run 'virmator deps regen' instead.
69
57
 
70
- validate dependencies
58
+ - Examples
59
+ - `virmator deps upgrade`
60
+ - Configs
61
+ - configs/ncu.config.ts
62
+ - Deps
63
+ - [npm-check-updates](https://npmjs.com/package/npm-check-updates)
71
64
 
72
- ### upgrade
65
+ - **regen**
73
66
 
74
- upgrade npm dependencies
67
+ Force regeneration of all all dependencies by deleting all node_modules directories and package-lock.json and then running 'npm i'.
75
68
 
76
- ### regen
69
+ - Examples
70
+ - `virmator deps regen`
77
71
 
78
- regenerate npm dependencies
72
+ - **docs**
79
73
 
80
- ## docs
74
+ Generates documentation using the typedoc package and inserts code examples into README files using the markdown-code-example-inserter package.
81
75
 
82
- This also inserts code snippets into markdown files. This uses the markdown-code-example-inserter package to expand code link comments inside of markdown files to actual markdown code blocks. See that package's README for more details but the basics are that you need a comment that looks like the following in your markdown file for this to do anything: `<!-- example-link: path/to/file.ts -->`
76
+ - Examples
77
+ - `virmator docs`
78
+ - Configs
79
+ - configs/typedoc.config.ts
80
+ - Deps
81
+ - [markdown-code-example-inserter](https://npmjs.com/package/markdown-code-example-inserter)
82
+ - [typedoc](https://npmjs.com/package/typedoc)
83
+ - [esbuild](https://npmjs.com/package/esbuild)
84
+ - Sub Commands
83
85
 
84
- By default this command parses all markdown files in the repo (ignoring node_modules). Specific markdown files can be parsed by giving virmator extra parameters.
86
+ - **check**
85
87
 
86
- To check if files are up-to-date (rather than actually updating them), use the "check" sub-command.
88
+ Checks that documentation is valid and passes all checks without generating documentation outputs.
87
89
 
88
- ### Examples
90
+ - Examples
91
+ - `virmator docs check`
89
92
 
90
- - default experience (usually all you need): `virmator docs`
91
- - checking if files are up-to-date: `virmator docs check`
92
- - override files to check to a single file: `virmator docs only/this/one/file.md`
93
- - override files to check to a group of files: `virmator docs "only/this/dir/*.md"`
93
+ - **format**
94
94
 
95
- ### check
95
+ Formats with prettier.
96
96
 
97
- Check that documentation is up-to-date.
97
+ - Examples
98
+ - `virmator format`
99
+ - Configs
100
+ - prettier.config.mjs
101
+ - .prettierignore
102
+ - Deps
103
+ - [prettier](https://npmjs.com/package/prettier)
104
+ - [prettier-plugin-jsdoc](https://npmjs.com/package/prettier-plugin-jsdoc)
105
+ - [prettier-plugin-multiline-arrays](https://npmjs.com/package/prettier-plugin-multiline-arrays)
106
+ - [prettier-plugin-organize-imports](https://npmjs.com/package/prettier-plugin-organize-imports)
107
+ - [prettier-plugin-packagejson](https://npmjs.com/package/prettier-plugin-packagejson)
108
+ - [prettier-plugin-sort-json](https://npmjs.com/package/prettier-plugin-sort-json)
109
+ - [prettier-plugin-toml](https://npmjs.com/package/prettier-plugin-toml)
110
+ - [prettier-plugin-interpolated-html-tags](https://npmjs.com/package/prettier-plugin-interpolated-html-tags)
111
+ - Sub Commands
98
112
 
99
- ## format
113
+ - **check**
100
114
 
101
- Formats source files with Prettier.
115
+ Checks that formatting is all valid.
102
116
 
103
- ### file extensions:
117
+ - Examples
118
+ - `virmator format check`
119
+
120
+ - **frontend**
121
+
122
+ Runs a frontend dev server with Vite.
104
123
 
105
- If only specific file extensions should be formatted, add the "--file-types" argument to this command. All following arguments will be treated as file extensions to be formatted. For example, the following command will format files only if they have the extension ".md" or ".json": virmator format --file-types md json
124
+ - Examples
125
+ - `virmator frontend`
126
+ - Configs
127
+ - configs/vite.config.ts
128
+ - Deps
129
+ - [typescript](https://npmjs.com/package/typescript)
130
+ - [vite](https://npmjs.com/package/vite)
131
+ - Sub Commands
106
132
 
107
- ### Prettier flags:
133
+ - **build**
108
134
 
109
- Any other arguments encountered between the operation command (if provided) and the "--file-types" marker are treated as extra arguments to Prettier and will be passed along.
135
+ Builds a frontend for deployment using Vite (and Rollup).
110
136
 
111
- ### Examples
137
+ - Examples
138
+ - `virmator frontend build`
112
139
 
113
- - checks formatting for files: `virmator format check`
114
- - checks formatting only for .md files: `virmator format check --file-types md`
115
- - checks formatting only for .md and .json files: `virmator format check --file-types md json`
116
- - fixes formatting for files:
140
+ - **preview**
117
141
 
118
- ```
119
- virmator format
120
- virmator format
121
- ```
142
+ Builds a frontend and previews that build in a local dev server.
122
143
 
123
- - examples with extra Prettier flags:
144
+ - Examples
145
+ - `virmator frontend preview`
124
146
 
125
- ```
126
- virmator format --ignore-path .prettierignore
127
- virmator format --ignore-path .prettierignore
128
- virmator format --ignore-path .prettierignore --file-types md json
129
- ```
147
+ - **help**
130
148
 
131
- ### check
149
+ Prints help messages for all supported plugins/commands.
132
150
 
133
- check formatting without overwriting files.
151
+ - Examples
152
+ - `virmator help`
134
153
 
135
- ## frontend
154
+ - **init**
136
155
 
137
- Runs a frontend. Currently uses vite.
156
+ Init all default configs. Needs env and package type args.
138
157
 
139
- ### build
158
+ - Examples
159
+ - `virmator init web mono-repo`
160
+ - `virmator init node package`
161
+ - Configs
162
+ - .github/workflows/build-for-gh-pages.yml
163
+ - .github/workflows/tagged-release.yml
164
+ - .github/workflows/tests.yml
165
+ - .github/workflows/tests.yml
166
+ - src/ui/elements/vir-app.element.ts
167
+ - src/index.html
168
+ - www-static/index.css
169
+ - www-static/\_redirects
170
+ - .gitattributes
171
+ - .nvmrc
172
+ - .gitignore
173
+ - LICENSE-MIT
174
+ - LICENSE-CC0
175
+ - .npmignore
176
+ - package.json
177
+ - package.json
178
+ - package.json
179
+ - package.json
180
+ - package.json
140
181
 
141
- Builds and bundles the frontend for deployment.
182
+ - **lint**
142
183
 
143
- ### preview
184
+ Runs ESLint.
144
185
 
145
- Builds and previews the built output.
186
+ - Examples
187
+ - `virmator lint`
188
+ - Configs
189
+ - configs/tsconfig.eslint.json
190
+ - eslint.config.mjs
191
+ - Deps
192
+ - [eslint](https://npmjs.com/package/eslint)
193
+ - [@eslint/js](https://npmjs.com/package/@eslint/js)
194
+ - [@stylistic/eslint-plugin](https://npmjs.com/package/@stylistic/eslint-plugin)
195
+ - [@stylistic/eslint-plugin-ts](https://npmjs.com/package/@stylistic/eslint-plugin-ts)
196
+ - [@typescript-eslint/eslint-plugin](https://npmjs.com/package/@typescript-eslint/eslint-plugin)
197
+ - [eslint-config-prettier](https://npmjs.com/package/eslint-config-prettier)
198
+ - [eslint-plugin-jsdoc](https://npmjs.com/package/eslint-plugin-jsdoc)
199
+ - [eslint-plugin-mocha](https://npmjs.com/package/eslint-plugin-mocha)
200
+ - [eslint-plugin-playwright](https://npmjs.com/package/eslint-plugin-playwright)
201
+ - [eslint-plugin-prettier](https://npmjs.com/package/eslint-plugin-prettier)
202
+ - [eslint-plugin-sonarjs](https://npmjs.com/package/eslint-plugin-sonarjs)
203
+ - [typescript-eslint](https://npmjs.com/package/typescript-eslint)
204
+ - Sub Commands
146
205
 
147
- ## init
206
+ - **fix**
148
207
 
149
- Initialize a repo with all virmator config files.
208
+ Auto fix all fixable ESLint issues.
150
209
 
151
- ### Examples
210
+ - Examples
211
+ - `virmator lint fix`
152
212
 
153
- - run init: `virmator init`
154
- - run init and force all configs to be written: `virmator init force`
213
+ - **publish**
155
214
 
156
- ### force
215
+ Publish a package or mono-repo to NPM with an optional test script and auto-incrementing package version.
157
216
 
158
- force overwrite files even if they already exist.
217
+ - Examples
218
+ - With tests: `virmator publish npm test`
219
+ - Without tests: `virmator publish`
159
220
 
160
- ## publish
221
+ - **spellcheck**
161
222
 
162
- Publish an npm package. Includes workspace support. Add test commands to run before publish as arguments.
223
+ Checks spelling for all files using the cspell package. All arguments are passed directly to cspell.
163
224
 
164
- ### Examples
225
+ - Examples
226
+ - `virmator spellcheck`
227
+ - Check a specific file: `virmator spellcheck src/index.ts`
228
+ - Configs
229
+ - cspell.config.cjs
230
+ - Deps
231
+ - [cspell](https://npmjs.com/package/cspell)
165
232
 
166
- - publish a package: `virmator publish`
167
- - publish a package and run tests beforehand: `virmator publish npm test`
233
+ - **test**
168
234
 
169
- ## spellcheck
235
+ Runs tests. An environment is required.
170
236
 
171
- 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.
237
+ This cannot be run in a mono-repo root, it can only be run for mono-repo sub-packages or a top-level singular package.
172
238
 
173
- ## test
239
+ - Examples
240
+ - Run tests in a browser: `virmator test web`
241
+ - Run tests in Node: `virmator test node`
242
+ - Sub Commands
174
243
 
175
- Test all .test.ts files with Mocha and Chai. By default this command tests all ".test.ts" files in the current directory (recursively) that are not ".type.test.ts" files. To override this behavior, override the "spec" property in .mocharc.cjs.
244
+ - **web**
176
245
 
177
- This command is meant to run Node.js tests. For running web-based testing, see the test-web command.
246
+ Runs web tests in a browser using web-test-runner.
178
247
 
179
- Note that the below single file examples only work because the base Mocha config from virmator is setup to handle them. (So if you don't use that config, the examples may not work properly.)
248
+ - Examples
249
+ - `virmator test web`
250
+ - Configs
251
+ - configs/web-test-runner.config.mjs
252
+ - Deps
253
+ - [@open-wc/testing](https://npmjs.com/package/@open-wc/testing)
254
+ - [@types/mocha](https://npmjs.com/package/@types/mocha)
255
+ - [@web/dev-server-esbuild](https://npmjs.com/package/@web/dev-server-esbuild)
256
+ - [@web/test-runner-commands](https://npmjs.com/package/@web/test-runner-commands)
257
+ - [@web/test-runner-playwright](https://npmjs.com/package/@web/test-runner-playwright)
258
+ - [@web/test-runner-visual-regression](https://npmjs.com/package/@web/test-runner-visual-regression)
259
+ - [@web/test-runner](https://npmjs.com/package/@web/test-runner)
260
+ - [istanbul-smart-text-reporter](https://npmjs.com/package/istanbul-smart-text-reporter)
261
+ - Sub Commands
262
+
263
+ - **coverage**
264
+
265
+ Run tests and calculate code coverage.
180
266
 
181
- ### Examples
267
+ - Examples
268
+ - `virmator test web coverage`
182
269
 
183
- - Test all .test.ts and .test.tsx files: `virmator test`
184
- - Test a single file: `virmator test ./path/to/single/file.js`
185
- - Test multiple files: `virmator test "./**/single-file.js"`
270
+ - **node**
186
271
 
187
- ### coverage
272
+ Runs backend tests in Node.js using its built-in test runner.
188
273
 
189
- run tests with code coverage calculations. This will often result in incorrect stack traces on errors, so this is only recommended after having first gotten all tests to pass without coverage calculations.
274
+ - Examples
275
+ - `virmator test node`
276
+ - Sub Commands
190
277
 
191
- ## test-web
278
+ - **coverage**
192
279
 
193
- 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 "virmator test" command, as the run-time environment is quite different (Node.js vs browser). However, just like the test 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 web-test-runner.config.mjs.
280
+ Run tests and calculate code coverage.
194
281
 
195
- By default this command runs all tests three times: in Chromium (Chrome), Firefox, and Webkit (Safari) using playwright.
282
+ - Examples
283
+ - `virmator test node coverage`
284
+ - Configs
285
+ - configs/c8.config.json
286
+ - Deps
287
+ - [c8](https://npmjs.com/package/c8)
288
+ - [istanbul-smart-text-reporter](https://npmjs.com/package/istanbul-smart-text-reporter)
196
289
 
197
- ### Examples
290
+ - **update**
198
291
 
199
- - Test all .test.ts and .test.tsx files: `virmator test-web`
200
- - Test a specific file: `virmator test-web path/to/file.test.ts`
292
+ Run tests and update snapshots.
201
293
 
202
- ### coverage
294
+ - Examples
295
+ - `virmator test node update`
203
296
 
204
- run web tests with code coverage calculations
297
+ ## Virmator Flags
205
298
 
206
- ## update-configs
299
+ All virmator flags are optional and typically not needed.
207
300
 
208
- Update all existing configuration files that virmator is able to update. (Like base config files.)
301
+ - **--no-configs**: Prevents command config files from being copied.
302
+ - **--no-deps**: Prevents command npm deps from being installed.
303
+ - **--help**: Print the help message.
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env -S npx tsx
2
2
  export {};
package/dist/cli.js CHANGED
@@ -1,5 +1,21 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const index_1 = require("./index");
5
- index_1.virmator.runInCli();
1
+ #!/usr/bin/env -S npx tsx
2
+ import { createPluginLogger, executeVirmatorCommand, hideNoTraceTraces, VirmatorNoTraceError, } from '@virmator/core';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { defaultVirmatorPlugins } from './index';
5
+ const log = createPluginLogger(process);
6
+ executeVirmatorCommand({
7
+ cliCommand: process.argv,
8
+ plugins: defaultVirmatorPlugins,
9
+ entryPointFilePath: fileURLToPath(import.meta.url),
10
+ log,
11
+ }).catch((error) => {
12
+ if (error instanceof VirmatorNoTraceError && hideNoTraceTraces) {
13
+ if (error.message) {
14
+ log.error(error.message);
15
+ }
16
+ }
17
+ else {
18
+ log.error(error);
19
+ }
20
+ process.exit(1);
21
+ });