mirror of https://github.com/apache/superset.git
refactor(monorepo): move superset-ui to superset(stage 2) (#17552)
This commit is contained in:
parent
bfba4f1689
commit
3c41ff68a4
12
.codecov.yml
12
.codecov.yml
|
@ -3,6 +3,7 @@ codecov:
|
||||||
after_n_builds: 4
|
after_n_builds: 4
|
||||||
ignore:
|
ignore:
|
||||||
- "superset/migrations/versions/*.py"
|
- "superset/migrations/versions/*.py"
|
||||||
|
- "superset-frontend/packages/superset-ui-demo/**/*"
|
||||||
- "**/*.stories.tsx"
|
- "**/*.stories.tsx"
|
||||||
- "**/*.stories.jsx"
|
- "**/*.stories.jsx"
|
||||||
coverage:
|
coverage:
|
||||||
|
@ -14,6 +15,17 @@ coverage:
|
||||||
# project coverage decrease:
|
# project coverage decrease:
|
||||||
target: auto
|
target: auto
|
||||||
threshold: 0%
|
threshold: 0%
|
||||||
|
core-packages-ts:
|
||||||
|
target: 95%
|
||||||
|
paths:
|
||||||
|
- 'superset-frontend/packages'
|
||||||
|
- '!superset-frontend/packages/**/*.jsx'
|
||||||
|
- '!superset-frontend/packages/**/*.tsx'
|
||||||
|
core-packages-tsx:
|
||||||
|
target: 50%
|
||||||
|
paths:
|
||||||
|
- 'superset-frontend/packages/**/*.jsx'
|
||||||
|
- 'superset-frontend/packages/**/*.tsx'
|
||||||
patch:
|
patch:
|
||||||
default:
|
default:
|
||||||
informational: true
|
informational: true
|
||||||
|
|
|
@ -43,11 +43,24 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
npm run lint
|
npm run lint
|
||||||
npm run prettier-check
|
npm run prettier-check
|
||||||
|
- name: Build plugins packages
|
||||||
|
if: steps.check.outcome == 'failure'
|
||||||
|
working-directory: ./superset-frontend
|
||||||
|
run: npm run plugins:build
|
||||||
|
- name: Build plugins Storybook
|
||||||
|
if: steps.check.outcome == 'failure'
|
||||||
|
working-directory: ./superset-frontend
|
||||||
|
run: npm run plugins:build-storybook
|
||||||
- name: unit tests
|
- name: unit tests
|
||||||
if: steps.check.outcome == 'failure'
|
if: steps.check.outcome == 'failure'
|
||||||
working-directory: ./superset-frontend
|
working-directory: ./superset-frontend
|
||||||
run: |
|
run: |
|
||||||
npm run test -- --coverage
|
npm run test -- --coverage
|
||||||
|
# todo: remove this step when fix generator as a project in root jest.config.js
|
||||||
|
- name: generator-superset unit tests
|
||||||
|
if: steps.check.outcome == 'failure'
|
||||||
|
working-directory: ./superset-frontend/packages/generator-superset
|
||||||
|
run: npx jest
|
||||||
- name: Upload code coverage
|
- name: Upload code coverage
|
||||||
if: steps.check.outcome == 'failure'
|
if: steps.check.outcome == 'failure'
|
||||||
working-directory: ./superset-frontend
|
working-directory: ./superset-frontend
|
||||||
|
|
|
@ -60,14 +60,29 @@ tmp
|
||||||
rat-results.txt
|
rat-results.txt
|
||||||
superset/app/
|
superset/app/
|
||||||
|
|
||||||
# Node.js, webpack artifacts
|
# Node.js, webpack artifacts, storybook
|
||||||
*.entry.js
|
*.entry.js
|
||||||
*.js.map
|
*.js.map
|
||||||
node_modules
|
node_modules
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
superset/static/assets
|
superset/static/assets
|
||||||
superset/static/version_info.json
|
superset/static/version_info.json
|
||||||
|
superset-frontend/**/esm/*
|
||||||
|
superset-frontend/**/lib/*
|
||||||
|
superset-frontend/**/storybook-static/*
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
|
*.map
|
||||||
|
*.min.js
|
||||||
|
test-changelog.md
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Ignore package-lock in packages
|
||||||
|
plugins/*/package-lock.json
|
||||||
|
packages/*/package-lock.json
|
||||||
|
|
||||||
|
# For country map geojson conversion script
|
||||||
|
.ipynb_checkpoints/
|
||||||
|
scripts/*.zip
|
||||||
|
|
||||||
# IntelliJ
|
# IntelliJ
|
||||||
*.iml
|
*.iml
|
||||||
|
|
|
@ -57,13 +57,11 @@ ENV BUILD_CMD=${NPM_BUILD_CMD}
|
||||||
RUN mkdir -p /app/superset-frontend
|
RUN mkdir -p /app/superset-frontend
|
||||||
RUN mkdir -p /app/superset/assets
|
RUN mkdir -p /app/superset/assets
|
||||||
COPY ./docker/frontend-mem-nag.sh /
|
COPY ./docker/frontend-mem-nag.sh /
|
||||||
COPY ./superset-frontend/package* /app/superset-frontend/
|
COPY ./superset-frontend /app/superset-frontend
|
||||||
RUN /frontend-mem-nag.sh \
|
RUN /frontend-mem-nag.sh \
|
||||||
&& cd /app/superset-frontend \
|
&& cd /app/superset-frontend \
|
||||||
&& npm ci
|
&& npm ci
|
||||||
|
|
||||||
# Next, copy in the rest and let webpack do its thing
|
|
||||||
COPY ./superset-frontend /app/superset-frontend
|
|
||||||
# This seems to be the most expensive step
|
# This seems to be the most expensive step
|
||||||
RUN cd /app/superset-frontend \
|
RUN cd /app/superset-frontend \
|
||||||
&& npm run ${BUILD_CMD} \
|
&& npm run ${BUILD_CMD} \
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
|
||||||
|
LICENSE_TMP=$(mktemp)
|
||||||
|
cat <<'EOF'> "$LICENSE_TMP"
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cd $ROOT_DIR
|
||||||
|
pybabel extract \
|
||||||
|
-F superset/translations/babel.cfg \
|
||||||
|
-o superset/translations/messages.pot \
|
||||||
|
--sort-output \
|
||||||
|
--copyright-holder=Superset \
|
||||||
|
--project=Superset \
|
||||||
|
-k _ -k __ -k t -k tn -k tct .
|
||||||
|
cat $LICENSE_TMP $ROOT_DIR/superset/translations/messages.pot > messages.pot.tmp \
|
||||||
|
&& mv messages.pot.tmp $ROOT_DIR/superset/translations/messages.pot \
|
||||||
|
&& cd $CURRENT_DIR
|
|
@ -28,4 +28,9 @@ src/dashboard/deprecated/*
|
||||||
src/temp/*
|
src/temp/*
|
||||||
**/node_modules
|
**/node_modules
|
||||||
*.d.ts
|
*.d.ts
|
||||||
|
coverage/
|
||||||
|
esm/
|
||||||
|
lib/
|
||||||
|
tmp/
|
||||||
|
storybook-static/
|
||||||
temporary_superset_ui/**/*
|
temporary_superset_ui/**/*
|
||||||
|
|
|
@ -25,6 +25,18 @@ Object.entries(packageConfig.dependencies).forEach(([pkg]) => {
|
||||||
importCoreModules.push(pkg);
|
importCoreModules.push(pkg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ignore files when running ForkTsCheckerWebpackPlugin
|
||||||
|
let ignorePatterns = [];
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
ignorePatterns = [
|
||||||
|
'*.test.{js,ts,jsx,tsx}',
|
||||||
|
'plugins/**/test/**/*',
|
||||||
|
'packages/**/test/**/*',
|
||||||
|
'packages/generator-superset/**/*',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: [
|
extends: [
|
||||||
'airbnb',
|
'airbnb',
|
||||||
|
@ -307,4 +319,5 @@ module.exports = {
|
||||||
'react/static-property-placement': 0, // disabled temporarily
|
'react/static-property-placement': 0, // disabled temporarily
|
||||||
'prettier/prettier': 'error',
|
'prettier/prettier': 'error',
|
||||||
},
|
},
|
||||||
|
ignorePatterns,
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,6 +38,14 @@ module.exports = {
|
||||||
'@babel/preset-react',
|
'@babel/preset-react',
|
||||||
{ development: process.env.BABEL_ENV === 'development' },
|
{ development: process.env.BABEL_ENV === 'development' },
|
||||||
],
|
],
|
||||||
|
'@babel/preset-typescript',
|
||||||
|
[
|
||||||
|
'@emotion/babel-preset-css-prop',
|
||||||
|
{
|
||||||
|
autoLabel: 'dev-only',
|
||||||
|
labelFormat: '[local]',
|
||||||
|
},
|
||||||
|
],
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
'lodash',
|
'lodash',
|
||||||
|
@ -47,6 +55,8 @@ module.exports = {
|
||||||
['@babel/plugin-proposal-private-methods', { loose: true }],
|
['@babel/plugin-proposal-private-methods', { loose: true }],
|
||||||
['@babel/plugin-proposal-nullish-coalescing-operator', { loose: true }],
|
['@babel/plugin-proposal-nullish-coalescing-operator', { loose: true }],
|
||||||
['@babel/plugin-transform-runtime', { corejs: 3 }],
|
['@babel/plugin-transform-runtime', { corejs: 3 }],
|
||||||
|
// only used in packages/superset-ui-core/src/chart/components/reactify.tsx
|
||||||
|
['babel-plugin-typescript-to-proptypes', { loose: true }],
|
||||||
'react-hot-loader/babel',
|
'react-hot-loader/babel',
|
||||||
],
|
],
|
||||||
env: {
|
env: {
|
||||||
|
@ -70,7 +80,14 @@ module.exports = {
|
||||||
},
|
},
|
||||||
// build instrumented code for testing code coverage with Cypress
|
// build instrumented code for testing code coverage with Cypress
|
||||||
instrumented: {
|
instrumented: {
|
||||||
plugins: ['istanbul'],
|
plugins: [
|
||||||
|
[
|
||||||
|
'istanbul',
|
||||||
|
{
|
||||||
|
exclude: ['plugins/**/*', 'packages/**/*'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
},
|
},
|
||||||
production: {
|
production: {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
|
@ -16,23 +16,48 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
testRegex: '(\\/spec|\\/src)\\/.*(_spec|\\.test)\\.(j|t)sx?$',
|
testRegex: '\\/(spec|src|plugins|packages)\\/.*(_spec|\\.test)\\.[jt]sx?$',
|
||||||
|
testPathIgnorePatterns: [
|
||||||
|
'packages\\/generator-superset\\/.*',
|
||||||
|
'/node_modules/',
|
||||||
|
],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'\\.(css|less|geojson)$': '<rootDir>/spec/__mocks__/mockExportObject.js',
|
'\\.(css|less|geojson)$': '<rootDir>/spec/__mocks__/mockExportObject.js',
|
||||||
'\\.(gif|ttf|eot|png|jpg)$': '<rootDir>/spec/__mocks__/mockExportString.js',
|
'\\.(gif|ttf|eot|png|jpg)$': '<rootDir>/spec/__mocks__/mockExportString.js',
|
||||||
'\\.svg$': '<rootDir>/spec/__mocks__/svgrMock.tsx',
|
'\\.svg$': '<rootDir>/spec/__mocks__/svgrMock.tsx',
|
||||||
'^src/(.*)$': '<rootDir>/src/$1',
|
'^src/(.*)$': '<rootDir>/src/$1',
|
||||||
'^spec/(.*)$': '<rootDir>/spec/$1',
|
'^spec/(.*)$': '<rootDir>/spec/$1',
|
||||||
|
// mapping to souce code instead of lib or esm module
|
||||||
|
'@superset-ui/(((?!(legacy-preset-chart-deckgl|core/src)).)*)$':
|
||||||
|
'<rootDir>/node_modules/@superset-ui/$1/src',
|
||||||
|
'@superset-ui/core/src/(.*)$':
|
||||||
|
'<rootDir>/node_modules/@superset-ui/core/src/$1',
|
||||||
},
|
},
|
||||||
testEnvironment: 'jsdom',
|
testEnvironment: 'jsdom',
|
||||||
modulePathIgnorePatterns: ['<rootDir>/temporary_superset_ui'],
|
modulePathIgnorePatterns: ['<rootDir>/temporary_superset_ui'],
|
||||||
setupFilesAfterEnv: ['<rootDir>/spec/helpers/setup.ts'],
|
setupFilesAfterEnv: ['<rootDir>/spec/helpers/setup.ts'],
|
||||||
testURL: 'http://localhost',
|
testURL: 'http://localhost',
|
||||||
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!**/*.stories.*'],
|
collectCoverageFrom: [
|
||||||
|
'src/**/*.{js,jsx,ts,tsx}',
|
||||||
|
'{packages,plugins}/**/src/**/*.{js,jsx,ts,tsx}',
|
||||||
|
'!**/*.stories.*',
|
||||||
|
'!packages/superset-ui-demo/**/*',
|
||||||
|
],
|
||||||
coverageDirectory: '<rootDir>/coverage/',
|
coverageDirectory: '<rootDir>/coverage/',
|
||||||
|
coveragePathIgnorePatterns: [
|
||||||
|
'coverage/',
|
||||||
|
'node_modules/',
|
||||||
|
'public/',
|
||||||
|
'tmp/',
|
||||||
|
'dist/',
|
||||||
|
],
|
||||||
|
coverageReporters: ['lcov', 'json-summary', 'html'],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.jsx?$': 'babel-jest',
|
'^.+\\.jsx?$': 'babel-jest',
|
||||||
|
// ts-jest can't load plugin 'babel-plugin-typescript-to-proptypes'
|
||||||
|
'reactify\\.tsx$': 'babel-jest',
|
||||||
'^.+\\.tsx?$': 'ts-jest',
|
'^.+\\.tsx?$': 'ts-jest',
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
||||||
|
@ -40,9 +65,15 @@ module.exports = {
|
||||||
globals: {
|
globals: {
|
||||||
'ts-jest': {
|
'ts-jest': {
|
||||||
babelConfig: true,
|
babelConfig: true,
|
||||||
|
// todo: duo to packages/**/test and plugins/**/test lack of type checking
|
||||||
|
// turning off checking in Jest.
|
||||||
|
// https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules
|
||||||
|
isolatedModules: true,
|
||||||
diagnostics: {
|
diagnostics: {
|
||||||
warnOnly: true,
|
warnOnly: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
__DEV__: true,
|
||||||
|
caches: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"lerna": "3.2.1",
|
"lerna": "3.2.1",
|
||||||
"npmClient": "npm",
|
"npmClient": "npm",
|
||||||
"packages": ["packages/*", "plugins/*", "temporary_superset_ui/*"],
|
"packages": ["packages/*", "plugins/*"],
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"ignoreChanges": [
|
"ignoreChanges": [
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,22 +28,37 @@
|
||||||
"doc": "docs",
|
"doc": "docs",
|
||||||
"test": "spec"
|
"test": "spec"
|
||||||
},
|
},
|
||||||
|
"workspaces": [
|
||||||
|
"packages/*",
|
||||||
|
"plugins/*"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"_lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx,.ts,tsx .",
|
||||||
|
"_prettier": "prettier './({src,spec,cypress-base,plugins,packages}/**/*{.js,.jsx,.ts,.tsx,.css,.less,.scss,.sass}|package.json)'",
|
||||||
"build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production BABEL_ENV=\"${BABEL_ENV:=production}\" webpack --mode=production --color",
|
"build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production BABEL_ENV=\"${BABEL_ENV:=production}\" webpack --mode=production --color",
|
||||||
"build-dev": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=development webpack --mode=development --color",
|
"build-dev": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=development webpack --mode=development --color",
|
||||||
"build-instrumented": "cross-env NODE_ENV=production BABEL_ENV=instrumented webpack --mode=production --color",
|
"build-instrumented": "cross-env NODE_ENV=production BABEL_ENV=instrumented webpack --mode=production --color",
|
||||||
"build-storybook": "build-storybook",
|
"build-storybook": "build-storybook",
|
||||||
"check-translation": "prettier --check ../superset/translations/**/LC_MESSAGES/*.json",
|
"check-translation": "prettier --check ../superset/translations/**/LC_MESSAGES/*.json",
|
||||||
"clean-css": "prettier --write 'src/**/*.{css,less,sass,scss}'",
|
|
||||||
"clean-translation": "prettier --write ../superset/translations/**/LC_MESSAGES/*.json",
|
"clean-translation": "prettier --write ../superset/translations/**/LC_MESSAGES/*.json",
|
||||||
"cover": "cross-env NODE_ENV=test jest --coverage",
|
"cover": "cross-env NODE_ENV=test jest --coverage",
|
||||||
"dev": "webpack --mode=development --color --watch",
|
"dev": "webpack --mode=development --color --watch",
|
||||||
"dev-server": "cross-env NODE_ENV=development BABEL_ENV=development node --max_old_space_size=4096 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --mode=development",
|
"dev-server": "cross-env NODE_ENV=development BABEL_ENV=development node --max_old_space_size=4096 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --mode=development",
|
||||||
"format": "prettier --write './{src,spec,cypress-base,plugins,packages}/**/*{.js,.jsx,.ts,.tsx,.css,.less,.scss,.sass}'",
|
"format": "npm run _prettier -- --write",
|
||||||
"lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx,.ts,.tsx . && npm run type",
|
"lint": "npm run _lint && npm run type",
|
||||||
"lint-fix": "eslint --fix --ignore-path=.eslintignore --ext .js,.jsx,.ts,tsx . && npm run clean-css && npm run type",
|
"lint-fix": "npm run _lint -- --fix && npm run type",
|
||||||
"prettier": "npm run format",
|
"plugins:build": "node ./scripts/build.js",
|
||||||
"prettier-check": "prettier --check 'src/**/*.{css,less,sass,scss}'",
|
"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: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",
|
||||||
|
"prettier": "npm run _prettier -- --write",
|
||||||
|
"prettier-check": "npm run _prettier -- --check",
|
||||||
"prod": "npm run build",
|
"prod": "npm run build",
|
||||||
"prune": "rm -rf ./{packages,plugins}/*/{lib,esm,tsconfig.tsbuildinfo,package-lock.json}",
|
"prune": "rm -rf ./{packages,plugins}/*/{lib,esm,tsconfig.tsbuildinfo,package-lock.json}",
|
||||||
"storybook": "cross-env NODE_ENV=development BABEL_ENV=development start-storybook -s ./src/assets/images -p 6006",
|
"storybook": "cross-env NODE_ENV=development BABEL_ENV=development start-storybook -s ./src/assets/images -p 6006",
|
||||||
|
@ -115,6 +130,7 @@
|
||||||
"abortcontroller-polyfill": "^1.1.9",
|
"abortcontroller-polyfill": "^1.1.9",
|
||||||
"antd": "^4.9.4",
|
"antd": "^4.9.4",
|
||||||
"array-move": "^2.2.1",
|
"array-move": "^2.2.1",
|
||||||
|
"babel-plugin-typescript-to-proptypes": "^2.0.0",
|
||||||
"bootstrap": "^3.4.1",
|
"bootstrap": "^3.4.1",
|
||||||
"bootstrap-slider": "^10.0.0",
|
"bootstrap-slider": "^10.0.0",
|
||||||
"brace": "^0.11.1",
|
"brace": "^0.11.1",
|
||||||
|
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
@ -0,0 +1,24 @@
|
||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
displayName: 'generator-superset',
|
||||||
|
testRegex: 'test\\/.*\\.test\\.[jt]sx?$',
|
||||||
|
testEnvironment: 'node',
|
||||||
|
};
|
|
@ -23,7 +23,8 @@
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"yeoman-assert": "^3.1.0",
|
"yeoman-assert": "^3.1.0",
|
||||||
"yeoman-test": "^2.0.0"
|
"yeoman-test": "^6.2.0",
|
||||||
|
"fs-extra": "^10.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"npm": ">= 4.0.0"
|
"npm": ">= 4.0.0"
|
|
@ -17,43 +17,22 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const assert = require('yeoman-assert');
|
const assert = require('yeoman-assert');
|
||||||
const helpers = require('yeoman-test');
|
const helpers = require('yeoman-test');
|
||||||
|
const appModule = require('../generators/app');
|
||||||
|
|
||||||
describe('generator-superset:app', () => {
|
test('generator-superset:app:creates files', () =>
|
||||||
let dir;
|
helpers
|
||||||
|
.run(appModule)
|
||||||
beforeAll(() => {
|
.withPrompts({
|
||||||
dir = process.cwd();
|
|
||||||
|
|
||||||
return helpers.run(path.join(__dirname, '../generators/app')).withPrompts({
|
|
||||||
subgenerator: 'package',
|
subgenerator: 'package',
|
||||||
name: 'my-package',
|
name: 'my-package',
|
||||||
});
|
})
|
||||||
});
|
.then(function () {
|
||||||
|
|
||||||
/*
|
|
||||||
* Change working directory back to original working directory
|
|
||||||
* after the test has completed.
|
|
||||||
* yeoman tests switch to tmp directory and write files there.
|
|
||||||
* Usually this is fine for solo package.
|
|
||||||
* However, for a monorepo like this one,
|
|
||||||
* it made jest confuses with current directory
|
|
||||||
* (being in tmp directory instead of superset-ui root)
|
|
||||||
* and interferes with other tests in sibling packages
|
|
||||||
* that are run after the yeoman tests.
|
|
||||||
*/
|
|
||||||
afterAll(() => {
|
|
||||||
process.chdir(dir);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('creates files', () => {
|
|
||||||
assert.file([
|
assert.file([
|
||||||
'package.json',
|
'package.json',
|
||||||
'README.md',
|
'README.md',
|
||||||
'src/index.ts',
|
'src/index.ts',
|
||||||
'test/index.test.ts',
|
'test/index.test.ts',
|
||||||
]);
|
]);
|
||||||
});
|
}));
|
||||||
});
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const assert = require('yeoman-assert');
|
||||||
|
const helpers = require('yeoman-test');
|
||||||
|
const fs = require('fs-extra');
|
||||||
|
const packageModule = require('../generators/package');
|
||||||
|
|
||||||
|
test('generator-superset:package:creates typescript files', () =>
|
||||||
|
helpers
|
||||||
|
.run(packageModule)
|
||||||
|
.inTmpDir(function (dir) {
|
||||||
|
// `dir` is the path to the new temporary directory
|
||||||
|
fs.copySync(path.join(__dirname, '../generators/package'), dir);
|
||||||
|
})
|
||||||
|
.withPrompts({ name: 'my-package', language: 'typescript' })
|
||||||
|
.withOptions({ skipInstall: true })
|
||||||
|
.then(function () {
|
||||||
|
assert.file([
|
||||||
|
'package.json',
|
||||||
|
'README.md',
|
||||||
|
'src/index.ts',
|
||||||
|
'test/index.test.ts',
|
||||||
|
]);
|
||||||
|
}));
|
||||||
|
|
||||||
|
test('generator-superset:package:creates javascript files', () =>
|
||||||
|
helpers
|
||||||
|
.run(packageModule)
|
||||||
|
.inTmpDir(function (dir) {
|
||||||
|
// `dir` is the path to the new temporary directory
|
||||||
|
fs.copySync(path.join(__dirname, '../generators/package'), dir);
|
||||||
|
})
|
||||||
|
.withPrompts({ name: 'my-package', language: 'javascript' })
|
||||||
|
.withOptions({ skipInstall: true })
|
||||||
|
.then(function () {
|
||||||
|
assert.file([
|
||||||
|
'package.json',
|
||||||
|
'README.md',
|
||||||
|
'src/index.js',
|
||||||
|
'test/index.test.js',
|
||||||
|
]);
|
||||||
|
}));
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* eslint-env node */
|
||||||
|
const path = require('path');
|
||||||
|
const assert = require('yeoman-assert');
|
||||||
|
const helpers = require('yeoman-test');
|
||||||
|
const fs = require('fs-extra');
|
||||||
|
const pluginChartModule = require('../generators/plugin-chart');
|
||||||
|
|
||||||
|
test('generator-superset:plugin-chart:creates files', () =>
|
||||||
|
helpers
|
||||||
|
.run(pluginChartModule)
|
||||||
|
.inTmpDir(function (dir) {
|
||||||
|
// `dir` is the path to the new temporary directory
|
||||||
|
fs.copySync(path.join(__dirname, '../generators/plugin-chart'), dir);
|
||||||
|
})
|
||||||
|
.withPrompts({
|
||||||
|
packageName: 'cold-map',
|
||||||
|
description: 'Cold Map',
|
||||||
|
componentType: 'function',
|
||||||
|
chartType: 'regular',
|
||||||
|
})
|
||||||
|
.withOptions({ skipInstall: true })
|
||||||
|
.then(function () {
|
||||||
|
assert.file([
|
||||||
|
'package.json',
|
||||||
|
'README.md',
|
||||||
|
'src/plugin/buildQuery.ts',
|
||||||
|
'src/plugin/controlPanel.ts',
|
||||||
|
'src/plugin/index.ts',
|
||||||
|
'src/plugin/transformProps.ts',
|
||||||
|
'src/ColdMap.tsx',
|
||||||
|
'src/index.ts',
|
||||||
|
'test/index.test.ts',
|
||||||
|
'test/plugin/buildQuery.test.ts',
|
||||||
|
'test/plugin/transformProps.test.ts',
|
||||||
|
'types/external.d.ts',
|
||||||
|
'src/images/thumbnail.png',
|
||||||
|
]);
|
||||||
|
}));
|
|
@ -5,15 +5,9 @@
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"rootDir": "."
|
"rootDir": "."
|
||||||
},
|
},
|
||||||
"extends": "../../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"include": [
|
"include": [
|
||||||
"**/*",
|
"**/*",
|
||||||
"../types/**/*",
|
"../../types/**/*",
|
||||||
"../../../types/**/*"
|
|
||||||
],
|
],
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"path": ".."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue