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:
Yangshun Tay 2018-09-17 15:34:55 +08:00 committed by GitHub
parent a1de6dab04
commit 9d4a5d5359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
101 changed files with 441 additions and 473 deletions

View file

@ -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`,
);
}