@appium/docutils 2.2.0 → 2.2.2
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/bin/appium-docs.js +0 -1
- package/build/lib/builder/deploy.d.ts +2 -2
- package/build/lib/builder/deploy.d.ts.map +1 -1
- package/build/lib/builder/deploy.js.map +1 -1
- package/build/lib/builder/site.d.ts +2 -2
- package/build/lib/builder/site.d.ts.map +1 -1
- package/build/lib/builder/site.js.map +1 -1
- package/build/lib/cli/command/validate.d.ts.map +1 -1
- package/build/lib/cli/command/validate.js.map +1 -1
- package/build/lib/cli/config.d.ts.map +1 -1
- package/build/lib/cli/config.js.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 +3 -3
- package/build/lib/fs.d.ts.map +1 -1
- package/build/lib/fs.js +7 -7
- package/build/lib/fs.js.map +1 -1
- package/build/lib/init.d.ts +3 -4
- package/build/lib/init.d.ts.map +1 -1
- package/build/lib/init.js.map +1 -1
- package/build/lib/scaffold.d.ts +2 -2
- package/build/lib/scaffold.d.ts.map +1 -1
- package/build/lib/util.d.ts +1 -1
- package/build/lib/util.d.ts.map +1 -1
- package/build/lib/util.js.map +1 -1
- package/build/lib/validate.d.ts +1 -1
- package/build/lib/validate.d.ts.map +1 -1
- package/build/lib/validate.js +2 -3
- package/build/lib/validate.js.map +1 -1
- package/lib/builder/deploy.ts +4 -2
- package/lib/builder/site.ts +4 -2
- package/lib/cli/command/validate.ts +2 -1
- package/lib/cli/config.ts +4 -2
- package/lib/cli/index.ts +4 -4
- package/lib/fs.ts +11 -10
- package/lib/init.ts +4 -4
- package/lib/scaffold.ts +2 -2
- package/lib/util.ts +2 -1
- package/lib/validate.ts +5 -11
- package/package.json +12 -16
- package/requirements.txt +3 -3
- package/build/test/e2e/build.e2e.spec.d.ts +0 -6
- package/build/test/e2e/build.e2e.spec.d.ts.map +0 -1
- package/build/test/e2e/build.e2e.spec.js +0 -313
- package/build/test/e2e/build.e2e.spec.js.map +0 -1
- package/build/test/unit/util.spec.d.ts +0 -2
- package/build/test/unit/util.spec.d.ts.map +0 -1
- package/build/test/unit/util.spec.js +0 -79
- package/build/test/unit/util.spec.js.map +0 -1
- package/index.js +0 -1
package/lib/fs.ts
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
import {fs} from '@appium/support';
|
|
7
7
|
import _ from 'lodash';
|
|
8
8
|
import path from 'node:path';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
9
|
+
import {packageDirectory} from 'package-directory';
|
|
10
|
+
import type {NormalizedPackageJson, PackageJson} from 'read-pkg';
|
|
11
|
+
import {readPackage} from 'read-pkg';
|
|
12
|
+
import type {JsonValue} from 'type-fest';
|
|
12
13
|
import * as YAML from 'yaml';
|
|
13
14
|
import {
|
|
14
15
|
MESSAGE_PYTHON_MISSING,
|
|
@@ -20,7 +21,7 @@ import {
|
|
|
20
21
|
} from './constants';
|
|
21
22
|
import {DocutilsError} from './error';
|
|
22
23
|
import {getLogger} from './logger';
|
|
23
|
-
import {MkDocsYml} from './model';
|
|
24
|
+
import type {MkDocsYml} from './model';
|
|
24
25
|
import {exec} from 'teen_process';
|
|
25
26
|
|
|
26
27
|
const log = getLogger('fs');
|
|
@@ -30,7 +31,7 @@ const log = getLogger('fs');
|
|
|
30
31
|
*
|
|
31
32
|
* Caches result
|
|
32
33
|
*/
|
|
33
|
-
const findPkgDir = _.memoize(
|
|
34
|
+
const findPkgDir = _.memoize(packageDirectory, (opts) => opts?.cwd);
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Stringifies a thing into a YAML
|
|
@@ -75,7 +76,7 @@ export async function findInPkgDir(
|
|
|
75
76
|
filename: string,
|
|
76
77
|
cwd = process.cwd(),
|
|
77
78
|
): Promise<string | undefined> {
|
|
78
|
-
const pkgDir = await findPkgDir(cwd);
|
|
79
|
+
const pkgDir = await findPkgDir({cwd});
|
|
79
80
|
if (!pkgDir) {
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
@@ -109,7 +110,7 @@ async function _readPkgJson(
|
|
|
109
110
|
cwd: string,
|
|
110
111
|
normalize?: boolean,
|
|
111
112
|
): Promise<{pkgPath: string; pkg: PackageJson | NormalizedPackageJson}> {
|
|
112
|
-
const pkgDir = await findPkgDir(cwd);
|
|
113
|
+
const pkgDir = await findPkgDir({cwd});
|
|
113
114
|
if (!pkgDir) {
|
|
114
115
|
throw new DocutilsError(
|
|
115
116
|
`Could not find a ${NAME_PACKAGE_JSON} near ${cwd}; please create it before using this utility`,
|
|
@@ -118,10 +119,10 @@ async function _readPkgJson(
|
|
|
118
119
|
const pkgPath = path.join(pkgDir, NAME_PACKAGE_JSON);
|
|
119
120
|
log.debug('Found `package.json` at %s', pkgPath);
|
|
120
121
|
if (normalize) {
|
|
121
|
-
const pkg = await
|
|
122
|
+
const pkg = await readPackage({cwd: pkgDir, normalize});
|
|
122
123
|
return {pkg, pkgPath};
|
|
123
124
|
} else {
|
|
124
|
-
const pkg = await
|
|
125
|
+
const pkg = await readPackage({cwd: pkgDir});
|
|
125
126
|
return {pkg, pkgPath};
|
|
126
127
|
}
|
|
127
128
|
}
|
|
@@ -151,7 +152,7 @@ export function writeFileString(filepath: string, content: JsonValue) {
|
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
type WhichFunction = (cmd: string, opts?: {nothrow: boolean}) => Promise<string|null>;
|
|
155
|
+
type WhichFunction = (cmd: string, opts?: {nothrow: boolean}) => Promise<string | null>;
|
|
155
156
|
|
|
156
157
|
/**
|
|
157
158
|
* `which` with memoization
|
package/lib/init.ts
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
import {NAME_MKDOCS_YML, PIP_ENV_VARS, REQUIREMENTS_TXT_PATH} from './constants';
|
|
8
8
|
import * as YAML from 'yaml';
|
|
9
9
|
import {exec} from 'teen_process';
|
|
10
|
-
import {Simplify} from 'type-fest';
|
|
10
|
+
import type {Simplify} from 'type-fest';
|
|
11
11
|
import {DocutilsError} from './error';
|
|
12
|
-
import {createScaffoldTask
|
|
13
|
-
import type {
|
|
12
|
+
import {createScaffoldTask} from './scaffold';
|
|
13
|
+
import type {ScaffoldTask, ScaffoldTaskOptions} from './scaffold';
|
|
14
14
|
import {getLogger} from './logger';
|
|
15
|
-
import {MkDocsYml} from './model';
|
|
15
|
+
import type {MkDocsYml} from './model';
|
|
16
16
|
import {requirePython, stringifyYaml} from './fs';
|
|
17
17
|
|
|
18
18
|
/**
|
package/lib/scaffold.ts
CHANGED
|
@@ -7,8 +7,8 @@ import {fs} from '@appium/support';
|
|
|
7
7
|
import {getLogger} from './logger';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import {createPatch} from 'diff';
|
|
10
|
-
import {NormalizedPackageJson} from 'read-pkg';
|
|
11
|
-
import {JsonValue, JsonObject} from 'type-fest';
|
|
10
|
+
import type {NormalizedPackageJson} from 'read-pkg';
|
|
11
|
+
import type {JsonValue, JsonObject} from 'type-fest';
|
|
12
12
|
import {DocutilsError} from './error';
|
|
13
13
|
import {relative} from './util';
|
|
14
14
|
import _ from 'lodash';
|
package/lib/util.ts
CHANGED
package/lib/validate.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {fs, util} from '@appium/support';
|
|
8
|
-
import chalk from 'chalk';
|
|
9
8
|
import _ from 'lodash';
|
|
10
9
|
import {EventEmitter} from 'node:events';
|
|
11
10
|
import {exec} from 'teen_process';
|
|
@@ -21,14 +20,9 @@ import {
|
|
|
21
20
|
REQUIREMENTS_TXT_PATH,
|
|
22
21
|
} from './constants';
|
|
23
22
|
import {DocutilsError} from './error';
|
|
24
|
-
import {
|
|
25
|
-
findMkDocsYml,
|
|
26
|
-
isMkDocsInstalled,
|
|
27
|
-
readMkDocsYml,
|
|
28
|
-
findPython,
|
|
29
|
-
} from './fs';
|
|
23
|
+
import {findMkDocsYml, isMkDocsInstalled, readMkDocsYml, findPython} from './fs';
|
|
30
24
|
import {getLogger} from './logger';
|
|
31
|
-
import {MkDocsYml, PipPackage} from './model';
|
|
25
|
+
import type {MkDocsYml, PipPackage} from './model';
|
|
32
26
|
|
|
33
27
|
/**
|
|
34
28
|
* Matches the Python version string from `python --version`
|
|
@@ -319,7 +313,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
319
313
|
]));
|
|
320
314
|
} catch {
|
|
321
315
|
return this.fail(
|
|
322
|
-
`Could not find ${NAME_PIP} installation for Python at ${pythonPath}. Is it installed
|
|
316
|
+
`Could not find ${NAME_PIP} installation for Python at ${pythonPath}. Is it installed?`,
|
|
323
317
|
);
|
|
324
318
|
}
|
|
325
319
|
|
|
@@ -352,7 +346,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
352
346
|
'package',
|
|
353
347
|
missingPackages.length,
|
|
354
348
|
)} could not be found:\n${missingPackages
|
|
355
|
-
.map((p) =>
|
|
349
|
+
.map((p) => `- ${p.name} @ ${p.version}`)
|
|
356
350
|
.join('\n')}`,
|
|
357
351
|
);
|
|
358
352
|
}
|
|
@@ -364,7 +358,7 @@ export class DocutilsValidator extends EventEmitter {
|
|
|
364
358
|
)} are installed, but at the wrong version:\n${invalidVersionPackages
|
|
365
359
|
.map(
|
|
366
360
|
([expected, actual]) =>
|
|
367
|
-
|
|
361
|
+
`- ${expected.name} @ ${expected.version} (found ${actual.version})`,
|
|
368
362
|
)
|
|
369
363
|
.join('\n')}`,
|
|
370
364
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/docutils",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Documentation generation utilities for Appium and related projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"author": "https://github.com/appium",
|
|
26
|
+
"main": "./build/lib/index.js",
|
|
26
27
|
"types": "./build/lib/index.d.ts",
|
|
27
28
|
"directories": {
|
|
28
29
|
"lib": "lib"
|
|
@@ -31,34 +32,29 @@
|
|
|
31
32
|
"appium-docs": "./bin/appium-docs.js"
|
|
32
33
|
},
|
|
33
34
|
"files": [
|
|
34
|
-
"index.js",
|
|
35
|
-
"index.d.ts",
|
|
36
35
|
"base-mkdocs.yml",
|
|
37
36
|
"lib",
|
|
38
|
-
"build",
|
|
37
|
+
"build/lib",
|
|
39
38
|
"tsconfig.json",
|
|
40
|
-
"!build/tsconfig.tsbuildinfo",
|
|
41
39
|
"requirements.txt"
|
|
42
40
|
],
|
|
43
41
|
"scripts": {
|
|
44
42
|
"test": "npm run test:unit",
|
|
45
43
|
"test:e2e": "mocha --exit --timeout 60s --slow 30s \"./test/e2e/**/*.e2e.spec.ts\"",
|
|
46
|
-
"test:smoke": "node ./index.js",
|
|
44
|
+
"test:smoke": "node ./build/lib/index.js",
|
|
47
45
|
"test:unit": "mocha \"./test/unit/**/*.spec.ts\"",
|
|
48
46
|
"start": "node ./build/lib/cli/index.js"
|
|
49
47
|
},
|
|
50
48
|
"dependencies": {
|
|
51
|
-
"@appium/support": "^7.0.
|
|
52
|
-
"chalk": "4.1.2",
|
|
49
|
+
"@appium/support": "^7.0.6",
|
|
53
50
|
"consola": "3.4.2",
|
|
54
|
-
"diff": "8.0.
|
|
51
|
+
"diff": "8.0.3",
|
|
55
52
|
"lilconfig": "3.1.3",
|
|
56
|
-
"lodash": "4.17.
|
|
57
|
-
"
|
|
58
|
-
"read-pkg": "
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"type-fest": "5.3.0",
|
|
53
|
+
"lodash": "4.17.23",
|
|
54
|
+
"package-directory": "8.2.0",
|
|
55
|
+
"read-pkg": "10.1.0",
|
|
56
|
+
"teen_process": "4.0.10",
|
|
57
|
+
"type-fest": "5.4.4",
|
|
62
58
|
"yaml": "2.8.2",
|
|
63
59
|
"yargs": "18.0.0",
|
|
64
60
|
"yargs-parser": "22.0.0"
|
|
@@ -70,5 +66,5 @@
|
|
|
70
66
|
"publishConfig": {
|
|
71
67
|
"access": "public"
|
|
72
68
|
},
|
|
73
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "980a121804ae006db879fb6860f627ac36174c15"
|
|
74
70
|
}
|
package/requirements.txt
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.e2e.spec.d.ts","sourceRoot":"","sources":["../../../test/e2e/build.e2e.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* E2E tests for the `appium-docs build` and `init` commands
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
40
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
|
-
};
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
44
|
-
const chai = __importStar(require("chai"));
|
|
45
|
-
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
|
|
46
|
-
const YAML = __importStar(require("yaml"));
|
|
47
|
-
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
48
|
-
const support_1 = require("@appium/support");
|
|
49
|
-
const builder_1 = require("../../lib/builder");
|
|
50
|
-
const init_1 = require("../../lib/init");
|
|
51
|
-
const fs_1 = require("../../lib/fs");
|
|
52
|
-
const constants_1 = require("../../lib/constants");
|
|
53
|
-
const command_1 = require("../../lib/cli/command");
|
|
54
|
-
chai.use(chai_as_promised_1.default);
|
|
55
|
-
const { expect } = chai;
|
|
56
|
-
/**
|
|
57
|
-
* Helper function to create a project directory with package.json
|
|
58
|
-
*/
|
|
59
|
-
async function createProjectDir(testDir, subdir, packageJson) {
|
|
60
|
-
const projectDir = node_path_1.default.join(testDir, subdir);
|
|
61
|
-
await support_1.fs.mkdirp(projectDir);
|
|
62
|
-
await support_1.fs.writeFile(node_path_1.default.join(projectDir, constants_1.NAME_PACKAGE_JSON), JSON.stringify(packageJson, null, 2), 'utf8');
|
|
63
|
-
return projectDir;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Helper function to create a minimal mkdocs.yml file
|
|
67
|
-
*/
|
|
68
|
-
async function createMkdocsYml(projectDir, mkdocsYml) {
|
|
69
|
-
await support_1.fs.writeFile(node_path_1.default.join(projectDir, constants_1.NAME_MKDOCS_YML), (0, fs_1.stringifyYaml)(mkdocsYml), 'utf8');
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Helper function to create a docs directory with a markdown file
|
|
73
|
-
*/
|
|
74
|
-
async function createDocsFile(projectDir, filename, content) {
|
|
75
|
-
const docsDir = node_path_1.default.join(projectDir, 'docs');
|
|
76
|
-
await support_1.fs.mkdirp(docsDir);
|
|
77
|
-
await support_1.fs.writeFile(node_path_1.default.join(docsDir, filename), content, 'utf8');
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Helper function to ensure Python dependencies are installed
|
|
81
|
-
*/
|
|
82
|
-
async function ensurePythonDeps(projectDir, context) {
|
|
83
|
-
try {
|
|
84
|
-
await (0, init_1.initPython)({ cwd: projectDir });
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
context.skip();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Helper function to verify a site was built
|
|
92
|
-
*/
|
|
93
|
-
async function verifySiteBuilt(siteDir, expectedContent) {
|
|
94
|
-
const siteDirExists = await support_1.fs.exists(siteDir);
|
|
95
|
-
expect(siteDirExists).to.be.true;
|
|
96
|
-
const indexHtml = node_path_1.default.join(siteDir, 'index.html');
|
|
97
|
-
const indexHtmlExists = await support_1.fs.exists(indexHtml);
|
|
98
|
-
expect(indexHtmlExists).to.be.true;
|
|
99
|
-
const indexHtmlContent = await support_1.fs.readFile(indexHtml, 'utf8');
|
|
100
|
-
expect(indexHtmlContent).to.include(expectedContent);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Helper function to read and parse mkdocs.yml
|
|
104
|
-
*/
|
|
105
|
-
async function readMkdocsYml(projectDir) {
|
|
106
|
-
const mkdocsYmlPath = node_path_1.default.join(projectDir, constants_1.NAME_MKDOCS_YML);
|
|
107
|
-
const mkdocsYmlContent = await support_1.fs.readFile(mkdocsYmlPath, 'utf8');
|
|
108
|
-
return YAML.parse(mkdocsYmlContent);
|
|
109
|
-
}
|
|
110
|
-
describe('@appium/docutils build e2e', function () {
|
|
111
|
-
let testDir;
|
|
112
|
-
before(async function () {
|
|
113
|
-
// Create a temporary directory for the test
|
|
114
|
-
testDir = await support_1.tempDir.openDir();
|
|
115
|
-
});
|
|
116
|
-
after(async function () {
|
|
117
|
-
// Clean up the temporary directory
|
|
118
|
-
if (testDir) {
|
|
119
|
-
await support_1.fs.rimraf(testDir);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
describe('buildSite', function () {
|
|
123
|
-
it('should build a site with mkdocs', async function () {
|
|
124
|
-
const projectDir = await createProjectDir(testDir, 'test1', {
|
|
125
|
-
name: 'test-docs',
|
|
126
|
-
version: '1.0.0',
|
|
127
|
-
description: 'Test documentation',
|
|
128
|
-
});
|
|
129
|
-
// Create a minimal mkdocs.yml
|
|
130
|
-
// For testing, we use a simple config without INHERIT to avoid path resolution issues
|
|
131
|
-
await createMkdocsYml(projectDir, {
|
|
132
|
-
site_name: 'Test Docs',
|
|
133
|
-
docs_dir: 'docs',
|
|
134
|
-
site_dir: constants_1.DEFAULT_SITE_DIR,
|
|
135
|
-
theme: {
|
|
136
|
-
name: 'material',
|
|
137
|
-
},
|
|
138
|
-
plugins: ['search'],
|
|
139
|
-
});
|
|
140
|
-
await createDocsFile(projectDir, 'index.md', '# Test Documentation\n\nThis is a test page.\n');
|
|
141
|
-
await ensurePythonDeps(projectDir, this);
|
|
142
|
-
// Build the site
|
|
143
|
-
await (0, builder_1.buildSite)({
|
|
144
|
-
mkdocsYml: node_path_1.default.join(projectDir, constants_1.NAME_MKDOCS_YML),
|
|
145
|
-
cwd: projectDir,
|
|
146
|
-
});
|
|
147
|
-
// Verify the site was built
|
|
148
|
-
await verifySiteBuilt(node_path_1.default.join(projectDir, constants_1.DEFAULT_SITE_DIR), 'Test Documentation');
|
|
149
|
-
});
|
|
150
|
-
it('should build a site with custom site-dir', async function () {
|
|
151
|
-
const customSiteDir = 'custom-site';
|
|
152
|
-
const projectDir = await createProjectDir(testDir, 'test2', {
|
|
153
|
-
name: 'test-docs-2',
|
|
154
|
-
version: '1.0.0',
|
|
155
|
-
description: 'Test documentation',
|
|
156
|
-
});
|
|
157
|
-
// Create a minimal mkdocs.yml
|
|
158
|
-
// For testing, we use a simple config without INHERIT to avoid path resolution issues
|
|
159
|
-
await createMkdocsYml(projectDir, {
|
|
160
|
-
site_name: 'Test Docs 2',
|
|
161
|
-
docs_dir: 'docs',
|
|
162
|
-
site_dir: customSiteDir,
|
|
163
|
-
theme: {
|
|
164
|
-
name: 'material',
|
|
165
|
-
},
|
|
166
|
-
plugins: ['search'],
|
|
167
|
-
});
|
|
168
|
-
await createDocsFile(projectDir, 'index.md', '# Test Documentation 2\n\nThis is another test page.\n');
|
|
169
|
-
await ensurePythonDeps(projectDir, this);
|
|
170
|
-
// Build the site with custom site-dir
|
|
171
|
-
const customSiteDirPath = node_path_1.default.join(projectDir, customSiteDir);
|
|
172
|
-
await (0, builder_1.buildSite)({
|
|
173
|
-
mkdocsYml: node_path_1.default.join(projectDir, constants_1.NAME_MKDOCS_YML),
|
|
174
|
-
siteDir: customSiteDirPath,
|
|
175
|
-
cwd: projectDir,
|
|
176
|
-
});
|
|
177
|
-
// Verify the site was built in the custom directory
|
|
178
|
-
await verifySiteBuilt(customSiteDirPath, 'Test Documentation 2');
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
describe('init', function () {
|
|
182
|
-
it('should scaffold mkdocs.yml file', async function () {
|
|
183
|
-
const projectDir = await createProjectDir(testDir, 'init-test', {
|
|
184
|
-
name: 'test-package',
|
|
185
|
-
version: '1.0.0',
|
|
186
|
-
description: 'Test package description',
|
|
187
|
-
repository: {
|
|
188
|
-
type: 'git',
|
|
189
|
-
url: 'https://github.com/testuser/test-package.git',
|
|
190
|
-
},
|
|
191
|
-
});
|
|
192
|
-
// Run init command (skip Python installation for faster test)
|
|
193
|
-
await (0, init_1.init)({
|
|
194
|
-
cwd: projectDir,
|
|
195
|
-
mkdocs: true,
|
|
196
|
-
python: false,
|
|
197
|
-
});
|
|
198
|
-
// Verify mkdocs.yml was created
|
|
199
|
-
const mkdocsYmlPath = node_path_1.default.join(projectDir, constants_1.NAME_MKDOCS_YML);
|
|
200
|
-
expect(await support_1.fs.exists(mkdocsYmlPath)).to.be.true;
|
|
201
|
-
// Read and verify the content of mkdocs.yml
|
|
202
|
-
const mkdocsYml = await readMkdocsYml(projectDir);
|
|
203
|
-
// Verify expected fields are present
|
|
204
|
-
expect(mkdocsYml.INHERIT).to.equal('./node_modules/@appium/docutils/base-mkdocs.yml');
|
|
205
|
-
expect(mkdocsYml.docs_dir).to.equal('docs');
|
|
206
|
-
expect(mkdocsYml.site_dir).to.equal('site');
|
|
207
|
-
expect(mkdocsYml.site_name).to.equal('test-package');
|
|
208
|
-
expect(mkdocsYml.site_description).to.equal('Test package description');
|
|
209
|
-
// Repository URL may be normalized with "git+" prefix by read-pkg
|
|
210
|
-
expect(mkdocsYml.repo_url).to.include('github.com/testuser/test-package');
|
|
211
|
-
expect(mkdocsYml.repo_name).to.equal('testuser/test-package');
|
|
212
|
-
});
|
|
213
|
-
it('should scaffold mkdocs.yml with custom options', async function () {
|
|
214
|
-
const projectDir = await createProjectDir(testDir, 'init-custom-test', {
|
|
215
|
-
name: 'custom-package',
|
|
216
|
-
version: '2.0.0',
|
|
217
|
-
description: 'Custom package',
|
|
218
|
-
});
|
|
219
|
-
// Run init command with custom options
|
|
220
|
-
await (0, init_1.init)({
|
|
221
|
-
cwd: projectDir,
|
|
222
|
-
mkdocs: true,
|
|
223
|
-
python: false,
|
|
224
|
-
siteName: 'Custom Site Name',
|
|
225
|
-
repoUrl: 'https://github.com/custom/repo',
|
|
226
|
-
repoName: 'custom/repo',
|
|
227
|
-
siteDescription: 'Custom description',
|
|
228
|
-
});
|
|
229
|
-
// Verify mkdocs.yml was created
|
|
230
|
-
const mkdocsYmlPath = node_path_1.default.join(projectDir, constants_1.NAME_MKDOCS_YML);
|
|
231
|
-
expect(await support_1.fs.exists(mkdocsYmlPath)).to.be.true;
|
|
232
|
-
// Read and verify the content
|
|
233
|
-
const mkdocsYml = await readMkdocsYml(projectDir);
|
|
234
|
-
// Verify custom values are used
|
|
235
|
-
expect(mkdocsYml.site_name).to.equal('Custom Site Name');
|
|
236
|
-
// Note: siteDescription from options should override package.json description
|
|
237
|
-
// If it doesn't work, it falls back to package description
|
|
238
|
-
expect(mkdocsYml.site_description).to.be.oneOf(['Custom description', 'Custom package']);
|
|
239
|
-
expect(mkdocsYml.repo_url).to.equal('https://github.com/custom/repo');
|
|
240
|
-
expect(mkdocsYml.repo_name).to.equal('custom/repo');
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
describe('CLI help', function () {
|
|
244
|
-
it('should print help when --help is passed', async function () {
|
|
245
|
-
let helpOutput = '';
|
|
246
|
-
// Create yargs instance similar to CLI
|
|
247
|
-
const y = (0, yargs_1.default)(['--help'])
|
|
248
|
-
.scriptName(constants_1.NAME_BIN)
|
|
249
|
-
.command(command_1.build)
|
|
250
|
-
.command(command_1.init)
|
|
251
|
-
.command(command_1.validate)
|
|
252
|
-
.options({
|
|
253
|
-
verbose: {
|
|
254
|
-
type: 'boolean',
|
|
255
|
-
describe: 'Alias for --log-level=debug',
|
|
256
|
-
},
|
|
257
|
-
'log-level': {
|
|
258
|
-
alias: 'L',
|
|
259
|
-
choices: ['debug', 'info', 'warn', 'error', 'silent'],
|
|
260
|
-
describe: 'Sets the log level',
|
|
261
|
-
default: 'info',
|
|
262
|
-
},
|
|
263
|
-
config: {
|
|
264
|
-
alias: 'c',
|
|
265
|
-
type: 'string',
|
|
266
|
-
describe: 'Path to config file',
|
|
267
|
-
normalize: true,
|
|
268
|
-
nargs: 1,
|
|
269
|
-
requiresArg: true,
|
|
270
|
-
defaultDescription: '(discovered automatically)',
|
|
271
|
-
},
|
|
272
|
-
'no-config': {
|
|
273
|
-
type: 'boolean',
|
|
274
|
-
describe: 'Disable config file discovery',
|
|
275
|
-
},
|
|
276
|
-
})
|
|
277
|
-
.demandCommand(1)
|
|
278
|
-
.strict();
|
|
279
|
-
// Try getHelp first (returns a string, no I/O needed)
|
|
280
|
-
try {
|
|
281
|
-
const helpText = await y.getHelp();
|
|
282
|
-
helpOutput = helpText;
|
|
283
|
-
}
|
|
284
|
-
catch {
|
|
285
|
-
// If getHelp doesn't work, use showHelp which writes to stderr by default
|
|
286
|
-
// Capture stderr since showHelp() writes to stderr by default
|
|
287
|
-
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
288
|
-
const mockStderrWrite = (chunk) => {
|
|
289
|
-
if (typeof chunk === 'string' || Buffer.isBuffer(chunk)) {
|
|
290
|
-
helpOutput += chunk.toString();
|
|
291
|
-
}
|
|
292
|
-
return true;
|
|
293
|
-
};
|
|
294
|
-
process.stderr.write = mockStderrWrite;
|
|
295
|
-
try {
|
|
296
|
-
y.showHelp();
|
|
297
|
-
}
|
|
298
|
-
finally {
|
|
299
|
-
process.stderr.write = originalStderrWrite;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
// Verify help output contains expected content
|
|
303
|
-
expect(helpOutput).to.include(constants_1.NAME_BIN);
|
|
304
|
-
expect(helpOutput).to.include('Commands:');
|
|
305
|
-
expect(helpOutput).to.include('build');
|
|
306
|
-
expect(helpOutput).to.include('init');
|
|
307
|
-
expect(helpOutput).to.include('validate');
|
|
308
|
-
expect(helpOutput).to.include('Options:');
|
|
309
|
-
expect(helpOutput).to.include('--help');
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
});
|
|
313
|
-
//# sourceMappingURL=build.e2e.spec.js.map
|
|
@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C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.spec.d.ts","sourceRoot":"","sources":["../../../test/unit/util.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,79 +0,0 @@
|
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const util_1 = require("../../lib/util");
|
|
40
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
41
|
-
const chai = __importStar(require("chai"));
|
|
42
|
-
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
|
|
43
|
-
chai.use(chai_as_promised_1.default);
|
|
44
|
-
const { expect } = chai;
|
|
45
|
-
describe('argify', function () {
|
|
46
|
-
it('should create args from params', function () {
|
|
47
|
-
// deploy example
|
|
48
|
-
const version = '2.0';
|
|
49
|
-
const mikeOpts = {
|
|
50
|
-
'config-file': '/path/to/yml',
|
|
51
|
-
push: true,
|
|
52
|
-
remote: 'origin',
|
|
53
|
-
branch: 'gh-pages',
|
|
54
|
-
'deploy-prefix': '2.0',
|
|
55
|
-
message: 'docs: a thing',
|
|
56
|
-
port: 8100,
|
|
57
|
-
host: 'localhost',
|
|
58
|
-
};
|
|
59
|
-
const mikeArgs = [
|
|
60
|
-
...(0, util_1.argify)(lodash_1.default.omitBy(mikeOpts, (value, key) => lodash_1.default.includes(['port', 'host'], key) || (!lodash_1.default.isNumber(value) && !value))),
|
|
61
|
-
version,
|
|
62
|
-
];
|
|
63
|
-
expect(mikeArgs).to.eql([
|
|
64
|
-
'--config-file',
|
|
65
|
-
'/path/to/yml',
|
|
66
|
-
'--push',
|
|
67
|
-
'--remote',
|
|
68
|
-
'origin',
|
|
69
|
-
'--branch',
|
|
70
|
-
'gh-pages',
|
|
71
|
-
'--deploy-prefix',
|
|
72
|
-
'2.0',
|
|
73
|
-
'--message',
|
|
74
|
-
'docs: a thing',
|
|
75
|
-
'2.0',
|
|
76
|
-
]);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=util.spec.js.map
|