mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-15 10:07:33 +02:00
refactor: print trailing new line when outputting JSON (#6186)
* refactor(core): print trailing new line when writing translation * Print these as well
This commit is contained in:
parent
a17deb6aa2
commit
1460f867d0
3 changed files with 5 additions and 5 deletions
|
@ -66,7 +66,7 @@ function generateTemplateExample(template) {
|
|||
// rewrite the package.json file with the new edit
|
||||
writeFileSync(
|
||||
`./examples/${template}/package.json`,
|
||||
JSON.stringify(templatePackageJson, null, 2),
|
||||
`${JSON.stringify(templatePackageJson, null, 2)}\n`,
|
||||
);
|
||||
|
||||
// create sandbox.config.json file at the root of template
|
||||
|
@ -82,7 +82,7 @@ function generateTemplateExample(template) {
|
|||
};
|
||||
writeFileSync(
|
||||
`./examples/${template}/sandbox.config.json`,
|
||||
JSON.stringify(codeSanboxConfig, null, 2),
|
||||
`${JSON.stringify(codeSanboxConfig, null, 2)}\n`,
|
||||
);
|
||||
|
||||
const stackBlitzConfig = {
|
||||
|
@ -91,7 +91,7 @@ function generateTemplateExample(template) {
|
|||
};
|
||||
writeFileSync(
|
||||
`./examples/${template}/.stackblitzrc`,
|
||||
JSON.stringify(stackBlitzConfig, null, 2),
|
||||
`${JSON.stringify(stackBlitzConfig, null, 2)}\n`,
|
||||
);
|
||||
|
||||
console.log(`Generated example for template ${template}`);
|
||||
|
|
|
@ -35,7 +35,7 @@ async function updatePkg(pkgPath: string, obj: Record<string, unknown>) {
|
|||
const pkg = JSON.parse(content);
|
||||
const newPkg = Object.assign(pkg, obj);
|
||||
|
||||
await fs.outputFile(pkgPath, JSON.stringify(newPkg, null, 2));
|
||||
await fs.outputFile(pkgPath, `${JSON.stringify(newPkg, null, 2)}\n`);
|
||||
}
|
||||
|
||||
function readTemplates(templatesDir: string) {
|
||||
|
|
|
@ -133,7 +133,7 @@ Maybe you should remove them? ${unknownKeys}`;
|
|||
filePath,
|
||||
)}.`;
|
||||
await fs.ensureDir(path.dirname(filePath));
|
||||
await fs.writeFile(filePath, JSON.stringify(mergedContent, null, 2));
|
||||
await fs.writeFile(filePath, `${JSON.stringify(mergedContent, null, 2)}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue