diff --git a/lib/copy-examples.js b/lib/copy-examples.js index 49381eec55..c75e5abe8b 100755 --- a/lib/copy-examples.js +++ b/lib/copy-examples.js @@ -124,11 +124,9 @@ if (feature === 'translations') { // copy docs examples if (fs.existsSync(`${CWD}/../docs-examples-from-docusaurus`)) { console.log( - `${chalk.yellow( - 'Example docs already exist!' - )} Rename or remove ${chalk.yellow( - `${outerFolder}/docs-examples-from-docusaurus` - )} to regenerate example docs.\n` + `- ${chalk.green( + 'docs-examples-from-docusaurus' + )} already exists in ${chalk.blue(outerFolder)}.` ); } else { fs.copySync( @@ -141,11 +139,9 @@ if (feature === 'translations') { // copy blog examples if (fs.existsSync(`${CWD}/blog-examples-from-docusaurus`)) { console.log( - `${chalk.yellow( - 'Example blog posts already exist!' - )} Rename or remove ${chalk.yellow( - `${outerFolder}/website/blog-examples-from-docusaurus` - )} to regenerate example blog posts.\n` + `- ${chalk.green( + 'blog-examples-from-docusaurus' + )} already exists in ${chalk.blue(`${outerFolder}/website`)}.` ); } else { fs.copySync( @@ -156,33 +152,32 @@ if (feature === 'translations') { blogCreated = true; } - const copyFileOutWebsiteFolder = (fileNameFrom, isHide) => { - let fileNameTo = isHide ? `.${fileNameFrom}` : fileNameFrom; - if (fs.existsSync(`${CWD}/../${fileNameTo}`)) { - fileNameTo = `${fileNameTo}-example-from-docusaurus`; + const copyFileToWebsite = (fileNameFrom, fileNameTo) => { + const copiedFileName = fileNameTo || fileNameFrom; + const src = path.join(folder, fileNameFrom); + const dest = path.join(CWD, '..', copiedFileName); + if (fs.existsSync(dest)) { console.log( - `${chalk.yellow(fileNameTo + ' already exists')} in ${chalk.yellow( - CWD - )}. Creating an example ${fileNameTo} file for you to copy from if desired.\n` + `- ${chalk.green(copiedFileName)} already exists in ${chalk.blue( + outerFolder + )}.` ); + } else { + fs.copySync(src, dest); } - fs.copySync( - path.join(folder, fileNameFrom), - path.join(CWD, `/../${fileNameTo}`) - ); }; // copy .gitignore file - copyFileOutWebsiteFolder('gitignore', true); + copyFileToWebsite('gitignore', '.gitignore'); // copy Dockerfile file - copyFileOutWebsiteFolder('Dockerfile', false); + copyFileToWebsite('Dockerfile'); // copy docker-compose.yml file - copyFileOutWebsiteFolder('docker-compose.yml', false); + copyFileToWebsite('docker-compose.yml'); // copy .dockerignore file - copyFileOutWebsiteFolder('dockerignore', true); + copyFileToWebsite('dockerignore', '.dockerignore'); // copy other files const files = glob.sync(`${folder}/**/*`); @@ -210,11 +205,11 @@ if (feature === 'translations') { exampleSiteCreated = true; } catch (e) { console.log( - `${chalk.yellow( - `${path.basename(filePath)} already exists` - )} in ${chalk.yellow( - `website${filePath.split(path.basename(filePath))[0]}` - )}. Rename or remove the file to regenerate an example version.\n` + `- ${chalk.green( + `${path.basename(filePath)}` + )} already exists in ${chalk.blue( + `${outerFolder}/website${filePath.split(path.basename(filePath))[0]}` + )}.` ); } }); diff --git a/lib/write-translations.js b/lib/write-translations.js index ce3f9aad8f..ef6ab435b7 100755 --- a/lib/write-translations.js +++ b/lib/write-translations.js @@ -176,13 +176,16 @@ function execute() { // Manually add 'Help Translate' to en.json translations['pages-strings'][ 'Help Translate|recruit community translators for your project' - ] = 'Help Translate'; + ] = + 'Help Translate'; translations['pages-strings'][ 'Edit this Doc|recruitment message asking to edit the doc source' - ] = 'Edit'; + ] = + 'Edit'; translations['pages-strings'][ 'Translate this Doc|recruitment message asking to translate the docs' - ] = 'Translate'; + ] = + 'Translate'; translations['pages-strings'] = Object.assign( translations['pages-strings'], customTranslations['pages-strings']