@docusaurus/core 0.0.0-4917 → 0.0.0-4923

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.
@@ -54,14 +54,8 @@ cli
54
54
  '--no-minify',
55
55
  'build website without minimizing JS bundles (default: false)',
56
56
  )
57
- .action(async (siteDir, {bundleAnalyzer, config, outDir, locale, minify}) => {
58
- build(await resolveDir(siteDir), {
59
- bundleAnalyzer,
60
- outDir,
61
- config,
62
- locale,
63
- minify,
64
- });
57
+ .action(async (siteDir, options) => {
58
+ build(await resolveDir(siteDir), options);
65
59
  });
66
60
 
67
61
  cli
@@ -86,9 +80,9 @@ cli
86
80
  'copy TypeScript theme files when possible (default: false)',
87
81
  )
88
82
  .option('--danger', 'enable swizzle for unsafe component of themes')
89
- .action(async (themeName, componentName, siteDir, options) => {
90
- swizzle(await resolveDir(siteDir), themeName, componentName, options);
91
- });
83
+ .action(async (themeName, componentName, siteDir, options) =>
84
+ swizzle(await resolveDir(siteDir), themeName, componentName, options),
85
+ );
92
86
 
93
87
  cli
94
88
  .command('deploy [siteDir]')
@@ -109,13 +103,9 @@ cli
109
103
  '--skip-build',
110
104
  'skip building website before deploy it (default: false)',
111
105
  )
112
- .action(async (siteDir, {outDir, skipBuild, config}) => {
113
- deploy(await resolveDir(siteDir), {
114
- outDir,
115
- config,
116
- skipBuild,
117
- });
118
- });
106
+ .action(async (siteDir, options) =>
107
+ deploy(await resolveDir(siteDir), options),
108
+ );
119
109
 
120
110
  cli
121
111
  .command('start [siteDir]')
@@ -136,18 +126,8 @@ cli
136
126
  '--poll [interval]',
137
127
  'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds',
138
128
  )
139
- .action(
140
- async (siteDir, {port, host, locale, config, hotOnly, open, poll}) => {
141
- start(await resolveDir(siteDir), {
142
- port,
143
- host,
144
- locale,
145
- config,
146
- hotOnly,
147
- open,
148
- poll,
149
- });
150
- },
129
+ .action(async (siteDir, options) =>
130
+ start(await resolveDir(siteDir), options),
151
131
  );
152
132
 
153
133
  cli
@@ -164,44 +144,25 @@ cli
164
144
  .option('-p, --port <port>', 'use specified port (default: 3000)')
165
145
  .option('--build', 'build website before serving (default: false)')
166
146
  .option('-h, --host <host>', 'use specified host (default: localhost)')
167
- .action(
168
- async (
169
- siteDir,
170
- {
171
- dir = 'build',
172
- port = 3000,
173
- host = 'localhost',
174
- build: buildSite = false,
175
- config,
176
- },
177
- ) => {
178
- serve(await resolveDir(siteDir), {
179
- dir,
180
- port,
181
- build: buildSite,
182
- config,
183
- host,
184
- });
185
- },
147
+ .action(async (siteDir, options) =>
148
+ serve(await resolveDir(siteDir), options),
186
149
  );
187
150
 
188
151
  cli
189
152
  .command('clear [siteDir]')
190
153
  .description('Remove build artifacts.')
191
- .action(async (siteDir) => {
192
- clear(await resolveDir(siteDir));
193
- });
154
+ .action(async (siteDir) => clear(await resolveDir(siteDir)));
194
155
 
195
156
  cli
196
157
  .command('write-translations [siteDir]')
197
158
  .description('Extract required translations of your site.')
198
159
  .option(
199
160
  '-l, --locale <locale>',
200
- 'the locale folder to write the translations\n"--locale fr" will write translations in ./i18n/fr folder)',
161
+ 'the locale folder to write the translations.\n"--locale fr" will write translations in the ./i18n/fr folder.',
201
162
  )
202
163
  .option(
203
164
  '--override',
204
- 'by default, we only append missing translation messages to existing translation files. This option allows to override existing translation messages. Make sure to commit or backup your existing translations, as they may be overridden',
165
+ 'By default, we only append missing translation messages to existing translation files. This option allows to override existing translation messages. Make sure to commit or backup your existing translations, as they may be overridden. (default: false)',
205
166
  )
206
167
  .option(
207
168
  '--config <config>',
@@ -209,20 +170,10 @@ cli
209
170
  )
210
171
  .option(
211
172
  '--messagePrefix <messagePrefix>',
212
- 'allows to init new written messages with a given prefix. This might help you to highlight untranslated message to make them stand out in the UI',
173
+ 'Allows to init new written messages with a given prefix. This might help you to highlight untranslated message by making them stand out in the UI (default: "")',
213
174
  )
214
- .action(
215
- async (
216
- siteDir,
217
- {locale = undefined, override = false, messagePrefix = '', config},
218
- ) => {
219
- writeTranslations(await resolveDir(siteDir), {
220
- locale,
221
- override,
222
- config,
223
- messagePrefix,
224
- });
225
- },
175
+ .action(async (siteDir, options) =>
176
+ writeTranslations(await resolveDir(siteDir), options),
226
177
  );
227
178
 
228
179
  cli
@@ -5,4 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { BuildCLIOptions } from '@docusaurus/types';
8
- export declare function build(siteDir: string, cliOptions?: Partial<BuildCLIOptions>, forceTerminate?: boolean): Promise<string>;
8
+ export declare function build(siteDir: string, cliOptions: Partial<BuildCLIOptions>, forceTerminate?: boolean): Promise<string>;
@@ -23,7 +23,7 @@ const utils_1 = require("../webpack/utils");
23
23
  const CleanWebpackPlugin_1 = tslib_1.__importDefault(require("../webpack/plugins/CleanWebpackPlugin"));
24
24
  const i18n_1 = require("../server/i18n");
25
25
  const utils_2 = require("@docusaurus/utils");
26
- async function build(siteDir, cliOptions = {},
26
+ async function build(siteDir, cliOptions,
27
27
  // When running build, we force terminate the process to prevent async
28
28
  // operations from never returning. However, if run as part of docusaurus
29
29
  // deploy, we have to let deploy finish.
@@ -4,4 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- export declare function clear(siteDir: string): Promise<unknown>;
7
+ export declare function clear(siteDir: string): Promise<void>;
@@ -39,6 +39,6 @@ async function clear(siteDir) {
39
39
  path: path_1.default.join(siteDir, p, '.cache'),
40
40
  description: 'Webpack persistent cache folder',
41
41
  }));
42
- return Promise.all([generatedFolder, buildFolder, ...cacheFolders].map(removePath));
42
+ await Promise.all([generatedFolder, buildFolder, ...cacheFolders].map(removePath));
43
43
  }
44
44
  exports.clear = clear;
@@ -5,4 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { BuildCLIOptions } from '@docusaurus/types';
8
- export declare function deploy(siteDir: string, cliOptions?: Partial<BuildCLIOptions>): Promise<void>;
8
+ export declare function deploy(siteDir: string, cliOptions: Partial<BuildCLIOptions>): Promise<void>;
@@ -34,7 +34,7 @@ function shellExecLog(cmd) {
34
34
  throw err;
35
35
  }
36
36
  }
37
- async function deploy(siteDir, cliOptions = {}) {
37
+ async function deploy(siteDir, cliOptions) {
38
38
  const { outDir, siteConfig, siteConfigPath } = await (0, server_1.loadContext)({
39
39
  siteDir,
40
40
  customConfigFilePath: cliOptions.config,
@@ -5,4 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { ServeCLIOptions } from '@docusaurus/types';
8
- export declare function serve(siteDir: string, cliOptions: ServeCLIOptions): Promise<void>;
8
+ export declare function serve(siteDir: string, cliOptions: Partial<ServeCLIOptions>): Promise<void>;
@@ -15,8 +15,10 @@ const path_1 = tslib_1.__importDefault(require("path"));
15
15
  const config_1 = require("../server/config");
16
16
  const build_1 = require("./build");
17
17
  const commandUtils_1 = require("./commandUtils");
18
+ const utils_1 = require("@docusaurus/utils");
18
19
  async function serve(siteDir, cliOptions) {
19
- let dir = path_1.default.resolve(siteDir, cliOptions.dir);
20
+ const buildDir = cliOptions.dir ?? utils_1.DEFAULT_BUILD_DIR_NAME;
21
+ let dir = path_1.default.resolve(siteDir, buildDir);
20
22
  if (cliOptions.build) {
21
23
  dir = await (0, build_1.build)(siteDir, {
22
24
  config: cliOptions.config,
@@ -52,7 +54,7 @@ async function serve(siteDir, cliOptions) {
52
54
  directoryListing: false,
53
55
  });
54
56
  });
55
- logger_1.default.success `Serving path=${cliOptions.dir} directory at url=${servingUrl + baseUrl}.`;
57
+ logger_1.default.success `Serving path=${buildDir} directory at url=${servingUrl + baseUrl}.`;
56
58
  server.listen(port);
57
59
  }
58
60
  exports.serve = serve;
@@ -95,6 +95,10 @@ async function start(siteDir, cliOptions) {
95
95
  });
96
96
  ['add', 'change', 'unlink', 'addDir', 'unlinkDir'].forEach((event) => fsWatcher.on(event, reload));
97
97
  let config = (0, webpack_merge_1.default)(await (0, client_1.default)(props), {
98
+ watchOptions: {
99
+ ignored: /node_modules\/(?!@docusaurus)/,
100
+ poll: cliOptions.poll,
101
+ },
98
102
  infrastructureLogging: {
99
103
  // Reduce log verbosity, see https://github.com/facebook/docusaurus/pull/5420#issuecomment-906613105
100
104
  level: 'warn',
@@ -5,4 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { type WriteHeadingIDOptions } from '@docusaurus/utils';
8
- export declare function writeHeadingIds(siteDir: string, files?: string[], options?: WriteHeadingIDOptions): Promise<void>;
8
+ export declare function writeHeadingIds(siteDir: string, files: string[], options: WriteHeadingIDOptions): Promise<void>;
@@ -6,6 +6,6 @@
6
6
  */
7
7
  import type { ConfigOptions } from '@docusaurus/types';
8
8
  import { type WriteTranslationsOptions } from '../server/translations/translations';
9
- export declare function writeTranslations(siteDir: string, options: WriteTranslationsOptions & ConfigOptions & {
9
+ export declare function writeTranslations(siteDir: string, options: Partial<WriteTranslationsOptions & ConfigOptions & {
10
10
  locale?: string;
11
- }): Promise<void>;
11
+ }>): Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "0.0.0-4917",
4
+ "version": "0.0.0-4923",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.17.9",
42
42
  "@babel/runtime-corejs3": "^7.17.9",
43
43
  "@babel/traverse": "^7.17.9",
44
- "@docusaurus/cssnano-preset": "0.0.0-4917",
45
- "@docusaurus/logger": "0.0.0-4917",
46
- "@docusaurus/mdx-loader": "0.0.0-4917",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4923",
45
+ "@docusaurus/logger": "0.0.0-4923",
46
+ "@docusaurus/mdx-loader": "0.0.0-4923",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4917",
49
- "@docusaurus/utils-common": "0.0.0-4917",
50
- "@docusaurus/utils-validation": "0.0.0-4917",
48
+ "@docusaurus/utils": "0.0.0-4923",
49
+ "@docusaurus/utils-common": "0.0.0-4923",
50
+ "@docusaurus/utils-validation": "0.0.0-4923",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.4",
52
52
  "@svgr/webpack": "^6.2.1",
53
53
  "autoprefixer": "^10.4.4",
@@ -105,8 +105,8 @@
105
105
  "webpackbar": "^5.0.2"
106
106
  },
107
107
  "devDependencies": {
108
- "@docusaurus/module-type-aliases": "0.0.0-4917",
109
- "@docusaurus/types": "0.0.0-4917",
108
+ "@docusaurus/module-type-aliases": "0.0.0-4923",
109
+ "@docusaurus/types": "0.0.0-4923",
110
110
  "@types/detect-port": "^1.3.2",
111
111
  "@types/nprogress": "^0.2.0",
112
112
  "@types/react-dom": "^18.0.2",
@@ -127,5 +127,5 @@
127
127
  "engines": {
128
128
  "node": ">=14"
129
129
  },
130
- "gitHead": "8a94c90547096df5a45a0de6c3f162475f2006b4"
130
+ "gitHead": "0d7f61e267384e2c272cc3c0df059bdfe16609fd"
131
131
  }