lowcode-cli 1.0.4 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # lowcode-cli VIZ组件脚手架
1
+ # lowcode-cli 组件脚手架
2
2
 
3
3
  ## 安装到全局
4
4
 
@@ -9,9 +9,9 @@ npm i lowcode-cli -g
9
9
  ## 脚手架提供的命令
10
10
 
11
11
  ```bash
12
- /* 可以在终端输入:lowcode, 打印以下内容 */
12
+ /* 可以在终端输入:my, 打印以下内容 */
13
13
 
14
- Usage: lowcode [options] [command]
14
+ Usage: my [options] [command]
15
15
 
16
16
  Options:
17
17
  -h, --help display help for command
@@ -0,0 +1,35 @@
1
+ const path = require('path');
2
+
3
+ exports.alias = {
4
+ '@babel/runtime/regenerator': path.join(
5
+ __dirname,
6
+ '../node_modules/@babel/runtime/regenerator',
7
+ ),
8
+ 'core-js': path.join(__dirname, '../node_modules/core-js'),
9
+
10
+ // react框架
11
+ 'react': path.join(__dirname, '../node_modules/react'),
12
+ 'react-dom': path.join(__dirname, '../node_modules/react-dom'),
13
+ 'dva': path.join(__dirname, '../node_modules/dva'),
14
+ 'react-router': path.join(__dirname, '../node_modules/react-router'),
15
+ 'react-router-dom': path.join(__dirname, '../node_modules/react-router-dom'),
16
+ 'history': path.join(__dirname, '../node_modules/history'),
17
+
18
+ // UI框架
19
+ 'antd': path.join(__dirname, '../node_modules/antd'),
20
+ '@ant-design': path.join(__dirname, '../node_modules/@ant-design'),
21
+ '@ctrl/tinycolor': path.join(__dirname, '../node_modules/@ctrl/tinycolor'),
22
+ 'rc-util': path.join(__dirname, '../node_modules/rc-util'),
23
+
24
+ // 第三方工具
25
+ 'lodash': path.join(__dirname, '../node_modules/lodash'),
26
+ 'moment': path.join(__dirname, '../node_modules/dayjs'),
27
+ 'echarts': path.join(__dirname, '../node_modules/echarts'),
28
+ 'monaco-editor': path.join(__dirname, '../node_modules/monaco-editor'),
29
+ '@emotion/css': path.join(__dirname, '../node_modules/@emotion/css'),
30
+
31
+ // 自定义工具
32
+ 'import-remote-module': path.join(__dirname, '../node_modules/import-remote-module'),
33
+ 'code-math': path.join(__dirname, '../node_modules/code-math'),
34
+
35
+ }
package/config/common.js CHANGED
@@ -24,7 +24,13 @@ exports.getBabelLoaderConfig = () => {
24
24
  require.resolve('@babel/preset-react'),
25
25
  ],
26
26
  plugins: [
27
- [require.resolve('babel-plugin-import'), { libraryName: 'antd', style: true }],
27
+ [require.resolve('babel-plugin-import'), { libraryName: 'antd', style: false, "libraryDirectory": "es" }, "antd"],
28
+ // [require.resolve('babel-plugin-import'), {
29
+ // "libraryName": "@ant-design/icons",
30
+ // // "style": false,
31
+ // "libraryDirectory": "es/icons",
32
+ // "camel2DashComponentName": false
33
+ // }, "@ant-design/icons"],
28
34
  [
29
35
  require.resolve('@babel/plugin-transform-runtime'),
30
36
  {
@@ -66,15 +72,15 @@ exports.getStyleLoaders = (isInJs, cssOptions, preProcessor) => {
66
72
  flexbox: 'no-2009',
67
73
  }),
68
74
 
69
- postcssPxtorem({
70
- rootValue: 16,
71
- propList: ['*'],
72
- selectorBlackList: [],
73
- replace: true,
74
- mediaQuery: false,
75
- minPixelValue: 0,
76
- unitPrecision: 5,
77
- }),
75
+ // postcssPxtorem({
76
+ // rootValue: 16,
77
+ // propList: ['*'],
78
+ // selectorBlackList: [],
79
+ // replace: true,
80
+ // mediaQuery: false,
81
+ // minPixelValue: 0,
82
+ // unitPrecision: 5,
83
+ // }),
78
84
  ],
79
85
  },
80
86
  },
@@ -14,6 +14,7 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
14
14
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
15
15
  const Webpack = require('webpack');
16
16
  const nodeExternals = require('webpack-node-externals');
17
+ const {alias} = require('./alias');
17
18
 
18
19
  const { getBabelLoaderConfig, getStyleLoaders } = require('./common');
19
20
  const lessModuleRegex = /\.module\.(scss|less)$/;
@@ -160,7 +161,9 @@ exports.getWebpackConfig = ({
160
161
  command,
161
162
  });
162
163
 
163
- config.resolve.alias['@layout'] = layoutRoot;
164
+ config.resolve.alias = Object.assign({
165
+ '@layout': layoutRoot
166
+ }, alias, (config.resolve && config.resolve.alias));
164
167
 
165
168
  return config;
166
169
  };
@@ -15,7 +15,9 @@ const webpack = require('webpack');
15
15
  const webpackDevMiddleware = require('webpack-dev-middleware');
16
16
  const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
17
17
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
18
+ const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
18
19
  const Webpack = require('webpack');
20
+ const {alias} = require('./alias');
19
21
 
20
22
  const { getBabelLoaderConfig, getStyleLoaders } = require('./common');
21
23
  const lessModuleRegex = /\.module\.(scss|less)$/;
@@ -38,7 +40,7 @@ exports.getWebpackConfig = ({
38
40
  command,
39
41
  isBundleAnalyzerPlugin,
40
42
  }) => {
41
- console.log(889, templatePath);
43
+
42
44
  let config = {
43
45
  mode: 'production',
44
46
 
@@ -50,7 +52,7 @@ exports.getWebpackConfig = ({
50
52
  path: outputPath,
51
53
  filename: '[name].js',
52
54
  publicPath: publicPath,
53
- chunkFilename: '[name].bundle.js',
55
+ chunkFilename: '[name].js',
54
56
  },
55
57
 
56
58
  devServer: devServer || {},
@@ -62,11 +64,11 @@ exports.getWebpackConfig = ({
62
64
  optimization: {
63
65
  splitChunks: {
64
66
  chunks: 'async',
65
- minSize: 30000,
66
- maxSize: 300000,
67
+ minSize: 50000,
68
+ maxSize: 1000000,
67
69
  minChunks: 1,
68
70
  maxAsyncRequests: 6,
69
- maxInitialRequests: 4,
71
+ maxInitialRequests: 1,
70
72
  automaticNameDelimiter: '~',
71
73
  cacheGroups: {
72
74
  vendors: {
@@ -74,6 +76,7 @@ exports.getWebpackConfig = ({
74
76
  test: /[\\/]node_modules[\\/]/,
75
77
  priority: -10,
76
78
  chunks: 'initial',
79
+ reuseExistingChunk: true,
77
80
  },
78
81
  common: {
79
82
  name: `chunk-common`,
@@ -137,7 +140,7 @@ exports.getWebpackConfig = ({
137
140
  },
138
141
  {
139
142
  test: /\.(ts|tsx|js|jsx|mjs)$/,
140
- // exclude: /node_modules/,
143
+ //exclude: /node_modules/,
141
144
  use: [getBabelLoaderConfig()],
142
145
  },
143
146
  {
@@ -218,6 +221,7 @@ exports.getWebpackConfig = ({
218
221
  config = webpackConfig(config, {
219
222
  requestPath: requirePath,
220
223
  moduleFederationPlugin: ModuleFederationPlugin,
224
+ monacoWebpackPlugin: MonacoWebpackPlugin,
221
225
  command,
222
226
  });
223
227
 
@@ -225,22 +229,7 @@ exports.getWebpackConfig = ({
225
229
 
226
230
  const isInGlobal = fs.existsSync(path.join(__dirname, '../node_modules/import-remote-module'));
227
231
  if (isInGlobal && command !== 'pack') {
228
- config.resolve.alias = Object.assign({}, config.resolve.alias, {
229
- '@babel/runtime/regenerator': path.join(
230
- __dirname,
231
- '../node_modules/@babel/runtime/regenerator',
232
- ),
233
- antd: path.join(__dirname, '../node_modules/antd'),
234
- 'core-js': path.join(__dirname, '../node_modules/core-js'),
235
- react: path.join(__dirname, '../node_modules/react'),
236
- moment: path.join(__dirname, '../node_modules/moment'),
237
- echarts: path.join(__dirname, '../node_modules/echarts'),
238
- 'react-dom': path.join(__dirname, '../node_modules/react-dom'),
239
- dva: path.join(__dirname, '../node_modules/dva'),
240
- 'react-router': path.join(__dirname, '../node_modules/react-router'),
241
- 'react-router-dom': path.join(__dirname, '../node_modules/react-router-dom'),
242
- 'import-remote-module': path.join(__dirname, '../node_modules/import-remote-module'),
243
- });
232
+ config.resolve.alias = Object.assign({}, alias, config.resolve.alias);
244
233
  }
245
234
 
246
235
  return config;
package/config/size.js CHANGED
@@ -51,7 +51,7 @@ FilesDataTree.prototype = {
51
51
  }
52
52
  });
53
53
  } else {
54
- console.log(22, dirName);
54
+ //
55
55
  }
56
56
  },
57
57
 
@@ -27,10 +27,11 @@ const projectConfig = getWebpackConfig({
27
27
  command: 'start',
28
28
  layoutRoot,
29
29
  projectRoot,
30
+ // devtool: 'eval-source-map',
30
31
  entry: {
31
32
  index: path.resolve(layoutRoot, 'index.js'),
32
33
  },
33
- publicPath: '/',
34
+ publicPath: '/',//runnerConfig.publicPath,
34
35
  webpackConfig: runnerConfig.webpackConfig,
35
36
  outputPath: outputPath,
36
37
  lessVariables: runnerConfig.lessVariables || {},