@appium/docutils 0.2.2 → 0.3.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.
Files changed (97) hide show
  1. package/LICENSE +1 -1
  2. package/build/lib/builder/deploy.d.ts +3 -3
  3. package/build/lib/builder/deploy.d.ts.map +1 -1
  4. package/build/lib/builder/deploy.js +6 -5
  5. package/build/lib/builder/deploy.js.map +1 -1
  6. package/build/lib/builder/index.d.ts +4 -0
  7. package/build/lib/builder/index.d.ts.map +1 -1
  8. package/build/lib/builder/index.js +4 -0
  9. package/build/lib/builder/index.js.map +1 -1
  10. package/build/lib/builder/nav.d.ts +1 -1
  11. package/build/lib/builder/nav.d.ts.map +1 -1
  12. package/build/lib/builder/nav.js +3 -3
  13. package/build/lib/builder/nav.js.map +1 -1
  14. package/build/lib/builder/reference.d.ts.map +1 -1
  15. package/build/lib/builder/reference.js +1 -19
  16. package/build/lib/builder/reference.js.map +1 -1
  17. package/build/lib/builder/site.d.ts +3 -3
  18. package/build/lib/builder/site.d.ts.map +1 -1
  19. package/build/lib/builder/site.js +4 -5
  20. package/build/lib/builder/site.js.map +1 -1
  21. package/build/lib/cli/check.d.ts +19 -0
  22. package/build/lib/cli/check.d.ts.map +1 -0
  23. package/build/lib/cli/check.js +58 -0
  24. package/build/lib/cli/check.js.map +1 -0
  25. package/build/lib/cli/command/build.d.ts +189 -174
  26. package/build/lib/cli/command/build.d.ts.map +1 -1
  27. package/build/lib/cli/command/build.js +56 -38
  28. package/build/lib/cli/command/build.js.map +1 -1
  29. package/build/lib/cli/command/index.d.ts +4 -0
  30. package/build/lib/cli/command/index.d.ts.map +1 -1
  31. package/build/lib/cli/command/index.js +4 -0
  32. package/build/lib/cli/command/index.js.map +1 -1
  33. package/build/lib/cli/command/init.d.ts +156 -139
  34. package/build/lib/cli/command/init.d.ts.map +1 -1
  35. package/build/lib/cli/command/init.js +52 -27
  36. package/build/lib/cli/command/init.js.map +1 -1
  37. package/build/lib/cli/command/validate.d.ts +71 -63
  38. package/build/lib/cli/command/validate.d.ts.map +1 -1
  39. package/build/lib/cli/command/validate.js +31 -20
  40. package/build/lib/cli/command/validate.js.map +1 -1
  41. package/build/lib/cli/index.d.ts.map +1 -1
  42. package/build/lib/cli/index.js +29 -12
  43. package/build/lib/cli/index.js.map +1 -1
  44. package/build/lib/constants.d.ts +4 -0
  45. package/build/lib/constants.d.ts.map +1 -1
  46. package/build/lib/constants.js +5 -1
  47. package/build/lib/constants.js.map +1 -1
  48. package/build/lib/error.d.ts +5 -0
  49. package/build/lib/error.d.ts.map +1 -1
  50. package/build/lib/error.js +5 -0
  51. package/build/lib/error.js.map +1 -1
  52. package/build/lib/fs.d.ts +1 -1
  53. package/build/lib/fs.d.ts.map +1 -1
  54. package/build/lib/fs.js +2 -2
  55. package/build/lib/fs.js.map +1 -1
  56. package/build/lib/index.d.ts +4 -0
  57. package/build/lib/index.d.ts.map +1 -1
  58. package/build/lib/index.js +4 -0
  59. package/build/lib/index.js.map +1 -1
  60. package/build/lib/init.d.ts +13 -5
  61. package/build/lib/init.d.ts.map +1 -1
  62. package/build/lib/init.js +12 -7
  63. package/build/lib/init.js.map +1 -1
  64. package/build/lib/logger.js.map +1 -1
  65. package/build/lib/mike.d.ts.map +1 -1
  66. package/build/lib/mike.js +4 -0
  67. package/build/lib/mike.js.map +1 -1
  68. package/build/lib/util.d.ts +15 -3
  69. package/build/lib/util.d.ts.map +1 -1
  70. package/build/lib/util.js +26 -1
  71. package/build/lib/util.js.map +1 -1
  72. package/build/lib/validate.d.ts +4 -1
  73. package/build/lib/validate.d.ts.map +1 -1
  74. package/build/lib/validate.js +9 -7
  75. package/build/lib/validate.js.map +1 -1
  76. package/lib/builder/deploy.ts +11 -8
  77. package/lib/builder/index.ts +5 -0
  78. package/lib/builder/nav.ts +2 -3
  79. package/lib/builder/reference.ts +2 -22
  80. package/lib/builder/site.ts +11 -10
  81. package/lib/cli/check.ts +87 -0
  82. package/lib/cli/command/build.ts +61 -43
  83. package/lib/cli/command/index.ts +5 -0
  84. package/lib/cli/command/init.ts +54 -29
  85. package/lib/cli/command/validate.ts +33 -25
  86. package/lib/cli/index.ts +23 -4
  87. package/lib/constants.ts +5 -0
  88. package/lib/error.ts +6 -0
  89. package/lib/fs.ts +6 -3
  90. package/lib/index.ts +5 -0
  91. package/lib/init.ts +23 -6
  92. package/lib/logger.ts +1 -1
  93. package/lib/mike.js +5 -0
  94. package/lib/util.ts +27 -4
  95. package/lib/validate.ts +10 -9
  96. package/package.json +8 -10
  97. package/requirements.txt +1 -1
@@ -1,25 +1,33 @@
1
- import pluralize from 'pluralize';
2
- import {CommandModule, InferredOptionTypes, Options} from 'yargs';
1
+ /**
2
+ * Yargs command module for the `validate` command.
3
+ * @module
4
+ */
5
+
6
+ import {util} from '@appium/support';
7
+ import type {CommandModule, InferredOptionTypes, Options} from 'yargs';
3
8
  import {DocutilsError} from '../../error';
4
9
  import {DocutilsValidator, ValidationKind} from '../../validate';
5
10
  import logger from '../../logger';
11
+ import {checkMissingPaths} from '../check';
6
12
 
7
13
  const log = logger.withTag('validate');
8
14
 
9
- const NAME_GROUP_VALIDATE = 'Validation Behavior:';
10
- const NAME_GROUP_VALIDATE_PATHS = 'Paths:';
15
+ enum ValidateCommandGroup {
16
+ Behavior = 'Validation Behavior:',
17
+ Paths = 'Custom Paths:',
18
+ }
11
19
 
12
- const opts = Object.freeze({
20
+ const opts = {
13
21
  mkdocs: {
14
22
  default: true,
15
23
  description: 'Validate MkDocs environment',
16
- group: NAME_GROUP_VALIDATE,
24
+ group: ValidateCommandGroup.Behavior,
17
25
  type: 'boolean',
18
26
  },
19
27
  'mkdocs-yml': {
20
28
  defaultDescription: './mkdocs.yml',
21
29
  description: 'Path to mkdocs.yml',
22
- group: NAME_GROUP_VALIDATE_PATHS,
30
+ group: ValidateCommandGroup.Paths,
23
31
  nargs: 1,
24
32
  normalize: true,
25
33
  requiresArg: true,
@@ -28,7 +36,7 @@ const opts = Object.freeze({
28
36
  'npm-path': {
29
37
  defaultDescription: '(derived from shell)',
30
38
  description: 'Path to npm executable',
31
- group: NAME_GROUP_VALIDATE_PATHS,
39
+ group: ValidateCommandGroup.Paths,
32
40
  nargs: 1,
33
41
  normalize: true,
34
42
  requiresArg: true,
@@ -37,13 +45,13 @@ const opts = Object.freeze({
37
45
  python: {
38
46
  default: true,
39
47
  description: 'Validate Python 3 environment',
40
- group: NAME_GROUP_VALIDATE,
48
+ group: ValidateCommandGroup.Behavior,
41
49
  type: 'boolean',
42
50
  },
43
51
  'python-path': {
44
52
  defaultDescription: '(derived from shell)',
45
53
  description: 'Path to python 3 executable',
46
- group: NAME_GROUP_VALIDATE_PATHS,
54
+ group: ValidateCommandGroup.Paths,
47
55
  nargs: 1,
48
56
  normalize: true,
49
57
  requiresArg: true,
@@ -52,7 +60,7 @@ const opts = Object.freeze({
52
60
  'tsconfig-json': {
53
61
  defaultDescription: './tsconfig.json',
54
62
  describe: 'Path to tsconfig.json',
55
- group: NAME_GROUP_VALIDATE_PATHS,
63
+ group: ValidateCommandGroup.Paths,
56
64
  nargs: 1,
57
65
  normalize: true,
58
66
  requiresArg: true,
@@ -61,13 +69,13 @@ const opts = Object.freeze({
61
69
  typedoc: {
62
70
  default: true,
63
71
  description: 'Validate TypoDoc environment',
64
- group: NAME_GROUP_VALIDATE,
72
+ group: ValidateCommandGroup.Behavior,
65
73
  type: 'boolean',
66
74
  },
67
75
  'typedoc-json': {
68
76
  defaultDescription: './typedoc.json',
69
77
  describe: 'Path to typedoc.json',
70
- group: NAME_GROUP_VALIDATE_PATHS,
78
+ group: ValidateCommandGroup.Paths,
71
79
  nargs: 1,
72
80
  normalize: true,
73
81
  requiresArg: true,
@@ -76,25 +84,25 @@ const opts = Object.freeze({
76
84
  typescript: {
77
85
  default: true,
78
86
  description: 'Validate TypeScript environment',
79
- group: NAME_GROUP_VALIDATE,
87
+ group: ValidateCommandGroup.Behavior,
80
88
  type: 'boolean',
81
89
  },
82
- }) satisfies Record<string, Options>;
90
+ } as const satisfies Record<string, Options>;
83
91
 
84
92
  type ValidateOptions = InferredOptionTypes<typeof opts>;
85
93
 
86
94
  export default {
87
95
  command: 'validate',
88
96
  describe: 'Validate Environment',
89
- builder: opts,
97
+ builder(yargs) {
98
+ return yargs.options(opts).check(async (argv) => {
99
+ if (!argv.python && !argv.typedoc && !argv.typescript && !argv.mkdocs) {
100
+ return 'No validation targets specified; one or more of --python, --typescript, --typedoc or --mkdocs must be provided';
101
+ }
102
+ return checkMissingPaths(opts, ValidateCommandGroup.Paths, argv);
103
+ });
104
+ },
90
105
  async handler(args) {
91
- if (!args.python && !args.typedoc && !args.typescript && !args.mkdocs) {
92
- // specifically not a DocutilsError
93
- throw new Error(
94
- 'No validation targets specified; one or more of --python, --typescript, --typedoc or --mkdocs must be provided'
95
- );
96
- }
97
-
98
106
  let errorCount = 0;
99
107
  const validator = new DocutilsValidator(args)
100
108
  .once(DocutilsValidator.BEGIN, (kinds: ValidationKind[]) => {
@@ -114,8 +122,8 @@ export default {
114
122
 
115
123
  if (errorCount) {
116
124
  throw new DocutilsError(
117
- `Validation failed with ${errorCount} ${pluralize('error', errorCount)}`
125
+ `Validation failed with ${errorCount} ${util.pluralize('error', errorCount)}`
118
126
  );
119
127
  }
120
128
  },
121
- } as CommandModule<{}, ValidateOptions>;
129
+ } as CommandModule<object, ValidateOptions>;
package/lib/cli/index.ts CHANGED
@@ -1,4 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ /* eslint-disable no-console */
3
+
4
+ /**
5
+ * Main CLI entry point for `@appium/docutils`
6
+ * @module
7
+ */
8
+
2
9
  import logger from '../logger';
3
10
 
4
11
  import _ from 'lodash';
@@ -8,6 +15,10 @@ import {DEFAULT_LOG_LEVEL, LogLevelMap, NAME_BIN} from '../constants';
8
15
  import {DocutilsError} from '../error';
9
16
  import {build, init, validate} from './command';
10
17
  import {findConfig} from './config';
18
+ import {fs} from '@appium/support';
19
+ import {sync as readPkg} from 'read-pkg';
20
+
21
+ const pkg = readPkg({cwd: fs.findRoot(__dirname)});
11
22
 
12
23
  const log = logger.withTag('cli');
13
24
  export async function main(argv = hideBin(process.argv)) {
@@ -45,7 +56,7 @@ export async function main(argv = hideBin(process.argv)) {
45
56
  describe: 'Disable config file discovery',
46
57
  },
47
58
  })
48
- .middleware(
59
+ .middleware([
49
60
  /**
50
61
  * Configures logging; `--verbose` implies `--log-level=debug`
51
62
  */
@@ -55,8 +66,15 @@ export async function main(argv = hideBin(process.argv)) {
55
66
  log.debug('Debug logging enabled via --verbose');
56
67
  }
57
68
  log.level = LogLevelMap[argv.logLevel];
58
- }
59
- )
69
+ },
70
+ /**
71
+ * Writes a startup message, if logging is enabled
72
+ */
73
+ async () => {
74
+ log.info(`${pkg.name} @ v${pkg.version} (Node.js ${process.version})`);
75
+ },
76
+ ])
77
+ .epilog(`Please report bugs at ${pkg.bugs?.url}`)
60
78
  .fail(
61
79
  /**
62
80
  * Custom failure handler so we can log nicely.
@@ -67,6 +85,7 @@ export async function main(argv = hideBin(process.argv)) {
67
85
  log.error(error.message);
68
86
  } else {
69
87
  y.showHelp();
88
+ console.log();
70
89
  log.error(msg ?? error.message);
71
90
  }
72
91
  y.exit(1, error);
@@ -81,7 +100,7 @@ export async function main(argv = hideBin(process.argv)) {
81
100
  }
82
101
 
83
102
  if (require.main === module) {
84
- // eslint-disable-next-line promise/prefer-await-to-then
103
+ // eslint-disable-next-line promise/prefer-await-to-then, promise/prefer-await-to-callbacks
85
104
  main().catch((err) => {
86
105
  log.error('Caught otherwise-unhandled rejection (this is probably a bug):', err);
87
106
  });
package/lib/constants.ts CHANGED
@@ -86,6 +86,11 @@ export const NAME_ERR_ENOENT = 'ENOENT';
86
86
  */
87
87
  export const NAME_ERR_EEXIST = 'EEXIST';
88
88
 
89
+ /**
90
+ * Name of the default theme
91
+ */
92
+ export const NAME_THEME = 'material';
93
+
89
94
  /**
90
95
  * Default log level
91
96
  */
package/lib/error.ts CHANGED
@@ -1 +1,7 @@
1
+ /**
2
+ * A custom error class. This exists so we can use `instanceof` to differentiate between "expected"
3
+ * exceptions and unexpected ones.
4
+ * @module
5
+ */
6
+
1
7
  export class DocutilsError extends Error {}
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(cwd: string): Promise<{pkgPath: string; pkg: PackageJson}>;
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 = <MkDocsYml>await readYaml(filepath);
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 = <MkDocsYml>await readYaml(inheritPath);
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
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Main entry point
3
+ * @module
4
+ */
5
+
1
6
  export * from './mike';
2
7
  export * from './builder';
3
8
  export * from './validate';
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
- let [owner, repo] = pathname.split('/');
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 interface InitTypeDocOptions extends ScaffoldTaskOptions {}
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/logger.ts CHANGED
@@ -134,7 +134,7 @@ class DocutilsReporter extends FancyReporter {
134
134
  *
135
135
  * "Global" inasmuch as any logger created from the root logger will use this level.
136
136
  */
137
- let globalLevel = LogLevelMap[DEFAULT_LOG_LEVEL];
137
+ let globalLevel: LogLevel = LogLevelMap[DEFAULT_LOG_LEVEL];
138
138
 
139
139
  /**
140
140
  * The logger from which all loggers are created. This one uses a unique tag and our custom reporter.
package/lib/mike.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * API around `mike`, a tool for deploying multiple versions of MkDocs-built sites to GitHub Pages
3
+ * @module
4
+ */
5
+
1
6
  import {exec} from 'teen_process';
2
7
  // eslint-disable-next-line import/no-unresolved
3
8
  import log from './logger';
package/lib/util.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import _ from 'lodash';
7
+ import {SpawnOptions, spawn} from 'node:child_process';
7
8
  import path from 'node:path';
8
9
  import type {SubProcess} from 'teen_process';
9
10
 
@@ -32,6 +33,9 @@ export function stopwatch(id: string) {
32
33
  }
33
34
  stopwatch.cache = new Map<string, number>();
34
35
 
36
+ /**
37
+ * Converts a tuple to an object; use for extracting parameter types from a function signature
38
+ */
35
39
  export type TupleToObject<
36
40
  T extends readonly any[],
37
41
  M extends Record<Exclude<keyof T, keyof any[]>, PropertyKey>
@@ -69,8 +73,27 @@ export const argify: (obj: Record<string, string | number | boolean | undefined>
69
73
  );
70
74
 
71
75
  /**
72
- * Conversion of the parameters of {@linkcode Subprocess.start} to an object.
76
+ * Spawns a long-running "background" child process. This is expected to only return control to the
77
+ * parent process in the case of a nonzero exit code from the child process.
78
+ * @param command Command to run
79
+ * @param args Args to pass to command
80
+ * @param opts Spawn options. `{stdio: 'inherit'}` will always be true
81
+ * @privateRemarks `teen_process` is good for running a one-shot command, but not so great for
82
+ * background tasks; we use node's `child_process` directly here to pass `stdio` through, since
83
+ * `teen_process` basically does not respect `{stdio: 'inherit'}`.
73
84
  */
74
- export type TeenProcessSubprocessStartOpts = Partial<
75
- TupleToObject<Parameters<SubProcess['start']>, ['startDetector', 'detach', 'timeoutMs']>
76
- >;
85
+ export async function spawnBackgroundProcess(command: string, args: string[], opts: SpawnOptions) {
86
+ return new Promise<void>((resolve, reject) => {
87
+ spawn(command, args, {...opts, stdio: 'inherit'})
88
+ .on('error', reject)
89
+ .on('close', (code) => {
90
+ // can be null or number
91
+ if (code) {
92
+ return reject(new Error(`${command} exited with code ${code}`));
93
+ }
94
+ resolve();
95
+ });
96
+ });
97
+ }
98
+
99
+ export type SpawnBackgroundProcessOpts = Omit<SpawnOptions, 'stdio'>;
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
- let requiredPackages: PipPackage[] = [];
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
- let match = rawTypeDocVersion.match(TYPEDOC_VERSION_REGEX);
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
- let match = rawTypeScriptVersion.match(TYPESCRIPT_VERSION_REGEX);
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.2.2",
3
+ "version": "0.3.1",
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.6",
52
+ "@appium/support": "^3.1.8",
53
53
  "@appium/tsconfig": "^0.2.4",
54
- "@appium/typedoc-plugin-appium": "^0.5.0",
54
+ "@appium/typedoc-plugin-appium": "^0.5.2",
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.6",
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.0",
73
- "typedoc": "0.23.25",
70
+ "type-fest": "3.7.1",
71
+ "typedoc": "0.23.28",
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": "7b4935632222123a4fa7422461f6312f1f0dfbe4"
86
+ "gitHead": "d514ebdd7ebd27bb236509d0a3d580f0f18a34e5"
89
87
  }
package/requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
1
  mkdocs==1.4.2
2
- mkdocs-material==9.0.14
2
+ mkdocs-material==9.1.4
3
3
  mkdocs-material-extensions==1.1.1
4
4
  mike==1.1.2