diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ebaaa4d19..5d716fc2d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,11 +53,14 @@ jobs: ${{ runner.os }}-npm- - name: Install dependencies + working-directory: ./superset-frontend run: npm ci - - name: Build packages - run: npm run plugins:build - name: Run unit tests + working-directory: ./superset-frontend run: npm run test -- plugins packages + - name: Build packages + working-directory: ./superset-frontend + run: npm run plugins:build - name: Configure npm and git run: | @@ -73,6 +76,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Bump version and publish package(s) + working-directory: ./superset-frontend run: | git tag -d `git tag | grep -E '^trigger-'` npm run plugins:release-from-tag diff --git a/superset-frontend/.prettierignore b/superset-frontend/.prettierignore index ce9d951a6..95c012720 100644 --- a/superset-frontend/.prettierignore +++ b/superset-frontend/.prettierignore @@ -20,6 +20,7 @@ lib/ tmp/ node_modules/ tsconfig.json +lerna.json CHANGELOG.md *.geojson *-topo.json diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index 6440b4061..a7d21e772 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -20,34 +20,34 @@ "@emotion/cache": "^11.4.0", "@emotion/react": "^11.4.1", "@emotion/styled": "^11.3.0", - "@superset-ui/chart-controls": "^0.18.25", - "@superset-ui/core": "^0.18.25", - "@superset-ui/legacy-plugin-chart-calendar": "^0.18.25", - "@superset-ui/legacy-plugin-chart-chord": "^0.18.25", - "@superset-ui/legacy-plugin-chart-country-map": "^0.18.25", - "@superset-ui/legacy-plugin-chart-event-flow": "^0.18.25", - "@superset-ui/legacy-plugin-chart-force-directed": "^0.18.25", - "@superset-ui/legacy-plugin-chart-heatmap": "^0.18.25", - "@superset-ui/legacy-plugin-chart-histogram": "^0.18.25", - "@superset-ui/legacy-plugin-chart-horizon": "^0.18.25", - "@superset-ui/legacy-plugin-chart-map-box": "^0.18.25", - "@superset-ui/legacy-plugin-chart-paired-t-test": "^0.18.25", - "@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.18.25", - "@superset-ui/legacy-plugin-chart-partition": "^0.18.25", - "@superset-ui/legacy-plugin-chart-pivot-table": "^0.18.25", - "@superset-ui/legacy-plugin-chart-rose": "^0.18.25", - "@superset-ui/legacy-plugin-chart-sankey": "^0.18.25", - "@superset-ui/legacy-plugin-chart-sankey-loop": "^0.18.25", - "@superset-ui/legacy-plugin-chart-sunburst": "^0.18.25", - "@superset-ui/legacy-plugin-chart-treemap": "^0.18.25", - "@superset-ui/legacy-plugin-chart-world-map": "^0.18.25", - "@superset-ui/legacy-preset-chart-deckgl": "^0.4.13", - "@superset-ui/legacy-preset-chart-nvd3": "^0.18.25", - "@superset-ui/plugin-chart-echarts": "^0.18.25", - "@superset-ui/plugin-chart-pivot-table": "^0.18.25", - "@superset-ui/plugin-chart-table": "^0.18.25", - "@superset-ui/plugin-chart-word-cloud": "^0.18.25", - "@superset-ui/preset-chart-xy": "^0.18.25", + "@superset-ui/chart-controls": "file://./packages/superset-ui-chart-controls", + "@superset-ui/core": "file://./packages/superset-ui-core", + "@superset-ui/legacy-plugin-chart-calendar": "file://./plugins/legacy-plugin-chart-calendar", + "@superset-ui/legacy-plugin-chart-chord": "file://./plugins/legacy-plugin-chart-chord", + "@superset-ui/legacy-plugin-chart-country-map": "file://./plugins/legacy-plugin-chart-country-map", + "@superset-ui/legacy-plugin-chart-event-flow": "file://./plugins/legacy-plugin-chart-event-flow", + "@superset-ui/legacy-plugin-chart-force-directed": "file://./plugins/legacy-plugin-chart-force-directed", + "@superset-ui/legacy-plugin-chart-heatmap": "file://./plugins/legacy-plugin-chart-heatmap", + "@superset-ui/legacy-plugin-chart-histogram": "file://./plugins/legacy-plugin-chart-histogram", + "@superset-ui/legacy-plugin-chart-horizon": "file://./plugins/legacy-plugin-chart-horizon", + "@superset-ui/legacy-plugin-chart-map-box": "file://./plugins/legacy-plugin-chart-map-box", + "@superset-ui/legacy-plugin-chart-paired-t-test": "file://./plugins/legacy-plugin-chart-paired-t-test", + "@superset-ui/legacy-plugin-chart-parallel-coordinates": "file://./plugins/legacy-plugin-chart-parallel-coordinates", + "@superset-ui/legacy-plugin-chart-partition": "file://./plugins/legacy-plugin-chart-partition", + "@superset-ui/legacy-plugin-chart-pivot-table": "file://./plugins/legacy-plugin-chart-pivot-table", + "@superset-ui/legacy-plugin-chart-rose": "file://./plugins/legacy-plugin-chart-rose", + "@superset-ui/legacy-plugin-chart-sankey": "file://./plugins/legacy-plugin-chart-sankey", + "@superset-ui/legacy-plugin-chart-sankey-loop": "file://./plugins/legacy-plugin-chart-sankey-loop", + "@superset-ui/legacy-plugin-chart-sunburst": "file://./plugins/legacy-plugin-chart-sunburst", + "@superset-ui/legacy-plugin-chart-treemap": "file://./plugins/legacy-plugin-chart-treemap", + "@superset-ui/legacy-plugin-chart-world-map": "file://./plugins/legacy-plugin-chart-world-map", + "@superset-ui/legacy-preset-chart-deckgl": "file://./plugins/legacy-preset-chart-deckgl", + "@superset-ui/legacy-preset-chart-nvd3": "file://./plugins/legacy-preset-chart-nvd3", + "@superset-ui/plugin-chart-echarts": "file://./plugins/plugin-chart-echarts", + "@superset-ui/plugin-chart-pivot-table": "file://./plugins/plugin-chart-pivot-table", + "@superset-ui/plugin-chart-table": "file://./plugins/plugin-chart-table", + "@superset-ui/plugin-chart-word-cloud": "file://./plugins/plugin-chart-word-cloud", + "@superset-ui/preset-chart-xy": "file://./plugins/preset-chart-xy", "@vx/responsive": "^0.0.195", "abortcontroller-polyfill": "^1.1.9", "antd": "^4.9.4", diff --git a/superset-frontend/package.json b/superset-frontend/package.json index 3d7d2bfd4..54693cb2a 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -51,9 +51,9 @@ "plugins:build-assets": "node ./scripts/copyAssets.js", "plugins:build-storybook": "cd packages/superset-ui-demo && npm run build-storybook", "plugins:chromatic": "cd packages/superset-ui-demo && npm run chromatic", - "plugins:create-conventional-version": "npm run prune && ./scripts/lernaVersion.sh '--conventional-commits --create-release github'", - "plugins:create-minor-version": "npm run prune && ./scripts/lernaVersion.sh minor", - "plugins:create-patch-version": "npm run prune && ./scripts/lernaVersion.sh patch", + "plugins:create-conventional-version": "npm run prune && lerna version --conventional-commits --create-release github --yes", + "plugins:create-minor-version": "npm run prune && lerna version minor --yes", + "plugins:create-patch-version": "npm run prune && lerna version patch --yes", "plugins:release-conventional": "npm run prune && lerna publish --conventional-commits --create-release github --yes", "plugins:release-from-tag": "npm run prune && lerna publish from-package --yes", "plugins:storybook": "cd packages/superset-ui-demo && npm run storybook", @@ -80,34 +80,34 @@ "@emotion/cache": "^11.4.0", "@emotion/react": "^11.4.1", "@emotion/styled": "^11.3.0", - "@superset-ui/chart-controls": "^0.18.25", - "@superset-ui/core": "^0.18.25", - "@superset-ui/legacy-plugin-chart-calendar": "^0.18.25", - "@superset-ui/legacy-plugin-chart-chord": "^0.18.25", - "@superset-ui/legacy-plugin-chart-country-map": "^0.18.25", - "@superset-ui/legacy-plugin-chart-event-flow": "^0.18.25", - "@superset-ui/legacy-plugin-chart-force-directed": "^0.18.25", - "@superset-ui/legacy-plugin-chart-heatmap": "^0.18.25", - "@superset-ui/legacy-plugin-chart-histogram": "^0.18.25", - "@superset-ui/legacy-plugin-chart-horizon": "^0.18.25", - "@superset-ui/legacy-plugin-chart-map-box": "^0.18.25", - "@superset-ui/legacy-plugin-chart-paired-t-test": "^0.18.25", - "@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.18.25", - "@superset-ui/legacy-plugin-chart-partition": "^0.18.25", - "@superset-ui/legacy-plugin-chart-pivot-table": "^0.18.25", - "@superset-ui/legacy-plugin-chart-rose": "^0.18.25", - "@superset-ui/legacy-plugin-chart-sankey": "^0.18.25", - "@superset-ui/legacy-plugin-chart-sankey-loop": "^0.18.25", - "@superset-ui/legacy-plugin-chart-sunburst": "^0.18.25", - "@superset-ui/legacy-plugin-chart-treemap": "^0.18.25", - "@superset-ui/legacy-plugin-chart-world-map": "^0.18.25", - "@superset-ui/legacy-preset-chart-deckgl": "^0.4.13", - "@superset-ui/legacy-preset-chart-nvd3": "^0.18.25", - "@superset-ui/plugin-chart-echarts": "^0.18.25", - "@superset-ui/plugin-chart-pivot-table": "^0.18.25", - "@superset-ui/plugin-chart-table": "^0.18.25", - "@superset-ui/plugin-chart-word-cloud": "^0.18.25", - "@superset-ui/preset-chart-xy": "^0.18.25", + "@superset-ui/chart-controls": "file://./packages/superset-ui-chart-controls", + "@superset-ui/core": "file://./packages/superset-ui-core", + "@superset-ui/legacy-plugin-chart-calendar": "file://./plugins/legacy-plugin-chart-calendar", + "@superset-ui/legacy-plugin-chart-chord": "file://./plugins/legacy-plugin-chart-chord", + "@superset-ui/legacy-plugin-chart-country-map": "file://./plugins/legacy-plugin-chart-country-map", + "@superset-ui/legacy-plugin-chart-event-flow": "file://./plugins/legacy-plugin-chart-event-flow", + "@superset-ui/legacy-plugin-chart-force-directed": "file://./plugins/legacy-plugin-chart-force-directed", + "@superset-ui/legacy-plugin-chart-heatmap": "file://./plugins/legacy-plugin-chart-heatmap", + "@superset-ui/legacy-plugin-chart-histogram": "file://./plugins/legacy-plugin-chart-histogram", + "@superset-ui/legacy-plugin-chart-horizon": "file://./plugins/legacy-plugin-chart-horizon", + "@superset-ui/legacy-plugin-chart-map-box": "file://./plugins/legacy-plugin-chart-map-box", + "@superset-ui/legacy-plugin-chart-paired-t-test": "file://./plugins/legacy-plugin-chart-paired-t-test", + "@superset-ui/legacy-plugin-chart-parallel-coordinates": "file://./plugins/legacy-plugin-chart-parallel-coordinates", + "@superset-ui/legacy-plugin-chart-partition": "file://./plugins/legacy-plugin-chart-partition", + "@superset-ui/legacy-plugin-chart-pivot-table": "file://./plugins/legacy-plugin-chart-pivot-table", + "@superset-ui/legacy-plugin-chart-rose": "file://./plugins/legacy-plugin-chart-rose", + "@superset-ui/legacy-plugin-chart-sankey": "file://./plugins/legacy-plugin-chart-sankey", + "@superset-ui/legacy-plugin-chart-sankey-loop": "file://./plugins/legacy-plugin-chart-sankey-loop", + "@superset-ui/legacy-plugin-chart-sunburst": "file://./plugins/legacy-plugin-chart-sunburst", + "@superset-ui/legacy-plugin-chart-treemap": "file://./plugins/legacy-plugin-chart-treemap", + "@superset-ui/legacy-plugin-chart-world-map": "file://./plugins/legacy-plugin-chart-world-map", + "@superset-ui/legacy-preset-chart-deckgl": "file://./plugins/legacy-preset-chart-deckgl", + "@superset-ui/legacy-preset-chart-nvd3": "file://./plugins/legacy-preset-chart-nvd3", + "@superset-ui/plugin-chart-echarts": "file://./plugins/plugin-chart-echarts", + "@superset-ui/plugin-chart-pivot-table": "file://./plugins/plugin-chart-pivot-table", + "@superset-ui/plugin-chart-table": "file://./plugins/plugin-chart-table", + "@superset-ui/plugin-chart-word-cloud": "file://./plugins/plugin-chart-word-cloud", + "@superset-ui/preset-chart-xy": "file://./plugins/preset-chart-xy", "@vx/responsive": "^0.0.195", "abortcontroller-polyfill": "^1.1.9", "antd": "^4.9.4", diff --git a/superset-frontend/scripts/lernaVersion.sh b/superset-frontend/scripts/lernaVersion.sh index 864d71978..f023f634f 100755 --- a/superset-frontend/scripts/lernaVersion.sh +++ b/superset-frontend/scripts/lernaVersion.sh @@ -53,11 +53,7 @@ fi # Get the current tag version tag=v$(node -e "process.stdout.write(require('./lerna.json').version)"); -message="chore: publish $tag" - -# Update the lock file here -rm "$rootDir/package-lock.json" -npm i --package-lock-only +message="chore(plugins): publish $tag" if [[ $? -ne 0 ]]; then echo '[ERROR] Can not update package-lock.json' diff --git a/superset-frontend/webpack.config.js b/superset-frontend/webpack.config.js index 98538dc9b..49ed956f9 100644 --- a/superset-frontend/webpack.config.js +++ b/superset-frontend/webpack.config.js @@ -284,6 +284,7 @@ const config = { resolve: { modules: [APP_DIR, 'node_modules', ROOT_DIR], alias: { + // TODO: remove alias once React has been upgraaded to v. 17 react: path.resolve('./node_modules/react'), }, extensions: ['.ts', '.tsx', '.js', '.jsx', '.yml'], @@ -422,33 +423,20 @@ const config = { }; // find all the symlinked plugins and use their source code for imports -Object.entries(packageConfig.dependencies).forEach(([pkg, version]) => { +Object.entries(packageConfig.dependencies).forEach(([pkg, relativeDir]) => { const srcPath = `./node_modules/${pkg}/src`; + const dir = relativeDir.replace('file://', ''); + if (/^superset-plugin-/.test(pkg) && fs.existsSync(srcPath)) { console.log( - `[Superset External Plugin] Use symlink source for ${pkg} @ ${version}`, + `[Superset External Plugin] Use symlink source for ${pkg} @ ${dir}`, ); // TODO: remove alias once React has been upgraaded to v. 17 - config.resolve.alias[pkg] = path.resolve( - APP_DIR, - `node_modules/${pkg}/src`, - ); - } else if (/^@superset-ui/.test(pkg) && fs.existsSync(srcPath)) { - console.log(`[Superset Plugin] Use symlink source for ${pkg} @ ${version}`); - // only allow exact match so imports like `@superset-ui/plugin-name/lib` - // and `@superset-ui/plugin-name/esm` can still work. - const pkgDirectory = pkg.split('/').pop(); - if (/^(core|chart-controls)/.test(pkgDirectory)) { - config.resolve.alias[pkg] = path.resolve( - APP_DIR, - `packages/superset-ui-${pkgDirectory}/src`, - ); - } else { - config.resolve.alias[pkg] = path.resolve( - APP_DIR, - `plugins/${pkgDirectory}/src`, - ); - } + config.resolve.alias[pkg] = path.resolve(APP_DIR, `${dir}/src`); + } + if (/^@superset-ui/.test(pkg) && fs.existsSync(srcPath)) { + console.log(`[Superset Plugin] Use symlink source for ${pkg} @ ${dir}`); + config.resolve.alias[pkg] = path.resolve(APP_DIR, `${dir}/src`); } }); console.log(''); // pure cosmetic new line