瀏覽代碼

feat: change project import

wxyyxc1992 5 年之前
父節點
當前提交
b7c1a339c4

+ 0
- 9
example/types.d.ts 查看文件

@@ -1,9 +0,0 @@
1
-declare module '*.less' {
2
-  const styles: Record<string, string>;
3
-  export = styles;
4
-}
5
-
6
-declare module '*.css' {
7
-  const content: any;
8
-  export default content;
9
-}

+ 2
- 0
package.json 查看文件

@@ -32,6 +32,7 @@
32 32
     "prop-types": "^15.6.2",
33 33
     "react": "^16.8.0",
34 34
     "react-dom": "^16.8.0",
35
+    "siema": "^1.5.1",
35 36
     "uuid": "^3.3.2"
36 37
   },
37 38
   "devDependencies": {
@@ -70,6 +71,7 @@
70 71
     "svg-inline-loader": "^0.8.0",
71 72
     "ts-jest": "^23.10.5",
72 73
     "ts-loader": "5.3.3",
74
+    "tsconfig-paths-webpack-plugin": "^3.2.0",
73 75
     "tslint": "^5.12.0",
74 76
     "tslint-config-prettier": "^1.17.0",
75 77
     "tslint-react": "^3.6.0",

+ 25
- 14
public/index.html 查看文件

@@ -5,10 +5,27 @@
5 5
     <meta http-equiv="X-UA-Compatible" content="ie=edge" />
6 6
     <title>fc-whiteboard</title>
7 7
     <style>
8
-      .image {
8
+      #demos {
9
+        display: flex;
10
+        align-items: center;
11
+      }
12
+
13
+      #demos a {
14
+        margin-left: 16px;
15
+      }
16
+
17
+      #root {
18
+        width: 500px;
19
+        height: 500px;
20
+        top: 100px;
21
+        position: absolute;
22
+      }
23
+
24
+      #root-mirror {
9 25
         width: 500px;
10 26
         height: 500px;
11 27
         top: 100px;
28
+        right: 16px;
12 29
         position: absolute;
13 30
       }
14 31
     </style>
@@ -16,20 +33,14 @@
16 33
   <body>
17 34
     <body>
18 35
       <noscript>You need to enable JavaScript to run this app.</noscript>
19
-      <div id="root">
20
-        <img
21
-          id="image1"
22
-          class="image"
23
-          style="left:100px"
24
-          src="https://i.postimg.cc/SNDkCfXD/image.png"
25
-        />
26
-        <img
27
-          id="image2"
28
-          class="image"
29
-          style="left:800px"
30
-          src="https://i.postimg.cc/SNDkCfXD/image.png"
31
-        />
36
+      <div id="demos">
37
+        <h3>Other Demos</h3>
38
+        <a href="./mirror.html">Mirror WhitePage</a>
39
+        <a href="./whiteboard.html">Whiteboard</a>
32 40
       </div>
41
+      <div id="root"></div>
42
+      <div id="root-mirror"></div>
43
+
33 44
       <script>
34 45
         window.__DEV_APP__ = {};
35 46
       </script>

+ 39
- 0
public/mirror.html 查看文件

@@ -0,0 +1,39 @@
1
+<html lang="en">
2
+  <head>
3
+    <meta charset="UTF-8" />
4
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
6
+    <title>fc-whiteboard</title>
7
+    <style>
8
+      .image {
9
+        width: 500px;
10
+        height: 500px;
11
+        top: 100px;
12
+        position: absolute;
13
+      }
14
+    </style>
15
+  </head>
16
+  <body>
17
+    <body>
18
+      <noscript>You need to enable JavaScript to run this app.</noscript>
19
+      <div id="root">
20
+        <img
21
+          id="image1"
22
+          class="image"
23
+          style="left:100px"
24
+          src="https://i.postimg.cc/SNDkCfXD/image.png"
25
+        />
26
+        <img
27
+          id="image2"
28
+          class="image"
29
+          style="left:800px"
30
+          src="https://i.postimg.cc/SNDkCfXD/image.png"
31
+        />
32
+      </div>
33
+      <script>
34
+        window.__DEV_APP__ = {};
35
+      </script>
36
+      <script src="./mirror.js"></script>
37
+    </body>
38
+  </body>
39
+</html>

+ 40
- 0
public/whiteboard.html 查看文件

@@ -0,0 +1,40 @@
1
+<html lang="en">
2
+  <head>
3
+    <meta charset="UTF-8" />
4
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
6
+    <title>fc-whiteboard</title>
7
+    <style>
8
+      #demos {
9
+        display: flex;
10
+        align-items: center;
11
+      }
12
+
13
+      #demos a {
14
+        margin-left: 16px;
15
+      }
16
+
17
+      #root {
18
+        width: 500px;
19
+        height: 500px;
20
+        top: 100px;
21
+        position: absolute;
22
+      }
23
+    </style>
24
+  </head>
25
+  <body>
26
+    <body>
27
+      <noscript>You need to enable JavaScript to run this app.</noscript>
28
+      <div id="demos">
29
+        <h3>Other Demos</h3>
30
+        <a href="./mirror.html">Mirror</a>
31
+      </div>
32
+      <div id="root"></div>
33
+
34
+      <script>
35
+        window.__DEV_APP__ = {};
36
+      </script>
37
+      <script src="./whiteboard.js"></script>
38
+    </body>
39
+  </body>
40
+</html>

+ 143
- 0
scripts/base/webpack.config.base.js 查看文件

@@ -0,0 +1,143 @@
1
+const path = require('path');
2
+const process = require('process');
3
+const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
4
+const TSConfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
5
+const webpack = require('webpack');
6
+
7
+const rootPath = process.cwd();
8
+const packageName = require(path.resolve(rootPath, 'package.json'));
9
+
10
+const buildEnv = {
11
+  rootPath,
12
+  packageName,
13
+  src: path.resolve(rootPath, './src'),
14
+  public: path.resolve(rootPath, './public'),
15
+  build: path.resolve(rootPath, './build')
16
+};
17
+
18
+const moduleCSSLoader = {
19
+  loader: 'css-loader',
20
+  options: {
21
+    modules: false,
22
+    sourceMap: false,
23
+    importLoaders: 2,
24
+    localIdentName: '[name]__[local]'
25
+  }
26
+};
27
+
28
+const lessLoader = {
29
+  loader: 'less-loader',
30
+  options: {
31
+    modifyVars: {
32
+      'primary-color': '#5d4bff'
33
+    },
34
+    javascriptEnabled: true,
35
+    paths: [path.resolve(rootPath, './node_modules')]
36
+  }
37
+};
38
+
39
+const fontsOptions = {
40
+  limit: 8192,
41
+  mimetype: 'application/font-woff',
42
+  name: 'fonts/[name].[ext]'
43
+};
44
+
45
+module.exports = {
46
+  context: rootPath,
47
+  entry: {
48
+    index: path.resolve(buildEnv.rootPath, './example/index.ts')
49
+  },
50
+  resolve: {
51
+    alias: {
52
+      systemjs: path.resolve(rootPath, './node_modules/systemjs/dist/system-production.js')
53
+    },
54
+    extensions: ['.ts', '.tsx', '.js', '.jsx', '.css', 'less'],
55
+    plugins: [new TSConfigPathsPlugin()]
56
+  },
57
+  output: {
58
+    path: buildEnv.build,
59
+    // 设置所有资源的默认公共路径,Webpack 会自动将 import 的资源改写为该路径
60
+    publicPath: '/',
61
+    filename: '[name].js',
62
+    sourceMapFilename: '[name].map',
63
+    globalObject: 'this' // 避免全局使用 window
64
+  },
65
+  module: {
66
+    rules: [
67
+      {
68
+        test: /.*ts-worker.*/,
69
+        use: ['workerize-loader', 'ts-loader']
70
+      },
71
+      {
72
+        test: /\.(ts|tsx)?$/,
73
+        loader: 'awesome-typescript-loader',
74
+        exclude: /node_modules/,
75
+        options: {
76
+          useBabel: true
77
+        }
78
+      },
79
+      {
80
+        test: /\.(png|jpg|gif)$/,
81
+        use: [
82
+          {
83
+            loader: 'url-loader',
84
+            options: {
85
+              limit: 8192,
86
+              name: 'images/[name].[ext]'
87
+            }
88
+          }
89
+        ]
90
+      },
91
+      {
92
+        test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
93
+        use: [
94
+          {
95
+            loader: 'url-loader',
96
+            options: fontsOptions
97
+          }
98
+        ]
99
+      },
100
+      {
101
+        test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
102
+        use: [
103
+          {
104
+            loader: 'file-loader',
105
+            options: fontsOptions
106
+          }
107
+        ]
108
+      },
109
+      {
110
+        test: /\.css$/,
111
+        use: ['style-loader', 'css-loader'],
112
+        include: [/node_modules/, buildEnv.src]
113
+      },
114
+      {
115
+        test: /\.less$/,
116
+        use: ['style-loader', moduleCSSLoader, lessLoader],
117
+        exclude: /node_modules/
118
+      },
119
+      {
120
+        test: /\.less$/,
121
+        use: ['style-loader', 'css-loader', lessLoader],
122
+        include: /node_modules/
123
+      },
124
+      { test: /\.svg$/, loader: 'svg-inline-loader' }
125
+    ]
126
+  },
127
+  plugins: [
128
+    new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true, tslint: true }),
129
+    new webpack.WatchIgnorePlugin([/less\.d\.ts$/]),
130
+    new webpack.IgnorePlugin(/\.js\.map$/)
131
+  ],
132
+
133
+  // 定义非直接引用依赖,使用方式即为 var $ = require("jquery")
134
+  externals: {
135
+    window: 'window',
136
+    jquery: '$'
137
+  },
138
+  extra: {
139
+    moduleCSSLoader,
140
+    lessLoader,
141
+    buildEnv
142
+  }
143
+};

+ 59
- 0
scripts/base/webpack.config.dev.js 查看文件

@@ -0,0 +1,59 @@
1
+const webpack = require('webpack');
2
+const path = require('path');
3
+const DashboardPlugin = require('webpack-dashboard/plugin');
4
+
5
+const baseConfig = require('./webpack.config.base');
6
+
7
+const config = {
8
+  ...baseConfig,
9
+  mode: 'development',
10
+  devtool: 'source-map',
11
+  plugins: [
12
+    ...baseConfig.plugins,
13
+
14
+    // 在控制台中输出可读的模块名
15
+    new webpack.NamedModulesPlugin(),
16
+
17
+    // 避免发出包含错误的模块
18
+    new webpack.NoEmitOnErrorsPlugin(),
19
+
20
+    // 定义控制变量
21
+    new webpack.DefinePlugin({
22
+      isProd: JSON.stringify(false)
23
+    }),
24
+    new DashboardPlugin()
25
+  ],
26
+  devServer: {
27
+    allowedHosts: ['0.0.0.0:8081'],
28
+    // 设置生成的 Bundle 的前缀路径
29
+    publicPath: '/',
30
+    // assets 中资源文件默认应该还使用 assets
31
+    contentBase: path.resolve(__dirname, '../../public'),
32
+    compress: true,
33
+    headers: {
34
+      'Access-Control-Allow-Origin': '*',
35
+      'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
36
+      'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
37
+      'X-Content-Type-Options': 'nosniff',
38
+      'X-Frame-Options': 'DENY'
39
+    },
40
+    open: true,
41
+    overlay: {
42
+      warnings: true,
43
+      errors: true
44
+    },
45
+    host: '0.0.0.0',
46
+    port: 8080,
47
+    hot: false,
48
+    https: false,
49
+    disableHostCheck: true,
50
+    quiet: false
51
+  },
52
+  stats: {
53
+    children: false
54
+  }
55
+};
56
+
57
+delete config.extra;
58
+
59
+module.exports = config;

+ 107
- 0
scripts/base/webpack.config.prod.js 查看文件

@@ -0,0 +1,107 @@
1
+const webpack = require('webpack');
2
+const path = require('path');
3
+
4
+const CopyWebpackPlugin = require('copy-webpack-plugin');
5
+const HtmlWebpackPlugin = require('html-webpack-plugin');
6
+const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
7
+const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
8
+
9
+const baseConfig = require('./webpack.config.base');
10
+
11
+const { buildEnv } = baseConfig.extra;
12
+
13
+const config = {
14
+  ...baseConfig,
15
+  devtool: false,
16
+  mode: 'production',
17
+  output: {
18
+    ...baseConfig.output,
19
+    filename: '[name].js'
20
+  },
21
+  module: {
22
+    rules: [
23
+      ...baseConfig.module.rules.filter(
24
+        rule => !['/\\.css$/', '/\\.less$/', '/\\.(scss|sass)$/'].includes(rule.test.toString())
25
+      ),
26
+      {
27
+        test: /\.css$/,
28
+        use: ['style - loader', 'css-loader', 'postcss-loader']
29
+      },
30
+      {
31
+        test: /\.less$/,
32
+        exclude: /node_modules/,
33
+        use: [
34
+          'style - loader',
35
+          baseConfig.extra.moduleCSSLoader,
36
+          'postcss-loader',
37
+          baseConfig.extra.lessLoader
38
+        ]
39
+      },
40
+      {
41
+        test: /\.less$/,
42
+        include: /node_modules/,
43
+        use: ['style - loader', 'css-loader', 'postcss-loader', baseConfig.extra.lessLoader]
44
+      }
45
+    ]
46
+  },
47
+  plugins: [
48
+    ...baseConfig.plugins,
49
+    new webpack.DefinePlugin({
50
+      isProd: JSON.stringify(true)
51
+    }),
52
+
53
+    // 使用 Prepack 优化包体大小
54
+    // 暂时存在 Bug,等待修复
55
+    // 使用前 21 - 425
56
+    // 使用后 21 - 433
57
+    // new PrepackWebpackPlugin({
58
+    //   mathRandomSeed: '0'
59
+    // }),
60
+
61
+    // 必须将 CopyWebpackPlugin 与 HtmlWebpackPlugin 添加到末尾
62
+    new CopyWebpackPlugin([{ from: buildEnv.public, to: buildEnv.build }]),
63
+    new HtmlWebpackPlugin({
64
+      template: path.join(__dirname, '../template/template.ejs'),
65
+      title: 'Webpack React',
66
+      favicon: path.join(baseConfig.extra.buildEnv.public, 'favicon.ico'),
67
+      manifest: path.join(buildEnv.public, 'manifest.json'),
68
+      meta: [
69
+        { name: 'robots', content: 'noindex,nofollow' },
70
+        {
71
+          name: 'viewport',
72
+          content:
73
+            'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no'
74
+        }
75
+      ],
76
+      appMountIds: ['root'],
77
+      inject: false,
78
+      minify: {
79
+        html5: true,
80
+        useShortDoctype: true,
81
+        collapseWhitespace: true,
82
+        conservativeCollapse: true,
83
+        preserveLineBreaks: true,
84
+        removeComments: true,
85
+        keepClosingSlash: true,
86
+        removeRedundantAttributes: true,
87
+        removeEmptyAttributes: true,
88
+        removeStyleLinkTypeAttributes: true
89
+      },
90
+      mobile: true,
91
+      scripts: ['./static.js']
92
+    })
93
+  ],
94
+  optimization: {
95
+    runtimeChunk: false,
96
+    minimizer: [
97
+      new UglifyJsPlugin({
98
+        exclude: /.*ts-worker.*/
99
+      }),
100
+      new OptimizeCSSAssetsPlugin({})
101
+    ]
102
+  }
103
+};
104
+
105
+delete config.extra;
106
+
107
+module.exports = config;

+ 45
- 0
scripts/base/webpack.config.umd.js 查看文件

@@ -0,0 +1,45 @@
1
+const path = require('path');
2
+
3
+const prodConfig = require('./webpack.config.prod');
4
+const rootPath = process.cwd();
5
+
6
+const plugins = [...prodConfig.plugins];
7
+
8
+// 移除 CopyWebpackPlugin 与 HtmlWebpackPlugin
9
+plugins.pop();
10
+plugins.pop();
11
+
12
+const umdConfig = {
13
+  ...prodConfig,
14
+  output: {
15
+    filename: '[name].js',
16
+    path: path.resolve(rootPath, './dist'),
17
+    // 默认不允许挂载在全局变量下
18
+    // library: library,
19
+    libraryTarget: 'umd'
20
+  },
21
+  externals: {
22
+    // Don't bundle react or react-dom
23
+    react: {
24
+      commonjs: 'react',
25
+      commonjs2: 'react',
26
+      amd: 'React',
27
+      root: 'React'
28
+    },
29
+    'react-dom': {
30
+      commonjs: 'react-dom',
31
+      commonjs2: 'react-dom',
32
+      amd: 'ReactDOM',
33
+      root: 'ReactDOM'
34
+    },
35
+    'styled-components': {
36
+      commonjs: 'styled-components',
37
+      commonjs2: 'styled-components'
38
+    }
39
+  },
40
+  plugins
41
+};
42
+
43
+delete umdConfig.optimization;
44
+
45
+module.exports = umdConfig;

+ 3
- 2
scripts/webpack/webpack.config.dev.js 查看文件

@@ -1,11 +1,12 @@
1 1
 const path = require('path');
2 2
 const merge = require('webpack-merge');
3 3
 
4
-const devConfig = require('../../../../scripts/webpack/webpack.config.dev');
4
+const devConfig = require('../base/webpack.config.dev');
5 5
 
6 6
 module.exports = merge(devConfig, {
7 7
   entry: {
8
-    index: path.resolve(__dirname, '../../example')
8
+    mirror: path.resolve(__dirname, '../../example/mirror/index.ts'),
9
+    whiteboard: path.resolve(__dirname, '../../example/whiteboard/index.ts')
9 10
   },
10 11
   devServer: {
11 12
     contentBase: path.resolve(__dirname, '../../public')

+ 1
- 1
scripts/webpack/webpack.config.umd.js 查看文件

@@ -1,7 +1,7 @@
1 1
 const merge = require('webpack-merge');
2 2
 const path = require('path');
3 3
 
4
-const umdConfig = require('../../../../scripts/webpack/webpack.config.umd');
4
+const umdConfig = require('../base/webpack.config.umd');
5 5
 
6 6
 module.exports = merge(umdConfig, {
7 7
   entry: {

+ 1
- 1
src/board/WhitePage/index.ts 查看文件

@@ -8,7 +8,7 @@ import { uuid } from './../../utils/uuid';
8 8
 import { getMarkerByType } from '../../markers/types';
9 9
 
10 10
 import './index.less';
11
-import { createDivWithClassName } from 'fc-whiteboard/src/utils/dom';
11
+import { createDivWithClassName } from '../../utils/dom';
12 12
 
13 13
 const prefix = 'fcw-page';
14 14
 

+ 2
- 2
src/markers/ArrowMarker/index.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import { MarkerType } from './../types';
2 2
 import { LinearMarker } from '../LinearMarker';
3
-import { SvgHelper } from 'fc-whiteboard/src/renderer/SvgHelper';
4
-import { WhitePage } from 'fc-whiteboard/src/board/WhitePage';
3
+import { SvgHelper } from '../../renderer/SvgHelper';
4
+import { WhitePage } from '../../board/WhitePage';
5 5
 
6 6
 export class ArrowMarker extends LinearMarker {
7 7
   type: MarkerType = 'arrow';

+ 1
- 1
src/markers/BaseMarker/index.ts 查看文件

@@ -1,5 +1,5 @@
1 1
 import { WhitePage } from './../../board/WhitePage/index';
2
-import { PositionType } from 'fc-whiteboard/src/event/Event';
2
+import { PositionType } from '../../event/Event';
3 3
 import { onSyncFunc, EventType } from '../../event/Event';
4 4
 import { MarkerType } from '../types';
5 5
 import * as uuid from 'uuid/v1';

+ 1
- 1
src/markers/CoverMarker/index.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import { MarkerType } from './../types';
2 2
 import { SvgHelper } from '../../renderer/SvgHelper';
3 3
 import { RectBaseMarker } from '../RectMarker/RectBaseMarker';
4
-import { WhitePage } from 'fc-whiteboard/src/board/WhitePage';
4
+import { WhitePage } from '../../board/WhitePage';
5 5
 
6 6
 export class CoverMarker extends RectBaseMarker {
7 7
   type: MarkerType = 'cover';

+ 1
- 1
src/markers/HighlightMarker/index.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import { MarkerType } from './../types';
2 2
 import { SvgHelper } from '../../renderer/SvgHelper';
3 3
 import { RectBaseMarker } from '../RectMarker/RectBaseMarker';
4
-import { WhitePage } from 'fc-whiteboard/src/board/WhitePage';
4
+import { WhitePage } from '../../board/WhitePage';
5 5
 
6 6
 export class HighlightMarker extends RectBaseMarker {
7 7
   type: MarkerType = 'highlight';

+ 1
- 1
src/markers/LineMarker/index.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import { MarkerType } from './../types';
2 2
 import { LinearMarker } from '../LinearMarker';
3 3
 import { SvgHelper } from './../../renderer/SvgHelper/index';
4
-import { WhitePage } from 'fc-whiteboard/src/board/WhitePage';
4
+import { WhitePage } from '../../board/WhitePage';
5 5
 
6 6
 export class LineMarker extends LinearMarker {
7 7
   type: MarkerType = 'line';

+ 1
- 1
src/markers/LinearMarker/index.ts 查看文件

@@ -2,7 +2,7 @@ import { WhitePage } from './../../board/WhitePage/index';
2 2
 import { BaseMarker } from '../BaseMarker';
3 3
 import { ResizeGrip } from '../BaseMarker/ResizeGrip';
4 4
 import { SvgHelper } from '../../renderer/SvgHelper';
5
-import { PositionType } from 'fc-whiteboard/src/event/Event';
5
+import { PositionType } from '../../event/Event';
6 6
 
7 7
 export class LinearMarker extends BaseMarker {
8 8
   public static createMarker = (page?: WhitePage): LinearMarker => {

+ 1
- 1
src/markers/RectMarker/RectBaseMarker.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import { PositionType } from '../../event/Event';
2 2
 import { SvgHelper } from '../../renderer/SvgHelper';
3 3
 import { RectangularMarker } from '../RectangularMarker';
4
-import { WhitePage } from 'fc-whiteboard/src/board/WhitePage';
4
+import { WhitePage } from '../../board/WhitePage';
5 5
 
6 6
 export class RectBaseMarker extends RectangularMarker {
7 7
   public static createMarker = (page?: WhitePage): RectBaseMarker => {

+ 1
- 1
src/markers/RectMarker/index.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import { WhitePage } from './../../board/WhitePage/index';
2 2
 import { MarkerType } from './../types';
3 3
 import { RectBaseMarker } from './RectBaseMarker';
4
-import { SvgHelper } from 'fc-whiteboard/src/renderer/SvgHelper';
4
+import { SvgHelper } from '../../renderer/SvgHelper';
5 5
 
6 6
 export class RectMarker extends RectBaseMarker {
7 7
   type: MarkerType = 'rect';

+ 1
- 1
src/markers/RectangularMarker/index.ts 查看文件

@@ -3,7 +3,7 @@ import { BaseMarker } from '../BaseMarker';
3 3
 import { ResizeGrip } from '../BaseMarker/ResizeGrip';
4 4
 import { PositionType } from '../../event/Event';
5 5
 import { SvgHelper } from '../../renderer/SvgHelper';
6
-import { WhitePage } from 'fc-whiteboard/src/board/WhitePage';
6
+import { WhitePage } from '../../board/WhitePage';
7 7
 
8 8
 export class RectangularMarker extends BaseMarker {
9 9
   public static createMarker = (page?: WhitePage): RectangularMarker => {

+ 2
- 2
src/markers/TextMarker/index.ts 查看文件

@@ -1,8 +1,8 @@
1 1
 import { MarkerType } from '../types';
2 2
 import { RectangularMarker } from '../RectangularMarker';
3 3
 import { SvgHelper } from '../../renderer/SvgHelper';
4
-import { PositionType } from 'fc-whiteboard/src/event/Event';
5
-import { WhitePage } from 'fc-whiteboard/src/board/WhitePage';
4
+import { PositionType } from '../../event/Event';
5
+import { WhitePage } from '../../board/WhitePage';
6 6
 
7 7
 const OkIcon = require('../../assets/check.svg');
8 8
 const CancelIcon = require('../../assets/times.svg');

+ 1
- 1
src/renderer/Synthetizer/index.ts 查看文件

@@ -1,4 +1,4 @@
1
-import { isHTMLImageElement } from 'fc-whiteboard/src/utils/validator';
1
+import { isHTMLImageElement } from '../../utils/validator';
2 2
 
3 3
 /** 图片导出 */
4 4
 export class Synthetizer {

+ 39
- 2
tsconfig.json 查看文件

@@ -1,4 +1,41 @@
1 1
 {
2
-  "extends": "../../tsconfig.json",
3
-  "include": ["src/**/*", "example/**/*"]
2
+  "compilerOptions": {
3
+    "baseUrl": "packages",
4
+    "lib": ["es6", "es7", "dom", "scripthost", "webworker"],
5
+    "jsx": "react",
6
+    "target": "es5",
7
+    "module": "commonjs",
8
+    "moduleResolution": "node",
9
+    "sourceMap": true,
10
+    "allowJs": false,
11
+    "outDir": "dist",
12
+    "experimentalDecorators": true,
13
+    "forceConsistentCasingInFileNames": true,
14
+    "removeComments": true,
15
+    "noImplicitReturns": true,
16
+    "noImplicitThis": true,
17
+    "noImplicitAny": true,
18
+    "allowUnusedLabels": true,
19
+    "strictNullChecks": true,
20
+    "suppressImplicitAnyIndexErrors": true,
21
+    "noUnusedLocals": true,
22
+    "allowSyntheticDefaultImports": true,
23
+    "skipLibCheck": true,
24
+    "paths": {
25
+      "lego-form-core": ["lego-form-core/src/"]
26
+    }
27
+  },
28
+  "include": ["**/*.js", "**/*.ts", "**/*.tsx"],
29
+  "exclude": [
30
+    "assets",
31
+    "build",
32
+    "dist",
33
+    "indep-pkgs",
34
+    "node_modules",
35
+    "scripts",
36
+    "ssr",
37
+    "stories",
38
+    "__test__",
39
+    "test"
40
+  ]
4 41
 }

+ 41
- 1
tslint.json 查看文件

@@ -1,3 +1,43 @@
1 1
 {
2
-  "extends": "../../tslint.json"
2
+  "extends": ["tslint-react", "tslint-config-prettier"],
3
+  "defaultSeverity": "warning",
4
+  "rules": {
5
+    "ban": false,
6
+    "class-name": true,
7
+    "comment-format": [true, "check-space"],
8
+    "curly": true,
9
+    "eofline": false,
10
+    "forin": true,
11
+    "jsdoc-format": true,
12
+    "jsx-no-lambda": false,
13
+    "jsx-no-multiline-js": false,
14
+    "label-position": true,
15
+    "no-any": true,
16
+    "no-arg": true,
17
+    "no-bitwise": true,
18
+    "no-console": [true, "log", "error", "debug", "info", "time", "timeEnd", "trace"],
19
+    "no-construct": true,
20
+    "no-debugger": true,
21
+    "no-duplicate-variable": true,
22
+    "no-empty": true,
23
+    "no-eval": true,
24
+    "no-shadowed-variable": true,
25
+    "no-string-literal": true,
26
+    "no-switch-case-fall-through": true,
27
+    "no-trailing-whitespace": false,
28
+    "no-unused-expression": true,
29
+    "no-use-before-declare": true,
30
+    "radix": true,
31
+    "switch-default": true,
32
+    "trailing-comma": [false],
33
+    "triple-equals": [true, "allow-null-check"],
34
+    "typedef": [true, "parameter", "property-declaration"],
35
+    "variable-name": [
36
+      true,
37
+      "ban-keywords",
38
+      "check-format",
39
+      "allow-leading-underscore",
40
+      "allow-pascal-case"
41
+    ]
42
+  }
3 43
 }

+ 35
- 0
yarn.lock 查看文件

@@ -828,6 +828,11 @@
828 828
   resolved "http://registry.npm.taobao.org/@types/jest/download/@types/jest-23.3.12.tgz#7e0ced251fa94c3bc2d1023d4b84b2992fa06376"
829 829
   integrity sha1-fgztJR+pTDvC0QI9S4SymS+gY3Y=
830 830
 
831
+"@types/json5@^0.0.29":
832
+  version "0.0.29"
833
+  resolved "http://registry.npm.taobao.org/@types/json5/download/@types/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
834
+  integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
835
+
831 836
 "@types/node@*":
832 837
   version "11.11.1"
833 838
   resolved "http://registry.npm.taobao.org/@types/node/download/@types/node-11.11.1.tgz#9ee55ffce20f72e141863b0036a6e51c6fc09a1f"
@@ -3084,6 +3089,11 @@ deepmerge@3.2.0:
3084 3089
   resolved "http://registry.npm.taobao.org/deepmerge/download/deepmerge-3.2.0.tgz#58ef463a57c08d376547f8869fdc5bcee957f44e"
3085 3090
   integrity sha1-WO9GOlfAjTdlR/iGn9xbzulX9E4=
3086 3091
 
3092
+deepmerge@^2.0.1:
3093
+  version "2.2.1"
3094
+  resolved "http://registry.npm.taobao.org/deepmerge/download/deepmerge-2.2.1.tgz#5d3ff22a01c00f645405a2fbc17d0778a1801170"
3095
+  integrity sha1-XT/yKgHAD2RUBaL7wX0HeKGAEXA=
3096
+
3087 3097
 default-gateway@^4.0.1:
3088 3098
   version "4.2.0"
3089 3099
   resolved "http://registry.npm.taobao.org/default-gateway/download/default-gateway-4.2.0.tgz#167104c7500c2115f6dd69b0a536bb8ed720552b"
@@ -9287,6 +9297,11 @@ shellwords@^0.1.1:
9287 9297
   resolved "http://registry.npm.taobao.org/shellwords/download/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
9288 9298
   integrity sha1-1rkYHBpI05cyTISHHvvPxz/AZUs=
9289 9299
 
9300
+siema@^1.5.1:
9301
+  version "1.5.1"
9302
+  resolved "http://registry.npm.taobao.org/siema/download/siema-1.5.1.tgz#eff312b77e8340fa4d81d5d053ebbeb9113ff888"
9303
+  integrity sha1-7/MSt36DQPpNgdXQU+u+uRE/+Ig=
9304
+
9290 9305
 signal-exit@^3.0.0, signal-exit@^3.0.2:
9291 9306
   version "3.0.2"
9292 9307
   resolved "http://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
@@ -10130,6 +10145,26 @@ ts-loader@5.3.3:
10130 10145
     micromatch "^3.1.4"
10131 10146
     semver "^5.0.1"
10132 10147
 
10148
+tsconfig-paths-webpack-plugin@^3.2.0:
10149
+  version "3.2.0"
10150
+  resolved "http://registry.npm.taobao.org/tsconfig-paths-webpack-plugin/download/tsconfig-paths-webpack-plugin-3.2.0.tgz#6e70bd42915ad0efb64d3385163f0c1270f3e04d"
10151
+  integrity sha1-bnC9QpFa0O+2TTOFFj8MEnDz4E0=
10152
+  dependencies:
10153
+    chalk "^2.3.0"
10154
+    enhanced-resolve "^4.0.0"
10155
+    tsconfig-paths "^3.4.0"
10156
+
10157
+tsconfig-paths@^3.4.0:
10158
+  version "3.8.0"
10159
+  resolved "http://registry.npm.taobao.org/tsconfig-paths/download/tsconfig-paths-3.8.0.tgz#4e34202d5b41958f269cf56b01ed95b853d59f72"
10160
+  integrity sha1-TjQgLVtBlY8mnPVrAe2VuFPVn3I=
10161
+  dependencies:
10162
+    "@types/json5" "^0.0.29"
10163
+    deepmerge "^2.0.1"
10164
+    json5 "^1.0.1"
10165
+    minimist "^1.2.0"
10166
+    strip-bom "^3.0.0"
10167
+
10133 10168
 tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0:
10134 10169
   version "1.9.3"
10135 10170
   resolved "http://registry.npm.taobao.org/tslib/download/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"