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

@ -42,7 +42,7 @@ module.exports = async function build(siteDir, cliOptions = {}) {
// apply user webpack config
const {
siteConfig: {configureWebpack}
siteConfig: {configureWebpack},
} = props;
clientConfig = applyConfigureWebpack(configureWebpack, clientConfig, false);
serverConfig = applyConfigureWebpack(configureWebpack, serverConfig, true);
@ -58,20 +58,20 @@ module.exports = async function build(siteDir, cliOptions = {}) {
const {outDir} = props;
const staticDir = path.resolve(siteDir, 'static');
const staticFiles = await globby(['**'], {
cwd: staticDir
cwd: staticDir,
});
await Promise.all(
staticFiles.map(async source => {
const fromPath = path.resolve(staticDir, source);
const toPath = path.resolve(outDir, source);
return fs.copy(fromPath, toPath);
})
}),
);
const relativeDir = path.relative(process.cwd(), outDir);
console.log(
`\n${chalk.green('Success!')} Generated static files in ${chalk.cyan(
relativeDir
)}.\n`
relativeDir,
)}.\n`,
);
};

View file

@ -10,7 +10,7 @@ module.exports = async function eject(siteDir) {
const relativeDir = path.relative(process.cwd(), customTheme);
console.log(
`\n${chalk.green('Success!')} Copied default theme files to ${chalk.cyan(
relativeDir
)}.\n`
relativeDir,
)}.\n`,
);
};

View file

@ -44,8 +44,8 @@ module.exports = async function start(siteDir, cliOptions = {}) {
[`../${docsRelativeDir}/**/*.md`, 'blog/**/*.md', 'siteConfig.js'],
{
cwd: siteDir,
ignoreInitial: true
}
ignoreInitial: true,
},
);
fsWatcher.on('add', reload);
fsWatcher.on('change', reload);
@ -69,14 +69,14 @@ module.exports = async function start(siteDir, cliOptions = {}) {
hash: true,
template: path.resolve(__dirname, '../core/devTemplate.ejs'),
filename: 'index.html',
title: siteConfig.title
}
title: siteConfig.title,
},
]);
config = config.toConfig();
// apply user webpack config
const {
siteConfig: {configureWebpack}
siteConfig: {configureWebpack},
} = props;
config = applyConfigureWebpack(configureWebpack, config, false);
@ -90,11 +90,11 @@ module.exports = async function start(siteDir, cliOptions = {}) {
compiler,
open: true,
devMiddleware: {
logLevel: 'silent'
logLevel: 'silent',
},
hotClient: {
port: hotPort,
logLevel: 'error'
logLevel: 'error',
},
logLevel: 'error',
port,
@ -113,12 +113,12 @@ module.exports = async function start(siteDir, cliOptions = {}) {
app.use(
convert(
history({
rewrites: [{from: /\.html$/, to: '/'}]
})
)
rewrites: [{from: /\.html$/, to: '/'}],
}),
),
);
}
}
},
},
);
}, 1000);
};