mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
Add docker related file to basic example
This commit is contained in:
parent
421d9b03de
commit
6dcd24ec8d
4 changed files with 60 additions and 13 deletions
|
@ -155,20 +155,34 @@ if (feature === 'translations') {
|
|||
exampleSiteCreated = true;
|
||||
blogCreated = true;
|
||||
}
|
||||
// copy .gitignore file
|
||||
let gitignoreName = '.gitignore';
|
||||
if (fs.existsSync(`${CWD}/../.gitignore`)) {
|
||||
gitignoreName = '.gitignore-example-from-docusaurus';
|
||||
console.log(
|
||||
`${chalk.yellow('.gitignore already exists')} in ${chalk.yellow(
|
||||
CWD
|
||||
)}. Creating an example gitignore file for you to copy from if desired.\n`
|
||||
|
||||
const copyFileOutWebsiteFolder = (fileNameFrom, isHide) => {
|
||||
let fileNameTo = isHide ? `.${fileNameFrom}` : fileNameFrom;
|
||||
if (fs.existsSync(`${CWD}/../${fileNameTo}`)) {
|
||||
fileNameTo = `${fileNameTo}-example-from-docusaurus`;
|
||||
console.log(
|
||||
`${chalk.yellow(fileNameTo + ' already exists')} in ${chalk.yellow(
|
||||
CWD
|
||||
)}. Creating an example ${fileNameTo} file for you to copy from if desired.\n`
|
||||
);
|
||||
}
|
||||
fs.copySync(
|
||||
path.join(folder, fileNameFrom),
|
||||
path.join(CWD, `/../${fileNameTo}`)
|
||||
);
|
||||
}
|
||||
fs.copySync(
|
||||
path.join(folder, 'gitignore'),
|
||||
path.join(CWD, `/../${gitignoreName}`)
|
||||
);
|
||||
};
|
||||
|
||||
// copy .gitignore file
|
||||
copyFileOutWebsiteFolder('gitignore', true);
|
||||
|
||||
// copy Dockerfile file
|
||||
copyFileOutWebsiteFolder('Dockerfile', false);
|
||||
|
||||
// copy docker-compose.yml file
|
||||
copyFileOutWebsiteFolder('docker-compose.yml', false);
|
||||
|
||||
// copy .dockerignore file
|
||||
copyFileOutWebsiteFolder('dockerignore', true);
|
||||
|
||||
// copy other files
|
||||
const files = glob.sync(`${folder}/**/*`);
|
||||
|
@ -179,6 +193,9 @@ if (feature === 'translations') {
|
|||
const containingFolder = path.basename(path.dirname(file));
|
||||
if (
|
||||
path.basename(file) === 'gitignore' ||
|
||||
path.basename(file) === 'Dockerfile' ||
|
||||
path.basename(file) === 'docker-compose.yml' ||
|
||||
path.basename(file) === 'dockerignore' ||
|
||||
containingFolder === 'blog-examples-from-docusaurus' ||
|
||||
containingFolder === 'docs-examples-from-docusaurus'
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue