mirror of https://github.com/apache/superset.git
build: allow building only one (or more) package (#571)
This commit is contained in:
parent
1fd72d53e0
commit
ac326ded47
|
@ -11,6 +11,12 @@ yarn install
|
|||
yarn build
|
||||
```
|
||||
|
||||
To build only selected packages or plugins,
|
||||
|
||||
```bash
|
||||
yarn build "*chart-table"
|
||||
```
|
||||
|
||||
### File organization
|
||||
|
||||
[lerna](https://github.com/lerna/lerna/) and [yarn](https://yarnpkg.com) are used to manage versions
|
||||
|
|
|
@ -85,12 +85,6 @@ should be written in Typescript.
|
|||
Please read the [contributing guidelines](CONTRIBUTING.md) which include development environment
|
||||
setup and other things you should know about coding in this repo.
|
||||
|
||||
To build only selected plugins,
|
||||
|
||||
```bash
|
||||
node scripts/build.js "*legacy-plugin-chart-table"
|
||||
```
|
||||
|
||||
### License
|
||||
|
||||
Apache-2.0
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
"description": "Superset UI",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "yarn babel && yarn type && yarn build:assets",
|
||||
"build": "node ./scripts/build.js",
|
||||
"build:assets": "node ./scripts/copyAssets.js",
|
||||
"babel": "yarn babel:cjs && yarn babel:esm",
|
||||
"babel:cjs": "nimbus babel --clean --workspaces=\"@superset-ui/!(demo|generator-superset)\" --config-file=../../babel.config.js",
|
||||
"babel:esm": "nimbus babel --clean --workspaces=\"@superset-ui/!(demo|generator-superset)\" --esm --config-file=../../babel.config.js",
|
||||
"build:assets": "node ./scripts/buildAssets.js",
|
||||
"demo": "cd packages/superset-ui-demo && yarn demo:build",
|
||||
"demo:clean": "cd packages/superset-ui-demo && yarn demo:clean",
|
||||
"storybook": "cd packages/superset-ui-demo && yarn storybook",
|
||||
|
|
17
superset-frontend/temporary_superset_ui/superset-ui/scripts/build.js
Normal file → Executable file
17
superset-frontend/temporary_superset_ui/superset-ui/scripts/build.js
Normal file → Executable file
|
@ -1,5 +1,6 @@
|
|||
#!/bin/env node
|
||||
/**
|
||||
* Build only plugins specified by globs
|
||||
* Build plugins specified by globs
|
||||
*/
|
||||
const { spawnSync } = require('child_process');
|
||||
|
||||
|
@ -9,6 +10,7 @@ const extraArgs = process.argv.slice(2);
|
|||
process.env.PATH = `./node_modules/.bin:${process.env.PATH}`;
|
||||
|
||||
const run = cmd => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`>> ${cmd}`);
|
||||
const [p, ...args] = cmd.split(' ');
|
||||
const runner = spawnSync;
|
||||
|
@ -18,15 +20,20 @@ const run = cmd => {
|
|||
}
|
||||
};
|
||||
|
||||
const BABEL_CONFIG = '--config-file=../../babel.config.js';
|
||||
|
||||
if (glob) {
|
||||
// lint is slow, so not turning it on by default
|
||||
if (extraArgs.includes('--lint')) {
|
||||
run(`nimbus eslint {packages,plugins}/${glob}/{src,test}`);
|
||||
}
|
||||
run(`nimbus babel --clean --workspaces="@superset-ui/${glob}"`);
|
||||
run(`nimbus babel --clean --workspaces="@superset-ui/${glob}" --esm`);
|
||||
run(`nimbus babel --clean --workspaces="@superset-ui/${glob}" ${BABEL_CONFIG}`);
|
||||
run(`nimbus babel --clean --workspaces="@superset-ui/${glob}" --esm ${BABEL_CONFIG}`);
|
||||
run(`nimbus typescript --build --workspaces="@superset-ui/${glob}"`);
|
||||
require('./buildAssets');
|
||||
// eslint-disable-next-line global-require
|
||||
require('./copyAssets');
|
||||
} else {
|
||||
run('yarn build');
|
||||
run('yarn babel');
|
||||
run('yarn type');
|
||||
run('yarn build:assets');
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* eslint-disable import/no-extraneous-dependencies, no-console */
|
||||
#!/bin/env node
|
||||
/* eslint-disable no-console */
|
||||
const fg = require('fast-glob');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
const pkgGlob = process.argv[2] || '*';
|
||||
|
||||
const packages = fg.sync([`{packages,plugins}/${pkgGlob}`], {
|
Loading…
Reference in New Issue