@alauda/doom 0.15.8 → 0.15.10

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.
@@ -0,0 +1 @@
1
+ export declare const parseBoolean: (value: string) => boolean;
@@ -0,0 +1 @@
1
+ export const parseBoolean = (value) => !!value && !['0', 'false'].includes(value);
package/lib/cli/index.js CHANGED
@@ -12,6 +12,7 @@ import { green } from 'yoctocolors';
12
12
  import { setNodeEnv } from '../utils/index.js';
13
13
  import { CWD, DEFAULT_CONFIGS, I18N_FILE, SITES_FILE } from './constants.js';
14
14
  import { exportCommand } from './export.js';
15
+ import { parseBoolean } from './helpers.js';
15
16
  import { loadConfig } from './load-config.js';
16
17
  import { newCommand } from './new.js';
17
18
  import { translateCommand } from './translate.js';
@@ -32,16 +33,16 @@ program
32
33
  .option('-p, --prefix <prefix>', 'Specify the prefix of the documentation base')
33
34
  .option('-f, --force [boolean]', `Force to
34
35
  1. fetch latest reference remotes or scaffolding templates, otherwise use local cache
35
- 2. translate ignore hash equality check and original text`, (value) => !!value && value !== 'false', false)
36
- .option('-i, --ignore [boolean]', 'Ignore internal routes', (value) => !!value && value !== 'false', false)
37
- .option('-d, --download [boolean]', 'Display download pdf link on nav bar', (value) => !!value && value !== 'false', false)
36
+ 2. translate ignore hash equality check and original text`, parseBoolean, false)
37
+ .option('-i, --ignore [boolean]', 'Ignore internal routes', parseBoolean, false)
38
+ .option('-d, --download [boolean]', 'Display download pdf link on nav bar', parseBoolean, false)
38
39
  .option('--no-open [boolean]', 'Do not open the browser after starting the server')
39
40
  .command('dev', { isDefault: true })
40
41
  .description('Start the development server')
41
42
  .argument('[root]', 'Root directory of the documentation')
42
43
  .option('-H, --host [host]', 'Dev server host name')
43
44
  .option('-P, --port [port]', 'Dev server port number')
44
- .option('--no-lazy [boolean', 'Do not enable `lazyCompilation`')
45
+ .option('-l, --lazy [boolean]', 'Whether to enable `lazyCompilation` which could improve the compilation performance', parseBoolean, false)
45
46
  .action(async function (root) {
46
47
  setNodeEnv('development');
47
48
  let devServer;
package/lib/cli/new.js CHANGED
@@ -104,7 +104,7 @@ export const newCommand = new Command('new')
104
104
  const source = path.resolve(base, render(layout.source, { parameters }));
105
105
  const target = path.resolve(render(layout.target, { parameters }));
106
106
  const when = layout.when && render(layout.when, { parameters });
107
- if (['', 'null', 'undefined', 'false'].includes(when)) {
107
+ if (['', '0', 'false', 'null', 'undefined'].includes(when)) {
108
108
  continue;
109
109
  }
110
110
  switch (layout.type) {
@@ -13,6 +13,7 @@ import { cyan } from 'yoctocolors';
13
13
  import { mdProcessor, mdxProcessor, normalizeImgSrc, } from '../plugins/index.js';
14
14
  import { isDoc } from '../shared/index.js';
15
15
  import { pathExists } from '../utils/index.js';
16
+ import { parseBoolean } from './helpers.js';
16
17
  import { loadConfig } from './load-config.js';
17
18
  const LANGUAGE_CODES = {
18
19
  zh: '中文',
@@ -95,7 +96,7 @@ export const translateCommand = new Command('translate')
95
96
  .option('-s, --source <language>', 'Document source language', 'zh')
96
97
  .option('-t, --target <language>', 'Document target language', 'en')
97
98
  .requiredOption('-g, --glob <path...>', 'Glob patterns for source dirs/files')
98
- .option('-C, --copy [boolean]', 'Wether to copy relative assets to the target directory instead of following links', (value) => !!value && value !== 'false', false)
99
+ .option('-C, --copy [boolean]', 'Wether to copy relative assets to the target directory instead of following links', parseBoolean, false)
99
100
  .action(async function (root) {
100
101
  const { source, target, glob: globs, copy, force, ...globalOptions } = this.optsWithGlobals();
101
102
  if (!Object.hasOwn(LANGUAGE_CODES, source) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.15.8",
3
+ "version": "0.15.10",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {