diff --git a/examples/basics/gitignore b/examples/basics/gitignore index aeedda9bfc31..0a65d6d4da57 100644 --- a/examples/basics/gitignore +++ b/examples/basics/gitignore @@ -1,11 +1,13 @@ -node_modules .DS_Store + +node_modules + lib/core/metadata.js lib/core/MetadataBlog.js + website/translated_docs website/build/ website/yarn.lock website/node_modules - website/i18n/* !website/i18n/en.json diff --git a/lib/copy-examples.js b/lib/copy-examples.js index 593c675e6a13..c9e5f97004e2 100755 --- a/lib/copy-examples.js +++ b/lib/copy-examples.js @@ -156,15 +156,20 @@ if (feature === 'translations') { blogCreated = true; } // copy .gitignore file - if (fs.existsSync(CWD + '/.gitignore')) { + let gitignoreName = '.gitignore'; + if (fs.existsSync(CWD + '/../.gitignore')) { + gitignoreName = '.gitignore-example-from-docusaurus'; console.log( `${chalk.yellow('.gitignore already exists')} in ${chalk.yellow( 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 let files = glob.sync(folder + '/**/*'); files.forEach(file => {