mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
Prettify all JavaScript files (#964)
* Prettify all JavaScript files * Make trailingComma all * Delete v2/.prettierignore * Remove v2 Prettier commands in package.json
This commit is contained in:
parent
a1de6dab04
commit
9d4a5d5359
101 changed files with 441 additions and 473 deletions
|
@ -27,7 +27,7 @@ commander
|
|||
// add scripts to package.json file
|
||||
if (fs.existsSync(`${CWD}/package.json`)) {
|
||||
const packageContent = JSON.parse(
|
||||
fs.readFileSync(`${CWD}/package.json`, 'utf8')
|
||||
fs.readFileSync(`${CWD}/package.json`, 'utf8'),
|
||||
);
|
||||
if (!packageContent.scripts) {
|
||||
packageContent.scripts = {};
|
||||
|
@ -42,10 +42,10 @@ if (fs.existsSync(`${CWD}/package.json`)) {
|
|||
packageContent.scripts['rename-version'] = 'docusaurus-rename-version';
|
||||
fs.writeFileSync(
|
||||
`${CWD}/package.json`,
|
||||
`${JSON.stringify(packageContent, null, 2)}\n`
|
||||
`${JSON.stringify(packageContent, null, 2)}\n`,
|
||||
);
|
||||
console.log(
|
||||
`${chalk.green('Wrote docusaurus scripts to package.json file.')}\n`
|
||||
`${chalk.green('Wrote docusaurus scripts to package.json file.')}\n`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,8 @@ if (feature === 'translations') {
|
|||
if (fs.existsSync(`${CWD}/../crowdin.yaml`)) {
|
||||
console.log(
|
||||
`${chalk.yellow('crowdin.yaml already exists')} in ${chalk.yellow(
|
||||
`${outerFolder}/`
|
||||
)}. Rename or remove the file to regenerate an example version.\n`
|
||||
`${outerFolder}/`,
|
||||
)}. Rename or remove the file to regenerate an example version.\n`,
|
||||
);
|
||||
} else {
|
||||
fs.copySync(`${folder}/crowdin.yaml`, `${CWD}/../crowdin.yaml`);
|
||||
|
@ -87,10 +87,10 @@ if (feature === 'translations') {
|
|||
} catch (e) {
|
||||
console.log(
|
||||
`${chalk.yellow(
|
||||
`${path.basename(filePath)} already exists`
|
||||
`${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`
|
||||
`website${filePath.split(path.basename(filePath))[0]}`,
|
||||
)}. Rename or remove the file to regenerate an example version.\n`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -112,10 +112,10 @@ if (feature === 'translations') {
|
|||
} catch (e) {
|
||||
console.log(
|
||||
`${chalk.yellow(
|
||||
`${path.basename(filePath)} already exists`
|
||||
`${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`
|
||||
`website${filePath.split(path.basename(filePath))[0]}`,
|
||||
)}. Rename or remove the file to regenerate an example version.\n`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -125,13 +125,13 @@ if (feature === 'translations') {
|
|||
if (fs.existsSync(`${CWD}/../docs-examples-from-docusaurus`)) {
|
||||
console.log(
|
||||
`- ${chalk.green(
|
||||
'docs-examples-from-docusaurus'
|
||||
)} already exists in ${chalk.blue(outerFolder)}.`
|
||||
'docs-examples-from-docusaurus',
|
||||
)} already exists in ${chalk.blue(outerFolder)}.`,
|
||||
);
|
||||
} else {
|
||||
fs.copySync(
|
||||
`${folder}/docs-examples-from-docusaurus`,
|
||||
`${CWD}/../docs-examples-from-docusaurus`
|
||||
`${CWD}/../docs-examples-from-docusaurus`,
|
||||
);
|
||||
exampleSiteCreated = true;
|
||||
docsCreated = true;
|
||||
|
@ -140,13 +140,13 @@ if (feature === 'translations') {
|
|||
if (fs.existsSync(`${CWD}/blog-examples-from-docusaurus`)) {
|
||||
console.log(
|
||||
`- ${chalk.green(
|
||||
'blog-examples-from-docusaurus'
|
||||
)} already exists in ${chalk.blue(`${outerFolder}/website`)}.`
|
||||
'blog-examples-from-docusaurus',
|
||||
)} already exists in ${chalk.blue(`${outerFolder}/website`)}.`,
|
||||
);
|
||||
} else {
|
||||
fs.copySync(
|
||||
path.join(folder, 'blog-examples-from-docusaurus'),
|
||||
path.join(CWD, 'blog-examples-from-docusaurus')
|
||||
path.join(CWD, 'blog-examples-from-docusaurus'),
|
||||
);
|
||||
exampleSiteCreated = true;
|
||||
blogCreated = true;
|
||||
|
@ -159,8 +159,8 @@ if (feature === 'translations') {
|
|||
if (fs.existsSync(dest)) {
|
||||
console.log(
|
||||
`- ${chalk.green(copiedFileName)} already exists in ${chalk.blue(
|
||||
outerFolder
|
||||
)}.`
|
||||
outerFolder,
|
||||
)}.`,
|
||||
);
|
||||
} else {
|
||||
fs.copySync(src, dest);
|
||||
|
@ -206,10 +206,10 @@ if (feature === 'translations') {
|
|||
} catch (e) {
|
||||
console.log(
|
||||
`- ${chalk.green(
|
||||
`${path.basename(filePath)}`
|
||||
`${path.basename(filePath)}`,
|
||||
)} already exists in ${chalk.blue(
|
||||
`${outerFolder}/website${filePath.split(path.basename(filePath))[0]}`
|
||||
)}.`
|
||||
`${outerFolder}/website${filePath.split(path.basename(filePath))[0]}`,
|
||||
)}.`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -233,19 +233,19 @@ if (feature === 'translations') {
|
|||
if (docsCreated) {
|
||||
console.log(
|
||||
`Rename ${chalk.yellow(
|
||||
`${outerFolder}/docs-examples-from-docusaurus`
|
||||
`${outerFolder}/docs-examples-from-docusaurus`,
|
||||
)} to ${chalk.yellow(
|
||||
`${outerFolder}/docs`
|
||||
)} to see the example docs on your site.\n`
|
||||
`${outerFolder}/docs`,
|
||||
)} to see the example docs on your site.\n`,
|
||||
);
|
||||
}
|
||||
|
||||
if (blogCreated) {
|
||||
console.log(
|
||||
`Rename ${chalk.yellow(
|
||||
`${outerFolder}/website/blog-examples-from-docusaurus`
|
||||
`${outerFolder}/website/blog-examples-from-docusaurus`,
|
||||
)} to ${chalk.yellow(
|
||||
`${outerFolder}/website/blog`
|
||||
)} to see the example blog posts on your site.\n`
|
||||
`${outerFolder}/website/blog`,
|
||||
)} to see the example blog posts on your site.\n`,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue