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 (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud authored Apr 2, 2020
1 parent 27f7df6 commit 47f2265
Show file tree
Hide file tree
Showing 85 changed files with 30,115 additions and 3,277 deletions.
5 changes: 2 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 @@ -47,8 +48,6 @@ tsconfig.options.json
*.tsbuildinfo
webpack.config.js

# Lock files, libs should not have lock files
# Ignore npm lock files, always use yarn.lock instead
npm-shrinkwrap.json
package-lock.json
# disable to provide more stability for the ci builds
# yarn.lock
19 changes: 19 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
coverage:
status:
patch:
default:
target: 50%
threshold: 0%
project:
default:
target: 90%
# send notification if coverage change exceed this threshold
threshold: 5%
core-packages:
target: 100%
paths:
- packages
plugins:
target: 40%
paths:
- plugins
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
55 changes: 42 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"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/superset-ui-demo && yarn demo:build",
"demo:clean": "cd packages/superset-ui-demo && yarn demo:clean",
"storybook": "cd packages/superset-ui-demo && yarn storybook",
"sb": "yarn storybook",
"clean": "rm -rf ./{packages,plugins}/**/{lib,esm,tsconfig.tsbuildinfo} build/",
"commit": "superset-commit",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 10",
"format": "yarn prettier --write",
Expand Down Expand Up @@ -42,12 +46,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.2",
"@superset-ui/commit-config": "^0.0.9",
"@types/enzyme": "^3.10.3",
"@types/jest": "^25.1.1",
Expand All @@ -59,20 +63,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 +106,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 +129,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 +157,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 +188,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
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ describe('TooltipTable', () => {
);
expect(wrapper.find('tbody')).toHaveLength(1);
expect(wrapper.find('tr')).toHaveLength(3);
expect(
wrapper
.find('tr > td')
.first()
.text(),
).toEqual('Cersei');
expect(wrapper.find('tr > td').first().text()).toEqual('Cersei');
});
});
12 changes: 2 additions & 10 deletions packages/superset-ui-chart/test/components/SuperChart.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,7 @@ describe('SuperChart', () => {

return promiseTimeout(() => {
const renderedWrapper = wrapper.render();
const boundingBox = renderedWrapper
.find('div.test-component')
.parent()
.parent()
.parent();
const boundingBox = renderedWrapper.find('div.test-component').parent().parent().parent();
expect(boundingBox.css('width')).toEqual('50%');
expect(boundingBox.css('height')).toEqual('125px');
expect(renderedWrapper.find('div.test-component')).toHaveLength(1);
Expand All @@ -272,11 +268,7 @@ describe('SuperChart', () => {

return promiseTimeout(() => {
const renderedWrapper = wrapper.render();
const boundingBox = renderedWrapper
.find('div.test-component')
.parent()
.parent()
.parent();
const boundingBox = renderedWrapper.find('div.test-component').parent().parent().parent();
expect(boundingBox.css('width')).toEqual('50px');
expect(boundingBox.css('height')).toEqual('25%');
expect(renderedWrapper.find('div.test-component')).toHaveLength(1);
Expand Down
21 changes: 3 additions & 18 deletions packages/superset-ui-chart/test/components/SuperChartCore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,7 @@ describe('SuperChartCore', () => {
);

return promiseTimeout(() => {
expect(
wrapper
.render()
.find('.message')
.text(),
).toEqual('hulk');
expect(wrapper.render().find('.message').text()).toEqual('hulk');
});
});
it('uses preTransformProps when specified', () => {
Expand All @@ -115,12 +110,7 @@ describe('SuperChartCore', () => {
);

return promiseTimeout(() => {
expect(
wrapper
.render()
.find('.message')
.text(),
).toEqual('hulk');
expect(wrapper.render().find('.message').text()).toEqual('hulk');
});
});
it('uses postTransformProps when specified', () => {
Expand All @@ -132,12 +122,7 @@ describe('SuperChartCore', () => {
);

return promiseTimeout(() => {
expect(
wrapper
.render()
.find('.message')
.text(),
).toEqual('hulk');
expect(wrapper.render().find('.message').text()).toEqual('hulk');
});
});
it('renders if chartProps is not specified', () => {
Expand Down
4 changes: 1 addition & 3 deletions packages/superset-ui-color/src/CategoricalColorNamespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ export function getNamespace(name: string = DEFAULT_NAMESPACE) {
}

export function getColor(value?: string, schemeId?: string, namespace?: string) {
return getNamespace(namespace)
.getScale(schemeId)
.getColor(value);
return getNamespace(namespace).getScale(schemeId).getColor(value);
}

export function getScale(scheme?: string, namespace?: string) {
Expand Down
7 changes: 2 additions & 5 deletions packages/superset-ui-color/src/SequentialScheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { scaleLinear } from 'd3-scale';
import ColorScheme, { ColorSchemeConfig } from './ColorScheme';

function range(count: number) {
const values = [];
const values: number[] = [];
for (let i = 0; i < count; i += 1) {
values.push(i);
}
Expand Down Expand Up @@ -31,10 +31,7 @@ export default class SequentialScheme extends ColorScheme {
const denominator = this.colors.length - 1;
const domain = range(this.colors.length).map(i => valueScale(i / denominator));

return scaleLinear<string>()
.domain(domain)
.range(this.colors)
.clamp(true);
return scaleLinear<string>().domain(domain).range(this.colors).clamp(true);
}

getColors(numColors: number = this.colors.length): string[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,22 @@ describe('CategoricalColorNamespace', () => {
it('getColor(value) returns a color from default scheme in default namespace', () => {
const value = 'dog';
const color = getColor(value);
const color2 = getNamespace()
.getScale()
.getColor(value);
const color2 = getNamespace().getScale().getColor(value);
expect(color).toBe(color2);
});
it('getColor(value, scheme) returns a color from specified scheme in default namespace', () => {
const value = 'dog';
const scheme = 'testColors';
const color = getColor(value, scheme);
const color2 = getNamespace()
.getScale(scheme)
.getColor(value);
const color2 = getNamespace().getScale(scheme).getColor(value);
expect(color).toBe(color2);
});
it('getColor(value, scheme, namespace) returns a color from specified scheme in specified namespace', () => {
const value = 'dog';
const scheme = 'testColors';
const namespace = 'test-getColor';
const color = getColor(value, scheme, namespace);
const color2 = getNamespace(namespace)
.getScale(scheme)
.getColor(value);
const color2 = getNamespace(namespace).getScale(scheme).getColor(value);
expect(color).toBe(color2);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/superset-ui-core/src/models/ExtensibleFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class ExtensibleFunction extends Function {
constructor(fn: Function) {
super();

// eslint-disable-next-line no-constructor-return
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, no-constructor-return
return Object.setPrototypeOf(fn, new.target.prototype);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ExtensibleFunction from '../../src/models/ExtensibleFunction';
import { ExtensibleFunction } from '../../src';

describe('ExtensibleFunction', () => {
class Func1 extends ExtensibleFunction {
Expand Down
2 changes: 1 addition & 1 deletion packages/superset-ui-core/test/models/Plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Plugin from '../../src/models/Plugin';
import { Plugin } from '../../src';

describe('Plugin', () => {
it('exists', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/superset-ui-core/test/models/Preset.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Plugin from '../../src/models/Plugin';
import Preset from '../../src/models/Preset';
import { Plugin, Preset } from '../../src';

describe('Preset', () => {
it('exists', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import RegistryWithDefaultKey from '../../src/models/RegistryWithDefaultKey';
import Registry from '../../src/models/Registry';
import { Registry, RegistryWithDefaultKey } from '../../src';

describe('RegistryWithDefaultKey', () => {
let registry: RegistryWithDefaultKey<number>;
Expand Down Expand Up @@ -31,10 +30,7 @@ describe('RegistryWithDefaultKey', () => {

describe('.get()', () => {
beforeEach(() => {
registry
.registerValue('abc', 100)
.registerValue('def', 200)
.setDefaultKey('abc');
registry.registerValue('abc', 100).registerValue('def', 200).setDefaultKey('abc');
});
it('.get() returns value from default key', () => {
expect(registry.get()).toEqual(100);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import convertKeysToCamelCase from '../../src/utils/convertKeysToCamelCase';
import { convertKeysToCamelCase } from '../../src';

describe('convertKeysToCamelCase(object)', () => {
it('returns undefined for undefined input', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/superset-ui-core/test/utils/isDefined.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isDefined from '../../src/utils/isDefined';
import { isDefined } from '../../src';

describe('isDefined(value)', () => {
it('returns true if value is not null and not undefined', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/superset-ui-core/test/utils/isRequired.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isRequired from '../../src/utils/isRequired';
import { isRequired } from '../../src';

describe('isRequired(field)', () => {
it('should throw error with the given field in the message', () => {
Expand Down
Loading

1 comment on commit 47f2265

@vercel
Copy link

@vercel vercel bot commented on 47f2265 Apr 2, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.