mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 18:27:56 +02:00
targetDir does not need to be part of the load context, it's just a CLI option
This commit is contained in:
parent
9de3abc821
commit
ac5e95a3f1
4 changed files with 3 additions and 10 deletions
1
packages/docusaurus-types/src/context.d.ts
vendored
1
packages/docusaurus-types/src/context.d.ts
vendored
|
@ -36,7 +36,6 @@ export type LoadContext = {
|
||||||
siteConfig: DocusaurusConfig;
|
siteConfig: DocusaurusConfig;
|
||||||
siteConfigPath: string;
|
siteConfigPath: string;
|
||||||
outDir: string;
|
outDir: string;
|
||||||
targetDir: string;
|
|
||||||
/**
|
/**
|
||||||
* Directory where all source translations for the current locale can be found
|
* Directory where all source translations for the current locale can be found
|
||||||
* in. Constructed with `i18n.path` + `i18n.currentLocale.path` (e.g.
|
* in. Constructed with `i18n.path` + `i18n.currentLocale.path` (e.g.
|
||||||
|
|
|
@ -27,11 +27,6 @@ export const DOCUSAURUS_VERSION =
|
||||||
*/
|
*/
|
||||||
export const DEFAULT_BUILD_DIR_NAME = 'build';
|
export const DEFAULT_BUILD_DIR_NAME = 'build';
|
||||||
|
|
||||||
/**
|
|
||||||
* Can be overridden with cli option `--target-dir`.
|
|
||||||
*/
|
|
||||||
export const DEFAULT_TARGET_DIR = '.';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be overridden with cli option `--config`. Code should generally use
|
* Can be overridden with cli option `--config`. Code should generally use
|
||||||
* `context.siteConfigPath` instead (which is always absolute).
|
* `context.siteConfigPath` instead (which is always absolute).
|
||||||
|
|
|
@ -10,7 +10,6 @@ export {
|
||||||
NODE_MINOR_VERSION,
|
NODE_MINOR_VERSION,
|
||||||
DOCUSAURUS_VERSION,
|
DOCUSAURUS_VERSION,
|
||||||
DEFAULT_BUILD_DIR_NAME,
|
DEFAULT_BUILD_DIR_NAME,
|
||||||
DEFAULT_TARGET_DIR,
|
|
||||||
DEFAULT_CONFIG_FILE_NAME,
|
DEFAULT_CONFIG_FILE_NAME,
|
||||||
BABEL_CONFIG_FILE_NAME,
|
BABEL_CONFIG_FILE_NAME,
|
||||||
GENERATED_FILES_DIR_NAME,
|
GENERATED_FILES_DIR_NAME,
|
||||||
|
|
|
@ -47,7 +47,7 @@ export async function deploy(
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const siteDir = await fs.realpath(siteDirParam);
|
const siteDir = await fs.realpath(siteDirParam);
|
||||||
|
|
||||||
const {outDir, siteConfig, siteConfigPath, targetDir} = await loadContext({
|
const {outDir, siteConfig, siteConfigPath} = await loadContext({
|
||||||
siteDir,
|
siteDir,
|
||||||
config: cliOptions.config,
|
config: cliOptions.config,
|
||||||
outDir: cliOptions.outDir,
|
outDir: cliOptions.outDir,
|
||||||
|
@ -186,7 +186,7 @@ You can also set the deploymentBranch property in docusaurus.config.js .`);
|
||||||
const currentCommit = shellExecLog('git rev-parse HEAD').stdout.trim();
|
const currentCommit = shellExecLog('git rev-parse HEAD').stdout.trim();
|
||||||
|
|
||||||
const runDeploy = async (outputDirectory: string) => {
|
const runDeploy = async (outputDirectory: string) => {
|
||||||
const targetDirectory = cliOptions.targetDir;
|
const targetDirectory = cliOptions.targetDir ?? '.';
|
||||||
const fromPath = outputDirectory;
|
const fromPath = outputDirectory;
|
||||||
const toPath = await fs.mkdtemp(
|
const toPath = await fs.mkdtemp(
|
||||||
path.join(os.tmpdir(), `${projectName}-${deploymentBranch}`),
|
path.join(os.tmpdir(), `${projectName}-${deploymentBranch}`),
|
||||||
|
@ -264,6 +264,6 @@ You can also set the deploymentBranch property in docusaurus.config.js .`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Push current build to deploymentBranch branch of specified repo.
|
// Push current build to deploymentBranch branch of specified repo.
|
||||||
await runDeploy(outDir, targetDir);
|
await runDeploy(outDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue