mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
refactor(core): remove useless build forceTerminate exit (#10410)
This commit is contained in:
parent
ae5328daac
commit
3a0b4bf7a2
3 changed files with 7 additions and 23 deletions
|
@ -48,11 +48,6 @@ export type BuildCLIOptions = Pick<
|
|||
export async function build(
|
||||
siteDirParam: string = '.',
|
||||
cliOptions: Partial<BuildCLIOptions> = {},
|
||||
// When running build, we force terminate the process to prevent async
|
||||
// operations from never returning. However, if run as part of docusaurus
|
||||
// deploy, we have to let deploy finish.
|
||||
// See https://github.com/facebook/docusaurus/pull/2496
|
||||
forceTerminate: boolean = true,
|
||||
): Promise<void> {
|
||||
process.env.BABEL_ENV = 'production';
|
||||
process.env.NODE_ENV = 'production';
|
||||
|
@ -98,18 +93,11 @@ export async function build(
|
|||
|
||||
await PerfLogger.async(`Build`, () =>
|
||||
mapAsyncSequential(locales, async (locale) => {
|
||||
const isLastLocale = locales.indexOf(locale) === locales.length - 1;
|
||||
await tryToBuildLocale({locale});
|
||||
if (isLastLocale) {
|
||||
logger.info`Use code=${'npm run serve'} command to test your build locally.`;
|
||||
}
|
||||
|
||||
// TODO do we really need this historical forceTerminate exit???
|
||||
if (forceTerminate && isLastLocale && !cliOptions.bundleAnalyzer) {
|
||||
process.exit(0);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
logger.info`Use code=${'npm run serve'} command to test your build locally.`;
|
||||
}
|
||||
|
||||
async function getLocalesToBuild({
|
||||
|
|
|
@ -256,7 +256,7 @@ You can also set the deploymentBranch property in docusaurus.config.js .`);
|
|||
if (!cliOptions.skipBuild) {
|
||||
// Build site, then push to deploymentBranch branch of specified repo.
|
||||
try {
|
||||
await build(siteDir, cliOptions, false);
|
||||
await build(siteDir, cliOptions);
|
||||
await runDeploy(outDir);
|
||||
} catch (err) {
|
||||
logger.error('Deployment of the build output failed.');
|
||||
|
|
|
@ -42,14 +42,10 @@ export async function serve(
|
|||
const outDir = path.resolve(siteDir, buildDir);
|
||||
|
||||
if (cliOptions.build) {
|
||||
await build(
|
||||
siteDir,
|
||||
{
|
||||
config: cliOptions.config,
|
||||
outDir,
|
||||
},
|
||||
false,
|
||||
);
|
||||
await build(siteDir, {
|
||||
config: cliOptions.config,
|
||||
outDir,
|
||||
});
|
||||
}
|
||||
|
||||
const {host, port} = await getHostPort(cliOptions);
|
||||
|
|
Loading…
Add table
Reference in a new issue