@virmator/docs 13.3.3 → 13.3.5
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 +0 -1
- package/configs/typedoc.config.share.ts +1 -6
- package/configs/typedoc.config.ts +1 -6
- package/dist/docs.d.ts +16 -13
- package/dist/docs.js +29 -30
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,7 +15,6 @@ A default plugin for [virmator](https://www.npmjs.com/package/virmator).
|
|
|
15
15
|
- Deps
|
|
16
16
|
- [markdown-code-example-inserter](https://npmjs.com/package/markdown-code-example-inserter)
|
|
17
17
|
- [typedoc](https://npmjs.com/package/typedoc)
|
|
18
|
-
- [esbuild](https://npmjs.com/package/esbuild)
|
|
19
18
|
- Sub Commands
|
|
20
19
|
|
|
21
20
|
- **check**
|
|
@@ -2,12 +2,7 @@ import {baseTypedocConfig} from '@virmator/docs/configs/typedoc.config.base';
|
|
|
2
2
|
import {join, resolve} from 'node:path';
|
|
3
3
|
import type {TypeDocOptions} from 'typedoc';
|
|
4
4
|
|
|
5
|
-
const repoRoot = resolve(
|
|
6
|
-
__dirname,
|
|
7
|
-
/** Go up two directories because this gets compiled into `node_modules/.virmator` */
|
|
8
|
-
'..',
|
|
9
|
-
'..',
|
|
10
|
-
);
|
|
5
|
+
const repoRoot = resolve(import.meta.dirname, '..');
|
|
11
6
|
const indexTsFile = join(repoRoot, 'src', 'index.ts');
|
|
12
7
|
|
|
13
8
|
export const typeDocConfig: Partial<TypeDocOptions> = {
|
|
@@ -2,12 +2,7 @@ import {baseTypedocConfig} from '@virmator/docs/configs/typedoc.config.base';
|
|
|
2
2
|
import {join, resolve} from 'path';
|
|
3
3
|
import type {TypeDocOptions} from 'typedoc';
|
|
4
4
|
|
|
5
|
-
const repoRoot = resolve(
|
|
6
|
-
__dirname,
|
|
7
|
-
/** Go up two directories because this gets compiled into `node_modules/.virmator` */
|
|
8
|
-
'..',
|
|
9
|
-
'..',
|
|
10
|
-
);
|
|
5
|
+
const repoRoot = resolve(import.meta.dirname, '..');
|
|
11
6
|
const indexTsFile = join(repoRoot, 'src', 'docs.ts');
|
|
12
7
|
|
|
13
8
|
export const typeDocConfig: Partial<TypeDocOptions> = {
|
package/dist/docs.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { NpmDepType, PackageType, VirmatorEnv } from '@virmator/core';
|
|
1
|
+
import { NpmDepType, PackageType, PluginLogger, VirmatorEnv } from '@virmator/core';
|
|
2
|
+
import type * as Typedoc from 'typedoc';
|
|
2
3
|
/** A virmator plugin for checking and generating documentation. */
|
|
3
4
|
export declare const virmatorDocsPlugin: Readonly<Readonly<{
|
|
4
5
|
name: string;
|
|
@@ -40,12 +41,6 @@ export declare const virmatorDocsPlugin: Readonly<Readonly<{
|
|
|
40
41
|
readonly env: readonly [VirmatorEnv.Node, VirmatorEnv.Web];
|
|
41
42
|
readonly packageType: readonly [PackageType.TopPackage, PackageType.MonoPackage];
|
|
42
43
|
};
|
|
43
|
-
/** Needed to compile the TS dep-cruiser config file. */
|
|
44
|
-
readonly esbuild: {
|
|
45
|
-
readonly type: NpmDepType.Dev;
|
|
46
|
-
readonly env: readonly [VirmatorEnv.Node, VirmatorEnv.Web];
|
|
47
|
-
readonly packageType: readonly [PackageType.TopPackage, PackageType.MonoPackage];
|
|
48
|
-
};
|
|
49
44
|
};
|
|
50
45
|
};
|
|
51
46
|
}>;
|
|
@@ -89,13 +84,21 @@ export declare const virmatorDocsPlugin: Readonly<Readonly<{
|
|
|
89
84
|
readonly env: readonly [VirmatorEnv.Node, VirmatorEnv.Web];
|
|
90
85
|
readonly packageType: readonly [PackageType.TopPackage, PackageType.MonoPackage];
|
|
91
86
|
};
|
|
92
|
-
/** Needed to compile the TS dep-cruiser config file. */
|
|
93
|
-
readonly esbuild: {
|
|
94
|
-
readonly type: NpmDepType.Dev;
|
|
95
|
-
readonly env: readonly [VirmatorEnv.Node, VirmatorEnv.Web];
|
|
96
|
-
readonly packageType: readonly [PackageType.TopPackage, PackageType.MonoPackage];
|
|
97
|
-
};
|
|
98
87
|
};
|
|
99
88
|
};
|
|
100
89
|
}>>;
|
|
101
90
|
}>;
|
|
91
|
+
/** Runs TypeDoc with a TypeScript config file just like `@virmator/docs` does. */
|
|
92
|
+
export declare function runTypedoc({ config, packageDir, checkOnly, log, }: {
|
|
93
|
+
/** Full typedoc options object. */
|
|
94
|
+
config: Partial<Typedoc.TypeDocOptions>;
|
|
95
|
+
/**
|
|
96
|
+
* Path to the npm package which is running typedoc. This should be a path to a directory that
|
|
97
|
+
* directly contains a `package.json` file.
|
|
98
|
+
*/
|
|
99
|
+
packageDir: string;
|
|
100
|
+
/** Set to `true` to only check current doc comments, rather than generating HTML from them. */
|
|
101
|
+
checkOnly?: boolean | undefined;
|
|
102
|
+
/** Optionally override the logger. */
|
|
103
|
+
log?: PluginLogger | undefined;
|
|
104
|
+
}): Promise<void>;
|
package/dist/docs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ensureError, isTruthy } from '@augment-vir/common';
|
|
2
2
|
import { readPackageJson } from '@augment-vir/node-js';
|
|
3
|
-
import {
|
|
3
|
+
import { defaultPluginLogger, defineVirmatorPlugin, NpmDepType, PackageType, VirmatorEnv, VirmatorNoTraceError, } from '@virmator/core';
|
|
4
4
|
import mri from 'mri';
|
|
5
5
|
import { basename, join } from 'node:path';
|
|
6
6
|
/** A virmator plugin for checking and generating documentation. */
|
|
@@ -77,18 +77,6 @@ export const virmatorDocsPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
77
77
|
PackageType.MonoPackage,
|
|
78
78
|
],
|
|
79
79
|
},
|
|
80
|
-
/** Needed to compile the TS dep-cruiser config file. */
|
|
81
|
-
esbuild: {
|
|
82
|
-
type: NpmDepType.Dev,
|
|
83
|
-
env: [
|
|
84
|
-
VirmatorEnv.Node,
|
|
85
|
-
VirmatorEnv.Web,
|
|
86
|
-
],
|
|
87
|
-
packageType: [
|
|
88
|
-
PackageType.TopPackage,
|
|
89
|
-
PackageType.MonoPackage,
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
80
|
},
|
|
93
81
|
},
|
|
94
82
|
},
|
|
@@ -131,22 +119,15 @@ export const virmatorDocsPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
131
119
|
log.faint(`Skipping typedoc ${typedocVerb} in private repo ${packageName}`);
|
|
132
120
|
return;
|
|
133
121
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
...typedocOptions,
|
|
144
|
-
...(checkOnly ? { emit: typedoc.Configuration.EmitStrategy.none } : {}),
|
|
145
|
-
tsconfig: join(packageDir, 'tsconfig.json'),
|
|
146
|
-
};
|
|
147
|
-
if (!(await runTypedoc(fullTypedocOptions, typedoc, log))) {
|
|
148
|
-
throw new VirmatorNoTraceError();
|
|
149
|
-
}
|
|
122
|
+
// dynamic imports are not branches
|
|
123
|
+
/* node:coverage ignore next 2 */
|
|
124
|
+
const config = (await import(join(packageDir, configs.docs.configs.typedoc.copyToPath)))
|
|
125
|
+
.typeDocConfig;
|
|
126
|
+
await runTypedoc({
|
|
127
|
+
checkOnly,
|
|
128
|
+
packageDir,
|
|
129
|
+
config,
|
|
130
|
+
log,
|
|
150
131
|
});
|
|
151
132
|
}
|
|
152
133
|
/**
|
|
@@ -164,7 +145,25 @@ export const virmatorDocsPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
164
145
|
await runDocs(cwdPackagePath, cwdPackageJson.name || basename(cwdPackagePath), undefined);
|
|
165
146
|
}
|
|
166
147
|
});
|
|
167
|
-
|
|
148
|
+
/** Runs TypeDoc with a TypeScript config file just like `@virmator/docs` does. */
|
|
149
|
+
export async function runTypedoc({ config, packageDir, checkOnly = false, log = defaultPluginLogger, }) {
|
|
150
|
+
// dynamic imports are not branches
|
|
151
|
+
/* node:coverage ignore next */
|
|
152
|
+
const typedoc = await import('typedoc');
|
|
153
|
+
const combinedConfig = {
|
|
154
|
+
tsconfig: join(packageDir, 'tsconfig.json'),
|
|
155
|
+
...config,
|
|
156
|
+
...(checkOnly
|
|
157
|
+
? {
|
|
158
|
+
emit: typedoc.Configuration.EmitStrategy.none,
|
|
159
|
+
}
|
|
160
|
+
: {}),
|
|
161
|
+
};
|
|
162
|
+
if (!(await runTypedocInternal(combinedConfig, typedoc, log))) {
|
|
163
|
+
throw new VirmatorNoTraceError();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async function runTypedocInternal(options, typeDoc, log) {
|
|
168
167
|
/** Lots of edge cases included in here to just make sure we fully run the typedoc API. */
|
|
169
168
|
/* node:coverage disable */
|
|
170
169
|
const app = await typeDoc.Application.bootstrapWithPlugins(options, [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virmator/docs",
|
|
3
|
-
"version": "13.3.
|
|
3
|
+
"version": "13.3.5",
|
|
4
4
|
"description": "Default TS docs plugin for virmator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"virmator",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@augment-vir/common": "^29.3.0",
|
|
36
36
|
"@augment-vir/node-js": "^29.3.0",
|
|
37
|
-
"@virmator/core": "^13.3.
|
|
37
|
+
"@virmator/core": "^13.3.5",
|
|
38
38
|
"chalk": "^5.3.0",
|
|
39
39
|
"mri": "^1.2.0",
|
|
40
40
|
"run-time-assertions": "^1.5.2"
|