Skip to content

Commit

Permalink
fix: 修改构建方式
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Jan 19, 2021
1 parent 8e023f8 commit e470d2f
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 75 deletions.
7 changes: 1 addition & 6 deletions .fatherrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,5 @@ export default {
esm: {
type: 'babel'
},
// extraBabelPlugins: [
// ['@babel/plugin-transform-react-jsx', {
// runtime: 'automatic',
// importSource: 'f2-jsx'
// }]
// ]
runtimeHelpers: true,
}
31 changes: 16 additions & 15 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// for jest
module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 'current'
}
}],
'@babel/preset-typescript'
],
plugins: [
['@babel/plugin-transform-react-jsx', {
runtime: 'automatic',
importSource: '@ali/f2-jsx'
}]
]
env: {
// for jest
test: {
presets: [
['@babel/preset-env', {
targets: {
node: 'current'
}
}],
'@babel/preset-typescript'
],
plugins: [
['@babel/plugin-transform-react-jsx']
]
},
}
};
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "f2-jsx",
"private": true,
"description": "",
"scripts": {
Expand All @@ -8,11 +9,13 @@
"build": "father build",
"test": "npm run build && jest",
"test-live": "npm run test-watch packages",
"test-watch": "DEBUG_MODE=1 jest --watch",
"test-watch": "BABEL_ENV=esm && DEBUG_MODE=1 jest --watch",
"coverage": "jest --coverage",
"publish": "npm run build && npm run lerna",
"lerna": "lerna publish"
},
"dependencies": {
},
"devDependencies": {
"@babel/cli": "^7.12.8",
"@babel/core": "^7.12.10",
Expand All @@ -25,9 +28,6 @@
"jest": "^26.6.3",
"jest-electron": "^0.1.11",
"lerna": "^2.11.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3"
},
"name": "f2-jsx",
"dependencies": {}
}
}
3 changes: 2 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"dependencies": {
"@ali/f2-jsx": "^0.0.7",
"@ali/f2x-util": "^0.0.7",
"@antv/f2": "^3.8.1"
"@antv/f2": "^3.8.1",
"@babel/runtime": "^7.12.5"
},
"files": [
"src",
Expand Down
24 changes: 0 additions & 24 deletions packages/components/src/chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ class Chart {
chart.tooltip(false);
chart.axis(false);

// 这些都比较hack, 暂时先这么处理
// const plot = chart.get('plot');
// chart.get('canvas').addShape('rect', {
// attrs: {
// x: plot.start.x,
// y: plot.start.y,
// width: plot.width,
// height: plot.height,
// fill: 'gray'
// }
// })


this.chart = chart;

this.createComponents(children);
Expand Down Expand Up @@ -141,17 +128,6 @@ class Chart {
map(components, (component: any) => {
this.renderComponent(component);
});

// const plot = this.chart.get('plot');
// this.chart.get('canvas').addShape('rect', {
// attrs: {
// x: plot.start.x,
// y: plot.start.y,
// width: plot.width,
// height: plot.height,
// fill: 'gray'
// }
// })
}

update(props: any) {
Expand Down
8 changes: 5 additions & 3 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"typeRoots": [ "/node_modules" ],
"declaration": true,
"target": "esnext",
"jsx": "react-jsx",
"jsxImportSource": "@ali/f2-jsx",
"esModuleInterop": true,
"declaration": true
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"typeRoots": [ "/node_modules" ]
}
}
3 changes: 2 additions & 1 deletion packages/fund-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"dependencies": {
"@ali/f2-components": "^0.0.9",
"@ali/f2-jsx": "^0.0.7",
"@ali/f2x-util": "^0.0.7"
"@ali/f2x-util": "^0.0.7",
"@babel/runtime": "^7.12.5"
},
"files": [
"src",
Expand Down
7 changes: 5 additions & 2 deletions packages/fund-components/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": true,
"target": "esnext",
"jsx": "react-jsx",
"jsxImportSource": "@ali/f2-jsx",
"esModuleInterop": true,
"declaration": true
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"typeRoots": [ "/node_modules" ]
}
}
1 change: 1 addition & 0 deletions packages/jsx/jsx-runtime.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/jsx-runtime';
3 changes: 2 additions & 1 deletion packages/jsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"module": "es/index.js",
"types": "es/index.d.ts",
"dependencies": {
"css-layout": "1.1.1"
"css-layout": "1.1.1",
"@babel/runtime": "^7.12.5"
},
"devDependencies": {
"@antv/f2": "~3.8.1"
Expand Down
3 changes: 2 additions & 1 deletion packages/jsx/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "esnext",
"typeRoots": [ "/node_modules" ],
"declaration": true
"declaration": true,
}
}
4 changes: 3 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"types": "es/index.d.ts",
"dependencies": {
"@ali/f2-components": "^0.0.9",
"@ali/fund-components": "*",
"@ali/f2-jsx": "^0.0.7",
"@antv/f2": "^3.8.1"
"@antv/f2": "^3.8.1",
"@babel/runtime": "^7.12.5"
},
"devDependencies": {
"enzyme": "^3.11.0",
Expand Down
6 changes: 2 additions & 4 deletions packages/react/test/chart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/** @jsxImportSource react */

// @ts-nocheck
import { Component } from 'react';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Chart from '../src';

import result from './managerData';

// 引入组件
// import { Line } from '../../components/src/index';
import { Axis, Line, Guide, WeaverLine } from '../../fund-components/src/index';
import { Axis, Line, Guide, WeaverLine } from '@ali/fund-components';

const style = document.createElement('style');
style.setAttribute('rel', 'text/css');
Expand Down
13 changes: 5 additions & 8 deletions packages/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "esnext",
"jsx": "react",
"esModuleInterop": true,
"declaration": true
},
"exclude": [
"scripts",
"node_modules",
"**/test/**/*.ts",
"**/test"
]
"declaration": true,
"moduleResolution": "Node"
}
}
3 changes: 3 additions & 0 deletions packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"lib",
"es"
],
"dependencies": {
"@babel/runtime": "^7.12.5"
},
"publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/util/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"strict": true,
"declaration": true
"target": "esnext",
"declaration": true,
"moduleResolution": "Node"
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"strict": true,
"target": "esnext",
"declaration": true
},
"exclude": [
Expand Down

0 comments on commit e470d2f

Please sign in to comment.