jjb-cmd 2.0.2 → 2.0.5
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/package.json +1 -1
- package/src/new/cmd.init.copy/lib/jjb.config.json +4 -4
- package/src/new/cmd.init.copy/lib/jjb.script/build.js +7 -4
- package/src/new/cmd.init.copy/micro-app/jjb.config.json +14 -10
- package/src/new/cmd.init.copy/micro-app/jjb.script/build.js +7 -4
- package/src/new/cmd.init.copy/micro-app/jjb.script/config.js +9 -12
- package/src/new/cmd.init.copy/micro-app/jjb.script/utils.js +1 -1
- package/src/new/cmd.init.copy/micro-app/package.json +8 -2
- package/src/new/cmd.init.copy/micro-app/public/index.html +30 -19
- package/src/new/cmd.init.copy/micro-app/src/api/{main → home}/index.js +0 -0
- package/src/new/cmd.init.copy/micro-app/src/enumerate/namespace/index.js +1 -1
- package/src/new/cmd.init.copy/micro-app/src/index.js +1 -1
- package/src/new/cmd.init.copy/micro-app/src/pages/index.js +6 -8
- package/src/new/cmd.init.copy/react-component/jjb.config.json +7 -7
- package/src/new/cmd.init.copy/react-component/jjb.script/build.js +7 -4
- package/src/new/cmd.init.copy/react-component/jjb.script/config.js +52 -19
- package/src/new/cmd.init.copy/react-component/package.json +6 -2
- package/src/new/cmd.init.copy/react-component/public/index.html +11 -0
- package/src/new/cmd.init.copy/react-component/src/index.js +6 -2
- package/src/new/cmd.install/index.js +15 -8
package/package.json
CHANGED
@@ -4,16 +4,16 @@
|
|
4
4
|
"installResources": [],
|
5
5
|
"environment": {
|
6
6
|
"development": {
|
7
|
-
"
|
7
|
+
"API_HOST": ""
|
8
8
|
},
|
9
9
|
"test": {
|
10
|
-
"
|
10
|
+
"API_HOST": ""
|
11
11
|
},
|
12
12
|
"release": {
|
13
|
-
"
|
13
|
+
"API_HOST": ""
|
14
14
|
},
|
15
15
|
"production": {
|
16
|
-
"
|
16
|
+
"API_HOST": ""
|
17
17
|
}
|
18
18
|
},
|
19
19
|
"contextInject": {},
|
@@ -1,11 +1,14 @@
|
|
1
1
|
const { hasEnvironment } = require('./utils');
|
2
2
|
|
3
|
-
if (!hasEnvironment()) {
|
3
|
+
if ( !hasEnvironment()) {
|
4
4
|
throw Error('jjb.script[build]: 启动build需要提供NODE_ENV变量,请确认你所运行的脚本是否正确?');
|
5
5
|
}
|
6
6
|
|
7
|
-
require('webpack')(require('./config')('production').webpack).run(
|
8
|
-
if (!
|
9
|
-
console.log('
|
7
|
+
require('webpack')(require('./config')('production').webpack).run(function (stat, compiler) {
|
8
|
+
if ( !compiler.compilation.errors.length) {
|
9
|
+
console.log('库文件Build完成!');
|
10
|
+
} else {
|
11
|
+
console.log('库文件Build失败,发现以下问题,请解决后重试!');
|
12
|
+
console.log(compiler.compilation.errors);
|
10
13
|
}
|
11
14
|
});
|
@@ -3,36 +3,40 @@
|
|
3
3
|
"installTarget": "node_modules",
|
4
4
|
"installResources": [
|
5
5
|
"jjb-dva-runtime",
|
6
|
-
"jjb-common-
|
6
|
+
"jjb-common-lib",
|
7
|
+
"jjb-common-decorator",
|
8
|
+
"react-admin-component"
|
7
9
|
],
|
8
10
|
"environment": {
|
9
11
|
"development": {
|
10
|
-
"
|
12
|
+
"API_HOST": "http://10.43.25.208:8888"
|
11
13
|
},
|
12
14
|
"test": {
|
13
|
-
|
15
|
+
|
14
16
|
},
|
15
17
|
"release": {
|
16
|
-
|
18
|
+
|
17
19
|
},
|
18
20
|
"production": {
|
19
|
-
"
|
21
|
+
"API_HOST": "https://zfdapi.ynjspx.cn"
|
20
22
|
}
|
21
23
|
},
|
22
24
|
"contextInject": {
|
25
|
+
"basename": "/"
|
23
26
|
},
|
24
27
|
"windowInject": {
|
25
|
-
"title": "
|
26
|
-
"
|
28
|
+
"title": "桌面",
|
29
|
+
"tenantCode": "YN",
|
30
|
+
"jjbCommonLibUrl": "https://cdn.cqjjb.cn/jjb-common-lib/latest/index.js"
|
27
31
|
},
|
28
32
|
"server": {
|
29
|
-
"port": "
|
33
|
+
"port": "8888",
|
30
34
|
"host": "127.0.0.1"
|
31
35
|
},
|
32
36
|
"framework": {
|
33
37
|
"antd": {
|
34
|
-
"link-color": "#
|
35
|
-
"primary-color": "#
|
38
|
+
"link-color": "#007AFF",
|
39
|
+
"primary-color": "#007AFF",
|
36
40
|
"border-radius-base": "2px"
|
37
41
|
}
|
38
42
|
}
|
@@ -1,11 +1,14 @@
|
|
1
1
|
const { hasEnvironment } = require('./utils');
|
2
2
|
|
3
|
-
if (!hasEnvironment()) {
|
3
|
+
if ( !hasEnvironment()) {
|
4
4
|
throw Error('jjb.script[build]: 启动build需要提供NODE_ENV变量,请确认你所运行的脚本是否正确?');
|
5
5
|
}
|
6
6
|
|
7
|
-
require('webpack')(require('./config')('production').webpack).run(
|
8
|
-
if (!
|
9
|
-
console.log('
|
7
|
+
require('webpack')(require('./config')('production').webpack).run(function (stat, compiler) {
|
8
|
+
if ( !compiler.compilation.errors.length) {
|
9
|
+
console.log('项目Build完成!');
|
10
|
+
} else {
|
11
|
+
console.log('项目Build失败,发现以下问题,请解决后重试!');
|
12
|
+
console.log(compiler.compilation.errors);
|
10
13
|
}
|
11
14
|
});
|
@@ -94,7 +94,9 @@ module.exports = mode => {
|
|
94
94
|
// ‘jjb-dva-runtime’库
|
95
95
|
path.resolve(__dirname, '../node_modules/jjb-dva-runtime'),
|
96
96
|
// ‘jjb-common-decorator’库
|
97
|
-
path.resolve(__dirname, '../node_modules/jjb-common-decorator')
|
97
|
+
path.resolve(__dirname, '../node_modules/jjb-common-decorator'),
|
98
|
+
// ‘react-admin-component’库
|
99
|
+
path.resolve(__dirname, '../node_modules/jjb-react-admin-component')
|
98
100
|
],
|
99
101
|
// 配置‘babel-loader’
|
100
102
|
options: {
|
@@ -129,11 +131,11 @@ module.exports = mode => {
|
|
129
131
|
// 处理‘svg’文件
|
130
132
|
test: /\.svg/,
|
131
133
|
// 使用‘file-loader’
|
132
|
-
loader: '
|
134
|
+
loader: 'url-loader',
|
133
135
|
// 配置‘file-loader’
|
134
136
|
options: {
|
135
|
-
//
|
136
|
-
|
137
|
+
// 转base64
|
138
|
+
limit: false
|
137
139
|
}
|
138
140
|
},
|
139
141
|
{
|
@@ -143,13 +145,8 @@ module.exports = mode => {
|
|
143
145
|
loader: 'url-loader',
|
144
146
|
// 配置‘url-loader’
|
145
147
|
options: {
|
146
|
-
//
|
147
|
-
|
148
|
-
limit: false,
|
149
|
-
// 处理引入地址‘code’编码为‘utf-8’
|
150
|
-
encoding: true,
|
151
|
-
// 若输出为‘url’,需要指定存储目录
|
152
|
-
outputPath: 'media/image'
|
148
|
+
// 转base64
|
149
|
+
limit: false
|
153
150
|
}
|
154
151
|
}
|
155
152
|
]
|
@@ -186,7 +183,7 @@ module.exports = mode => {
|
|
186
183
|
],
|
187
184
|
// 外部扩展
|
188
185
|
externals: {
|
189
|
-
'jjb-common-lib': 'jjbCommonLib'
|
186
|
+
'jjb-common-lib-types': 'jjbCommonLib'
|
190
187
|
},
|
191
188
|
// 打包优化
|
192
189
|
optimization: isProduction
|
@@ -10,4 +10,4 @@ exports.hasEnvironment = () => process.env.NODE_ENV !== undefined;
|
|
10
10
|
* @param name {string}
|
11
11
|
* @return {`${string}\\${string}`}
|
12
12
|
*/
|
13
|
-
exports.requireResolve = name => `${path.resolve(__dirname, '..')}
|
13
|
+
exports.requireResolve = name => `${path.resolve(__dirname, '..')}//${name}`;
|
@@ -13,8 +13,7 @@
|
|
13
13
|
"build:development": "cross-env NODE_ENV=development npm run build",
|
14
14
|
"build:test": "cross-env NODE_ENV=test npm run build",
|
15
15
|
"build:release": "cross-env NODE_ENV=release npm run build",
|
16
|
-
"build:production": "cross-env NODE_ENV=production npm run build"
|
17
|
-
"jjb-cmd:install": "jjb-cmd install"
|
16
|
+
"build:production": "cross-env NODE_ENV=production npm run build"
|
18
17
|
},
|
19
18
|
"author": "JJB",
|
20
19
|
"license": "MIT",
|
@@ -46,12 +45,19 @@
|
|
46
45
|
},
|
47
46
|
"dependencies": {
|
48
47
|
"@ant-design/icons": "^4.7.0",
|
48
|
+
"@xiwell/ant-form-validate-tools": "^1.1.8",
|
49
49
|
"antd": "^4.23.5",
|
50
50
|
"axios": "^1.1.2",
|
51
51
|
"crypto-js": "^4.1.1",
|
52
52
|
"dva": "^2.6.0-beta.22",
|
53
|
+
"echarts": "^5.4.0",
|
53
54
|
"history": "^5.3.0",
|
55
|
+
"jjb-common-decorator": "^1.0.0",
|
56
|
+
"jjb-common-lib-types": "^1.0.0",
|
57
|
+
"jjb-dva-runtime": "^1.0.1",
|
58
|
+
"jjb-react-admin-component": "^1.0.3",
|
54
59
|
"moment": "^2.29.4",
|
60
|
+
"object-field-resolve": "^1.0.5",
|
55
61
|
"prop-types": "^15.8.1",
|
56
62
|
"qiankun": "^2.8.3",
|
57
63
|
"react": "^17.0.2",
|
@@ -1,22 +1,33 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="zh">
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta
|
6
|
+
name="renderer"
|
7
|
+
content="webkit"
|
8
|
+
>
|
9
|
+
<meta
|
10
|
+
http-equiv="X-UA-Compatible"
|
11
|
+
content="IE=edge,Chrome=1"
|
12
|
+
>
|
13
|
+
<title>
|
14
|
+
<%= htmlWebpackPlugin.options.title %>
|
15
|
+
</title>
|
16
|
+
<script>
|
17
|
+
window.__JJB_ENVIRONMENT__ = {
|
18
|
+
API_HOST: '<%= htmlWebpackPlugin.options.API_HOST %>',
|
19
|
+
tenantCode: '<%= htmlWebpackPlugin.options.tenantCode %>',
|
20
|
+
FRAMEWORK: JSON.parse('<%= JSON.stringify(htmlWebpackPlugin.options.framework.antd) %>')
|
21
|
+
};
|
22
|
+
sessionStorage.setItem('tenantCode', window.__JJB_ENVIRONMENT__.tenantCode);
|
23
|
+
</script>
|
24
|
+
<script src="<%= htmlWebpackPlugin.options.jjbCommonLibUrl %>"></script>
|
25
|
+
</head>
|
26
|
+
<body>
|
27
|
+
<noscript>此网页需要开启JavaScript功能。</noscript>
|
28
|
+
<div
|
29
|
+
id="root"
|
30
|
+
style="width: 100%; height: 100%; position: relative"
|
31
|
+
></div>
|
32
|
+
</body>
|
22
33
|
</html>
|
File without changes
|
@@ -1,22 +1,23 @@
|
|
1
1
|
{
|
2
2
|
"projectType": "micro-spa",
|
3
3
|
"installTarget": "node_modules",
|
4
|
-
"installResources": [
|
4
|
+
"installResources": [
|
5
|
+
"jjb-common-lib"
|
6
|
+
],
|
5
7
|
"environment": {
|
6
8
|
"development": {
|
7
|
-
"
|
9
|
+
"API_HOST": ""
|
8
10
|
},
|
9
11
|
"test": {
|
10
|
-
"
|
12
|
+
"API_HOST": ""
|
11
13
|
},
|
12
14
|
"release": {
|
13
|
-
"
|
15
|
+
"API_HOST": ""
|
14
16
|
},
|
15
17
|
"production": {
|
16
|
-
"
|
18
|
+
"API_HOST": ""
|
17
19
|
}
|
18
20
|
},
|
19
|
-
"contextInject": {},
|
20
21
|
"windowInject": {},
|
21
22
|
"server": {
|
22
23
|
"port": "8066",
|
@@ -24,7 +25,6 @@
|
|
24
25
|
},
|
25
26
|
"framework": {
|
26
27
|
"antd": {
|
27
|
-
"ant-prefix": "test",
|
28
28
|
"link-color": "red",
|
29
29
|
"primary-color": "red",
|
30
30
|
"border-radius-base": "2px"
|
@@ -1,11 +1,14 @@
|
|
1
1
|
const { hasEnvironment } = require('./utils');
|
2
2
|
|
3
|
-
if (!hasEnvironment()) {
|
3
|
+
if ( !hasEnvironment()) {
|
4
4
|
throw Error('jjb.script[build]: 启动build需要提供NODE_ENV变量,请确认你所运行的脚本是否正确?');
|
5
5
|
}
|
6
6
|
|
7
|
-
require('webpack')(require('./config')('production').webpack).run(
|
8
|
-
if (!
|
9
|
-
console.log('
|
7
|
+
require('webpack')(require('./config')('production').webpack).run(function (stat, compiler) {
|
8
|
+
if ( !compiler.compilation.errors.length) {
|
9
|
+
console.log('组件Build完成!');
|
10
|
+
} else {
|
11
|
+
console.log('组件Build失败,发现以下问题,请解决后重试!');
|
12
|
+
console.log(compiler.compilation.errors);
|
10
13
|
}
|
11
14
|
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// noinspection JSUnresolvedVariable
|
2
2
|
|
3
3
|
const path = require('path');
|
4
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
4
5
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
5
6
|
const { requireResolve } = require('./utils');
|
6
7
|
const webpack = require('webpack');
|
@@ -8,7 +9,13 @@ const webpack = require('webpack');
|
|
8
9
|
const config = require(requireResolve('jjb.config.json'));
|
9
10
|
const packageJSON = require(requireResolve('package.json'));
|
10
11
|
const server = (config.server || {});
|
12
|
+
const framework = (config.framework || {});
|
11
13
|
const environment = (config.environment || {})[ process.env.NODE_ENV ];
|
14
|
+
const windowInject = {
|
15
|
+
...(config.windowInject || {}),
|
16
|
+
...environment,
|
17
|
+
framework
|
18
|
+
};
|
12
19
|
const contextInject = (config.contextInject || {});
|
13
20
|
const contextData = {
|
14
21
|
...environment,
|
@@ -16,6 +23,7 @@ const contextData = {
|
|
16
23
|
};
|
17
24
|
|
18
25
|
module.exports = mode => {
|
26
|
+
const isProduction = mode === 'production';
|
19
27
|
return {
|
20
28
|
server,
|
21
29
|
webpack: {
|
@@ -25,6 +33,7 @@ module.exports = mode => {
|
|
25
33
|
entry: './src/index.js',
|
26
34
|
// 输出
|
27
35
|
output: {
|
36
|
+
libraryTarget: 'umd',
|
28
37
|
// 指定输出目录文件名
|
29
38
|
path: path.resolve(__dirname, '../dist'),
|
30
39
|
// 定义全局变量,暴露到‘window’对象中
|
@@ -32,9 +41,7 @@ module.exports = mode => {
|
|
32
41
|
// 指定编译的‘js’存放目录文件名称
|
33
42
|
filename: 'index.js',
|
34
43
|
// 输出公共路径
|
35
|
-
publicPath: '/'
|
36
|
-
// 默认暴露‘window’此处修改为暴露到‘exports’中
|
37
|
-
libraryTarget: 'umd'
|
44
|
+
publicPath: '/'
|
38
45
|
},
|
39
46
|
// ‘node.module’
|
40
47
|
module: {
|
@@ -45,9 +52,14 @@ module.exports = mode => {
|
|
45
52
|
test: /\.(less|css)$/,
|
46
53
|
// 以此从下到上处理‘css’
|
47
54
|
use: [
|
55
|
+
// 3:由‘webpack.MiniCssExtractPlugin.loader’做收尾工作
|
56
|
+
// 主要分离css文件
|
48
57
|
{
|
49
58
|
loader: 'style-loader'
|
50
59
|
},
|
60
|
+
// {
|
61
|
+
// loader: MiniCssExtractPlugin.loader
|
62
|
+
// },
|
51
63
|
// 2:将被‘less-loader’处理的‘css’
|
52
64
|
// 由‘css-loader’再次处理
|
53
65
|
{
|
@@ -62,7 +74,7 @@ module.exports = mode => {
|
|
62
74
|
// ‘less-loader’特殊配置
|
63
75
|
lessOptions: {
|
64
76
|
// 定义‘less’全局变量,从jjb.config.antd获取
|
65
|
-
modifyVars: (
|
77
|
+
modifyVars: (framework || {}).antd || {},
|
66
78
|
// 启用‘less-javascript’功能
|
67
79
|
javascriptEnabled: true
|
68
80
|
}
|
@@ -78,11 +90,7 @@ module.exports = mode => {
|
|
78
90
|
// 允许‘babel-loader’操作目录
|
79
91
|
include: [
|
80
92
|
// 整个‘src’目录
|
81
|
-
path.resolve(__dirname, '../src')
|
82
|
-
// ‘jjb-common’库
|
83
|
-
path.resolve(__dirname, '../node_modules/jjb-common'),
|
84
|
-
// ‘jjb-react-admin-component’库
|
85
|
-
path.resolve(__dirname, '../node_modules/jjb-react-admin-component')
|
93
|
+
path.resolve(__dirname, '../src')
|
86
94
|
],
|
87
95
|
// 配置‘babel-loader’
|
88
96
|
options: {
|
@@ -95,10 +103,10 @@ module.exports = mode => {
|
|
95
103
|
libraryName: 'antd',
|
96
104
|
// 按需将‘es’文件夹中组件导出,绑定到‘antd’变量
|
97
105
|
// 除了‘es’,也可以修改为‘lib’
|
98
|
-
libraryDirectory: 'es'
|
106
|
+
libraryDirectory: 'es',
|
99
107
|
// 这里设为‘true’,表示自动导入‘antd/dist/less’
|
100
108
|
// 或修改为‘css’ | ‘less’
|
101
|
-
|
109
|
+
style: true
|
102
110
|
}
|
103
111
|
],
|
104
112
|
[
|
@@ -113,6 +121,16 @@ module.exports = mode => {
|
|
113
121
|
presets: [ '@babel/preset-react' ]
|
114
122
|
}
|
115
123
|
},
|
124
|
+
{
|
125
|
+
// 处理‘svg’文件
|
126
|
+
test: /\.svg/,
|
127
|
+
// 使用‘file-loader’
|
128
|
+
loader: 'url-loader',
|
129
|
+
// 配置‘file-loader’
|
130
|
+
options: {
|
131
|
+
limit: true
|
132
|
+
}
|
133
|
+
},
|
116
134
|
{
|
117
135
|
// 处理图片文件
|
118
136
|
test: /\.(png|jpg|jpeg|gif|ico|bmp)/,
|
@@ -120,8 +138,6 @@ module.exports = mode => {
|
|
120
138
|
loader: 'url-loader',
|
121
139
|
// 配置‘url-loader’
|
122
140
|
options: {
|
123
|
-
// 当文件大小处于(?)byte,输出‘base64’,反之为‘url’.
|
124
|
-
// 这里设为‘false’,表示无论多大多小,都为‘url’.
|
125
141
|
limit: true
|
126
142
|
}
|
127
143
|
}
|
@@ -134,13 +150,20 @@ module.exports = mode => {
|
|
134
150
|
'~': requireResolve('src')
|
135
151
|
}
|
136
152
|
},
|
137
|
-
externals: {
|
138
|
-
'jjb-common-lib': 'jjbCommonLib',
|
139
|
-
'react': 'React',
|
140
|
-
'react-dom': 'ReactDOM',
|
141
|
-
},
|
142
153
|
// 插件
|
143
154
|
plugins: [
|
155
|
+
// 定义输出‘html’模板
|
156
|
+
// 并向‘window’全局注入变量
|
157
|
+
!isProduction
|
158
|
+
? new HtmlWebpackPlugin(Object.assign({ template: requireResolve('public/index.html') }, windowInject))
|
159
|
+
: null,
|
160
|
+
// 对分离的‘css’区块定义同步导入名称,和异步导入名称
|
161
|
+
// new MiniCssExtractPlugin({
|
162
|
+
// // 同步导入‘import | require’
|
163
|
+
// filename: 'static/css/[id].css',
|
164
|
+
// // 异步导入‘import | require’
|
165
|
+
// chunkFilename: 'static/css/[id].css'
|
166
|
+
// }),
|
144
167
|
// 注入全局变量到项目中,从‘jjb.config.contextData’读取
|
145
168
|
new webpack.DefinePlugin({ 'process.env.app': JSON.stringify(contextData) }),
|
146
169
|
// 解决‘moment.js’本地化文件过多问题
|
@@ -151,7 +174,17 @@ module.exports = mode => {
|
|
151
174
|
}),
|
152
175
|
// 每次打包前删除‘dist’目录
|
153
176
|
new CleanWebpackPlugin()
|
154
|
-
]
|
177
|
+
].filter(value => !!value),
|
178
|
+
// 外部扩展
|
179
|
+
externals: {
|
180
|
+
'jjb-common-lib': 'jjbCommonLib',
|
181
|
+
...(isProduction
|
182
|
+
? {
|
183
|
+
'react': 'React',
|
184
|
+
'react-dom': 'ReactDOM'
|
185
|
+
}
|
186
|
+
: {})
|
187
|
+
}
|
155
188
|
}
|
156
189
|
};
|
157
190
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"name": "react-component",
|
2
|
+
"name": "test-react-component",
|
3
3
|
"version": "1.0.7",
|
4
4
|
"description": "react组件模板",
|
5
5
|
"main": "index.js",
|
@@ -28,14 +28,18 @@
|
|
28
28
|
"connect-history-api-fallback": "^2.0.0",
|
29
29
|
"cross-env": "^7.0.3",
|
30
30
|
"css-loader": "^6.7.1",
|
31
|
+
"css-minimizer-webpack-plugin": "^4.2.2",
|
31
32
|
"express": "^4.18.2",
|
32
33
|
"file-loader": "^6.2.0",
|
34
|
+
"html-webpack-plugin": "^5.5.0",
|
33
35
|
"less": "^4.1.3",
|
34
36
|
"less-loader": "^11.1.0",
|
37
|
+
"mini-css-extract-plugin": "^2.7.0",
|
35
38
|
"style-loader": "^3.3.1",
|
36
39
|
"url-loader": "^4.1.1",
|
37
40
|
"webpack": "^5.74.0",
|
38
|
-
"webpack-cli": "^4.10.0"
|
41
|
+
"webpack-cli": "^4.10.0",
|
42
|
+
"webpack-dev-server": "^4.11.1"
|
39
43
|
},
|
40
44
|
"dependencies": {
|
41
45
|
"@ant-design/icons": "^4.7.0",
|
@@ -1,11 +1,15 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
2
3
|
|
3
|
-
export class Test extends React.Component {
|
4
|
+
export default class Test extends React.Component {
|
4
5
|
render () {
|
5
6
|
return (
|
6
7
|
<div>
|
7
|
-
|
8
|
+
Hello World
|
8
9
|
</div>
|
9
10
|
);
|
10
11
|
}
|
11
12
|
}
|
13
|
+
|
14
|
+
// TODO 打包发布请删除此段代码,此处仅在开发模式用做预览。
|
15
|
+
ReactDOM.render(<Test />, document.getElementById('root'));
|
@@ -201,14 +201,21 @@ module.exports = () => {
|
|
201
201
|
*/
|
202
202
|
fs.mkdirSync(`${target_node_modules}\\${package_name}`);
|
203
203
|
}
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
204
|
+
if (package_name !== 'jjb-common-lib') {
|
205
|
+
/**
|
206
|
+
* 文件操作:复制文件到node_modules中
|
207
|
+
*/
|
208
|
+
f_file_copy(item.path, `${target_node_modules}\\${package_name}`);
|
209
|
+
/**
|
210
|
+
* 文件操作:创建package.json
|
211
|
+
*/
|
212
|
+
f_create_package_json(`${target_node_modules}\\${package_name}`, package_name, '1.0.0');
|
213
|
+
} else {
|
214
|
+
/**
|
215
|
+
* 文件操作:复制文件到node_modules中
|
216
|
+
*/
|
217
|
+
f_file_copy(`${item.path}\\types`, `${target_node_modules}\\${package_name}`);
|
218
|
+
}
|
212
219
|
/**
|
213
220
|
* 文件操作:在src/package.json中定义一个组件依赖
|
214
221
|
*/
|