Skip to content

Commit ac8cdb4

Browse files
committed
build(build): build project and config
build project and config
1 parent 683a8f3 commit ac8cdb4

84 files changed

Lines changed: 22572 additions & 7613 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
module.exports = {
3+
presets: [
4+
[
5+
"@babel/preset-env",
6+
{
7+
modules: false
8+
}
9+
],
10+
"@babel/preset-react",
11+
"@babel/preset-typescript"
12+
],
13+
plugins: [
14+
"@babel/plugin-transform-runtime",
15+
[
16+
"@babel/plugin-proposal-decorators",
17+
{
18+
legacy: true
19+
}
20+
],
21+
"@babel/plugin-proposal-class-properties",
22+
"@babel/plugin-proposal-object-rest-spread",
23+
"@babel/plugin-transform-modules-commonjs"
24+
]
25+
};

.czrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// path 用来指定适配器
2+
{ "path": "cz-conventional-changelog" }

.eslintignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
storybook-static/
2+
node_modules/
3+
.cache-loader/
4+
.history
5+
npm-error.log
6+
npm-debug.log
7+
debug.log
8+
yarn-error.log
9+
package-lock.json

.eslintrc.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"ecmaVersion": 8,
5+
"sourceType": "module",
6+
"project": "./tsconfig.json"
7+
},
8+
"extends":[
9+
"standard",
10+
"plugin:react/recommended",
11+
"plugin:@typescript-eslint/recommended"
12+
],
13+
"plugins": [
14+
"import",
15+
"react",
16+
"jsx-a11y"
17+
],
18+
"settings": {
19+
"react": {
20+
"pragma": "React",
21+
"version": "16.6.3"
22+
}
23+
},
24+
"env": {
25+
"browser": true,
26+
"node": true,
27+
"es6": true
28+
},
29+
"globals": {
30+
"expect": true,
31+
"test": true,
32+
"describe": true,
33+
"beforeEach": true,
34+
"afterEach": true,
35+
"jest": true,
36+
"it": true
37+
},
38+
"rules": {
39+
"semi": 0,
40+
"strict": 0,
41+
"indent": [2, 4, { "SwitchCase": 1 }],
42+
"arrow-body-style": 0,
43+
"no-return-assign": 0,
44+
"no-useless-constructor": 0,
45+
"eqeqeq": 0,
46+
"no-console": 0,
47+
"no-param-reassign": 0,
48+
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false }],
49+
"import/no-extraneous-dependencies": ["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}],
50+
"react/display-name":[0],
51+
"react/sort-comp": 0,
52+
"react/jsx-uses-react": 1,
53+
"react/prefer-stateless-function": 0,
54+
"react/jsx-closing-bracket-location": 0,
55+
"jsx-a11y/no-static-element-interactions": 0,
56+
"react/prop-types": [0, {"ignore": ["children"]}],
57+
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".js", ".jsx"] }],
58+
"react/react-in-jsx-scope": 0,
59+
"@typescript-eslint/no-explicit-any": 0,
60+
"@typescript-eslint/explicit-member-accessibility": 0,
61+
"@typescript-eslint/explicit-function-return-type": 0,
62+
"@typescript-eslint/no-use-before-define": 0,
63+
"@typescript-eslint/no-var-requires": 0,
64+
"@typescript-eslint/interface-name-prefix":0,
65+
"@typescript-eslint/no-empty-interface":0,
66+
"prefer-const": 0,
67+
"no-var": 0,
68+
"prefer-rest-params": 0
69+
}
70+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
.history/
2+
storybook-static
3+
lib

.storybook/.babelrc

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": false
7+
}
8+
],
9+
"@babel/preset-react",
10+
"@babel/preset-typescript"
11+
],
12+
"env": {
13+
"test": {
14+
"presets": [
15+
"@babel/preset-env",
16+
"@babel/preset-react",
17+
"@babel/preset-typescript"
18+
]
19+
}
20+
},
21+
"plugins": [
22+
[
23+
"import",
24+
{
25+
"libraryName": "antd",
26+
"style": true
27+
}
28+
],
29+
"@babel/transform-runtime",
30+
[
31+
"@babel/plugin-proposal-decorators",
32+
{
33+
"legacy": true
34+
}
35+
],
36+
"@babel/plugin-syntax-dynamic-import",
37+
"macros",
38+
"@babel/plugin-proposal-class-properties"
39+
],
40+
"babelrcRoots": [
41+
".",
42+
".storybook"
43+
]
44+
}

.storybook/addons.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import '@storybook/addon-storysource/register';
22
import '@storybook/addon-notes/register';
33
import '@storybook/addon-knobs/register';
4-
import '@storybook/addon-actions/register';
5-
import '@storybook/addon-links/register';
6-
import '@storybook/addon-options/register';
4+
import '@storybook/addon-actions/register';

.storybook/config.js

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,46 @@
1-
import { configure, addDecorator } from '@storybook/react';
2-
import { withOptions } from '@storybook/addon-options';
1+
import { configure, addDecorator, addParameters, setAddon } from '@storybook/react';
2+
// 避免jest识别webpack context 报错
3+
import requireContext from 'require-context.macro';
34
import { withNotes } from '@storybook/addon-notes';
4-
import { themes } from '@storybook/components';
5-
// 全局加载装饰器
6-
// addDecorator(story => <div style={{ textAlign: 'center' }}>{story()}</div>);
7-
addDecorator(
8-
withOptions({
9-
// name: 'Foo',
10-
// theme: themes.dark
11-
showSearchBox: false,
12-
showAddonsPanel: true,
13-
addonPanelInRight : true,
14-
enableShortcuts : true,
15-
})
16-
)
5+
import { withKnobs } from '@storybook/addon-knobs';
6+
import { withInfo } from '@storybook/addon-info';
7+
import chaptersAddon from 'react-storybook-addon-chapters';
8+
9+
setAddon(chaptersAddon);
1710
addDecorator(withNotes);
11+
addDecorator(withKnobs);
12+
// addReadme与withInfo不能共存
13+
addDecorator(withInfo);
14+
/**
15+
* 全局设置 info 样式
16+
* info-addons源样式
17+
* Overrides styles of addon. The object should follow this shape:
18+
* https://github.com/storybookjs/storybook/blob/master/addons/info/src/components/Story.js#L19
19+
*/
20+
addParameters({
21+
info: {
22+
inline: true,
23+
styles: stylesheet => ({
24+
// Setting the style with a function
25+
...stylesheet,
26+
infoBody: {
27+
...stylesheet.infoBody,
28+
padding: '20px 40px 20px'
29+
},
30+
header: {
31+
...stylesheet.header,
32+
h1: {
33+
...stylesheet.header.h1,
34+
},
35+
},
36+
}),
37+
}
38+
});
39+
1840
/**
1941
* 动态加载所有stories
2042
*/
21-
const req = require.context('../src/stories', true, /\.stories\.js$/);
43+
const req = requireContext('../src/stories', true, /\.stories\.(ts|tsx)$/);
2244
function loadStories() {
2345
req.keys().forEach(fileName => req(fileName));
2446
}

.storybook/webpack.config.js

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,43 @@
1-
const path = require("path");
21

3-
// module.exports = {
4-
// module: {
5-
// rules: [
6-
// {
7-
// test: /.(scss|sass)$/,
8-
// loaders: ["style-loader", "css-loader", "sass-loader"],
9-
// include: path.resolve(__dirname, "../")
10-
// }
11-
// ]
12-
// }
13-
// }
14-
15-
// 保留storybook原有默认配置 + 扩展配置
16-
module.exports = function (baseConfig, env, defaultConfig) {
17-
defaultConfig.module.rules.push({
18-
test: /\.stories\.js$/,
19-
loaders: [require.resolve('@storybook/addon-storysource/loader')],
20-
enforce: 'pre',
2+
const path = require('path');
3+
module.exports = async ({ config, mode }) => {
4+
config.module.rules.push({
5+
test: /\.(ts|tsx)$/,
6+
loader: require.resolve('babel-loader'),
7+
options: {
8+
presets: [['react-app', { flow: false, typescript: true }]],
9+
plugins: [
10+
['import', { libraryName: "antd", style: true }]
11+
]
12+
}
13+
}, {
14+
test: /\.stories\.(ts|tsx)$/,
15+
loaders: [require.resolve('@storybook/addon-storysource/loader')],
16+
enforce: 'pre',
17+
}, {
18+
test: /\.scss$/,
19+
use: ['style-loader', 'css-loader', 'sass-loader'],
20+
include: path.resolve(__dirname, '../'),
2121
}, {
22-
test: /.(scss|sass)$/,
23-
loaders: ["style-loader", "css-loader", "sass-loader"],
24-
include: path.resolve(__dirname, "../")
22+
test: /\.less$/,
23+
use: ['style-loader', 'css-loader', {
24+
loader: "less-loader",
25+
options: {
26+
javascriptEnabled: true
27+
}
28+
}],
29+
include: [/[\\/]node_modules[\\/].*antd/],
30+
}, {
31+
test: /\.(jpg|png|gif)$/,
32+
loader: ["file-loader", "url-loader?limit=100000"]
33+
}, {
34+
test: /\.(eot|woff|svg|ttf|woff2|gif|appcache|webp)(\?|$)/,
35+
loader: [
36+
"file-loader?name=[name].[ext]",
37+
"url-loader?limit=100000"
38+
]
2539
});
26-
27-
return defaultConfig;
40+
config.resolve.extensions.push(".ts", ".tsx", ".js", ".jsx", ".scss", ".css");
41+
// Return the altered config
42+
return config;
2843
};

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# 1.0.0 (2020-06-02)
2+
3+
4+
### Features
5+
6+
* **component:** add components ([be532fd](http://gitlab.prod.dtstack.cn/dt-insight-front/infrastructure/dt-react-component/commit/be532fd))
7+
* **component:** add table cell component ([16f6772](http://gitlab.prod.dtstack.cn/dt-insight-front/infrastructure/dt-react-component/commit/16f6772))
8+
* **global:** optimze ([25ee271](http://gitlab.prod.dtstack.cn/dt-insight-front/infrastructure/dt-react-component/commit/25ee271))
9+
* **stories:** add index stories ([5f9392d](http://gitlab.prod.dtstack.cn/dt-insight-front/infrastructure/dt-react-component/commit/5f9392d))
10+
11+
12+

0 commit comments

Comments
 (0)