mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
Fix .gitignore placement when running example script or docusaurus-init (#533)
Fixes #415
This commit is contained in:
parent
6500f9bacf
commit
fc051acde5
2 changed files with 13 additions and 6 deletions
|
@ -1,11 +1,13 @@
|
||||||
node_modules
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
|
||||||
lib/core/metadata.js
|
lib/core/metadata.js
|
||||||
lib/core/MetadataBlog.js
|
lib/core/MetadataBlog.js
|
||||||
|
|
||||||
website/translated_docs
|
website/translated_docs
|
||||||
website/build/
|
website/build/
|
||||||
website/yarn.lock
|
website/yarn.lock
|
||||||
website/node_modules
|
website/node_modules
|
||||||
|
|
||||||
website/i18n/*
|
website/i18n/*
|
||||||
!website/i18n/en.json
|
!website/i18n/en.json
|
||||||
|
|
|
@ -156,15 +156,20 @@ if (feature === 'translations') {
|
||||||
blogCreated = true;
|
blogCreated = true;
|
||||||
}
|
}
|
||||||
// copy .gitignore file
|
// copy .gitignore file
|
||||||
if (fs.existsSync(CWD + '/.gitignore')) {
|
let gitignoreName = '.gitignore';
|
||||||
|
if (fs.existsSync(CWD + '/../.gitignore')) {
|
||||||
|
gitignoreName = '.gitignore-example-from-docusaurus';
|
||||||
console.log(
|
console.log(
|
||||||
`${chalk.yellow('.gitignore already exists')} in ${chalk.yellow(
|
`${chalk.yellow('.gitignore already exists')} in ${chalk.yellow(
|
||||||
CWD
|
CWD
|
||||||
)}. Rename or remove the file to regenerate an example version.\n`
|
)}. Creating an example gitignore file for you to copy from if desired.\n`
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
fs.copySync(path.join(folder, 'gitignore'), path.join(CWD, '.gitignore'));
|
|
||||||
}
|
}
|
||||||
|
fs.copySync(
|
||||||
|
path.join(folder, 'gitignore'),
|
||||||
|
path.join(CWD, '/../' + gitignoreName)
|
||||||
|
);
|
||||||
|
|
||||||
// copy other files
|
// copy other files
|
||||||
let files = glob.sync(folder + '/**/*');
|
let files = glob.sync(folder + '/**/*');
|
||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue