mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 16:29:47 +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
|
@ -16,7 +16,7 @@ module.exports = function createBaseConfig(props, isServer) {
|
|||
sourceToMetadata,
|
||||
versionedDir,
|
||||
translatedDir,
|
||||
baseUrl
|
||||
baseUrl,
|
||||
} = props;
|
||||
|
||||
const config = new Config();
|
||||
|
@ -52,7 +52,7 @@ module.exports = function createBaseConfig(props, isServer) {
|
|||
.options({
|
||||
babelrc: false,
|
||||
presets: ['env', 'react'],
|
||||
plugins: [isServer ? 'dynamic-import-node' : 'syntax-dynamic-import']
|
||||
plugins: [isServer ? 'dynamic-import-node' : 'syntax-dynamic-import'],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ module.exports = function createBaseConfig(props, isServer) {
|
|||
versionedDir,
|
||||
translatedDir,
|
||||
docsDir,
|
||||
sourceToMetadata
|
||||
sourceToMetadata,
|
||||
});
|
||||
|
||||
const cssRule = config.module.rule('css').test(/\.css$/);
|
||||
|
@ -103,15 +103,15 @@ module.exports = function createBaseConfig(props, isServer) {
|
|||
importLoaders: 1,
|
||||
localIdentName: `[local]_[hash:base64:8]`,
|
||||
sourceMap: !isProd,
|
||||
minimize: true
|
||||
minimize: true,
|
||||
});
|
||||
|
||||
// mini-css-extract plugin
|
||||
config.plugin('extract-css').use(CSSExtractPlugin, [
|
||||
{
|
||||
filename: isProd ? '[name].[chunkhash].css' : '[name].css',
|
||||
chunkFilename: isProd ? '[id].[chunkhash].css' : '[id].css'
|
||||
}
|
||||
chunkFilename: isProd ? '[id].[chunkhash].css' : '[id].css',
|
||||
},
|
||||
]);
|
||||
|
||||
if (isProd) {
|
||||
|
@ -122,10 +122,10 @@ module.exports = function createBaseConfig(props, isServer) {
|
|||
warnings: false,
|
||||
compress: false,
|
||||
ecma: 6,
|
||||
mangle: true
|
||||
mangle: true,
|
||||
},
|
||||
sourceMap: true
|
||||
})
|
||||
sourceMap: true,
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = function(fileString) {
|
|||
versionedDir,
|
||||
docsDir,
|
||||
translatedDir,
|
||||
sourceToMetadata
|
||||
sourceToMetadata,
|
||||
} = options;
|
||||
|
||||
/* Extract content of markdown (without frontmatter) */
|
||||
|
|
|
@ -18,17 +18,17 @@ module.exports = function createServerConfig(props) {
|
|||
|
||||
// static site generator webpack plugin
|
||||
const docsLinks = Object.values(docsMetadatas).map(data => ({
|
||||
path: `${data.permalink}`
|
||||
path: `${data.permalink}`,
|
||||
}));
|
||||
const paths = [...docsLinks, ...pagesMetadatas].map(data => data.path);
|
||||
config.plugin('siteGenerator').use(staticSiteGenerator, [
|
||||
{
|
||||
entry: 'main',
|
||||
locals: {
|
||||
baseUrl: siteConfig.baseUrl
|
||||
baseUrl: siteConfig.baseUrl,
|
||||
},
|
||||
paths
|
||||
}
|
||||
paths,
|
||||
},
|
||||
]);
|
||||
|
||||
// show compilation progress bar and build time
|
||||
|
|
|
@ -23,5 +23,5 @@ function applyChainWebpack(userChainWebpack, config, isServer) {
|
|||
|
||||
module.exports = {
|
||||
applyConfigureWebpack,
|
||||
applyChainWebpack
|
||||
applyChainWebpack,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue