mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Toolkit: Deprecate and replace toolkit:build with plain yarn scripts (#57620)
* Toolkit: Deprecate and replace toolkit:build with plain yarn scripts * Remove "generated" from copied files in the script
This commit is contained in:
parent
cbe7fe3d8d
commit
987d4fd459
@ -30,7 +30,8 @@
|
||||
"LICENSE_APACHE2"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "grafana-toolkit toolkit:build",
|
||||
"build": "yarn clean && tsc -p tsconfig.json && yarn copy-files",
|
||||
"copy-files": "node ./scripts/copy-files.js",
|
||||
"clean": "rimraf ./dist ./compiled ./sass ./package.tgz",
|
||||
"prepack": "mv ./src ./src_bak && cp -r ./dist/src ./src",
|
||||
"postpack": "rimraf ./src && mv ./src_bak ./src",
|
||||
|
38
packages/grafana-toolkit/scripts/copy-files.js
Normal file
38
packages/grafana-toolkit/scripts/copy-files.js
Normal file
@ -0,0 +1,38 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function copyFiles(files, cwd, distDir) {
|
||||
for (const file of files) {
|
||||
const basedir = path.dirname(`${distDir}/${file}`);
|
||||
const name = file.replace('.generated', '');
|
||||
if (!fs.existsSync(basedir)) {
|
||||
fs.mkdirSync(basedir, { recursive: true });
|
||||
}
|
||||
fs.copyFileSync(`${cwd}/${file}`, `${distDir}/${name}`);
|
||||
}
|
||||
}
|
||||
const configFilesToCopy = [
|
||||
'src/config/prettier.plugin.config.json',
|
||||
'src/config/prettier.plugin.rc.js',
|
||||
'src/config/tsconfig.plugin.json',
|
||||
'src/config/tsconfig.plugin.local.json',
|
||||
'src/config/eslint.plugin.js',
|
||||
'src/config/styles.mock.js',
|
||||
'src/config/jest.babel.config.js',
|
||||
'src/config/jest.plugin.config.local.js',
|
||||
'src/config/matchMedia.js',
|
||||
'src/config/react-inlinesvg.tsx',
|
||||
];
|
||||
const sassFilesToCopy = [
|
||||
'_variables.generated.scss',
|
||||
'_variables.dark.generated.scss',
|
||||
'_variables.light.generated.scss',
|
||||
];
|
||||
|
||||
const cwd = path.resolve(__dirname, '../');
|
||||
const distPath = path.resolve(cwd, 'dist');
|
||||
const sassPath = path.resolve(cwd, 'sass');
|
||||
const grafanaSassPath = path.resolve(cwd, '../../public/sass');
|
||||
|
||||
copyFiles(configFilesToCopy, cwd, distPath);
|
||||
copyFiles(sassFilesToCopy, grafanaSassPath, sassPath);
|
@ -58,8 +58,11 @@ export const run = (includeInternalScripts = false) => {
|
||||
|
||||
program
|
||||
.command('toolkit:build')
|
||||
.description('Prepares grafana/toolkit dist package')
|
||||
.description('[Deprecated] Prepares grafana/toolkit dist package')
|
||||
.action(async (cmd) => {
|
||||
chalk.yellow.bold(
|
||||
`⚠️ This command is deprecated and will be removed in v10. No further support will be provided. ⚠️`
|
||||
);
|
||||
await execTask(toolkitBuildTask)({});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user