From 7bb6ff30c3a20ca45fa3ea1d52cd3f7f0b034d96 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Wed, 1 Apr 2020 22:06:01 -0700 Subject: [PATCH] Toolkit: use src/README.md if it exists (#23271) --- packages/grafana-toolkit/src/config/webpack.plugin.config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/grafana-toolkit/src/config/webpack.plugin.config.ts b/packages/grafana-toolkit/src/config/webpack.plugin.config.ts index 9d8602dd948..cb88145aa43 100644 --- a/packages/grafana-toolkit/src/config/webpack.plugin.config.ts +++ b/packages/grafana-toolkit/src/config/webpack.plugin.config.ts @@ -82,6 +82,7 @@ const getEntries = async () => { }; const getCommonPlugins = (options: WebpackConfigurationOptions) => { + const hasREADME = fs.existsSync(path.resolve(process.cwd(), 'src', 'README.md')); const packageJson = require(path.resolve(process.cwd(), 'package.json')); return [ new MiniCssExtractPlugin({ @@ -91,8 +92,9 @@ const getCommonPlugins = (options: WebpackConfigurationOptions) => { new webpack.optimize.OccurrenceOrderPlugin(true), 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: '../README.md', to: '.' }, { from: '../LICENSE', to: '.' }, { from: '**/*.json', to: '.' }, { from: '**/*.svg', to: '.' },