Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
build: try to merge superset-ui-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud committed Apr 1, 2020
1 parent 4a4edf1 commit 8231266
Show file tree
Hide file tree
Showing 91 changed files with 30,170 additions and 3,349 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ lib/
public/
node_modules/
tmp/
_gh-pages/

# Custom
*.map
Expand All @@ -43,12 +44,11 @@ jest.config.js
prettier.config.js
tsconfig.eslint.json
tsconfig.json
!demo/tsconfig.json
tsconfig.options.json
*.tsbuildinfo
webpack.config.js

# Lock files, libs should not have lock files
# Ignore npm lock files, always use yarn.loock instead
npm-shrinkwrap.json
package-lock.json
# disable to provide more stability for the ci builds
# yarn.lock
8 changes: 0 additions & 8 deletions docs/storybook.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ You can demo your changes by running the storybook demo locally with the followi
```sh
yarn install
yarn build
cd packages/superset-ui-demo
yarn storybook:run
```

Alternatively, you can demo your changes by using the following command while in
`packages/superset-ui-demo`:

```sh
yarn storybook
```

Expand Down
3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"lerna": "3.2.1",
"npmClient": "yarn",
"packages": [
"packages/*"
"packages/*",
"plugins/*"
],
"useWorkspaces": true,
"version": "0.12.12"
Expand Down
54 changes: 41 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"babel:cjs": "nimbus babel --clean --workspaces=\"@superset-ui/!(demo|generator-superset)\"",
"babel:esm": "nimbus babel --clean --workspaces=\"@superset-ui/!(demo|generator-superset)\" --esm",
"build:assets": "node ./scripts/buildAssets.js",
"clean": "rm -rf ./packages/**/{lib,esm}",
"demo": "cd packages/demo && yarn demo:build",
"storybook": "cd packages/demo && yarn storybook",
"sb": "yarn storybook",
"clean": "rm -rf ./{packages,plugins}/**/{lib,esm}",
"commit": "superset-commit",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 10",
"format": "yarn prettier --write",
Expand Down Expand Up @@ -42,12 +45,12 @@
],
"license": "Apache-2.0",
"devDependencies": {
"@airbnb/config-babel": "^2.1.3",
"@airbnb/config-eslint": "^2.1.3",
"@airbnb/config-jest": "^2.1.3",
"@airbnb/config-prettier": "^2.0.4",
"@airbnb/config-typescript": "^2.1.2",
"@airbnb/nimbus": "^2.1.3",
"@airbnb/config-babel": "^3.1.0",
"@airbnb/config-eslint": "^3.1.0",
"@airbnb/config-jest": "^3.0.1",
"@airbnb/config-prettier": "^3.1.0",
"@airbnb/config-typescript": "^3.0.1",
"@airbnb/nimbus": "^3.1.1",
"@superset-ui/commit-config": "^0.0.9",
"@types/enzyme": "^3.10.3",
"@types/jest": "^25.1.1",
Expand All @@ -59,20 +62,22 @@
"fast-glob": "^3.0.1",
"fs-extra": "^8.0.1",
"husky": "^4.2.1",
"identity-obj-proxy": "^3.0.0",
"jest-mock-console": "^1.0.0",
"lerna": "^3.15.0",
"lint-staged": "^10.0.3",
"react-test-renderer": "^16.9.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react": "^16.9.0"
"react-test-renderer": "^16.9.0"
},
"engines": {
"node": ">=10.10.0",
"npm": ">=6.8.0",
"yarn": ">=1.13.0"
},
"workspaces": [
"./packages/*"
"./packages/*",
"./plugins/*"
],
"browserslist": [
"last 3 chrome versions",
Expand Down Expand Up @@ -100,6 +105,10 @@
"globals": {
"caches": true
},
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "identity-obj-proxy"
},
"timers": "real",
"setupFilesAfterEnv": [
"@airbnb/config-jest/enzyme"
Expand All @@ -119,7 +128,13 @@
}
]
},
"prettier": {
"arrowParens": "avoid"
},
"eslint": {
"rules": {
"arrow-parens": ["warn", "as-needed"]
},
"overrides": [
{
"files": "./packages/generator-superset/**/*.test.{js,jsx,ts,tsx}",
Expand All @@ -141,14 +156,27 @@
"files": "*.{js,jsx,ts,tsx}",
"rules": {
"react/jsx-no-literals": "off",
"@typescript-eslint/no-explicit-any": ["warn", { "fixToUnknown": false }]
"@typescript-eslint/no-explicit-any": [
"warn",
{
"fixToUnknown": false
}
]
}
},
{
"files": "./scripts/*",
"env": {
"node": true
}
}
]
},
"typescript": {
"compilerOptions": {
"emitDeclarationOnly": true
"emitDeclarationOnly": true,
"composite": true,
"resolveJsonModule": true
}
}
},
Expand All @@ -159,7 +187,7 @@
}
},
"lint-staged": {
"./packages/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx,json,md}": [
"./{packages,plugins}/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx,json,md}": [
"yarn prettier --write",
"git add"
]
Expand Down
48 changes: 48 additions & 0 deletions packages/demo/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const path = require('path');
const { lstatSync, readdirSync } = require('fs');

// find @superset-ui packages
const basePath = path.resolve(__dirname, '../../../node_modules/@superset-ui');
const packages = readdirSync(basePath).filter(name => {
const stat = lstatSync(path.join(basePath, name));
return stat.isSymbolicLink();
});

module.exports = {
addons: [
'@storybook/preset-typescript',
'@storybook/addon-actions/register',
'@storybook/addon-knobs/register',
'storybook-addon-jsx/register',
'@storybook/addon-links/register',
],
stories: [
'../storybook/stories/**/*Stories.[tj]sx',
],
webpackFinal: config => {
config.module.rules.push({
test: /\.tsx?$/,
use: [
{
loader: require.resolve('ts-loader'),
},
],
});

config.resolve.extensions.push('.ts', '.tsx');
// let webpack know where to find the source code
Object.assign(config.resolve.alias, {
...packages.reduce(
(acc, name) => ({
...acc,
[`@superset-ui/${name}$`]: path.join(basePath, name, 'src'),
}),
{},
),
});

config.stats = 'errors-warnings';

return config;
},
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { addParameters, configure } from '@storybook/react';
import { addParameters, addDecorator } from '@storybook/react';
import { jsxDecorator } from 'storybook-addon-jsx';

import 'bootstrap/dist/css/bootstrap.min.css';
import './storybook.css';

addDecorator(jsxDecorator);

addParameters({
options: {
Expand All @@ -15,12 +21,8 @@ addParameters({
sidebarAnimations: true,
sortStoriesByKind: false,
url: '#',
storySort: (a, b) => {
return a[1].kind === b[1].kind ? 0 : a[1].id.localeCompare(b[1].id, undefined, { numeric: true });
},
},
});

function loadStorybook() {
require('./storybook.css');
require('../storybook/stories'); // all of the stories
}

configure(loadStorybook, module);
24 changes: 24 additions & 0 deletions packages/demo/.storybook/storybook.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
html,
body,
#root {
height: 100%;
font-family: BlinkMacSystemFont, Roboto, Helvetica Neue, sans-serif;
font-weight: 200;
color: #484848;
}
#root > div {
padding: 8px;
}

#root > div.superset-body {
background: #f5f5f5;
padding: 16px;
min-height: 100%;
}
#root > div.superset-body .panel {
margin-bottom: 0;
}

code {
background: none;
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"main": "index.js",
"scripts": {
"demo:clean": "rm -rf _gh-pages",
"demo:build": "build-storybook -o _gh-pages",
"demo:build": "npm run demo:clean && build-storybook -o _gh-pages",
"demo:publish": "gh-pages -d _gh-pages",
"deploy-demo": "npm run demo:clean && npm run demo:build && npm run demo:publish && npm run demo:clean",
"deploy-demo": "npm run demo:build && npm run demo:publish && npm run demo:clean",
"storybook": "start-storybook -p 9001"
},
"repository": {
Expand All @@ -29,32 +29,39 @@
},
"homepage": "https://github.com/apache-superset/superset-ui#readme",
"dependencies": {
"@storybook/addon-actions": "^5.0.6",
"@storybook/addon-knobs": "^5.2.3",
"@storybook/addon-links": "^5.0.6",
"@storybook/addons": "^5.0.6",
"@storybook/react": "^5.2.3",
"@superset-ui/chart": "0.12.12",
"@superset-ui/color": "0.12.12",
"@superset-ui/connection": "0.12.12",
"@storybook/addon-info": "^5.3.18",
"@storybook/addon-actions": "^5.3.18",
"@storybook/addon-knobs": "^5.3.18",
"@storybook/addon-links": "^5.3.18",
"@storybook/addons": "^5.3.18",
"@storybook/react": "^5.3.18",
"@storybook/preset-typescript": "^3.0.0",
"@superset-ui/chart": "*",
"@superset-ui/color": "*",
"@superset-ui/connection": "*",
"@superset-ui/legacy-plugin-chart-sankey": "^0.11.15",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.11.15",
"@superset-ui/legacy-plugin-chart-word-cloud": "^0.11.15",
"@superset-ui/legacy-preset-chart-big-number": "^0.11.15",
"@superset-ui/number-format": "0.12.12",
"@superset-ui/legacy-plugin-chart-table": "*",
"@superset-ui/legacy-preset-chart-big-number": "*",
"@superset-ui/number-format": "*",
"@superset-ui/plugin-chart-word-cloud": "^0.11.15",
"@superset-ui/query": "0.12.12",
"@superset-ui/time-format": "0.12.12",
"@superset-ui/query": "*",
"@superset-ui/time-format": "*",
"@superset-ui/translation": "*",
"@types/storybook__react": "4.0.2",
"bootstrap": "^4.3.1",
"bootstrap": "^3.4.1",
"core-js": "3.6.4",
"gh-pages": "^2.2.0",
"jquery": "^3.4.1",
"react": "^16.6.0",
"storybook-addon-jsx": "^7.1.0"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/plugin-transform-runtime": "^7.8.3",
"babel-loader": "^8.0.6",
"gh-pages": "^2.2.0"
"@babel/core": "^7.9.0",
"typescript": "^3.8.3",
"ts-loader": "^6.2.2",
"babel-loader": "^8.1.0",
"fork-ts-checker-webpack-plugin": "^4.1.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ export default class Expandable extends React.Component<Props, State> {

return (
<div>
<button
type="button"
onClick={this.handleToggle}
className="btn btn-outline-primary btn-sm"
>
<button type="button" className="btn btn-primary btn-sm" onClick={this.handleToggle}>
{`${open ? 'Hide' : 'Show'} ${expandableWhat}`}
</button>
<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class VerifyCORS extends React.Component<Props, State> {
.then(response => this.setState({ didVerify: true, error: undefined, payload: response }))
.catch((error: Response) => {
const { status, statusText = error } = error;
this.setState({ error: Error(`${status || ''}${status ? ':' : ''} ${statusText}`) });
this.setState({ error: new Error(`${status || ''}${status ? ':' : ''} ${statusText}`) });
});
}

Expand All @@ -94,11 +94,7 @@ export default class VerifyCORS extends React.Component<Props, State> {
3) click below to verify authentication. You may debug CORS further using the
`@superset-ui/connection` story. <br />
<br />
<button
type="button"
onClick={this.handleVerify}
className="btn btn-outline-primary btn-sm"
>
<button type="button" className="btn btn-primary btn-sm" onClick={this.handleVerify}>
Verify
</button>
<br />
Expand Down

0 comments on commit 8231266

Please sign in to comment.