Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(monorepo): update plugin dependencies #17837

Merged
merged 5 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ lib/
tmp/
node_modules/
tsconfig.json
lerna.json
CHANGELOG.md
*.geojson
*-topo.json
Expand Down
56 changes: 28 additions & 28 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 28 additions & 28 deletions superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 1 addition & 5 deletions superset-frontend/scripts/lernaVersion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to update lock file when use file dependencies in packages.json

npm i --package-lock-only
message="chore(plugins): publish $tag"
zhaoyongjie marked this conversation as resolved.
Show resolved Hide resolved

if [[ $? -ne 0 ]]; then
echo '[ERROR] Can not update package-lock.json'
Expand Down
32 changes: 10 additions & 22 deletions superset-frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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
Expand Down