diff --git a/docusaurus-init/initialize.js b/docusaurus-init/initialize.js index 0044c4253e..942d469405 100644 --- a/docusaurus-init/initialize.js +++ b/docusaurus-init/initialize.js @@ -39,7 +39,10 @@ console.log( ); const packageContent = { scripts: { examples: "docusaurus-examples" } }; -fs.writeFileSync(CWD + "/website/package.json", JSON.stringify(packageContent)); +fs.writeFileSync( + CWD + "/website/package.json", + JSON.stringify(packageContent, null, 2) + "\n" +); if (useYarn) { shell.exec("yarn add docusaurus --dev"); diff --git a/lib/copy-examples.js b/lib/copy-examples.js index b132548bcb..45b57db3e9 100755 --- a/lib/copy-examples.js +++ b/lib/copy-examples.js @@ -42,7 +42,7 @@ if (fs.existsSync(CWD + '/package.json')) { packageContent.scripts['rename-version'] = 'docusaurus-rename-version'; fs.writeFileSync( CWD + '/package.json', - JSON.stringify(packageContent, null, 2) + JSON.stringify(packageContent, null, 2) + '\n' ); console.log( `${chalk.green('Wrote docusaurus scripts to package.json file.')}\n` diff --git a/lib/rename-version.js b/lib/rename-version.js index ba4c4941d8..fe1f84537a 100755 --- a/lib/rename-version.js +++ b/lib/rename-version.js @@ -80,7 +80,10 @@ if (versionIndex < 0) { } // replace old version with new version in versions.json file versions[versionIndex] = newVersion; -fs.writeFileSync(CWD + '/versions.json', JSON.stringify(versions)); +fs.writeFileSync( + CWD + '/versions.json', + JSON.stringify(versions, null, 2) + '\n' +); // if folder of docs for this version exists, rename folder and rewrite doc // headers to use new version diff --git a/lib/server/readMetadata.js b/lib/server/readMetadata.js index e336c918f7..b27cf3abb4 100644 --- a/lib/server/readMetadata.js +++ b/lib/server/readMetadata.js @@ -337,7 +337,7 @@ function generateMetadataDocs() { ' */\n' + 'module.exports = ' + JSON.stringify(metadatas, null, 2) + - ';' + ';\n' ); } @@ -404,7 +404,7 @@ function generateMetadataBlog() { ' */\n' + 'module.exports = ' + JSON.stringify(metadatas, null, 2) + - ';' + ';\n' ); } diff --git a/lib/version.js b/lib/version.js index fe9befd202..4df180de19 100755 --- a/lib/version.js +++ b/lib/version.js @@ -125,13 +125,16 @@ if (versionFallback.diffLatestSidebar()) { fs.writeFileSync( CWD + '/versioned_sidebars/version-' + version + '-sidebars.json', - JSON.stringify(versioned, null, 2), + JSON.stringify(versioned, null, 2) + '\n', 'utf8' ); } // update versions.json file versions.unshift(version); -fs.writeFileSync(CWD + '/versions.json', JSON.stringify(versions, null, 2)); +fs.writeFileSync( + CWD + '/versions.json', + JSON.stringify(versions, null, 2) + '\n' +); console.log(`${chalk.green('Version ' + version + ' created!\n')}`); diff --git a/lib/write-translations.js b/lib/write-translations.js index 578928cc40..8fb49fde6a 100755 --- a/lib/write-translations.js +++ b/lib/write-translations.js @@ -176,7 +176,7 @@ function execute() { ), null, 2 - ) + ) + '\n' ); }