Commit 7bb6ff30 by Ryan McKinley Committed by GitHub

Toolkit: use src/README.md if it exists (#23271)

parent a6f2ae1f
...@@ -82,6 +82,7 @@ const getEntries = async () => { ...@@ -82,6 +82,7 @@ const getEntries = async () => {
}; };
const getCommonPlugins = (options: WebpackConfigurationOptions) => { const getCommonPlugins = (options: WebpackConfigurationOptions) => {
const hasREADME = fs.existsSync(path.resolve(process.cwd(), 'src', 'README.md'));
const packageJson = require(path.resolve(process.cwd(), 'package.json')); const packageJson = require(path.resolve(process.cwd(), 'package.json'));
return [ return [
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
...@@ -91,8 +92,9 @@ const getCommonPlugins = (options: WebpackConfigurationOptions) => { ...@@ -91,8 +92,9 @@ const getCommonPlugins = (options: WebpackConfigurationOptions) => {
new webpack.optimize.OccurrenceOrderPlugin(true), new webpack.optimize.OccurrenceOrderPlugin(true),
new CopyWebpackPlugin( new CopyWebpackPlugin(
[ [
// If src/README.md exists use it; otherwise the root README
{ from: hasREADME ? 'README.md' : '../README.md', to: '.', force: true },
{ from: 'plugin.json', to: '.' }, { from: 'plugin.json', to: '.' },
{ from: '../README.md', to: '.' },
{ from: '../LICENSE', to: '.' }, { from: '../LICENSE', to: '.' },
{ from: '**/*.json', to: '.' }, { from: '**/*.json', to: '.' },
{ from: '**/*.svg', to: '.' }, { from: '**/*.svg', to: '.' },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment