@appium/docutils 2.4.1 → 2.4.3
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/build/lib/builder/deploy.d.ts.map +1 -1
- package/build/lib/builder/deploy.js +2 -3
- package/build/lib/builder/deploy.js.map +1 -1
- package/build/lib/cli/check.d.ts.map +1 -1
- package/build/lib/cli/check.js +9 -11
- package/build/lib/cli/check.js.map +1 -1
- package/build/lib/cli/config.d.ts.map +1 -1
- package/build/lib/cli/config.js +1 -2
- package/build/lib/cli/config.js.map +1 -1
- package/build/lib/cli/index.d.ts.map +1 -1
- package/build/lib/cli/index.js +1 -2
- package/build/lib/cli/index.js.map +1 -1
- package/build/lib/fs.d.ts +19 -7
- package/build/lib/fs.d.ts.map +1 -1
- package/build/lib/fs.js +21 -18
- package/build/lib/fs.js.map +1 -1
- package/build/lib/logger.d.ts +0 -7
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +8 -6
- package/build/lib/logger.js.map +1 -1
- package/build/lib/scaffold.d.ts.map +1 -1
- package/build/lib/scaffold.js +4 -5
- package/build/lib/scaffold.js.map +1 -1
- package/build/lib/util.d.ts +16 -6
- package/build/lib/util.d.ts.map +1 -1
- package/build/lib/util.js +69 -18
- package/build/lib/util.js.map +1 -1
- package/build/lib/validate.d.ts.map +1 -1
- package/build/lib/validate.js +3 -7
- package/build/lib/validate.js.map +1 -1
- package/lib/builder/deploy.ts +10 -5
- package/lib/cli/check.ts +10 -9
- package/lib/cli/config.ts +1 -2
- package/lib/cli/index.ts +1 -2
- package/lib/fs.ts +22 -27
- package/lib/logger.ts +7 -3
- package/lib/scaffold.ts +7 -8
- package/lib/util.ts +69 -26
- package/lib/validate.ts +3 -4
- package/package.json +4 -5
- package/requirements.txt +1 -1
package/build/lib/util.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
import _ from 'lodash';
|
|
6
1
|
import type { SpawnOptions } from 'node:child_process';
|
|
7
2
|
import type { TeenProcessExecOptions } from 'teen_process';
|
|
8
3
|
/**
|
|
9
4
|
* Computes a relative path, prepending `./`
|
|
10
5
|
*/
|
|
11
|
-
export declare
|
|
6
|
+
export declare function relative(from: string): (to: string) => string;
|
|
7
|
+
export declare function relative(from: string, to: string): string;
|
|
12
8
|
/**
|
|
13
9
|
* A stopwatch-like thing
|
|
14
10
|
*
|
|
@@ -40,6 +36,20 @@ export declare const isStringArray: (value: any) => value is string[];
|
|
|
40
36
|
*/
|
|
41
37
|
export declare const argify: (obj: Record<string, string | number | boolean | undefined>) => string[];
|
|
42
38
|
export type SpawnBackgroundProcessOpts = Omit<SpawnOptions, 'stdio'>;
|
|
39
|
+
/**
|
|
40
|
+
* Converts a string to kebab-case.
|
|
41
|
+
* @param value Input string
|
|
42
|
+
* @returns Kebab-cased string
|
|
43
|
+
*/
|
|
44
|
+
export declare function kebabCase(value: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Performs a deep "defaults" merge into a clone of `target`.
|
|
47
|
+
* Only undefined properties in `target` are filled from `defaults`.
|
|
48
|
+
* @param target Destination object
|
|
49
|
+
* @param defaults Default values object
|
|
50
|
+
* @returns Merged clone
|
|
51
|
+
*/
|
|
52
|
+
export declare function mergeDefaultsDeep<T extends Record<string, any>>(target: T, defaults: T): T;
|
|
43
53
|
/**
|
|
44
54
|
* Spawns a long-running "background" child process. This is expected to only return control to the
|
|
45
55
|
* parent process in the case of a nonzero exit code from the child process.
|
package/build/lib/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../lib/util.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../lib/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;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;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,iBAY/F;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,IAAI,CAAC,EAAE,sBAAsB,iEAS9B"}
|
package/build/lib/util.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Utilities
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
4
|
};
|
|
9
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.argify = exports.isStringArray =
|
|
6
|
+
exports.argify = exports.isStringArray = void 0;
|
|
7
|
+
exports.relative = relative;
|
|
11
8
|
exports.stopwatch = stopwatch;
|
|
9
|
+
exports.kebabCase = kebabCase;
|
|
10
|
+
exports.mergeDefaultsDeep = mergeDefaultsDeep;
|
|
12
11
|
exports.spawnBackgroundProcess = spawnBackgroundProcess;
|
|
13
12
|
exports.execWithErrorHandling = execWithErrorHandling;
|
|
14
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
15
13
|
const node_child_process_1 = require("node:child_process");
|
|
16
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
17
15
|
const teen_process_1 = require("teen_process");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const support_1 = require("@appium/support");
|
|
17
|
+
function relative(from, to) {
|
|
18
|
+
if (to === undefined) {
|
|
19
|
+
return (nextTo) => `.${node_path_1.default.sep}${node_path_1.default.relative(from, nextTo)}`;
|
|
20
|
+
}
|
|
21
|
+
return `.${node_path_1.default.sep}${node_path_1.default.relative(from, to)}`;
|
|
22
|
+
}
|
|
22
23
|
/**
|
|
23
24
|
* A stopwatch-like thing
|
|
24
25
|
*
|
|
@@ -41,22 +42,72 @@ stopwatch.cache = new Map();
|
|
|
41
42
|
* @param value any value
|
|
42
43
|
* @returns `true` if the array is `string[]`
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
+
const isStringArray = (value) => Array.isArray(value) && value.every((item) => typeof item === 'string');
|
|
46
|
+
exports.isStringArray = isStringArray;
|
|
45
47
|
/**
|
|
46
48
|
* Converts an object of string values to an array of arguments for CLI
|
|
47
49
|
*
|
|
48
50
|
* Supports `boolean` and `number` values as well. `boolean`s are assumed to be flags which default
|
|
49
51
|
* to `false`, so they will only be added to the array if the value is `true`.
|
|
50
52
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
const argify = (obj) => {
|
|
54
|
+
const args = [];
|
|
55
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
56
|
+
if (value === true) {
|
|
57
|
+
args.push(`--${key}`);
|
|
58
|
+
}
|
|
59
|
+
else if (value === false || value === undefined) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
args.push(`--${key}`, String(value));
|
|
64
|
+
}
|
|
54
65
|
}
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
return args;
|
|
67
|
+
};
|
|
68
|
+
exports.argify = argify;
|
|
69
|
+
/**
|
|
70
|
+
* Converts a string to kebab-case.
|
|
71
|
+
* @param value Input string
|
|
72
|
+
* @returns Kebab-cased string
|
|
73
|
+
*/
|
|
74
|
+
function kebabCase(value) {
|
|
75
|
+
return value
|
|
76
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
77
|
+
.replace(/[_\s]+/g, '-')
|
|
78
|
+
.toLowerCase();
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Performs a deep "defaults" merge into a clone of `target`.
|
|
82
|
+
* Only undefined properties in `target` are filled from `defaults`.
|
|
83
|
+
* @param target Destination object
|
|
84
|
+
* @param defaults Default values object
|
|
85
|
+
* @returns Merged clone
|
|
86
|
+
*/
|
|
87
|
+
function mergeDefaultsDeep(target, defaults) {
|
|
88
|
+
const out = structuredClone(target);
|
|
89
|
+
const stack = [
|
|
90
|
+
{ dest: out, src: defaults },
|
|
91
|
+
];
|
|
92
|
+
while (stack.length) {
|
|
93
|
+
const next = stack.pop();
|
|
94
|
+
if (!next) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const { dest, src } = next;
|
|
98
|
+
for (const [key, srcVal] of Object.entries(src)) {
|
|
99
|
+
const destVal = dest[key];
|
|
100
|
+
if (destVal === undefined) {
|
|
101
|
+
dest[key] = structuredClone(srcVal);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (support_1.util.isPlainObject(destVal) && support_1.util.isPlainObject(srcVal)) {
|
|
105
|
+
stack.push({ dest: destVal, src: srcVal });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
57
108
|
}
|
|
58
|
-
return
|
|
59
|
-
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
60
111
|
/**
|
|
61
112
|
* Spawns a long-running "background" child process. This is expected to only return control to the
|
|
62
113
|
* parent process in the case of a nonzero exit code from the child process.
|
package/build/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../lib/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../lib/util.ts"],"names":[],"mappings":";;;;;;AAYA,4BAKC;AASD,8BAQC;AA8CD,8BAKC;AASD,8CAwBC;AAYD,wDAYC;AAKD,sDAYC;AA9JD,2DAAyC;AACzC,0DAA6B;AAE7B,+CAAkC;AAClC,6CAAoD;AAOpD,SAAgB,QAAQ,CAAC,IAAY,EAAE,EAAW;IAChD,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,CAAC,MAAc,EAAE,EAA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CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAC7G,MAAM,OAAO,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../lib/validate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../lib/validate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC,OAAO,EAIL,WAAW,EAGX,WAAW,EAGZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAGtC,OAAO,KAAK,EAAY,UAAU,EAAC,MAAM,SAAS,CAAC;AAcnD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,WAAW,GAAG,OAAO,WAAW,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;;OAGG;IACH,gBAAuB,KAAK,WAAW;IAEvC;;;OAGG;IACH,gBAAuB,GAAG,SAAS;IAEnC;;;OAGG;IACH,gBAAuB,OAAO,UAAU;IAExC;;;OAGG;IACH,gBAAuB,OAAO,QAAQ;IAEtC;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEvC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,sBAA6B;IAE3D;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,6BAAoC;IAE3D;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEjC,OAAO,CAAC,eAAe,CAA2B;IAElD;;OAEG;gBACS,IAAI,GAAE,qBAA0B;IAoB5C;;OAEG;IACU,QAAQ;IAoBrB;;;;;OAKG;IACH,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM;IAO1C;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM;IAI5B;;;;;OAKG;cACa,oBAAoB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IA0B7D;;OAEG;IACH,SAAS,CAAC,KAAK;IAIf;;OAEG;cACa,cAAc;IAuC9B;;;;OAIG;cACa,oBAAoB;IA8BpC;;;;;OAKG;cACa,kBAAkB;IA4ElC;;OAEG;cACa,qBAAqB;CAkBtC"}
|
package/build/lib/validate.js
CHANGED
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
8
|
exports.DocutilsValidator = void 0;
|
|
12
9
|
const support_1 = require("@appium/support");
|
|
13
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
14
10
|
const node_events_1 = require("node:events");
|
|
15
11
|
const teen_process_1 = require("teen_process");
|
|
16
12
|
const constants_1 = require("./constants");
|
|
@@ -129,7 +125,7 @@ class DocutilsValidator extends node_events_1.EventEmitter {
|
|
|
129
125
|
* @returns
|
|
130
126
|
*/
|
|
131
127
|
fail(err) {
|
|
132
|
-
const dErr =
|
|
128
|
+
const dErr = typeof err === 'string' ? new error_1.DocutilsError(err) : err;
|
|
133
129
|
if (!this.emittedErrors.has(dErr.message)) {
|
|
134
130
|
this.emit(DocutilsValidator.FAILURE, dErr);
|
|
135
131
|
}
|
|
@@ -199,7 +195,7 @@ class DocutilsValidator extends node_events_1.EventEmitter {
|
|
|
199
195
|
}
|
|
200
196
|
const version = match[1];
|
|
201
197
|
const reqs = await this.parseRequirementsTxt();
|
|
202
|
-
const mkDocsPipPkg =
|
|
198
|
+
const mkDocsPipPkg = reqs.find((pkg) => pkg.name === constants_1.NAME_MKDOCS);
|
|
203
199
|
if (!mkDocsPipPkg) {
|
|
204
200
|
throw new error_1.DocutilsError(`No ${constants_1.NAME_MKDOCS} package in ${constants_1.REQUIREMENTS_TXT_PATH}. This is a bug`);
|
|
205
201
|
}
|
|
@@ -268,7 +264,7 @@ class DocutilsValidator extends node_events_1.EventEmitter {
|
|
|
268
264
|
catch {
|
|
269
265
|
return this.fail(`Could not parse output of "${constants_1.NAME_PIP} list" as JSON: ${pipListOutput}`);
|
|
270
266
|
}
|
|
271
|
-
const pkgsByName =
|
|
267
|
+
const pkgsByName = Object.fromEntries(installedPkgs.map((pkg) => [pkg.name, pkg.version]));
|
|
272
268
|
log.debug('Installed Python packages: %O', pkgsByName);
|
|
273
269
|
const requiredPackages = await this.parseRequirementsTxt();
|
|
274
270
|
const missingPackages = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../lib/validate.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../lib/validate.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6CAAyC;AACzC,6CAAyC;AACzC,+CAAkC;AAClC,2CAUqB;AACrB,mCAAsC;AACtC,6BAAiF;AACjF,qCAAmC;AAGnC;;GAEG;AACH,MAAM,cAAc,GAAG,WAAW,CAAC;AAEnC;;GAEG;AACH,MAAM,oBAAoB,GAAG,8BAA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DAAoD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChG,CAAC;QAED,IAAI,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,qBAAqB;QACnC,GAAG,CAAC,KAAK,CAAC,cAAc,uBAAW,UAAU,CAAC,CAAC;QAE/C,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,IAAA,eAAU,GAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,IAAI,CAAC,kCAAsB,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC;YACH,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAA,mBAAI,EAAC,UAAU,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC,IAAI,CAAC,4CAA4C,MAAM,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC;IAC/B,CAAC;;AAvVH,8CAwVC"}
|
package/lib/builder/deploy.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import _ from 'lodash';
|
|
8
7
|
import path from 'node:path';
|
|
9
8
|
import type {TeenProcessExecOptions} from 'teen_process';
|
|
10
9
|
import {
|
|
@@ -169,7 +168,11 @@ export async function deploy({
|
|
|
169
168
|
}
|
|
170
169
|
if (serve) {
|
|
171
170
|
const mikeArgs = [
|
|
172
|
-
...argify(
|
|
171
|
+
...argify(
|
|
172
|
+
Object.fromEntries(
|
|
173
|
+
Object.entries(mikeOpts).filter(([, value]) => typeof value === 'number' || Boolean(value))
|
|
174
|
+
)
|
|
175
|
+
),
|
|
173
176
|
];
|
|
174
177
|
stop(); // discard
|
|
175
178
|
// unsure about how SIGHUP is handled here
|
|
@@ -178,9 +181,11 @@ export async function deploy({
|
|
|
178
181
|
log.info('Deploying into branch %s', branch);
|
|
179
182
|
const mikeArgs = [
|
|
180
183
|
...argify(
|
|
181
|
-
|
|
182
|
-
mikeOpts
|
|
183
|
-
|
|
184
|
+
Object.fromEntries(
|
|
185
|
+
Object.entries(mikeOpts).filter(
|
|
186
|
+
([key, value]) =>
|
|
187
|
+
!['port', 'host'].includes(key) && (typeof value === 'number' || Boolean(value))
|
|
188
|
+
)
|
|
184
189
|
),
|
|
185
190
|
),
|
|
186
191
|
];
|
package/lib/cli/check.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {fs, util} from '@appium/support';
|
|
7
|
-
import _ from 'lodash';
|
|
8
7
|
import type {Options} from 'yargs';
|
|
9
8
|
import {getLogger} from '../logger';
|
|
9
|
+
import {kebabCase} from '../util';
|
|
10
10
|
|
|
11
11
|
const log = getLogger('check');
|
|
12
12
|
|
|
@@ -41,17 +41,17 @@ export async function checkMissingPaths<T extends Record<string, Options>>(
|
|
|
41
41
|
group: string,
|
|
42
42
|
argv: Record<string, unknown>
|
|
43
43
|
): Promise<true | string> {
|
|
44
|
-
const argsToCheck =
|
|
45
|
-
|
|
44
|
+
const argsToCheck = Object.keys(opts).filter(
|
|
45
|
+
(id) => opts[id]?.group === group && id in argv
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
// yargs is pretty loose about allowing CLI args multiple times, and the value could potentially
|
|
49
49
|
// be a `string[]` instead of `string`; we don't want to allow more than one path per arg.
|
|
50
|
-
if (!argsToCheck.every((id) =>
|
|
50
|
+
if (!argsToCheck.every((id) => typeof argv[id] === 'string')) {
|
|
51
51
|
return 'Paths may only be provided once each';
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const pathsToCheck: MissingFileData[] =
|
|
54
|
+
const pathsToCheck: MissingFileData[] = argsToCheck.map((id) => ({
|
|
55
55
|
id,
|
|
56
56
|
path: String(argv[id]), // this must be a string per the above check
|
|
57
57
|
}));
|
|
@@ -59,7 +59,7 @@ export async function checkMissingPaths<T extends Record<string, Options>>(
|
|
|
59
59
|
log.debug(
|
|
60
60
|
'Checking for existence of %s: %s',
|
|
61
61
|
util.pluralize('path', pathsToCheck.length),
|
|
62
|
-
|
|
62
|
+
pathsToCheck.map(({path}) => path)
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
const missingPaths = await filterMissing(pathsToCheck);
|
|
@@ -68,7 +68,7 @@ export async function checkMissingPaths<T extends Record<string, Options>>(
|
|
|
68
68
|
return missingPaths
|
|
69
69
|
.map(
|
|
70
70
|
({id, path}) =>
|
|
71
|
-
`Default or specified path via --${
|
|
71
|
+
`Default or specified path via --${kebabCase(id)} (${path}) does not exist`
|
|
72
72
|
)
|
|
73
73
|
.join('\n');
|
|
74
74
|
}
|
|
@@ -85,6 +85,7 @@ async function filterMissing(paths: MissingFileData[]): Promise<MissingFileData[
|
|
|
85
85
|
const exists = await Promise.all(
|
|
86
86
|
paths.map(async ({id, path}) => ({id, path, exists: await fs.exists(path)}))
|
|
87
87
|
);
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
return exists
|
|
89
|
+
.filter((result) => !result.exists)
|
|
90
|
+
.map(({id, path}) => ({id, path}));
|
|
90
91
|
}
|
package/lib/cli/config.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import type {Loader} from 'lilconfig';
|
|
7
7
|
import {lilconfig} from 'lilconfig';
|
|
8
|
-
import _ from 'lodash';
|
|
9
8
|
import path from 'node:path';
|
|
10
9
|
import * as YAML from 'yaml';
|
|
11
10
|
import parser from 'yargs-parser';
|
|
@@ -20,7 +19,7 @@ const log = getLogger('config');
|
|
|
20
19
|
/**
|
|
21
20
|
* `lilconfig` loader for YAML
|
|
22
21
|
*/
|
|
23
|
-
const loadYaml: Loader =
|
|
22
|
+
const loadYaml: Loader = (_filepath, content) => YAML.parse(content);
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Controls how we load/find a config file.
|
package/lib/cli/index.ts
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import {getLogger} from '../logger';
|
|
10
10
|
|
|
11
11
|
import {fs} from '@appium/support';
|
|
12
|
-
import _ from 'lodash';
|
|
13
12
|
import {readPackageSync} from 'read-pkg';
|
|
14
13
|
import {hideBin} from 'yargs/helpers';
|
|
15
14
|
import yargs from 'yargs/yargs';
|
|
@@ -46,7 +45,7 @@ export async function main(argv = hideBin(process.argv)) {
|
|
|
46
45
|
choices: ['debug', 'info', 'warn', 'error', 'silent'],
|
|
47
46
|
describe: 'Sets the log level',
|
|
48
47
|
default: DEFAULT_LOG_LEVEL,
|
|
49
|
-
coerce:
|
|
48
|
+
coerce: ((x: string) => x) as (x: string) => keyof typeof LogLevelMap,
|
|
50
49
|
},
|
|
51
50
|
config: {
|
|
52
51
|
alias: 'c',
|
package/lib/fs.ts
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {fs} from '@appium/support';
|
|
7
|
-
import _ from 'lodash';
|
|
6
|
+
import {fs, util} from '@appium/support';
|
|
8
7
|
import path from 'node:path';
|
|
9
8
|
import {packageDirectory} from 'package-directory';
|
|
10
9
|
import type {NormalizedPackageJson, PackageJson} from 'read-pkg';
|
|
@@ -23,6 +22,7 @@ import {DocutilsError} from './error';
|
|
|
23
22
|
import {getLogger} from './logger';
|
|
24
23
|
import type {MkDocsYml} from './model';
|
|
25
24
|
import {exec} from 'teen_process';
|
|
25
|
+
import {mergeDefaultsDeep} from './util';
|
|
26
26
|
|
|
27
27
|
const log = getLogger('fs');
|
|
28
28
|
|
|
@@ -31,34 +31,27 @@ const log = getLogger('fs');
|
|
|
31
31
|
*
|
|
32
32
|
* Caches result
|
|
33
33
|
*/
|
|
34
|
-
const findPkgDir =
|
|
34
|
+
const findPkgDir = util.memoize(packageDirectory, (opts) => opts?.cwd);
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Stringifies a thing into a YAML
|
|
38
38
|
* @param value Something to yamlify
|
|
39
39
|
* @returns Some nice YAML 4 u
|
|
40
40
|
*/
|
|
41
|
-
export const stringifyYaml
|
|
42
|
-
YAML.stringify,
|
|
43
|
-
{indent: 2},
|
|
44
|
-
undefined,
|
|
45
|
-
);
|
|
41
|
+
export const stringifyYaml = (value: JsonValue): string =>
|
|
42
|
+
YAML.stringify(value, undefined, {indent: 2});
|
|
46
43
|
|
|
47
44
|
/**
|
|
48
45
|
* Pretty-stringifies a JSON value
|
|
49
46
|
* @param value Something to stringify
|
|
50
47
|
* @returns JSON string
|
|
51
48
|
*/
|
|
52
|
-
export const stringifyJson
|
|
53
|
-
JSON.stringify,
|
|
54
|
-
2,
|
|
55
|
-
undefined,
|
|
56
|
-
);
|
|
49
|
+
export const stringifyJson = (value: JsonValue): string => JSON.stringify(value, undefined, 2);
|
|
57
50
|
|
|
58
51
|
/**
|
|
59
52
|
* Reads a YAML file, parses it and caches the result
|
|
60
53
|
*/
|
|
61
|
-
const readYaml =
|
|
54
|
+
const readYaml = util.memoize(async (filepath: string) =>
|
|
62
55
|
YAML.parse(await fs.readFile(filepath, 'utf8'), {
|
|
63
56
|
prettyErrors: false,
|
|
64
57
|
logLevel: 'silent',
|
|
@@ -90,7 +83,9 @@ export async function findInPkgDir(
|
|
|
90
83
|
* @param cwd - Current working directory
|
|
91
84
|
* @returns Path to `mkdocs.yml`
|
|
92
85
|
*/
|
|
93
|
-
export const findMkDocsYml =
|
|
86
|
+
export const findMkDocsYml = util.memoize(
|
|
87
|
+
async (cwd = process.cwd()) => await findInPkgDir(NAME_MKDOCS_YML, cwd)
|
|
88
|
+
);
|
|
94
89
|
|
|
95
90
|
/**
|
|
96
91
|
* Given a directory path, finds closest `package.json` and reads it.
|
|
@@ -130,12 +125,12 @@ async function _readPkgJson(
|
|
|
130
125
|
/**
|
|
131
126
|
* Given a directory to start from, reads a `package.json` file and returns its path and contents
|
|
132
127
|
*/
|
|
133
|
-
export const readPackageJson =
|
|
128
|
+
export const readPackageJson = util.memoize(_readPkgJson);
|
|
134
129
|
|
|
135
130
|
/**
|
|
136
131
|
* Reads a JSON file and parses it
|
|
137
132
|
*/
|
|
138
|
-
export const readJson =
|
|
133
|
+
export const readJson = util.memoize(
|
|
139
134
|
async <T extends JsonValue>(filepath: string): Promise<T> =>
|
|
140
135
|
JSON.parse(await fs.readFile(filepath, 'utf8')),
|
|
141
136
|
);
|
|
@@ -148,7 +143,7 @@ type WhichFunction = (cmd: string, opts?: {nothrow: boolean}) => Promise<string
|
|
|
148
143
|
* @param content - File contents
|
|
149
144
|
*/
|
|
150
145
|
export function writeFileString(filepath: string, content: JsonValue) {
|
|
151
|
-
const data: string =
|
|
146
|
+
const data: string = typeof content === 'string' ? content : JSON.stringify(content, undefined, 2);
|
|
152
147
|
return fs.writeFile(filepath, data, {
|
|
153
148
|
encoding: 'utf8',
|
|
154
149
|
});
|
|
@@ -157,22 +152,22 @@ export function writeFileString(filepath: string, content: JsonValue) {
|
|
|
157
152
|
/**
|
|
158
153
|
* `which` with memoization
|
|
159
154
|
*/
|
|
160
|
-
const cachedWhich =
|
|
155
|
+
const cachedWhich = util.memoize(fs.which as WhichFunction);
|
|
161
156
|
|
|
162
157
|
/**
|
|
163
158
|
* Finds `python` executable
|
|
164
159
|
*/
|
|
165
|
-
const whichPython =
|
|
160
|
+
const whichPython = async () => await cachedWhich(NAME_PYTHON, {nothrow: true});
|
|
166
161
|
|
|
167
162
|
/**
|
|
168
163
|
* Finds `python3` executable
|
|
169
164
|
*/
|
|
170
|
-
const whichPython3 =
|
|
165
|
+
const whichPython3 = async () => await cachedWhich(`${NAME_PYTHON}3`, {nothrow: true});
|
|
171
166
|
|
|
172
167
|
/**
|
|
173
168
|
* Check if `mkdocs` is installed
|
|
174
169
|
*/
|
|
175
|
-
export const isMkDocsInstalled =
|
|
170
|
+
export const isMkDocsInstalled = util.memoize(async (): Promise<boolean> => {
|
|
176
171
|
// see if it's in PATH
|
|
177
172
|
const mkDocsPath = await cachedWhich(NAME_MKDOCS, {nothrow: true});
|
|
178
173
|
if (mkDocsPath) {
|
|
@@ -194,7 +189,7 @@ export const isMkDocsInstalled = _.memoize(async (): Promise<boolean> => {
|
|
|
194
189
|
/**
|
|
195
190
|
* `mike` cannot be invoked via `python -m`, so we need to find the script.
|
|
196
191
|
*/
|
|
197
|
-
export const findMike =
|
|
192
|
+
export const findMike = async () => {
|
|
198
193
|
// see if it's in PATH
|
|
199
194
|
let mikePath = await cachedWhich(NAME_MIKE, {nothrow: true});
|
|
200
195
|
if (mikePath) {
|
|
@@ -216,14 +211,14 @@ export const findMike = _.partial(async () => {
|
|
|
216
211
|
}
|
|
217
212
|
}
|
|
218
213
|
} catch {}
|
|
219
|
-
}
|
|
214
|
+
};
|
|
220
215
|
|
|
221
216
|
/**
|
|
222
217
|
* Finds the `python3` or `python` executable in the user's `PATH`.
|
|
223
218
|
*
|
|
224
219
|
* `python3` is preferred over `python`, since the latter could be Python 2.
|
|
225
220
|
*/
|
|
226
|
-
export const findPython =
|
|
221
|
+
export const findPython = util.memoize(
|
|
227
222
|
async (): Promise<string | null> => (await whichPython3()) ?? (await whichPython()),
|
|
228
223
|
);
|
|
229
224
|
|
|
@@ -246,7 +241,7 @@ export async function requirePython(pythonPath?: string): Promise<string> {
|
|
|
246
241
|
* @param filepath Patgh to an `mkdocs.yml` file
|
|
247
242
|
* @returns Parsed `mkdocs.yml` file
|
|
248
243
|
*/
|
|
249
|
-
export const readMkDocsYml =
|
|
244
|
+
export const readMkDocsYml: (filepath: string, cwd?: string) => Promise<MkDocsYml> = util.memoize(
|
|
250
245
|
async (filepath: string, cwd = process.cwd()): Promise<MkDocsYml> => {
|
|
251
246
|
let mkDocsYml = (await readYaml(filepath)) as MkDocsYml;
|
|
252
247
|
if (mkDocsYml.site_dir) {
|
|
@@ -264,7 +259,7 @@ export const readMkDocsYml = _.memoize(
|
|
|
264
259
|
inheritYml.docs_dir = path.resolve(path.dirname(inheritPath), inheritYml.docs_dir);
|
|
265
260
|
log.debug('Resolved docs_dir to %s', inheritYml.docs_dir);
|
|
266
261
|
}
|
|
267
|
-
mkDocsYml =
|
|
262
|
+
mkDocsYml = mergeDefaultsDeep(mkDocsYml, inheritYml);
|
|
268
263
|
inheritPath = inheritYml.INHERIT
|
|
269
264
|
? path.resolve(path.dirname(inheritPath), inheritYml.INHERIT)
|
|
270
265
|
: undefined;
|
package/lib/logger.ts
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
11
|
const {ConsolaInstance, createConsola, LogLevel} = require('consola');
|
|
12
|
-
import _ from 'lodash';
|
|
13
12
|
import {DEFAULT_LOG_LEVEL, LogLevelMap} from './constants';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -72,7 +71,12 @@ export function getLogger(tag: string, parent = rootLogger) {
|
|
|
72
71
|
*
|
|
73
72
|
* @remarks Child loggers seem to inherit the "paused" state of the parent, so when this is called, we must resume all of them.
|
|
74
73
|
*/
|
|
75
|
-
|
|
74
|
+
let hasInitializedLogger = false;
|
|
75
|
+
export const initLogger = (level: keyof typeof LogLevelMap | typeof LogLevel) => {
|
|
76
|
+
if (hasInitializedLogger) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
hasInitializedLogger = true;
|
|
76
80
|
globalLevel = isLogLevelString(level) ? LogLevelMap[level] : level;
|
|
77
81
|
rootLogger.level = globalLevel;
|
|
78
82
|
rootLogger.resumeLogs();
|
|
@@ -83,4 +87,4 @@ export const initLogger = _.once((level: keyof typeof LogLevelMap | typeof LogLe
|
|
|
83
87
|
logger.resumeLogs();
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
|
-
}
|
|
90
|
+
};
|
package/lib/scaffold.ts
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {fs} from '@appium/support';
|
|
6
|
+
import {fs, util} from '@appium/support';
|
|
7
7
|
import {getLogger} from './logger';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import {createPatch} from 'diff';
|
|
10
10
|
import type {NormalizedPackageJson} from 'read-pkg';
|
|
11
11
|
import type {JsonValue, JsonObject} from 'type-fest';
|
|
12
12
|
import {DocutilsError} from './error';
|
|
13
|
-
import {relative} from './util';
|
|
14
|
-
import _ from 'lodash';
|
|
13
|
+
import {mergeDefaultsDeep, relative} from './util';
|
|
15
14
|
import {stringifyJson, readPackageJson, writeFileString} from './fs';
|
|
16
15
|
import {NAME_ERR_ENOENT} from './constants';
|
|
17
16
|
|
|
@@ -127,7 +126,7 @@ export function createScaffoldTask<Opts extends ScaffoldTaskOptions, T extends J
|
|
|
127
126
|
defaultContent: T,
|
|
128
127
|
description: string,
|
|
129
128
|
{
|
|
130
|
-
transform =
|
|
129
|
+
transform = (content) => content,
|
|
131
130
|
deserialize = JSON.parse,
|
|
132
131
|
serialize = stringifyJson,
|
|
133
132
|
}: CreateScaffoldTaskOptions<Opts, T> = {}
|
|
@@ -168,9 +167,9 @@ export function createScaffoldTask<Opts extends ScaffoldTaskOptions, T extends J
|
|
|
168
167
|
}
|
|
169
168
|
|
|
170
169
|
const defaults: T = transform(defaultContent, opts, pkg);
|
|
171
|
-
const finalDestContent: T =
|
|
170
|
+
const finalDestContent: T = mergeDefaultsDeep(destContent, defaults);
|
|
172
171
|
|
|
173
|
-
destChangesNeeded = destChangesNeeded || !
|
|
172
|
+
destChangesNeeded = destChangesNeeded || !util.isEqual(destContent, finalDestContent);
|
|
174
173
|
|
|
175
174
|
if (destChangesNeeded) {
|
|
176
175
|
log.info('Changes needed in %s', relativeDest);
|
|
@@ -225,7 +224,7 @@ function makePatch<T extends JsonValue>(
|
|
|
225
224
|
) {
|
|
226
225
|
return createPatch(
|
|
227
226
|
filename,
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
typeof oldData === 'string' ? oldData : serializer(oldData),
|
|
228
|
+
typeof newData === 'string' ? newData : serializer(newData)
|
|
230
229
|
);
|
|
231
230
|
}
|