@appium/docutils 0.4.13 → 1.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.
- package/base-mkdocs.yml +45 -5
- package/build/lib/builder/deploy.d.ts +4 -4
- package/build/lib/builder/deploy.d.ts.map +1 -1
- package/build/lib/builder/deploy.js +5 -4
- package/build/lib/builder/deploy.js.map +1 -1
- package/build/lib/builder/index.d.ts +0 -2
- package/build/lib/builder/index.d.ts.map +1 -1
- package/build/lib/builder/index.js +0 -2
- package/build/lib/builder/index.js.map +1 -1
- package/build/lib/builder/site.d.ts +2 -2
- package/build/lib/builder/site.js +2 -2
- package/build/lib/cli/command/build.d.ts +8 -45
- package/build/lib/cli/command/build.d.ts.map +1 -1
- package/build/lib/cli/command/build.js +11 -56
- package/build/lib/cli/command/build.js.map +1 -1
- package/build/lib/cli/command/init.d.ts +0 -27
- package/build/lib/cli/command/init.d.ts.map +1 -1
- package/build/lib/cli/command/init.js +0 -27
- package/build/lib/cli/command/init.js.map +1 -1
- package/build/lib/cli/command/validate.d.ts +0 -24
- package/build/lib/cli/command/validate.d.ts.map +1 -1
- package/build/lib/cli/command/validate.js +2 -26
- package/build/lib/cli/command/validate.js.map +1 -1
- package/build/lib/constants.d.ts +3 -14
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/constants.js +4 -15
- package/build/lib/constants.js.map +1 -1
- package/build/lib/fs.d.ts +0 -29
- package/build/lib/fs.d.ts.map +1 -1
- package/build/lib/fs.js +4 -57
- package/build/lib/fs.js.map +1 -1
- package/build/lib/index.d.ts +0 -1
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +0 -1
- package/build/lib/index.js.map +1 -1
- package/build/lib/init.d.ts +7 -131
- package/build/lib/init.d.ts.map +1 -1
- package/build/lib/init.js +2 -55
- package/build/lib/init.js.map +1 -1
- package/build/lib/model.d.ts +0 -11
- package/build/lib/model.d.ts.map +1 -1
- package/build/lib/validate.d.ts +2 -30
- package/build/lib/validate.d.ts.map +1 -1
- package/build/lib/validate.js +2 -93
- package/build/lib/validate.js.map +1 -1
- package/lib/builder/deploy.ts +17 -15
- package/lib/builder/index.ts +0 -2
- package/lib/builder/site.ts +6 -6
- package/lib/cli/command/build.ts +12 -59
- package/lib/cli/command/init.ts +0 -27
- package/lib/cli/command/validate.ts +3 -27
- package/lib/constants.ts +4 -17
- package/lib/fs.ts +16 -84
- package/lib/index.ts +0 -1
- package/lib/init.ts +9 -106
- package/lib/model.ts +0 -14
- package/lib/validate.ts +23 -172
- package/package.json +7 -13
- package/requirements.txt +4 -3
- package/tsconfig.json +1 -0
- package/build/lib/builder/nav.d.ts +0 -81
- package/build/lib/builder/nav.d.ts.map +0 -1
- package/build/lib/builder/nav.js +0 -288
- package/build/lib/builder/nav.js.map +0 -1
- package/build/lib/builder/reference.d.ts +0 -57
- package/build/lib/builder/reference.d.ts.map +0 -1
- package/build/lib/builder/reference.js +0 -111
- package/build/lib/builder/reference.js.map +0 -1
- package/build/lib/mike.d.ts +0 -81
- package/build/lib/mike.d.ts.map +0 -1
- package/build/lib/mike.js +0 -146
- package/build/lib/mike.js.map +0 -1
- package/lib/builder/nav.ts +0 -402
- package/lib/builder/reference.ts +0 -171
- package/lib/mike.js +0 -153
package/lib/init.ts
CHANGED
|
@@ -5,21 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as JSON5 from 'json5';
|
|
8
|
-
import {
|
|
9
|
-
NAME_MKDOCS_YML,
|
|
10
|
-
NAME_TSCONFIG_JSON,
|
|
11
|
-
NAME_PYTHON,
|
|
12
|
-
REQUIREMENTS_TXT_PATH,
|
|
13
|
-
NAME_TYPEDOC_JSON,
|
|
14
|
-
NAME_PACKAGE_JSON,
|
|
15
|
-
} from './constants';
|
|
8
|
+
import {NAME_MKDOCS_YML, NAME_TSCONFIG_JSON, NAME_PYTHON, REQUIREMENTS_TXT_PATH} from './constants';
|
|
16
9
|
import YAML from 'yaml';
|
|
17
10
|
import {exec} from 'teen_process';
|
|
18
|
-
import {
|
|
11
|
+
import {Simplify} from 'type-fest';
|
|
19
12
|
import {DocutilsError} from './error';
|
|
20
13
|
import {createScaffoldTask, ScaffoldTaskOptions} from './scaffold';
|
|
14
|
+
import type { ScaffoldTask } from './scaffold';
|
|
21
15
|
import {getLogger} from './logger';
|
|
22
|
-
import {MkDocsYml, TsConfigJson
|
|
16
|
+
import {MkDocsYml, TsConfigJson} from './model';
|
|
23
17
|
import _ from 'lodash';
|
|
24
18
|
import {findPython, stringifyJson5, stringifyYaml} from './fs';
|
|
25
19
|
|
|
@@ -32,18 +26,6 @@ const BASE_MKDOCS_YML: Readonly<MkDocsYml> = Object.freeze({
|
|
|
32
26
|
site_dir: 'site',
|
|
33
27
|
});
|
|
34
28
|
|
|
35
|
-
/**
|
|
36
|
-
* Data for the base `typedoc.json` file
|
|
37
|
-
*/
|
|
38
|
-
const BASE_TYPEDOC_JSON: Readonly<TypeDocJson> = Object.freeze({
|
|
39
|
-
$schema: 'https://typedoc.org/schema.json',
|
|
40
|
-
cleanOutputDir: true,
|
|
41
|
-
entryPointStrategy: 'packages',
|
|
42
|
-
theme: 'appium',
|
|
43
|
-
readme: 'none',
|
|
44
|
-
entryPoints: ['.'],
|
|
45
|
-
});
|
|
46
|
-
|
|
47
29
|
/**
|
|
48
30
|
* Data for the base `tsconfig.json` file
|
|
49
31
|
*/
|
|
@@ -55,13 +37,6 @@ const BASE_TSCONFIG_JSON: Readonly<TsConfigJson> = Object.freeze({
|
|
|
55
37
|
},
|
|
56
38
|
});
|
|
57
39
|
|
|
58
|
-
/**
|
|
59
|
-
* Data for the base `package.json` file.
|
|
60
|
-
* We expect `package.json` to exist, and we are not in the business of creating it.
|
|
61
|
-
* However, we will need to add a `typedoc.entryPoint` prop to it.
|
|
62
|
-
*/
|
|
63
|
-
const BASE_PACKAGE_JSON: Readonly<PackageJson> = Object.freeze({});
|
|
64
|
-
|
|
65
40
|
const log = getLogger('init');
|
|
66
41
|
const dryRunLog = getLogger('dry-run', log);
|
|
67
42
|
|
|
@@ -96,42 +71,13 @@ export const initTsConfigJson = createScaffoldTask<InitTsConfigOptions, TsConfig
|
|
|
96
71
|
},
|
|
97
72
|
deserialize: JSON5.parse,
|
|
98
73
|
serialize: stringifyJson5,
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Function which scaffolds a `typedoc.json` file
|
|
104
|
-
*/
|
|
105
|
-
export const initTypeDocJson = createScaffoldTask<InitTypeDocOptions, TypeDocJson>(
|
|
106
|
-
NAME_TYPEDOC_JSON,
|
|
107
|
-
BASE_TYPEDOC_JSON,
|
|
108
|
-
'TypeDoc configuration'
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Function which scaffolds a `package.json` file
|
|
113
|
-
*
|
|
114
|
-
* This only amends prop `typedoc.entryPoint` to the `package.json` file.
|
|
115
|
-
*
|
|
116
|
-
* If, strangely, `package.json` did not exist, then it will now contain _only_ that prop.
|
|
117
|
-
*/
|
|
118
|
-
export const initTypeDocPkgJson = createScaffoldTask<InitTypeDocOptions, PackageJson>(
|
|
119
|
-
NAME_PACKAGE_JSON,
|
|
120
|
-
BASE_PACKAGE_JSON,
|
|
121
|
-
'Package configuration for TypeDoc',
|
|
122
|
-
{
|
|
123
|
-
transform: (content, opts) =>
|
|
124
|
-
({
|
|
125
|
-
...content,
|
|
126
|
-
typedoc: {entryPoint: opts.typeDocEntryPoint},
|
|
127
|
-
} as PackageJson),
|
|
128
|
-
}
|
|
74
|
+
},
|
|
129
75
|
);
|
|
130
76
|
|
|
131
77
|
/**
|
|
132
78
|
* Function which scaffolds an `mkdocs.yml` file
|
|
133
79
|
*/
|
|
134
|
-
export const initMkDocs = createScaffoldTask<InitMkDocsOptions, MkDocsYml>(
|
|
80
|
+
export const initMkDocs: ScaffoldTask<InitMkDocsOptions, MkDocsYml> = createScaffoldTask<InitMkDocsOptions, MkDocsYml>(
|
|
135
81
|
NAME_MKDOCS_YML,
|
|
136
82
|
BASE_MKDOCS_YML,
|
|
137
83
|
'MkDocs configuration',
|
|
@@ -181,7 +127,7 @@ export const initMkDocs = createScaffoldTask<InitMkDocsOptions, MkDocsYml>(
|
|
|
181
127
|
site_description: siteDescription,
|
|
182
128
|
};
|
|
183
129
|
},
|
|
184
|
-
}
|
|
130
|
+
},
|
|
185
131
|
);
|
|
186
132
|
|
|
187
133
|
/**
|
|
@@ -212,7 +158,7 @@ export async function initPython({
|
|
|
212
158
|
}
|
|
213
159
|
} catch (err) {
|
|
214
160
|
throw new DocutilsError(
|
|
215
|
-
`Could not install Python dependencies. Reason: ${(err as Error).message}
|
|
161
|
+
`Could not install Python dependencies. Reason: ${(err as Error).message}`,
|
|
216
162
|
);
|
|
217
163
|
}
|
|
218
164
|
}
|
|
@@ -238,7 +184,6 @@ export interface InitMkDocsOptions extends ScaffoldTaskOptions {
|
|
|
238
184
|
*/
|
|
239
185
|
export async function init({
|
|
240
186
|
typescript,
|
|
241
|
-
typedoc,
|
|
242
187
|
python,
|
|
243
188
|
tsconfigJson: tsconfigJsonPath,
|
|
244
189
|
packageJson: packageJsonPath,
|
|
@@ -254,15 +199,7 @@ export async function init({
|
|
|
254
199
|
cwd,
|
|
255
200
|
pythonPath,
|
|
256
201
|
upgrade,
|
|
257
|
-
typedocJson: typeDocJsonPath,
|
|
258
|
-
entryPoint: typeDocEntryPoint,
|
|
259
202
|
}: InitOptions = {}): Promise<void> {
|
|
260
|
-
if (!typescript && typedoc) {
|
|
261
|
-
log.warn(
|
|
262
|
-
'Initialization of tsconfig.json disabled. TypeDoc requires a tsconfig.json; please ensure it exists'
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
203
|
if (typescript && !upgrade) {
|
|
267
204
|
await initTsConfigJson({
|
|
268
205
|
dest: tsconfigJsonPath,
|
|
@@ -274,23 +211,6 @@ export async function init({
|
|
|
274
211
|
});
|
|
275
212
|
}
|
|
276
213
|
|
|
277
|
-
if (typedoc && !upgrade) {
|
|
278
|
-
await initTypeDocJson({
|
|
279
|
-
dest: typeDocJsonPath,
|
|
280
|
-
packageJson: packageJsonPath,
|
|
281
|
-
overwrite,
|
|
282
|
-
dryRun,
|
|
283
|
-
cwd,
|
|
284
|
-
});
|
|
285
|
-
await initTypeDocPkgJson({
|
|
286
|
-
packageJson: packageJsonPath,
|
|
287
|
-
overwrite: true, // <-- always overwrite
|
|
288
|
-
dryRun,
|
|
289
|
-
cwd,
|
|
290
|
-
typeDocEntryPoint,
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
|
|
294
214
|
if (python) {
|
|
295
215
|
await initPython({pythonPath, dryRun, upgrade});
|
|
296
216
|
}
|
|
@@ -310,10 +230,6 @@ export async function init({
|
|
|
310
230
|
}
|
|
311
231
|
}
|
|
312
232
|
|
|
313
|
-
export interface InitTypeDocOptions extends ScaffoldTaskOptions {
|
|
314
|
-
typeDocEntryPoint?: string;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
233
|
export interface InitTsConfigOptions extends ScaffoldTaskOptions {
|
|
318
234
|
/**
|
|
319
235
|
* List of source files (globs supported); typically `src` or `lib`
|
|
@@ -338,15 +254,11 @@ export interface InitPythonOptions extends ScaffoldTaskOptions {
|
|
|
338
254
|
* The props of the various "path" options are rewritten as `dest` for the scaffold tasks functions.
|
|
339
255
|
*/
|
|
340
256
|
export type InitOptions = Simplify<
|
|
341
|
-
Omit<InitPythonOptions & InitTsConfigOptions &
|
|
257
|
+
Omit<InitPythonOptions & InitTsConfigOptions & InitMkDocsOptions, 'dest'> & {
|
|
342
258
|
/**
|
|
343
259
|
* If `true` will initialize a `tsconfig.json` file
|
|
344
260
|
*/
|
|
345
261
|
typescript?: boolean;
|
|
346
|
-
/**
|
|
347
|
-
* If `true` will initialize a `typedoc.json` file
|
|
348
|
-
*/
|
|
349
|
-
typedoc?: boolean;
|
|
350
262
|
/**
|
|
351
263
|
* If `true` will install Python deps
|
|
352
264
|
*/
|
|
@@ -355,10 +267,6 @@ export type InitOptions = Simplify<
|
|
|
355
267
|
* If `true` will initialize a `mkdocs.yml` file
|
|
356
268
|
*/
|
|
357
269
|
mkdocs?: boolean;
|
|
358
|
-
/**
|
|
359
|
-
* Path to new or existing `typedoc.json` file
|
|
360
|
-
*/
|
|
361
|
-
typedocJson?: string;
|
|
362
270
|
/**
|
|
363
271
|
* Path to new or existing `tsconfig.json` file
|
|
364
272
|
*/
|
|
@@ -376,10 +284,5 @@ export type InitOptions = Simplify<
|
|
|
376
284
|
* If `true`, upgrade only
|
|
377
285
|
*/
|
|
378
286
|
upgrade?: boolean;
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Path to entry point of extension (source; not "main" field)
|
|
382
|
-
*/
|
|
383
|
-
entryPoint?: string;
|
|
384
287
|
}
|
|
385
288
|
>;
|
package/lib/model.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type {Jsonify, JsonValue, TsConfigJson as TsConfigJsonBase} from 'type-fest';
|
|
8
|
-
import type {TypeDocOptions} from 'typedoc';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* A `tsconfig.json` file w/ `$schema` prop
|
|
@@ -14,19 +13,6 @@ export type TsConfigJson = TsConfigJsonBase & {
|
|
|
14
13
|
$schema?: string;
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
/**
|
|
18
|
-
* A `typedoc.json` file w/ `$schema` and `extends` props
|
|
19
|
-
*
|
|
20
|
-
* TypeDoc doesn't recognize `$schema` and ignores it; its own config parser expands the value of
|
|
21
|
-
* `extends` before it reaches its `Options` class. This is why we cannot use `TypeDocOptions` directly.
|
|
22
|
-
*/
|
|
23
|
-
export type TypeDocJson = Jsonify<
|
|
24
|
-
Partial<TypeDocOptions> & {
|
|
25
|
-
$schema?: string;
|
|
26
|
-
extends?: string;
|
|
27
|
-
}
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
16
|
/**
|
|
31
17
|
* The `nav` prop of an `mkdocs.yml` file
|
|
32
18
|
* @see {@linkcode MkDocsYml}
|
package/lib/validate.ts
CHANGED
|
@@ -12,7 +12,6 @@ import path from 'node:path';
|
|
|
12
12
|
import {satisfies} from 'semver';
|
|
13
13
|
import {exec} from 'teen_process';
|
|
14
14
|
import {
|
|
15
|
-
DEFAULT_REL_TYPEDOC_OUT_PATH,
|
|
16
15
|
DOCUTILS_PKG,
|
|
17
16
|
NAME_BIN,
|
|
18
17
|
NAME_ERR_ENOENT,
|
|
@@ -24,24 +23,13 @@ import {
|
|
|
24
23
|
NAME_PYTHON,
|
|
25
24
|
NAME_REQUIREMENTS_TXT,
|
|
26
25
|
NAME_TSCONFIG_JSON,
|
|
27
|
-
NAME_TYPEDOC,
|
|
28
|
-
NAME_TYPEDOC_JSON,
|
|
29
26
|
NAME_TYPESCRIPT,
|
|
30
27
|
REQUIREMENTS_TXT_PATH,
|
|
31
28
|
} from './constants';
|
|
32
29
|
import {DocutilsError} from './error';
|
|
33
|
-
import {
|
|
34
|
-
findMkDocsYml,
|
|
35
|
-
findPkgDir,
|
|
36
|
-
findTypeDoc,
|
|
37
|
-
readJson5,
|
|
38
|
-
readMkDocsYml,
|
|
39
|
-
readTypedocJson,
|
|
40
|
-
whichNpm,
|
|
41
|
-
findPython,
|
|
42
|
-
} from './fs';
|
|
30
|
+
import {findMkDocsYml, findPkgDir, readJson5, readMkDocsYml, whichNpm, findPython} from './fs';
|
|
43
31
|
import {getLogger} from './logger';
|
|
44
|
-
import {MkDocsYml, PipPackage
|
|
32
|
+
import {MkDocsYml, PipPackage} from './model';
|
|
45
33
|
import {relative} from './util';
|
|
46
34
|
|
|
47
35
|
/**
|
|
@@ -54,11 +42,6 @@ const PYTHON_VER_STR = 'Python 3.';
|
|
|
54
42
|
*/
|
|
55
43
|
const TYPESCRIPT_VERSION_REGEX = /Version\s(\d+\.\d+\..+)/;
|
|
56
44
|
|
|
57
|
-
/**
|
|
58
|
-
* Matches the TypeDoc version string from `typedoc --version`
|
|
59
|
-
*/
|
|
60
|
-
const TYPEDOC_VERSION_REGEX = /TypeDoc\s(\d+\.\d+\..+)/;
|
|
61
|
-
|
|
62
45
|
/**
|
|
63
46
|
* Matches the MkDocs version string from `mkdocs --version`
|
|
64
47
|
*/
|
|
@@ -72,7 +55,6 @@ const log = getLogger('validate');
|
|
|
72
55
|
export type ValidationKind =
|
|
73
56
|
| typeof NAME_PYTHON
|
|
74
57
|
| typeof NAME_TYPESCRIPT
|
|
75
|
-
| typeof NAME_TYPEDOC
|
|
76
58
|
| typeof NAME_NPM
|
|
77
59
|
| typeof NAME_MKDOCS;
|
|
78
60
|
|
|
@@ -137,13 +119,6 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
137
119
|
*/
|
|
138
120
|
protected tsconfigJsonPath?: string;
|
|
139
121
|
|
|
140
|
-
/**
|
|
141
|
-
* Path to `typedoc.json`. If not provided, will be lazily resolved.
|
|
142
|
-
*/
|
|
143
|
-
protected typeDocJsonPath?: string;
|
|
144
|
-
|
|
145
|
-
protected typeDocPath?: string;
|
|
146
|
-
|
|
147
122
|
/**
|
|
148
123
|
* Emitted when validation begins with a list of validation kinds to be performed
|
|
149
124
|
* @event
|
|
@@ -180,21 +155,15 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
180
155
|
this.pythonPath = opts.pythonPath;
|
|
181
156
|
this.cwd = opts.cwd ?? process.cwd();
|
|
182
157
|
this.tsconfigJsonPath = opts.tsconfigJson;
|
|
183
|
-
this.typeDocJsonPath = opts.typedocJson;
|
|
184
158
|
this.npmPath = opts.npm;
|
|
185
159
|
this.mkDocsYmlPath = opts.mkdocsYml;
|
|
186
|
-
this.typeDocPath = opts.typedocPath;
|
|
187
160
|
|
|
188
161
|
if (opts.python) {
|
|
189
162
|
this.validations.add(NAME_PYTHON);
|
|
190
163
|
}
|
|
191
164
|
if (opts.typescript) {
|
|
192
165
|
this.validations.add(NAME_TYPESCRIPT);
|
|
193
|
-
// npm validation is required for
|
|
194
|
-
this.validations.add(NAME_NPM);
|
|
195
|
-
}
|
|
196
|
-
if (opts.typedoc) {
|
|
197
|
-
this.validations.add(NAME_TYPEDOC);
|
|
166
|
+
// npm validation is required for typescript
|
|
198
167
|
this.validations.add(NAME_NPM);
|
|
199
168
|
}
|
|
200
169
|
if (opts.mkdocs) {
|
|
@@ -233,11 +202,6 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
233
202
|
await this.validateTypeScriptConfig();
|
|
234
203
|
}
|
|
235
204
|
|
|
236
|
-
if (this.validations.has(NAME_TYPEDOC)) {
|
|
237
|
-
await this.validateTypeDoc();
|
|
238
|
-
await this.validateTypeDocConfig();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
205
|
this.emit(DocutilsValidator.END, this.emittedErrors.size);
|
|
242
206
|
} finally {
|
|
243
207
|
this.reset();
|
|
@@ -321,7 +285,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
321
285
|
|
|
322
286
|
if (!pythonPath) {
|
|
323
287
|
return this.fail(
|
|
324
|
-
`Could not find ${NAME_PYTHON} executable in PATH. If it is installed, check your PATH environment variable
|
|
288
|
+
`Could not find ${NAME_PYTHON} executable in PATH. If it is installed, check your PATH environment variable.`,
|
|
325
289
|
);
|
|
326
290
|
}
|
|
327
291
|
|
|
@@ -338,18 +302,18 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
338
302
|
const mkDocsPipPkg = _.find(reqs, {name: NAME_MKDOCS});
|
|
339
303
|
if (!mkDocsPipPkg) {
|
|
340
304
|
throw new DocutilsError(
|
|
341
|
-
`No ${NAME_MKDOCS} package in ${REQUIREMENTS_TXT_PATH}. This is a bug
|
|
305
|
+
`No ${NAME_MKDOCS} package in ${REQUIREMENTS_TXT_PATH}. This is a bug.`,
|
|
342
306
|
);
|
|
343
307
|
}
|
|
344
308
|
const {version: mkDocsReqdVersion} = mkDocsPipPkg;
|
|
345
309
|
if (version !== mkDocsReqdVersion) {
|
|
346
310
|
return this.fail(
|
|
347
|
-
`${NAME_MKDOCS} is v${version}, but ${REQUIREMENTS_TXT_PATH} requires v${mkDocsReqdVersion}
|
|
311
|
+
`${NAME_MKDOCS} is v${version}, but ${REQUIREMENTS_TXT_PATH} requires v${mkDocsReqdVersion}`,
|
|
348
312
|
);
|
|
349
313
|
}
|
|
350
314
|
} else {
|
|
351
315
|
throw new DocutilsError(
|
|
352
|
-
`Could not parse version from MkDocs. This is a bug. Output was ${rawMkDocsVersion}
|
|
316
|
+
`Could not parse version from MkDocs. This is a bug. Output was ${rawMkDocsVersion}`,
|
|
353
317
|
);
|
|
354
318
|
}
|
|
355
319
|
|
|
@@ -365,7 +329,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
365
329
|
mkDocsYmlPath = mkDocsYmlPath ?? this.mkDocsYmlPath ?? (await findMkDocsYml(this.cwd));
|
|
366
330
|
if (!mkDocsYmlPath) {
|
|
367
331
|
return this.fail(
|
|
368
|
-
`Could not find ${NAME_MKDOCS_YML} from ${this.cwd}. Run "${NAME_BIN} init" to create it
|
|
332
|
+
`Could not find ${NAME_MKDOCS_YML} from ${this.cwd}. Run "${NAME_BIN} init" to create it`,
|
|
369
333
|
);
|
|
370
334
|
}
|
|
371
335
|
let mkDocsYml: MkDocsYml;
|
|
@@ -375,7 +339,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
375
339
|
const err = e as NodeJS.ErrnoException;
|
|
376
340
|
if (err.code === NAME_ERR_ENOENT) {
|
|
377
341
|
return this.fail(
|
|
378
|
-
`Could not find ${NAME_MKDOCS_YML} at ${mkDocsYmlPath}. Use --mkdocs-yml to specify a different path
|
|
342
|
+
`Could not find ${NAME_MKDOCS_YML} at ${mkDocsYmlPath}. Use --mkdocs-yml to specify a different path.`,
|
|
379
343
|
);
|
|
380
344
|
}
|
|
381
345
|
return this.fail(`Could not parse ${mkDocsYmlPath}: ${err}`);
|
|
@@ -402,7 +366,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
402
366
|
const npmPath = this.npmPath ?? (await whichNpm());
|
|
403
367
|
if (!npmPath) {
|
|
404
368
|
throw new DocutilsError(
|
|
405
|
-
`Could not find ${NAME_NPM} in PATH. That seems weird, doesn't it
|
|
369
|
+
`Could not find ${NAME_NPM} in PATH. That seems weird, doesn't it?`,
|
|
406
370
|
);
|
|
407
371
|
}
|
|
408
372
|
const {stdout: npmVersion} = await exec(npmPath, ['-v']);
|
|
@@ -445,7 +409,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
445
409
|
installedPkgs = JSON.parse(pipListOutput) as PipPackage[];
|
|
446
410
|
} catch {
|
|
447
411
|
throw new DocutilsError(
|
|
448
|
-
`Could not parse output of "${NAME_PIP} list" as JSON: ${pipListOutput}
|
|
412
|
+
`Could not parse output of "${NAME_PIP} list" as JSON: ${pipListOutput}`,
|
|
449
413
|
);
|
|
450
414
|
}
|
|
451
415
|
|
|
@@ -470,23 +434,23 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
470
434
|
msgParts.push(
|
|
471
435
|
`The following required ${util.pluralize(
|
|
472
436
|
'package',
|
|
473
|
-
missingPackages.length
|
|
437
|
+
missingPackages.length,
|
|
474
438
|
)} could not be found:\n${missingPackages
|
|
475
439
|
.map((p) => chalk`- {yellow ${p.name}} @ {yellow ${p.version}}`)
|
|
476
|
-
.join('\n')}
|
|
440
|
+
.join('\n')}`,
|
|
477
441
|
);
|
|
478
442
|
}
|
|
479
443
|
if (invalidVersionPackages.length) {
|
|
480
444
|
msgParts.push(
|
|
481
445
|
`The following required ${util.pluralize(
|
|
482
446
|
'package',
|
|
483
|
-
invalidVersionPackages.length
|
|
447
|
+
invalidVersionPackages.length,
|
|
484
448
|
)} are installed, but at the wrong version:\n${invalidVersionPackages
|
|
485
449
|
.map(
|
|
486
450
|
([expected, actual]) =>
|
|
487
|
-
chalk`- {yellow ${expected.name}} @ {yellow ${expected.version}} (found {red ${actual.version}})
|
|
451
|
+
chalk`- {yellow ${expected.name}} @ {yellow ${expected.version}} (found {red ${actual.version}})`,
|
|
488
452
|
)
|
|
489
|
-
.join('\n')}
|
|
453
|
+
.join('\n')}`,
|
|
490
454
|
);
|
|
491
455
|
}
|
|
492
456
|
if (msgParts.length) {
|
|
@@ -509,7 +473,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
509
473
|
const {stdout} = await exec(pythonPath, ['--version']);
|
|
510
474
|
if (!stdout.includes(PYTHON_VER_STR)) {
|
|
511
475
|
return this.fail(
|
|
512
|
-
`Could not find Python 3.x in PATH; found ${stdout}. Please use --python-path
|
|
476
|
+
`Could not find Python 3.x in PATH; found ${stdout}. Please use --python-path`,
|
|
513
477
|
);
|
|
514
478
|
}
|
|
515
479
|
} catch {
|
|
@@ -518,107 +482,6 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
518
482
|
this.ok('Python version OK');
|
|
519
483
|
}
|
|
520
484
|
|
|
521
|
-
/**
|
|
522
|
-
* Asserts TypeDoc is installed, runnable, the correct version, and that the config file is readable
|
|
523
|
-
* and constaints required options
|
|
524
|
-
*
|
|
525
|
-
* @todo Another option would be to `npm exec typedoc@<version>` which delegates to `npx`.
|
|
526
|
-
*/
|
|
527
|
-
protected async validateTypeDoc() {
|
|
528
|
-
const pkgDir = await this.findPkgDir();
|
|
529
|
-
const typeDocPath = this.typeDocPath ?? (await findTypeDoc(pkgDir));
|
|
530
|
-
|
|
531
|
-
if (!typeDocPath) {
|
|
532
|
-
return this.fail(`Could not find ${NAME_TYPEDOC}; is it installed?`);
|
|
533
|
-
}
|
|
534
|
-
log.debug('Found %s at %s', NAME_TYPEDOC, typeDocPath);
|
|
535
|
-
|
|
536
|
-
let rawTypeDocVersion: string;
|
|
537
|
-
let typeDocVersion: string;
|
|
538
|
-
try {
|
|
539
|
-
({stdout: rawTypeDocVersion} = await exec(process.execPath, [typeDocPath, '--version'], {
|
|
540
|
-
cwd: pkgDir,
|
|
541
|
-
}));
|
|
542
|
-
} catch (err) {
|
|
543
|
-
return this.fail(
|
|
544
|
-
`Could not execute ${process.execPath} ${typeDocPath} from ${pkgDir}. Reason: ${
|
|
545
|
-
(err as Error).message
|
|
546
|
-
}`
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
if (rawTypeDocVersion) {
|
|
551
|
-
const match = rawTypeDocVersion.match(TYPEDOC_VERSION_REGEX);
|
|
552
|
-
if (match) {
|
|
553
|
-
typeDocVersion = match[1];
|
|
554
|
-
} else {
|
|
555
|
-
throw new DocutilsError(
|
|
556
|
-
`Could not parse TypeDoc version from "typedoc --version"; output was:\n ${rawTypeDocVersion}`
|
|
557
|
-
);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
561
|
-
const reqdTypeDocVersion = DOCUTILS_PKG.dependencies!.typedoc!; // this is our own package.json
|
|
562
|
-
if (!satisfies(typeDocVersion, reqdTypeDocVersion)) {
|
|
563
|
-
return this.fail(
|
|
564
|
-
`Found TypeDoc version ${typeDocVersion}, but ${reqdTypeDocVersion} is required`
|
|
565
|
-
);
|
|
566
|
-
}
|
|
567
|
-
this.ok('TypeDoc install OK');
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Validates the `typedoc.json` file
|
|
573
|
-
*/
|
|
574
|
-
protected async validateTypeDocConfig() {
|
|
575
|
-
const pkgDir = await this.findPkgDir();
|
|
576
|
-
if (!pkgDir) {
|
|
577
|
-
return this.fail(new DocutilsError(`Could not find package.json in ${this.cwd}`));
|
|
578
|
-
}
|
|
579
|
-
const typeDocJsonPath = (this.typeDocJsonPath =
|
|
580
|
-
this.typeDocJsonPath ?? path.join(pkgDir, NAME_TYPEDOC_JSON));
|
|
581
|
-
const relTypeDocJsonPath = relative(this.cwd, typeDocJsonPath);
|
|
582
|
-
let typeDocJson: TypeDocJson;
|
|
583
|
-
|
|
584
|
-
// handle the case where the user passes a JS file as the typedoc config
|
|
585
|
-
// (which is allowed by TypeDoc)
|
|
586
|
-
if (typeDocJsonPath.endsWith('.js')) {
|
|
587
|
-
try {
|
|
588
|
-
typeDocJson = require(typeDocJsonPath);
|
|
589
|
-
} catch (err) {
|
|
590
|
-
throw new DocutilsError(
|
|
591
|
-
`TypeDoc config at ${relTypeDocJsonPath} threw an exception: ${err}`
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
} else {
|
|
595
|
-
try {
|
|
596
|
-
typeDocJson = readTypedocJson(typeDocJsonPath);
|
|
597
|
-
} catch (e) {
|
|
598
|
-
if (e instanceof SyntaxError) {
|
|
599
|
-
return this.fail(
|
|
600
|
-
new DocutilsError(`Unparseable ${NAME_TYPEDOC_JSON} at ${relTypeDocJsonPath}: ${e}`)
|
|
601
|
-
);
|
|
602
|
-
}
|
|
603
|
-
return this.fail(
|
|
604
|
-
new DocutilsError(
|
|
605
|
-
`Missing ${NAME_TYPEDOC_JSON} at ${relTypeDocJsonPath}; "${NAME_BIN} init" can help`
|
|
606
|
-
)
|
|
607
|
-
);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
if (!typeDocJson.out) {
|
|
612
|
-
return this.fail(
|
|
613
|
-
new DocutilsError(
|
|
614
|
-
`Missing "out" property in ${relTypeDocJsonPath}; path "${DEFAULT_REL_TYPEDOC_OUT_PATH}" is recommended`
|
|
615
|
-
)
|
|
616
|
-
);
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
this.ok('TypeDoc config OK');
|
|
620
|
-
}
|
|
621
|
-
|
|
622
485
|
/**
|
|
623
486
|
* Asserts that TypeScript is installed, runnable, the correct version, and a parseable `tsconfig.json` exists.
|
|
624
487
|
*/
|
|
@@ -642,7 +505,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
642
505
|
typeScriptVersion = match[1];
|
|
643
506
|
} else {
|
|
644
507
|
return this.fail(
|
|
645
|
-
`Could not parse TypeScript version from "tsc --version"; output was:\n ${rawTypeScriptVersion}
|
|
508
|
+
`Could not parse TypeScript version from "tsc --version"; output was:\n ${rawTypeScriptVersion}`,
|
|
646
509
|
);
|
|
647
510
|
}
|
|
648
511
|
|
|
@@ -650,13 +513,13 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
650
513
|
|
|
651
514
|
if (!reqdTypeScriptVersion) {
|
|
652
515
|
throw new DocutilsError(
|
|
653
|
-
`Could not find a dep for ${NAME_TYPESCRIPT} in ${NAME_PACKAGE_JSON}. This is a bug
|
|
516
|
+
`Could not find a dep for ${NAME_TYPESCRIPT} in ${NAME_PACKAGE_JSON}. This is a bug.`,
|
|
654
517
|
);
|
|
655
518
|
}
|
|
656
519
|
|
|
657
520
|
if (!satisfies(typeScriptVersion, reqdTypeScriptVersion)) {
|
|
658
521
|
return this.fail(
|
|
659
|
-
`Found TypeScript version ${typeScriptVersion}, but ${reqdTypeScriptVersion} is required
|
|
522
|
+
`Found TypeScript version ${typeScriptVersion}, but ${reqdTypeScriptVersion} is required`,
|
|
660
523
|
);
|
|
661
524
|
}
|
|
662
525
|
this.ok('TypeScript install OK');
|
|
@@ -678,13 +541,13 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
678
541
|
} catch (e) {
|
|
679
542
|
if (e instanceof SyntaxError) {
|
|
680
543
|
return this.fail(
|
|
681
|
-
new DocutilsError(`Unparseable ${NAME_TSCONFIG_JSON} at ${relTsconfigJsonPath}: ${e}`)
|
|
544
|
+
new DocutilsError(`Unparseable ${NAME_TSCONFIG_JSON} at ${relTsconfigJsonPath}: ${e}`),
|
|
682
545
|
);
|
|
683
546
|
}
|
|
684
547
|
return this.fail(
|
|
685
548
|
new DocutilsError(
|
|
686
|
-
`Missing ${NAME_TSCONFIG_JSON} at ${relTsconfigJsonPath}; "${NAME_BIN} init" can help
|
|
687
|
-
)
|
|
549
|
+
`Missing ${NAME_TSCONFIG_JSON} at ${relTsconfigJsonPath}; "${NAME_BIN} init" can help`,
|
|
550
|
+
),
|
|
688
551
|
);
|
|
689
552
|
}
|
|
690
553
|
|
|
@@ -725,18 +588,6 @@ export interface DocutilsValidatorOpts {
|
|
|
725
588
|
* Path to `tsconfig.json`
|
|
726
589
|
*/
|
|
727
590
|
tsconfigJson?: string;
|
|
728
|
-
/**
|
|
729
|
-
* If `true`, run TypeDoc validation
|
|
730
|
-
*/
|
|
731
|
-
typedoc?: boolean;
|
|
732
|
-
/**
|
|
733
|
-
* Path to `typedoc` executable
|
|
734
|
-
*/
|
|
735
|
-
typedocPath?: string;
|
|
736
|
-
/**
|
|
737
|
-
* Path to `typedoc.json`
|
|
738
|
-
*/
|
|
739
|
-
typedocJson?: string;
|
|
740
591
|
/**
|
|
741
592
|
* If `true`, run TypeScript validation
|
|
742
593
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/docutils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Documentation generation utilities for Appium and related projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"build",
|
|
39
39
|
"tsconfig.json",
|
|
40
40
|
"!build/tsconfig.tsbuildinfo",
|
|
41
|
-
"typedoc-shared.json",
|
|
42
41
|
"requirements.txt"
|
|
43
42
|
],
|
|
44
43
|
"scripts": {
|
|
@@ -49,16 +48,14 @@
|
|
|
49
48
|
"start": "node ./build/lib/cli/index.js"
|
|
50
49
|
},
|
|
51
50
|
"dependencies": {
|
|
52
|
-
"@appium/support": "^4.1.
|
|
51
|
+
"@appium/support": "^4.1.11",
|
|
53
52
|
"@appium/tsconfig": "^0.x",
|
|
54
|
-
"@appium/typedoc-plugin-appium": "^0.x",
|
|
55
53
|
"@sliphua/lilconfig-ts-loader": "3.2.2",
|
|
56
|
-
"@types/which": "3.0.
|
|
54
|
+
"@types/which": "3.0.3",
|
|
57
55
|
"chalk": "4.1.2",
|
|
58
56
|
"consola": "2.15.3",
|
|
59
57
|
"diff": "5.1.0",
|
|
60
58
|
"figures": "3.2.0",
|
|
61
|
-
"find-up": "5.0.0",
|
|
62
59
|
"json5": "2.2.3",
|
|
63
60
|
"lilconfig": "2.1.0",
|
|
64
61
|
"lodash": "4.17.21",
|
|
@@ -67,12 +64,9 @@
|
|
|
67
64
|
"read-pkg": "5.2.0",
|
|
68
65
|
"semver": "7.5.4",
|
|
69
66
|
"source-map-support": "0.5.21",
|
|
70
|
-
"teen_process": "2.
|
|
71
|
-
"type-fest": "
|
|
72
|
-
"
|
|
73
|
-
"typedoc-plugin-markdown": "3.14.0",
|
|
74
|
-
"typedoc-plugin-resolve-crossmodule-references": "0.3.3",
|
|
75
|
-
"typescript": "5.0.4",
|
|
67
|
+
"teen_process": "2.1.1",
|
|
68
|
+
"type-fest": "4.8.3",
|
|
69
|
+
"typescript": "5.2.2",
|
|
76
70
|
"yaml": "2.3.4",
|
|
77
71
|
"yargs": "17.7.2",
|
|
78
72
|
"yargs-parser": "21.1.1"
|
|
@@ -84,5 +78,5 @@
|
|
|
84
78
|
"publishConfig": {
|
|
85
79
|
"access": "public"
|
|
86
80
|
},
|
|
87
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "5c1d20517cfc8773cd5ffb0f8bb996668d71116b"
|
|
88
82
|
}
|
package/requirements.txt
CHANGED