virmator 7.4.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,38 +28,38 @@ Below is full documentation for the cli, which is generated via the cli's `help`
28
28
 
29
29
  # Available commands
30
30
 
31
- ## code-in-markdown
32
-
33
- Insert 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 -->`
34
-
35
- 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.
31
+ ## compile
36
32
 
37
- To check if files are up-to-date (rather than actually updating them), use the "check" sub-command.
33
+ compile typescript files
34
+ Pass any extra tsc flags to this command.
38
35
 
39
36
  ### Examples
40
37
 
41
- - default experience (usually all you need): `virmator code-in-markdown`
42
- - checking if files are up-to-date: `virmator code-in-markdown check`
43
- - override files to check to a single file: `virmator code-in-markdown only/this/one/file.md`
44
- - override files to check to a group of files: `virmator code-in-markdown "only/this/dir/*.md"`
38
+ - no extra flags: `virmator compile`
39
+ - one extra flag: `virmator compile --noEmit`
45
40
 
46
41
  ### check
47
42
 
48
- Check that markdown files have their examples inserted and are up-to-date.
43
+ Run type checking without emitting compiled files.
44
+
45
+ ## docs
49
46
 
50
- ## compile
47
+ 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 -->`
51
48
 
52
- compile typescript files
53
- Pass any extra tsc flags to this command.
49
+ 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.
50
+
51
+ To check if files are up-to-date (rather than actually updating them), use the "check" sub-command.
54
52
 
55
53
  ### Examples
56
54
 
57
- - no extra flags: `virmator compile`
58
- - one extra flag: `virmator compile --noEmit`
55
+ - default experience (usually all you need): `virmator docs`
56
+ - checking if files are up-to-date: `virmator docs check`
57
+ - override files to check to a single file: `virmator docs only/this/one/file.md`
58
+ - override files to check to a group of files: `virmator docs "only/this/dir/*.md"`
59
59
 
60
60
  ### check
61
61
 
62
- Run type checking without emitting compiled files.
62
+ Check that documentation is up-to-date.
63
63
 
64
64
  ## format
65
65
 
@@ -10,6 +10,7 @@ const baseConfig = {
10
10
  '**/build/',
11
11
  '**/coverage/',
12
12
  '**/dist/',
13
+ '**/docs-dist/',
13
14
  '**/graphics/',
14
15
  '**/node_modules/',
15
16
  'package-lock.json',
@@ -13,7 +13,7 @@ jobs:
13
13
  - uses: actions/checkout@v3
14
14
  - uses: actions/setup-node@v3
15
15
  with:
16
- node-version: 20.x
16
+ node-version-file: '.nvmrc'
17
17
  - name: build
18
18
  run: |
19
19
  npm ci
@@ -21,4 +21,4 @@ jobs:
21
21
  - uses: JamesIves/github-pages-deploy-action@v4
22
22
  with:
23
23
  branch: 'gh-pages'
24
- folder: 'dist'
24
+ folder: 'docs-dist'
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Use Node.js
17
17
  uses: actions/setup-node@v3
18
18
  with:
19
- node-version: 20.x
19
+ node-version-file: '.nvmrc'
20
20
  - name: run test
21
21
  run: |
22
22
  npm ci
@@ -1,6 +1,7 @@
1
1
  /Icon?
2
2
  coverage/
3
3
  dist/
4
+ docs-dist/
4
5
  graphics/
5
6
  node_modules/
6
7
  package-lock.json
@@ -0,0 +1,14 @@
1
+ import {join, resolve} from 'path';
2
+ import type {TypeDocOptions} from 'typedoc';
3
+ import {baseTypedocConfig} from 'virmator/dist/compiled-base-configs/base-typedoc';
4
+
5
+ const repoRoot = resolve(__dirname, '..');
6
+ const indexTsFile = join(repoRoot, 'src', 'index.ts');
7
+
8
+ export const typedocConfig: Partial<TypeDocOptions> = {
9
+ ...baseTypedocConfig,
10
+ out: join(repoRoot, 'docs-dist'),
11
+ entryPoints: [
12
+ indexTsFile,
13
+ ],
14
+ };
@@ -3,6 +3,7 @@
3
3
  /Icon?
4
4
  coverage/
5
5
  dist/
6
+ docs-dist/
6
7
  graphics/
7
8
  node_modules/
8
9
  src/all-files-for-code-coverage.test.ts
@@ -13,6 +13,7 @@
13
13
  /src/
14
14
  /www-static/
15
15
  bash-scripts/
16
+ docs-dist/
16
17
  index.html
17
18
  test-files/
18
19
  tsconfig*.json
@@ -5,7 +5,7 @@
5
5
  "scripts": {
6
6
  "build": "virmator frontend build",
7
7
  "compile": "virmator compile",
8
- "docs:update": "virmator code-in-markdown",
8
+ "docs:update": "virmator docs",
9
9
  "format": "virmator format",
10
10
  "preview": "virmator frontend preview",
11
11
  "publish": "virmator publish \"npm run compile && npm run test:all\"",
@@ -13,7 +13,7 @@
13
13
  "test": "virmator test",
14
14
  "test:all": "concurrently --colors --kill-others-on-fail -c auto --names types,tests,spelling,format,docs \"npm run test:types\" \"npm run test:coverage\" \"npm run test:spelling\" \"npm run test:format\" \"npm run test:docs\"",
15
15
  "test:coverage": "npm run test coverage",
16
- "test:docs": "virmator code-in-markdown check",
16
+ "test:docs": "virmator docs check",
17
17
  "test:format": "virmator format check",
18
18
  "test:spelling": "virmator spellcheck",
19
19
  "test:types": "tsc --noEmit",
@@ -0,0 +1 @@
1
+ export declare function withTypescriptConfigFile<T>(configPath: string, callback: (config: any) => Promise<T>): Promise<T>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.withTypescriptConfigFile = void 0;
27
+ const node_js_1 = require("@augment-vir/node-js");
28
+ const promises_1 = require("fs/promises");
29
+ const path_1 = require("path");
30
+ async function withTypescriptConfigFile(configPath, callback) {
31
+ const tempFilePath = (0, path_1.join)((0, path_1.dirname)(configPath), `config-output-${Date.now()}-${(0, node_js_1.randomString)()}.cjs`);
32
+ try {
33
+ await (await Promise.resolve().then(() => __importStar(require('esbuild')))).build({
34
+ entryPoints: [configPath],
35
+ outfile: tempFilePath,
36
+ write: true,
37
+ target: ['node20'],
38
+ platform: 'node',
39
+ bundle: false,
40
+ format: 'cjs',
41
+ });
42
+ const loadedConfig = require(tempFilePath);
43
+ return callback(loadedConfig);
44
+ }
45
+ finally {
46
+ try {
47
+ await (0, promises_1.unlink)(tempFilePath);
48
+ }
49
+ catch (error) { }
50
+ }
51
+ }
52
+ exports.withTypescriptConfigFile = withTypescriptConfigFile;
@@ -0,0 +1,99 @@
1
+ import { NpmDepTypeEnum } from '../api/command/define-command-inputs';
2
+ export declare const docsCommandDefinition: {
3
+ commandName: "docs";
4
+ subCommandDescriptions: {
5
+ readonly check: "Check that documentation is up-to-date.";
6
+ };
7
+ configFiles: {
8
+ readonly typedocConfig: {
9
+ readonly copyFromInternalPath: string;
10
+ readonly copyToPathRelativeToRepoDir: string;
11
+ };
12
+ };
13
+ npmDeps: readonly [{
14
+ readonly name: "markdown-code-example-inserter";
15
+ readonly type: NpmDepTypeEnum.Dev;
16
+ }, {
17
+ readonly name: "typedoc";
18
+ readonly type: NpmDepTypeEnum.Dev;
19
+ }];
20
+ } & {
21
+ allAvailableSubCommands: readonly "check"[];
22
+ subCommands: import("../api/command/define-command-inputs").SubCommandsMap<{
23
+ commandName: "docs";
24
+ subCommandDescriptions: {
25
+ readonly check: "Check that documentation is up-to-date.";
26
+ };
27
+ configFiles: {
28
+ readonly typedocConfig: {
29
+ readonly copyFromInternalPath: string;
30
+ readonly copyToPathRelativeToRepoDir: string;
31
+ };
32
+ };
33
+ npmDeps: readonly [{
34
+ readonly name: "markdown-code-example-inserter";
35
+ readonly type: NpmDepTypeEnum.Dev;
36
+ }, {
37
+ readonly name: "typedoc";
38
+ readonly type: NpmDepTypeEnum.Dev;
39
+ }];
40
+ }>;
41
+ } & {
42
+ executor: import("..").CommandExecutor<{
43
+ commandName: "docs";
44
+ subCommandDescriptions: {
45
+ readonly check: "Check that documentation is up-to-date.";
46
+ };
47
+ configFiles: {
48
+ readonly typedocConfig: {
49
+ readonly copyFromInternalPath: string;
50
+ readonly copyToPathRelativeToRepoDir: string;
51
+ };
52
+ };
53
+ npmDeps: readonly [{
54
+ readonly name: "markdown-code-example-inserter";
55
+ readonly type: NpmDepTypeEnum.Dev;
56
+ }, {
57
+ readonly name: "typedoc";
58
+ readonly type: NpmDepTypeEnum.Dev;
59
+ }];
60
+ }>;
61
+ createDescription: import("..").CreateDescriptionsCallback<{
62
+ commandName: "docs";
63
+ subCommandDescriptions: {
64
+ readonly check: "Check that documentation is up-to-date.";
65
+ };
66
+ configFiles: {
67
+ readonly typedocConfig: {
68
+ readonly copyFromInternalPath: string;
69
+ readonly copyToPathRelativeToRepoDir: string;
70
+ };
71
+ };
72
+ npmDeps: readonly [{
73
+ readonly name: "markdown-code-example-inserter";
74
+ readonly type: NpmDepTypeEnum.Dev;
75
+ }, {
76
+ readonly name: "typedoc";
77
+ readonly type: NpmDepTypeEnum.Dev;
78
+ }];
79
+ }>;
80
+ extend: import("../api/command/define-command").ExtendCallback<{
81
+ commandName: "docs";
82
+ subCommandDescriptions: {
83
+ readonly check: "Check that documentation is up-to-date.";
84
+ };
85
+ configFiles: {
86
+ readonly typedocConfig: {
87
+ readonly copyFromInternalPath: string;
88
+ readonly copyToPathRelativeToRepoDir: string;
89
+ };
90
+ };
91
+ npmDeps: readonly [{
92
+ readonly name: "markdown-code-example-inserter";
93
+ readonly type: NpmDepTypeEnum.Dev;
94
+ }, {
95
+ readonly name: "typedoc";
96
+ readonly type: NpmDepTypeEnum.Dev;
97
+ }];
98
+ }>;
99
+ };
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.docsCommandDefinition = void 0;
27
+ const path_1 = require("path");
28
+ const typedoc_1 = require("typedoc");
29
+ const define_command_1 = require("../api/command/define-command");
30
+ const define_command_inputs_1 = require("../api/command/define-command-inputs");
31
+ const typescript_config_file_1 = require("../augments/typescript-config-file");
32
+ const package_paths_1 = require("../file-paths/package-paths");
33
+ exports.docsCommandDefinition = (0, define_command_1.defineCommand)({
34
+ commandName: 'docs',
35
+ subCommandDescriptions: {
36
+ check: 'Check that documentation is up-to-date.',
37
+ },
38
+ configFiles: {
39
+ typedocConfig: {
40
+ copyFromInternalPath: (0, path_1.join)(package_paths_1.virmatorConfigsDir, 'configs', 'typedoc.config.ts'),
41
+ copyToPathRelativeToRepoDir: (0, path_1.join)('configs', 'typedoc.config.ts'),
42
+ },
43
+ },
44
+ npmDeps: [
45
+ {
46
+ name: 'markdown-code-example-inserter',
47
+ type: define_command_inputs_1.NpmDepTypeEnum.Dev,
48
+ },
49
+ {
50
+ name: 'typedoc',
51
+ type: define_command_inputs_1.NpmDepTypeEnum.Dev,
52
+ },
53
+ ],
54
+ }, ({ commandName, packageBinName }) => {
55
+ return {
56
+ sections: [
57
+ {
58
+ title: '',
59
+ content: `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 -->\``,
60
+ },
61
+ {
62
+ title: '',
63
+ content: `By default this command parses all markdown files in the repo (ignoring node_modules). Specific markdown files can be parsed by giving ${packageBinName} extra parameters.`,
64
+ },
65
+ {
66
+ title: '',
67
+ content: `To check if files are up-to-date (rather than actually updating them), use the "check" sub-command.`,
68
+ },
69
+ ],
70
+ examples: [
71
+ {
72
+ title: 'default experience (usually all you need)',
73
+ content: `${packageBinName} ${commandName}`,
74
+ },
75
+ {
76
+ title: 'checking if files are up-to-date',
77
+ content: `${packageBinName} ${commandName} check`,
78
+ },
79
+ {
80
+ title: 'override files to check to a single file',
81
+ content: `${packageBinName} ${commandName} only/this/one/file.md`,
82
+ },
83
+ {
84
+ title: 'override files to check to a group of files',
85
+ content: `${packageBinName} ${commandName} "only/this/dir/*.md"`,
86
+ },
87
+ ],
88
+ };
89
+ }, async ({ repoDir, packageDir, configFiles, filteredInputArgs, inputSubCommands, subCommands, packageBinName, }) => {
90
+ const typedocConfigPath = (0, path_1.join)(repoDir, configFiles.typedocConfig.copyToPathRelativeToRepoDir);
91
+ return await (0, typescript_config_file_1.withTypescriptConfigFile)(typedocConfigPath, async (loadedConfig) => {
92
+ const containsManualMarkdownArgs = filteredInputArgs.some((arg) => arg.match(/\.md['"]?$/));
93
+ const args = containsManualMarkdownArgs
94
+ ? filteredInputArgs
95
+ : [`\"./**/*.md\"`];
96
+ const isCheckingOnly = inputSubCommands.includes(subCommands.check);
97
+ const subCommand = isCheckingOnly ? '--check' : '';
98
+ const logTransforms = {
99
+ stderr: (stderrInput) => stderrInput.replace('Run without --check to update.', 'Run without the "check" sub-command in order to update.'),
100
+ };
101
+ const options = loadedConfig.typedocConfig;
102
+ const checkTypeDocOptions = isCheckingOnly
103
+ ? { emit: typedoc_1.Configuration.EmitStrategy.none }
104
+ : {};
105
+ if (!(await runTypeDoc({
106
+ ...options,
107
+ ...checkTypeDocOptions,
108
+ }, packageBinName))) {
109
+ return { success: false };
110
+ }
111
+ return {
112
+ logTransforms,
113
+ args: [
114
+ await (0, package_paths_1.getNpmBinPath)({
115
+ repoDir: repoDir,
116
+ command: 'md-code',
117
+ packageDirPath: packageDir,
118
+ }),
119
+ subCommand,
120
+ ...args,
121
+ ],
122
+ };
123
+ });
124
+ });
125
+ async function runTypeDoc(options, packageBinName) {
126
+ const typedoc = await Promise.resolve().then(() => __importStar(require('typedoc')));
127
+ const app = await typedoc.Application.bootstrapWithPlugins(options, [
128
+ new typedoc.TypeDocReader(),
129
+ new typedoc.PackageJsonReader(),
130
+ new typedoc.TSConfigReader(),
131
+ ]);
132
+ if (app.options.getValue('version')) {
133
+ console.log(app.toString());
134
+ return true;
135
+ }
136
+ else if (app.options.getValue('help')) {
137
+ console.log(app.options.getHelp());
138
+ return true;
139
+ }
140
+ else if (app.options.getValue('showConfig')) {
141
+ console.log(app.options.getRawValues());
142
+ return true;
143
+ }
144
+ else if (app.logger.hasErrors()) {
145
+ return false;
146
+ }
147
+ else if (app.options.getValue('treatWarningsAsErrors') && app.logger.hasWarnings()) {
148
+ return false;
149
+ }
150
+ else if (app.options.getValue('watch')) {
151
+ throw new Error(`TypeDoc watch mode not supported in ${packageBinName}. Run typedoc directly.`);
152
+ }
153
+ const project = await app.convert();
154
+ if (!project) {
155
+ return false;
156
+ }
157
+ else if (app.options.getValue('treatWarningsAsErrors') && app.logger.hasWarnings()) {
158
+ return false;
159
+ }
160
+ const preValidationWarnCount = app.logger.warningCount;
161
+ app.validate(project);
162
+ const hadValidationWarnings = app.logger.warningCount !== preValidationWarnCount;
163
+ if (app.logger.hasErrors()) {
164
+ return false;
165
+ }
166
+ else if (hadValidationWarnings &&
167
+ (app.options.getValue('treatWarningsAsErrors') ||
168
+ app.options.getValue('treatValidationWarningsAsErrors'))) {
169
+ return false;
170
+ }
171
+ else if (app.options.getValue('emit') !== 'none') {
172
+ const json = app.options.getValue('json');
173
+ if (!json || app.options.isSet('out')) {
174
+ await app.generateDocs(project, app.options.getValue('out'));
175
+ }
176
+ if (json) {
177
+ await app.generateJson(project, json);
178
+ }
179
+ if (app.logger.hasErrors()) {
180
+ return false;
181
+ }
182
+ else if (app.options.getValue('treatWarningsAsErrors') && app.logger.hasWarnings()) {
183
+ return false;
184
+ }
185
+ }
186
+ return true;
187
+ }
@@ -24,12 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.upgradeDepsCommandDefinition = void 0;
27
- const common_1 = require("@augment-vir/common");
28
27
  const node_js_1 = require("@augment-vir/node-js");
29
- const promises_1 = require("fs/promises");
30
28
  const path_1 = require("path");
31
29
  const define_command_1 = require("../api/command/define-command");
32
30
  const define_command_inputs_1 = require("../api/command/define-command-inputs");
31
+ const typescript_config_file_1 = require("../augments/typescript-config-file");
33
32
  const package_paths_1 = require("./../file-paths/package-paths");
34
33
  exports.upgradeDepsCommandDefinition = (0, define_command_1.defineCommand)({
35
34
  commandName: 'upgrade-deps',
@@ -59,25 +58,14 @@ exports.upgradeDepsCommandDefinition = (0, define_command_1.defineCommand)({
59
58
  },
60
59
  ],
61
60
  };
62
- }, async (inputs) => {
63
- const tempFilePath = (0, path_1.join)(__dirname, `config-output-${Date.now()}-${(0, node_js_1.randomString)()}.cjs`);
64
- try {
65
- const configPath = (0, path_1.join)(inputs.repoDir, inputs.configFiles.ncuConfig.copyToPathRelativeToRepoDir);
66
- await (await Promise.resolve().then(() => __importStar(require('esbuild')))).build({
67
- entryPoints: [configPath],
68
- outfile: tempFilePath,
69
- write: true,
70
- target: ['node20'],
71
- platform: 'node',
72
- bundle: false,
73
- format: 'cjs',
74
- });
75
- const repoPackageJson = await (0, node_js_1.readPackageJson)(inputs.repoDir);
76
- const loadedConfig = require(tempFilePath);
61
+ }, async ({ repoDir, configFiles }) => {
62
+ const ncuConfigPath = (0, path_1.join)(repoDir, configFiles.ncuConfig.copyToPathRelativeToRepoDir);
63
+ return await (0, typescript_config_file_1.withTypescriptConfigFile)(ncuConfigPath, async (loadedConfig) => {
64
+ const repoPackageJson = await (0, node_js_1.readPackageJson)(repoDir);
77
65
  const config = loadedConfig.ncuConfig;
78
66
  await (await Promise.resolve().then(() => __importStar(require('npm-check-updates')))).run({
79
67
  ...config,
80
- cwd: inputs.repoDir,
68
+ cwd: repoDir,
81
69
  json: false,
82
70
  workspaces: !!repoPackageJson.workspaces,
83
71
  format: [],
@@ -85,15 +73,5 @@ exports.upgradeDepsCommandDefinition = (0, define_command_1.defineCommand)({
85
73
  cli: true,
86
74
  });
87
75
  return { success: true };
88
- }
89
- catch (error) {
90
- console.error((0, common_1.extractErrorMessage)(error));
91
- return { success: false };
92
- }
93
- finally {
94
- try {
95
- await (0, promises_1.unlink)(tempFilePath);
96
- }
97
- catch (error) { }
98
- }
76
+ });
99
77
  });
@@ -0,0 +1,3 @@
1
+ import type { TypeDocOptions } from 'typedoc';
2
+ export declare const defaultDocumentationRequirements: TypeDocOptions['requiredToBeDocumented'];
3
+ export declare const baseTypedocConfig: Partial<TypeDocOptions>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.baseTypedocConfig = exports.defaultDocumentationRequirements = void 0;
4
+ exports.defaultDocumentationRequirements = [
5
+ 'Accessor',
6
+ 'CallSignature',
7
+ 'Class',
8
+ 'Constructor',
9
+ 'ConstructorSignature',
10
+ 'Enum',
11
+ 'Function',
12
+ 'GetSignature',
13
+ 'IndexSignature',
14
+ 'Interface',
15
+ 'Method',
16
+ 'Module',
17
+ 'Namespace',
18
+ 'Parameter',
19
+ 'Reference',
20
+ 'SetSignature',
21
+ 'TypeAlias',
22
+ 'TypeLiteral',
23
+ 'Variable',
24
+ ];
25
+ exports.baseTypedocConfig = {
26
+ cacheBust: true,
27
+ cleanOutputDir: true,
28
+ githubPages: true,
29
+ includeVersion: true,
30
+ searchInComments: true,
31
+ skipErrorChecking: true,
32
+ treatWarningsAsErrors: true,
33
+ validation: {
34
+ notExported: true,
35
+ invalidLink: true,
36
+ notDocumented: true,
37
+ },
38
+ requiredToBeDocumented: exports.defaultDocumentationRequirements,
39
+ };
package/dist/index.d.ts CHANGED
@@ -18,141 +18,181 @@ export declare const virmator: Readonly<{
18
18
  cliHelpMessage: string;
19
19
  markdownHelpMessage: string;
20
20
  commandMapping: import("./api/command/command-mapping").CommandDefinitionArrayToMapping<(({
21
- commandName: "code-in-markdown";
21
+ commandName: "compile";
22
22
  subCommandDescriptions: {
23
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
23
+ readonly check: "Run type checking without emitting compiled files.";
24
+ };
25
+ configFiles: {
26
+ readonly tsConfig: {
27
+ readonly copyFromInternalPath: string;
28
+ readonly copyToPathRelativeToRepoDir: "tsconfig.json";
29
+ };
24
30
  };
25
- configFiles: {};
26
31
  npmDeps: readonly [{
27
- readonly name: "markdown-code-example-inserter";
32
+ readonly name: "typescript";
28
33
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
29
34
  }];
30
35
  } & {
31
36
  allAvailableSubCommands: readonly "check"[];
32
37
  subCommands: import("./api/command/define-command-inputs").SubCommandsMap<{
33
- commandName: "code-in-markdown";
38
+ commandName: "compile";
34
39
  subCommandDescriptions: {
35
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
40
+ readonly check: "Run type checking without emitting compiled files.";
41
+ };
42
+ configFiles: {
43
+ readonly tsConfig: {
44
+ readonly copyFromInternalPath: string;
45
+ readonly copyToPathRelativeToRepoDir: "tsconfig.json";
46
+ };
36
47
  };
37
- configFiles: {};
38
48
  npmDeps: readonly [{
39
- readonly name: "markdown-code-example-inserter";
49
+ readonly name: "typescript";
40
50
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
41
51
  }];
42
52
  }>;
43
53
  } & {
44
54
  executor: import("./api/command/command-executor").CommandExecutor<{
45
- commandName: "code-in-markdown";
55
+ commandName: "compile";
46
56
  subCommandDescriptions: {
47
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
57
+ readonly check: "Run type checking without emitting compiled files.";
58
+ };
59
+ configFiles: {
60
+ readonly tsConfig: {
61
+ readonly copyFromInternalPath: string;
62
+ readonly copyToPathRelativeToRepoDir: "tsconfig.json";
63
+ };
48
64
  };
49
- configFiles: {};
50
65
  npmDeps: readonly [{
51
- readonly name: "markdown-code-example-inserter";
66
+ readonly name: "typescript";
52
67
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
53
68
  }];
54
69
  }>;
55
70
  createDescription: import("./api/command/command-description").CreateDescriptionsCallback<{
56
- commandName: "code-in-markdown";
71
+ commandName: "compile";
57
72
  subCommandDescriptions: {
58
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
73
+ readonly check: "Run type checking without emitting compiled files.";
74
+ };
75
+ configFiles: {
76
+ readonly tsConfig: {
77
+ readonly copyFromInternalPath: string;
78
+ readonly copyToPathRelativeToRepoDir: "tsconfig.json";
79
+ };
59
80
  };
60
- configFiles: {};
61
81
  npmDeps: readonly [{
62
- readonly name: "markdown-code-example-inserter";
82
+ readonly name: "typescript";
63
83
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
64
84
  }];
65
85
  }>;
66
86
  extend: import("./api/command/define-command").ExtendCallback<{
67
- commandName: "code-in-markdown";
87
+ commandName: "compile";
68
88
  subCommandDescriptions: {
69
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
89
+ readonly check: "Run type checking without emitting compiled files.";
90
+ };
91
+ configFiles: {
92
+ readonly tsConfig: {
93
+ readonly copyFromInternalPath: string;
94
+ readonly copyToPathRelativeToRepoDir: "tsconfig.json";
95
+ };
70
96
  };
71
- configFiles: {};
72
97
  npmDeps: readonly [{
73
- readonly name: "markdown-code-example-inserter";
98
+ readonly name: "typescript";
74
99
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
75
100
  }];
76
101
  }>;
77
102
  }) | ({
78
- commandName: "compile";
103
+ commandName: "docs";
79
104
  subCommandDescriptions: {
80
- readonly check: "Run type checking without emitting compiled files.";
105
+ readonly check: "Check that documentation is up-to-date.";
81
106
  };
82
107
  configFiles: {
83
- readonly tsConfig: {
108
+ readonly typedocConfig: {
84
109
  readonly copyFromInternalPath: string;
85
- readonly copyToPathRelativeToRepoDir: "tsconfig.json";
110
+ readonly copyToPathRelativeToRepoDir: string;
86
111
  };
87
112
  };
88
113
  npmDeps: readonly [{
89
- readonly name: "typescript";
114
+ readonly name: "markdown-code-example-inserter";
115
+ readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
116
+ }, {
117
+ readonly name: "typedoc";
90
118
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
91
119
  }];
92
120
  } & {
93
121
  allAvailableSubCommands: readonly "check"[];
94
122
  subCommands: import("./api/command/define-command-inputs").SubCommandsMap<{
95
- commandName: "compile";
123
+ commandName: "docs";
96
124
  subCommandDescriptions: {
97
- readonly check: "Run type checking without emitting compiled files.";
125
+ readonly check: "Check that documentation is up-to-date.";
98
126
  };
99
127
  configFiles: {
100
- readonly tsConfig: {
128
+ readonly typedocConfig: {
101
129
  readonly copyFromInternalPath: string;
102
- readonly copyToPathRelativeToRepoDir: "tsconfig.json";
130
+ readonly copyToPathRelativeToRepoDir: string;
103
131
  };
104
132
  };
105
133
  npmDeps: readonly [{
106
- readonly name: "typescript";
134
+ readonly name: "markdown-code-example-inserter";
135
+ readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
136
+ }, {
137
+ readonly name: "typedoc";
107
138
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
108
139
  }];
109
140
  }>;
110
141
  } & {
111
142
  executor: import("./api/command/command-executor").CommandExecutor<{
112
- commandName: "compile";
143
+ commandName: "docs";
113
144
  subCommandDescriptions: {
114
- readonly check: "Run type checking without emitting compiled files.";
145
+ readonly check: "Check that documentation is up-to-date.";
115
146
  };
116
147
  configFiles: {
117
- readonly tsConfig: {
148
+ readonly typedocConfig: {
118
149
  readonly copyFromInternalPath: string;
119
- readonly copyToPathRelativeToRepoDir: "tsconfig.json";
150
+ readonly copyToPathRelativeToRepoDir: string;
120
151
  };
121
152
  };
122
153
  npmDeps: readonly [{
123
- readonly name: "typescript";
154
+ readonly name: "markdown-code-example-inserter";
155
+ readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
156
+ }, {
157
+ readonly name: "typedoc";
124
158
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
125
159
  }];
126
160
  }>;
127
161
  createDescription: import("./api/command/command-description").CreateDescriptionsCallback<{
128
- commandName: "compile";
162
+ commandName: "docs";
129
163
  subCommandDescriptions: {
130
- readonly check: "Run type checking without emitting compiled files.";
164
+ readonly check: "Check that documentation is up-to-date.";
131
165
  };
132
166
  configFiles: {
133
- readonly tsConfig: {
167
+ readonly typedocConfig: {
134
168
  readonly copyFromInternalPath: string;
135
- readonly copyToPathRelativeToRepoDir: "tsconfig.json";
169
+ readonly copyToPathRelativeToRepoDir: string;
136
170
  };
137
171
  };
138
172
  npmDeps: readonly [{
139
- readonly name: "typescript";
173
+ readonly name: "markdown-code-example-inserter";
174
+ readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
175
+ }, {
176
+ readonly name: "typedoc";
140
177
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
141
178
  }];
142
179
  }>;
143
180
  extend: import("./api/command/define-command").ExtendCallback<{
144
- commandName: "compile";
181
+ commandName: "docs";
145
182
  subCommandDescriptions: {
146
- readonly check: "Run type checking without emitting compiled files.";
183
+ readonly check: "Check that documentation is up-to-date.";
147
184
  };
148
185
  configFiles: {
149
- readonly tsConfig: {
186
+ readonly typedocConfig: {
150
187
  readonly copyFromInternalPath: string;
151
- readonly copyToPathRelativeToRepoDir: "tsconfig.json";
188
+ readonly copyToPathRelativeToRepoDir: string;
152
189
  };
153
190
  };
154
191
  npmDeps: readonly [{
155
- readonly name: "typescript";
192
+ readonly name: "markdown-code-example-inserter";
193
+ readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
194
+ }, {
195
+ readonly name: "typedoc";
156
196
  readonly type: import("./api/command/define-command-inputs").NpmDepTypeEnum.Dev;
157
197
  }];
158
198
  }>;
package/dist/index.js CHANGED
@@ -16,8 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.virmator = exports.getNpmBinPath = void 0;
18
18
  const create_virmator_1 = require("./api/create-virmator");
19
- const code_in_markdown_command_1 = require("./commands/code-in-markdown.command");
20
19
  const compile_command_1 = require("./commands/compile.command");
20
+ const docs_command_1 = require("./commands/docs.command");
21
21
  const format_command_1 = require("./commands/format.command");
22
22
  const frontend_command_1 = require("./commands/frontend.command");
23
23
  const init_command_1 = require("./commands/init.command");
@@ -49,7 +49,7 @@ exports.virmator = (0, create_virmator_1.createVirmator)({
49
49
  packageBinName: 'virmator',
50
50
  packageRootDir: package_paths_1.virmatorPackageDir,
51
51
  commandDefinitions: [
52
- code_in_markdown_command_1.codeInMarkdownCommandDefinition,
52
+ docs_command_1.docsCommandDefinition,
53
53
  compile_command_1.compileCommandDefinition,
54
54
  format_command_1.formatCommandDefinition,
55
55
  frontend_command_1.frontendCommandDefinition,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "7.4.1",
3
+ "version": "8.0.0",
4
4
  "description": "Handle common package configs, commands, and dependencies.",
5
5
  "keywords": [
6
6
  "automation",
@@ -43,38 +43,38 @@
43
43
  "test:types": "tsc --noEmit"
44
44
  },
45
45
  "dependencies": {
46
- "@augment-vir/common": "^16.4.1",
47
- "@augment-vir/node-js": "^16.4.1",
46
+ "@augment-vir/common": "^19.0.1",
47
+ "@augment-vir/node-js": "^19.0.1",
48
48
  "ansi-colors": "^4.1.3",
49
49
  "concurrently": "^8.2.1",
50
50
  "glob": "^8.1.0",
51
- "glob-promise": "^6.0.3",
51
+ "glob-promise": "^6.0.5",
52
52
  "semver": "^7.5.4",
53
- "simple-git": "^3.19.1",
53
+ "simple-git": "^3.20.0",
54
54
  "type-fest": "^4.3.1"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@electrovir/nyc": "15.1.0-fix0",
58
58
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
59
59
  "@open-wc/testing": "^3.2.0",
60
- "@types/chai": "^4.3.5",
61
- "@types/fs-extra": "^11.0.1",
60
+ "@types/chai": "^4.3.6",
61
+ "@types/fs-extra": "^11.0.2",
62
62
  "@types/glob": "^8.1.0",
63
63
  "@types/mocha": "^10.0.1",
64
- "@types/node": "^20.5.8",
65
- "@types/semver": "^7.5.1",
64
+ "@types/node": "^20.6.4",
65
+ "@types/semver": "^7.5.2",
66
66
  "@web/dev-server-esbuild": "^0.4.1",
67
67
  "@web/test-runner": "^0.17.1",
68
68
  "@web/test-runner-commands": "^0.8.0",
69
69
  "@web/test-runner-playwright": "^0.10.1",
70
70
  "@web/test-runner-visual-regression": "^0.8.2",
71
71
  "chai": "^4.3.8",
72
- "cspell": "^7.3.2",
73
- "element-vir": "^16.3.1",
74
- "esbuild": "^0.19.2",
72
+ "cspell": "^7.3.6",
73
+ "element-vir": "^16.4.0",
74
+ "esbuild": "^0.19.3",
75
75
  "fs-extra": "^11.1.1",
76
76
  "istanbul-smart-text-reporter": "^1.1.2",
77
- "markdown-code-example-inserter": "^0.3.1",
77
+ "markdown-code-example-inserter": "^0.3.2",
78
78
  "mocha": "^10.2.0",
79
79
  "mocha-spec-reporter-with-file-names": "^0.0.3",
80
80
  "npm-check-updates": "~16.12.3",
@@ -90,10 +90,11 @@
90
90
  "test-established-expectations": "^0.5.0",
91
91
  "ts-node": "^10.9.1",
92
92
  "tsconfig-paths": "^4.2.0",
93
+ "typedoc": "^0.25.1",
93
94
  "typescript": "^5.2.2",
94
- "virmator": "^7.4.0",
95
+ "virmator": "^7.4.1",
95
96
  "vite": "^4.4.9",
96
- "vite-tsconfig-paths": "^4.2.0"
97
+ "vite-tsconfig-paths": "^4.2.1"
97
98
  },
98
99
  "engines": {
99
100
  "node": ">=16",
@@ -1,59 +0,0 @@
1
- import { NpmDepTypeEnum } from '../api/command/define-command-inputs';
2
- export declare const codeInMarkdownCommandDefinition: {
3
- commandName: "code-in-markdown";
4
- subCommandDescriptions: {
5
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
6
- };
7
- configFiles: {};
8
- npmDeps: readonly [{
9
- readonly name: "markdown-code-example-inserter";
10
- readonly type: NpmDepTypeEnum.Dev;
11
- }];
12
- } & {
13
- allAvailableSubCommands: readonly "check"[];
14
- subCommands: import("../api/command/define-command-inputs").SubCommandsMap<{
15
- commandName: "code-in-markdown";
16
- subCommandDescriptions: {
17
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
18
- };
19
- configFiles: {};
20
- npmDeps: readonly [{
21
- readonly name: "markdown-code-example-inserter";
22
- readonly type: NpmDepTypeEnum.Dev;
23
- }];
24
- }>;
25
- } & {
26
- executor: import("..").CommandExecutor<{
27
- commandName: "code-in-markdown";
28
- subCommandDescriptions: {
29
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
30
- };
31
- configFiles: {};
32
- npmDeps: readonly [{
33
- readonly name: "markdown-code-example-inserter";
34
- readonly type: NpmDepTypeEnum.Dev;
35
- }];
36
- }>;
37
- createDescription: import("..").CreateDescriptionsCallback<{
38
- commandName: "code-in-markdown";
39
- subCommandDescriptions: {
40
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
41
- };
42
- configFiles: {};
43
- npmDeps: readonly [{
44
- readonly name: "markdown-code-example-inserter";
45
- readonly type: NpmDepTypeEnum.Dev;
46
- }];
47
- }>;
48
- extend: import("../api/command/define-command").ExtendCallback<{
49
- commandName: "code-in-markdown";
50
- subCommandDescriptions: {
51
- readonly check: "Check that markdown files have their examples inserted and are up-to-date.";
52
- };
53
- configFiles: {};
54
- npmDeps: readonly [{
55
- readonly name: "markdown-code-example-inserter";
56
- readonly type: NpmDepTypeEnum.Dev;
57
- }];
58
- }>;
59
- };
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.codeInMarkdownCommandDefinition = void 0;
4
- const define_command_1 = require("../api/command/define-command");
5
- const define_command_inputs_1 = require("../api/command/define-command-inputs");
6
- const package_paths_1 = require("../file-paths/package-paths");
7
- exports.codeInMarkdownCommandDefinition = (0, define_command_1.defineCommand)({
8
- commandName: 'code-in-markdown',
9
- subCommandDescriptions: {
10
- check: 'Check that markdown files have their examples inserted and are up-to-date.',
11
- },
12
- configFiles: {},
13
- npmDeps: [
14
- { name: 'markdown-code-example-inserter', type: define_command_inputs_1.NpmDepTypeEnum.Dev },
15
- ],
16
- }, ({ commandName, packageBinName }) => {
17
- return {
18
- sections: [
19
- {
20
- title: '',
21
- content: `Insert 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 -->\``,
22
- },
23
- {
24
- title: '',
25
- content: `By default this command parses all markdown files in the repo (ignoring node_modules). Specific markdown files can be parsed by giving ${packageBinName} extra parameters.`,
26
- },
27
- {
28
- title: '',
29
- content: `To check if files are up-to-date (rather than actually updating them), use the "check" sub-command.`,
30
- },
31
- ],
32
- examples: [
33
- {
34
- title: 'default experience (usually all you need)',
35
- content: `${packageBinName} ${commandName}`,
36
- },
37
- {
38
- title: 'checking if files are up-to-date',
39
- content: `${packageBinName} ${commandName} check`,
40
- },
41
- {
42
- title: 'override files to check to a single file',
43
- content: `${packageBinName} ${commandName} only/this/one/file.md`,
44
- },
45
- {
46
- title: 'override files to check to a group of files',
47
- content: `${packageBinName} ${commandName} "only/this/dir/*.md"`,
48
- },
49
- ],
50
- };
51
- }, async (inputs) => {
52
- const args = inputs.filteredInputArgs.length
53
- ? inputs.filteredInputArgs
54
- : [`\"./**/*.md\"`];
55
- const subCommand = inputs.inputSubCommands.includes(inputs.subCommands.check)
56
- ? '--check'
57
- : '';
58
- const logTransforms = {
59
- stderr: (stderrInput) => stderrInput.replace('Run without --check to update.', 'Run without the "check" sub-command in order to update.'),
60
- };
61
- return {
62
- logTransforms,
63
- args: [
64
- await (0, package_paths_1.getNpmBinPath)({
65
- repoDir: inputs.repoDir,
66
- command: 'md-code',
67
- packageDirPath: inputs.packageDir,
68
- }),
69
- subCommand,
70
- ...args,
71
- ],
72
- };
73
- });