@appium/docutils 0.2.2 → 0.3.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/LICENSE +1 -1
- package/build/lib/builder/deploy.d.ts.map +1 -1
- package/build/lib/builder/deploy.js +6 -2
- package/build/lib/builder/deploy.js.map +1 -1
- package/build/lib/builder/index.d.ts +4 -0
- package/build/lib/builder/index.d.ts.map +1 -1
- package/build/lib/builder/index.js +4 -0
- package/build/lib/builder/index.js.map +1 -1
- package/build/lib/builder/nav.d.ts +1 -1
- package/build/lib/builder/nav.d.ts.map +1 -1
- package/build/lib/builder/nav.js +3 -3
- package/build/lib/builder/nav.js.map +1 -1
- package/build/lib/builder/reference.d.ts.map +1 -1
- package/build/lib/builder/reference.js +1 -19
- package/build/lib/builder/reference.js.map +1 -1
- package/build/lib/builder/site.d.ts.map +1 -1
- package/build/lib/builder/site.js +4 -3
- package/build/lib/builder/site.js.map +1 -1
- package/build/lib/cli/check.d.ts +19 -0
- package/build/lib/cli/check.d.ts.map +1 -0
- package/build/lib/cli/check.js +58 -0
- package/build/lib/cli/check.js.map +1 -0
- package/build/lib/cli/command/build.d.ts +189 -174
- package/build/lib/cli/command/build.d.ts.map +1 -1
- package/build/lib/cli/command/build.js +56 -38
- package/build/lib/cli/command/build.js.map +1 -1
- package/build/lib/cli/command/index.d.ts +4 -0
- package/build/lib/cli/command/index.d.ts.map +1 -1
- package/build/lib/cli/command/index.js +4 -0
- package/build/lib/cli/command/index.js.map +1 -1
- package/build/lib/cli/command/init.d.ts +156 -139
- package/build/lib/cli/command/init.d.ts.map +1 -1
- package/build/lib/cli/command/init.js +52 -27
- package/build/lib/cli/command/init.js.map +1 -1
- package/build/lib/cli/command/validate.d.ts +71 -63
- package/build/lib/cli/command/validate.d.ts.map +1 -1
- package/build/lib/cli/command/validate.js +31 -20
- package/build/lib/cli/command/validate.js.map +1 -1
- package/build/lib/cli/index.d.ts.map +1 -1
- package/build/lib/cli/index.js +29 -12
- package/build/lib/cli/index.js.map +1 -1
- package/build/lib/constants.d.ts +4 -0
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/constants.js +5 -1
- package/build/lib/constants.js.map +1 -1
- package/build/lib/error.d.ts +5 -0
- package/build/lib/error.d.ts.map +1 -1
- package/build/lib/error.js +5 -0
- package/build/lib/error.js.map +1 -1
- package/build/lib/fs.d.ts +1 -1
- package/build/lib/fs.d.ts.map +1 -1
- package/build/lib/fs.js +2 -2
- package/build/lib/fs.js.map +1 -1
- package/build/lib/index.d.ts +4 -0
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +4 -0
- package/build/lib/index.js.map +1 -1
- package/build/lib/init.d.ts +12 -5
- package/build/lib/init.d.ts.map +1 -1
- package/build/lib/init.js +12 -7
- package/build/lib/init.js.map +1 -1
- package/build/lib/mike.d.ts.map +1 -1
- package/build/lib/mike.js +4 -0
- package/build/lib/mike.js.map +1 -1
- package/build/lib/util.d.ts +4 -1
- package/build/lib/util.d.ts.map +1 -1
- package/build/lib/util.js.map +1 -1
- package/build/lib/validate.d.ts +4 -1
- package/build/lib/validate.d.ts.map +1 -1
- package/build/lib/validate.js +9 -7
- package/build/lib/validate.js.map +1 -1
- package/lib/builder/deploy.ts +9 -3
- package/lib/builder/index.ts +5 -0
- package/lib/builder/nav.ts +2 -3
- package/lib/builder/reference.ts +2 -22
- package/lib/builder/site.ts +6 -5
- package/lib/cli/check.ts +87 -0
- package/lib/cli/command/build.ts +61 -43
- package/lib/cli/command/index.ts +5 -0
- package/lib/cli/command/init.ts +54 -29
- package/lib/cli/command/validate.ts +33 -25
- package/lib/cli/index.ts +23 -4
- package/lib/constants.ts +5 -0
- package/lib/error.ts +6 -0
- package/lib/fs.ts +6 -3
- package/lib/index.ts +5 -0
- package/lib/init.ts +23 -6
- package/lib/mike.js +5 -0
- package/lib/util.ts +4 -1
- package/lib/validate.ts +10 -9
- package/package.json +8 -10
- package/requirements.txt +1 -1
package/lib/constants.ts
CHANGED
package/lib/error.ts
CHANGED
package/lib/fs.ts
CHANGED
|
@@ -127,7 +127,10 @@ async function _readPkgJson(
|
|
|
127
127
|
cwd: string,
|
|
128
128
|
normalize: true
|
|
129
129
|
): Promise<{pkgPath: string; pkg: NormalizedPackageJson}>;
|
|
130
|
-
async function _readPkgJson(
|
|
130
|
+
async function _readPkgJson(
|
|
131
|
+
cwd: string,
|
|
132
|
+
normalize?: false
|
|
133
|
+
): Promise<{pkgPath: string; pkg: PackageJson}>;
|
|
131
134
|
async function _readPkgJson(
|
|
132
135
|
cwd: string,
|
|
133
136
|
normalize?: boolean
|
|
@@ -236,14 +239,14 @@ export const whichMike = _.partial(cachedWhich, NAME_MIKE);
|
|
|
236
239
|
*/
|
|
237
240
|
export const readMkDocsYml = _.memoize(
|
|
238
241
|
async (filepath: string, cwd = process.cwd()): Promise<MkDocsYml> => {
|
|
239
|
-
let mkDocsYml =
|
|
242
|
+
let mkDocsYml = (await readYaml(filepath)) as MkDocsYml;
|
|
240
243
|
if (mkDocsYml.site_dir) {
|
|
241
244
|
mkDocsYml.site_dir = path.resolve(cwd, path.dirname(filepath), mkDocsYml.site_dir);
|
|
242
245
|
}
|
|
243
246
|
if (mkDocsYml.INHERIT) {
|
|
244
247
|
let inheritPath: string | undefined = path.resolve(path.dirname(filepath), mkDocsYml.INHERIT);
|
|
245
248
|
while (inheritPath) {
|
|
246
|
-
const inheritYml =
|
|
249
|
+
const inheritYml = (await readYaml(inheritPath)) as MkDocsYml;
|
|
247
250
|
if (inheritYml.site_dir) {
|
|
248
251
|
inheritYml.site_dir = path.resolve(path.dirname(inheritPath), inheritYml.site_dir);
|
|
249
252
|
log.debug('Resolved site_dir to %s', inheritYml.site_dir);
|
package/lib/index.ts
CHANGED
package/lib/init.ts
CHANGED
|
@@ -126,7 +126,9 @@ export const initMkDocs = createScaffoldTask<InitMkDocsOptions, MkDocsYml>(
|
|
|
126
126
|
if (repoUrl && !repoName) {
|
|
127
127
|
let {pathname} = new URL(repoUrl);
|
|
128
128
|
pathname = pathname.slice(1);
|
|
129
|
-
|
|
129
|
+
const pathparts = pathname.split('/');
|
|
130
|
+
const owner = pathparts[0];
|
|
131
|
+
let repo = pathparts[1];
|
|
130
132
|
repo = repo.replace(/\.git$/, '');
|
|
131
133
|
repoName = [owner, repo].join('/');
|
|
132
134
|
if (repoName) {
|
|
@@ -158,8 +160,12 @@ export const initMkDocs = createScaffoldTask<InitMkDocsOptions, MkDocsYml>(
|
|
|
158
160
|
export async function initPython({
|
|
159
161
|
pythonPath = NAME_PYTHON,
|
|
160
162
|
dryRun = false,
|
|
163
|
+
upgrade = false,
|
|
161
164
|
}: InitPythonOptions = {}): Promise<void> {
|
|
162
165
|
const args = ['-m', 'pip', 'install', '-r', REQUIREMENTS_TXT_PATH];
|
|
166
|
+
if (upgrade) {
|
|
167
|
+
args.push('--upgrade');
|
|
168
|
+
}
|
|
163
169
|
if (dryRun) {
|
|
164
170
|
dryRunLog.info('Would execute command: %s %s', pythonPath, args.join(' '));
|
|
165
171
|
} else {
|
|
@@ -214,6 +220,7 @@ export async function init({
|
|
|
214
220
|
dryRun,
|
|
215
221
|
cwd,
|
|
216
222
|
pythonPath,
|
|
223
|
+
upgrade,
|
|
217
224
|
typedocJson: typeDocJsonPath,
|
|
218
225
|
}: InitOptions = {}): Promise<void> {
|
|
219
226
|
if (!typescript && typedoc) {
|
|
@@ -222,7 +229,7 @@ export async function init({
|
|
|
222
229
|
);
|
|
223
230
|
}
|
|
224
231
|
|
|
225
|
-
if (typescript) {
|
|
232
|
+
if (typescript && !upgrade) {
|
|
226
233
|
await initTsConfigJson({
|
|
227
234
|
dest: tsconfigJsonPath,
|
|
228
235
|
packageJson: packageJsonPath,
|
|
@@ -233,7 +240,7 @@ export async function init({
|
|
|
233
240
|
});
|
|
234
241
|
}
|
|
235
242
|
|
|
236
|
-
if (typedoc) {
|
|
243
|
+
if (typedoc && !upgrade) {
|
|
237
244
|
await initTypeDocJson({
|
|
238
245
|
dest: typeDocJsonPath,
|
|
239
246
|
packageJson: packageJsonPath,
|
|
@@ -244,10 +251,10 @@ export async function init({
|
|
|
244
251
|
}
|
|
245
252
|
|
|
246
253
|
if (python) {
|
|
247
|
-
await initPython({pythonPath, dryRun});
|
|
254
|
+
await initPython({pythonPath, dryRun, upgrade});
|
|
248
255
|
}
|
|
249
256
|
|
|
250
|
-
if (mkdocs) {
|
|
257
|
+
if (mkdocs && !upgrade) {
|
|
251
258
|
await initMkDocs({
|
|
252
259
|
dest: mkdocsYmlPath,
|
|
253
260
|
cwd,
|
|
@@ -262,7 +269,7 @@ export async function init({
|
|
|
262
269
|
}
|
|
263
270
|
}
|
|
264
271
|
|
|
265
|
-
export
|
|
272
|
+
export type InitTypeDocOptions = ScaffoldTaskOptions;
|
|
266
273
|
export interface InitTsConfigOptions extends ScaffoldTaskOptions {
|
|
267
274
|
/**
|
|
268
275
|
* List of source files (globs supported); typically `src` or `lib`
|
|
@@ -274,6 +281,11 @@ export interface InitPythonOptions extends ScaffoldTaskOptions {
|
|
|
274
281
|
* Path to `python` (v3.x) executable
|
|
275
282
|
*/
|
|
276
283
|
pythonPath?: string;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* If true, upgrade only
|
|
287
|
+
*/
|
|
288
|
+
upgrade?: boolean;
|
|
277
289
|
}
|
|
278
290
|
|
|
279
291
|
/**
|
|
@@ -315,5 +327,10 @@ export type InitOptions = Simplify<
|
|
|
315
327
|
* Path to new or existing `mkdocs.yml` file
|
|
316
328
|
*/
|
|
317
329
|
mkdocsYml?: string;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* If `true`, upgrade only
|
|
333
|
+
*/
|
|
334
|
+
upgrade?: boolean;
|
|
318
335
|
}
|
|
319
336
|
>;
|
package/lib/mike.js
CHANGED
package/lib/util.ts
CHANGED
|
@@ -32,6 +32,9 @@ export function stopwatch(id: string) {
|
|
|
32
32
|
}
|
|
33
33
|
stopwatch.cache = new Map<string, number>();
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Converts a tuple to an object; use for extracting parameter types from a function signature
|
|
37
|
+
*/
|
|
35
38
|
export type TupleToObject<
|
|
36
39
|
T extends readonly any[],
|
|
37
40
|
M extends Record<Exclude<keyof T, keyof any[]>, PropertyKey>
|
|
@@ -69,7 +72,7 @@ export const argify: (obj: Record<string, string | number | boolean | undefined>
|
|
|
69
72
|
);
|
|
70
73
|
|
|
71
74
|
/**
|
|
72
|
-
* Conversion of the parameters of {@linkcode
|
|
75
|
+
* Conversion of the parameters of {@linkcode SubProcess.start} to an object.
|
|
73
76
|
*/
|
|
74
77
|
export type TeenProcessSubprocessStartOpts = Partial<
|
|
75
78
|
TupleToObject<Parameters<SubProcess['start']>, ['startDetector', 'detach', 'timeoutMs']>
|
package/lib/validate.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Validates an environment for building documentation
|
|
2
|
+
* Validates an environment for building documentation; used by `validate` command
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {fs} from '@appium/support';
|
|
7
|
+
import {fs, util} from '@appium/support';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
import _ from 'lodash';
|
|
10
10
|
import {EventEmitter} from 'node:events';
|
|
11
11
|
import path from 'node:path';
|
|
12
|
-
import pluralize from 'pluralize';
|
|
13
12
|
import {satisfies} from 'semver';
|
|
14
13
|
import {exec} from 'teen_process';
|
|
15
14
|
import {
|
|
@@ -36,7 +35,6 @@ import {
|
|
|
36
35
|
findMkDocsYml,
|
|
37
36
|
readJson5,
|
|
38
37
|
readTypedocJson,
|
|
39
|
-
readYaml,
|
|
40
38
|
whichMkDocs,
|
|
41
39
|
whichNpm,
|
|
42
40
|
whichPython,
|
|
@@ -287,7 +285,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
287
285
|
return this.requirementsTxt;
|
|
288
286
|
}
|
|
289
287
|
|
|
290
|
-
|
|
288
|
+
const requiredPackages: PipPackage[] = [];
|
|
291
289
|
|
|
292
290
|
try {
|
|
293
291
|
let requirementsTxt = await fs.readFile(REQUIREMENTS_TXT_PATH, 'utf8');
|
|
@@ -312,6 +310,9 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
312
310
|
this.emittedErrors.clear();
|
|
313
311
|
}
|
|
314
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Validates that the correct version of `mkdocs` is installed
|
|
315
|
+
*/
|
|
315
316
|
protected async validateMkDocs() {
|
|
316
317
|
let mkDocsPath: string | undefined;
|
|
317
318
|
try {
|
|
@@ -466,7 +467,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
466
467
|
const msgParts = [];
|
|
467
468
|
if (missingPackages.length) {
|
|
468
469
|
msgParts.push(
|
|
469
|
-
`The following required ${pluralize(
|
|
470
|
+
`The following required ${util.pluralize(
|
|
470
471
|
'package',
|
|
471
472
|
missingPackages.length
|
|
472
473
|
)} could not be found:\n${missingPackages
|
|
@@ -476,7 +477,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
476
477
|
}
|
|
477
478
|
if (invalidVersionPackages.length) {
|
|
478
479
|
msgParts.push(
|
|
479
|
-
`The following required ${pluralize(
|
|
480
|
+
`The following required ${util.pluralize(
|
|
480
481
|
'package',
|
|
481
482
|
invalidVersionPackages.length
|
|
482
483
|
)} are installed, but at the wrong version:\n${invalidVersionPackages
|
|
@@ -533,7 +534,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
533
534
|
}
|
|
534
535
|
|
|
535
536
|
if (rawTypeDocVersion) {
|
|
536
|
-
|
|
537
|
+
const match = rawTypeDocVersion.match(TYPEDOC_VERSION_REGEX);
|
|
537
538
|
if (match) {
|
|
538
539
|
typeDocVersion = match[1];
|
|
539
540
|
} else {
|
|
@@ -621,7 +622,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
621
622
|
return this.fail(`Could not find TypeScript compiler ("tsc") from ${pkgDir}`);
|
|
622
623
|
}
|
|
623
624
|
|
|
624
|
-
|
|
625
|
+
const match = rawTypeScriptVersion.match(TYPESCRIPT_VERSION_REGEX);
|
|
625
626
|
if (match) {
|
|
626
627
|
typeScriptVersion = match[1];
|
|
627
628
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/docutils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Documentation generation utilities for Appium and related projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -46,31 +46,29 @@
|
|
|
46
46
|
"test:e2e": "echo \"No e2e tests for this package\"",
|
|
47
47
|
"test:smoke": "node ./index.js",
|
|
48
48
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\"",
|
|
49
|
-
"start": "node ./build/lib/cli.js"
|
|
49
|
+
"start": "node ./build/lib/cli/index.js"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@appium/support": "^3.1.
|
|
52
|
+
"@appium/support": "^3.1.7",
|
|
53
53
|
"@appium/tsconfig": "^0.2.4",
|
|
54
|
-
"@appium/typedoc-plugin-appium": "^0.5.
|
|
54
|
+
"@appium/typedoc-plugin-appium": "^0.5.1",
|
|
55
55
|
"@sliphua/lilconfig-ts-loader": "3.2.2",
|
|
56
56
|
"chalk": "4.1.2",
|
|
57
57
|
"consola": "2.15.3",
|
|
58
58
|
"diff": "5.1.0",
|
|
59
59
|
"figures": "3.2.0",
|
|
60
60
|
"find-up": "5.0.0",
|
|
61
|
-
"glob": "8.1.0",
|
|
62
61
|
"json5": "2.2.3",
|
|
63
|
-
"lilconfig": "2.0
|
|
62
|
+
"lilconfig": "2.1.0",
|
|
64
63
|
"lodash": "4.17.21",
|
|
65
64
|
"log-symbols": "4.1.0",
|
|
66
65
|
"pkg-dir": "5.0.0",
|
|
67
|
-
"pluralize": "8.0.0",
|
|
68
66
|
"read-pkg": "5.2.0",
|
|
69
67
|
"semver": "7.3.8",
|
|
70
68
|
"source-map-support": "0.5.21",
|
|
71
69
|
"teen_process": "2.0.2",
|
|
72
|
-
"type-fest": "3.6.
|
|
73
|
-
"typedoc": "0.23.
|
|
70
|
+
"type-fest": "3.6.1",
|
|
71
|
+
"typedoc": "0.23.26",
|
|
74
72
|
"typedoc-plugin-markdown": "3.14.0",
|
|
75
73
|
"typedoc-plugin-resolve-crossmodule-references": "0.3.3",
|
|
76
74
|
"typescript": "4.9.5",
|
|
@@ -85,5 +83,5 @@
|
|
|
85
83
|
"publishConfig": {
|
|
86
84
|
"access": "public"
|
|
87
85
|
},
|
|
88
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "872b924a97c13142bdb8bf4218a4db324f309ce4"
|
|
89
87
|
}
|
package/requirements.txt
CHANGED