jjb-cmd 1.0.16 → 2.0.0
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/bin/command-old.js +65 -0
- package/bin/command.js +52 -40
- package/package.json +7 -4
- package/src/new/cmd.init/index.js +48 -0
- package/src/{cli.init → new/cmd.init.copy/lib}/jjb.config.json +3 -8
- package/src/{cli.init → new/cmd.init.copy/lib}/jjb.script/build.js +0 -0
- package/src/new/cmd.init.copy/lib/jjb.script/config.js +149 -0
- package/src/{cli.init → new/cmd.init.copy/lib}/jjb.script/proxy.js +0 -0
- package/src/{cli.init → new/cmd.init.copy/lib}/jjb.script/server.js +0 -0
- package/src/{cli.init → new/cmd.init.copy/lib}/jjb.script/utils.js +0 -0
- package/src/{cli.init → new/cmd.init.copy/lib}/package.json +2 -2
- package/src/new/cmd.init.copy/lib/src/index.js +1 -0
- package/src/{cli.init → new/cmd.init.copy/lib}/webstorm.config.js +0 -0
- package/src/new/cmd.init.copy/micro-app/jjb.config.json +40 -0
- package/src/new/cmd.init.copy/micro-app/jjb.script/build.js +11 -0
- package/src/new/cmd.init.copy/micro-app/jjb.script/config.js +222 -0
- package/src/new/cmd.init.copy/micro-app/jjb.script/proxy.js +19 -0
- package/src/new/cmd.init.copy/micro-app/jjb.script/server.js +29 -0
- package/src/new/cmd.init.copy/micro-app/jjb.script/utils.js +13 -0
- package/src/new/cmd.init.copy/micro-app/package.json +65 -0
- package/src/new/cmd.init.copy/micro-app/public/index.html +22 -0
- package/src/new/cmd.init.copy/micro-app/src/enumerate/namespace/index.js +3 -0
- package/src/new/cmd.init.copy/micro-app/src/index.js +24 -0
- package/src/new/cmd.init.copy/micro-app/src/models/main/index.js +9 -0
- package/src/new/cmd.init.copy/micro-app/src/pages/index.js +11 -0
- package/src/new/cmd.init.copy/micro-app/webstorm.config.js +18 -0
- package/src/new/cmd.init.copy/react-component/jjb.config.json +33 -0
- package/src/new/cmd.init.copy/react-component/jjb.script/build.js +11 -0
- package/src/new/cmd.init.copy/react-component/jjb.script/config.js +159 -0
- package/src/new/cmd.init.copy/react-component/jjb.script/proxy.js +22 -0
- package/src/new/cmd.init.copy/react-component/jjb.script/server.js +29 -0
- package/src/new/cmd.init.copy/react-component/jjb.script/utils.js +13 -0
- package/src/new/cmd.init.copy/react-component/package.json +56 -0
- package/src/new/cmd.init.copy/react-component/src/index.js +11 -0
- package/src/new/cmd.init.copy/react-component/webstorm.config.js +16 -0
- package/src/new/cmd.install/config.js +31 -0
- package/src/new/cmd.install/index.js +255 -0
- package/src/{cli.install → new/cmd.install}/tools.js +5 -2
- package/src/new/cmd.push/index.js +54 -0
- package/src/new/cmd.reglist/index.js +22 -0
- package/src/new/cmd.rm-rf/index.js +58 -0
- package/src/new/cmd.version/index.js +34 -0
- package/src/{cli.dva.register.saas.txt → old/cli.dva.register.saas.txt} +5 -9
- package/src/{cli.dva.register.spa.txt → old/cli.dva.register.spa.txt} +0 -0
- package/src/{cli.dva.router.saas.txt → old/cli.dva.router.saas.txt} +37 -25
- package/src/{cli.dva.router.spa.txt → old/cli.dva.router.spa.txt} +0 -0
- package/src/old/cli.init/jjb.config.json +40 -0
- package/src/old/cli.init/jjb.script/build.js +11 -0
- package/src/{cli.init → old/cli.init}/jjb.script/config.js +11 -8
- package/src/old/cli.init/jjb.script/proxy.js +19 -0
- package/src/old/cli.init/jjb.script/server.js +29 -0
- package/src/old/cli.init/jjb.script/utils.js +13 -0
- package/src/old/cli.init/package.json +65 -0
- package/src/{cli.init → old/cli.init}/public/index.html +7 -1
- package/src/{cli.init → old/cli.init}/src/enumerate/menu/index.js +0 -0
- package/src/old/cli.init/src/enumerate/namespace/index.js +3 -0
- package/src/{cli.init → old/cli.init}/src/index.js +1 -1
- package/src/old/cli.init/src/models/main/index.js +31 -0
- package/src/old/cli.init/src/pages/index.js +9 -0
- package/src/old/cli.init/webstorm.config.js +18 -0
- package/src/{cli.init.js → old/cli.init.js} +1 -4
- package/src/{cli.install → old/cli.install}/config.js +12 -0
- package/src/{cli.install → old/cli.install}/index.js +3 -5
- package/src/old/cli.install/tools.js +230 -0
- package/src/{cli.merge.js → old/cli.merge.js} +0 -0
- package/src/{cli.pull.js → old/cli.pull.js} +0 -0
- package/src/{cli.pull2.js → old/cli.pull2.js} +4 -6
- package/src/{cli.rm-rf.js → old/cli.rm-rf.js} +11 -11
- package/src/{progress-bar.js → old/progress-bar.js} +0 -0
- package/src/{util.js → old/util.js} +0 -0
- package/src/cli.init/src/enumerate/namespace/index.js +0 -3
- package/src/cli.init/src/models/demo/index.js +0 -10
- package/src/cli.init/src/pages/index.js +0 -14
@@ -0,0 +1,65 @@
|
|
1
|
+
#! /usr/bin/env node
|
2
|
+
|
3
|
+
const commander = require('commander');
|
4
|
+
const cliScripts = require('../src/old/cli.pull.js');
|
5
|
+
const cliScripts2 = require('../src/old/cli.pull2.js');
|
6
|
+
const cliScripts3 = require('../src/old/cli.install/index.js');
|
7
|
+
const cliScripts4 = require('../src/old/cli.rm-rf.js');
|
8
|
+
const cliScripts6 = require('../src/old/cli.init');
|
9
|
+
const MergeScripts = require('../src/old/cli.merge.js');
|
10
|
+
|
11
|
+
commander.command('v').description('-- 查看版本').action(() => {
|
12
|
+
console.log('当前版本 v1.0.12');
|
13
|
+
});
|
14
|
+
|
15
|
+
commander.command('help').description('-- 帮助').action(() => {
|
16
|
+
console.log('使用方法:');
|
17
|
+
console.log('1.jjb-cmd v -- 查看版本。');
|
18
|
+
console.log('2.jjb-cmd help -- 帮助。');
|
19
|
+
console.log('3.jjb-cmd view res -- 预览资源。');
|
20
|
+
console.log('4.jjb-cmd [actionName (有效值 pull | pull2 | install | rm-rf)] [...args] -- 基础功能。');
|
21
|
+
});
|
22
|
+
|
23
|
+
commander.command('view res').description('-- 预览资源').action(() => {
|
24
|
+
console.log('当前可资源:');
|
25
|
+
console.log('[common, react-admin-component]');
|
26
|
+
});
|
27
|
+
|
28
|
+
// pull 命令
|
29
|
+
commander.command('pull -- <文件夹名称必填。>').description('-- 文件名称').action(res => {
|
30
|
+
console.log('pull命令已过时,新项目请使用pull2.');
|
31
|
+
cliScripts(res);
|
32
|
+
});
|
33
|
+
|
34
|
+
// pull 命令
|
35
|
+
commander.command('pull2 -- <文件夹名称必填。>').description('-- 文件名称').action(res => {
|
36
|
+
cliScripts2(res);
|
37
|
+
});
|
38
|
+
|
39
|
+
// pull 命令
|
40
|
+
commander.command('init').description('-- 初始化项目').action(res => {
|
41
|
+
cliScripts6(res);
|
42
|
+
});
|
43
|
+
|
44
|
+
// rm-rf 命令
|
45
|
+
commander.command('rm-rf').description('-- 删除全部').action(res => {
|
46
|
+
cliScripts4(res);
|
47
|
+
});
|
48
|
+
|
49
|
+
// install 安装
|
50
|
+
commander.command('install').description('-- 安装').action(res => {
|
51
|
+
cliScripts3(res);
|
52
|
+
});
|
53
|
+
|
54
|
+
//多省多应用命令
|
55
|
+
commander.command('mp -- <multi prov多省多应用启动dev>').description('-- multi prov多省多应用合并').action(res => {
|
56
|
+
MergeScripts(res, 'mp');
|
57
|
+
console.log('start test');
|
58
|
+
});
|
59
|
+
|
60
|
+
//多省单应用
|
61
|
+
commander.command('sp -- <single prov多省单应用>').description('-- single prov多省单应用').action(res => {
|
62
|
+
|
63
|
+
});
|
64
|
+
|
65
|
+
commander.parse(process.argv);
|
package/bin/command.js
CHANGED
@@ -1,23 +1,9 @@
|
|
1
1
|
#! /usr/bin/env node
|
2
2
|
|
3
3
|
const commander = require('commander');
|
4
|
-
const cliScripts = require('../src/cli.pull.js');
|
5
|
-
const cliScripts2 = require('../src/cli.pull2.js');
|
6
|
-
const cliScripts3 = require('../src/cli.install/index.js');
|
7
|
-
const cliScripts4 = require('../src/cli.rm-rf.js');
|
8
|
-
const cliScripts6 = require('../src/cli.init');
|
9
|
-
const MergeScripts = require('../src/cli.merge.js');
|
10
4
|
|
11
5
|
commander.command('v').description('-- 查看版本').action(() => {
|
12
|
-
console.log('当前版本
|
13
|
-
});
|
14
|
-
|
15
|
-
commander.command('help').description('-- 帮助').action(() => {
|
16
|
-
console.log('使用方法:');
|
17
|
-
console.log('1.jjb-cmd v -- 查看版本。');
|
18
|
-
console.log('2.jjb-cmd help -- 帮助。');
|
19
|
-
console.log('3.jjb-cmd view res -- 预览资源。');
|
20
|
-
console.log('4.jjb-cmd [actionName (有效值 pull | pull2 | install | rm-rf)] [...args] -- 基础功能。');
|
6
|
+
console.log('当前版本 v2.0.0');
|
21
7
|
});
|
22
8
|
|
23
9
|
commander.command('view res').description('-- 预览资源').action(() => {
|
@@ -25,41 +11,67 @@ commander.command('view res').description('-- 预览资源').action(() => {
|
|
25
11
|
console.log('[common, react-admin-component]');
|
26
12
|
});
|
27
13
|
|
28
|
-
//
|
29
|
-
commander.command('
|
30
|
-
|
31
|
-
|
14
|
+
// publish 命令
|
15
|
+
commander.command('push [args]').description('-- 发布包').action(args => {
|
16
|
+
if (args) {
|
17
|
+
if ([
|
18
|
+
'server',
|
19
|
+
'version',
|
20
|
+
'v',
|
21
|
+
'latest',
|
22
|
+
'components'
|
23
|
+
].includes(args)) {
|
24
|
+
if ([
|
25
|
+
'v',
|
26
|
+
'version'
|
27
|
+
].includes(args)) {
|
28
|
+
require('../src/new/cmd.version/index.js')();
|
29
|
+
}
|
30
|
+
if ([
|
31
|
+
'server',
|
32
|
+
'components'
|
33
|
+
].includes(args)) {
|
34
|
+
require('../src/new/cmd.reglist/index.js')(args);
|
35
|
+
}
|
36
|
+
if ([ 'latest' ].includes(args)) {
|
37
|
+
require('../src/new/cmd.push/index.js')('latest');
|
38
|
+
}
|
39
|
+
} else {
|
40
|
+
console.log(`无效的选项‘${args}’。`);
|
41
|
+
process.exit(0);
|
42
|
+
}
|
43
|
+
} else {
|
44
|
+
require('../src/new/cmd.push/index.js')(null);
|
45
|
+
}
|
32
46
|
});
|
33
47
|
|
34
|
-
//
|
35
|
-
commander.command('
|
36
|
-
|
48
|
+
// reglist 命令
|
49
|
+
commander.command('reg [args]').description('-- 查询注册表').action(a => {
|
50
|
+
// require('../src/new/cmd.reglist/index.js')();
|
37
51
|
});
|
38
52
|
|
39
|
-
//
|
40
|
-
commander.command('init').description('--
|
41
|
-
|
53
|
+
// init 命令
|
54
|
+
commander.command('init -- <templateName>').description('-- 初始化模板').action(stdin => {
|
55
|
+
if ([
|
56
|
+
'lib',
|
57
|
+
'react-component',
|
58
|
+
'micro-app'
|
59
|
+
].includes(stdin)) {
|
60
|
+
require('../src/new/cmd.init/index.js')(stdin);
|
61
|
+
} else {
|
62
|
+
console.log(`初始化失败,未能正确输入模板类型,仅支持(lib,react-component,micro-app)模板。`);
|
63
|
+
process.exit(0);
|
64
|
+
}
|
42
65
|
});
|
43
66
|
|
44
67
|
// rm-rf 命令
|
45
|
-
commander.command('rm-rf').description('-- 删除全部').action(
|
46
|
-
|
68
|
+
commander.command('rm-rf').description('-- 删除全部').action(() => {
|
69
|
+
require('../src/new/cmd.rm-rf/index.js')();
|
47
70
|
});
|
48
71
|
|
49
72
|
// install 安装
|
50
|
-
commander.command('install').description('-- 安装').action(
|
51
|
-
|
52
|
-
});
|
53
|
-
|
54
|
-
//多省多应用命令
|
55
|
-
commander.command('mp -- <multi prov多省多应用启动dev>').description('-- multi prov多省多应用合并').action(res => {
|
56
|
-
MergeScripts(res, 'mp');
|
57
|
-
console.log('start test');
|
58
|
-
});
|
59
|
-
|
60
|
-
//多省单应用
|
61
|
-
commander.command('sp -- <single prov多省单应用>').description('-- single prov多省单应用').action(res => {
|
62
|
-
|
73
|
+
commander.command('install').description('-- 安装').action(() => {
|
74
|
+
require('../src/new/cmd.install/index.js')();
|
63
75
|
});
|
64
76
|
|
65
77
|
commander.parse(process.argv);
|
package/package.json
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
{
|
2
2
|
"name": "jjb-cmd",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.0",
|
4
4
|
"description": "jjb脚手架工具",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
7
|
-
"test": "node bin/command.js help"
|
7
|
+
"test": "node bin/command.js help",
|
8
|
+
"publish": "npm publish",
|
9
|
+
"install:package": "npm i"
|
8
10
|
},
|
9
11
|
"bin": {
|
10
12
|
"jjb-cmd": "bin/command.js"
|
11
13
|
},
|
12
14
|
"author": "jjb-front-team",
|
13
15
|
"license": "MIT",
|
14
|
-
"
|
15
|
-
"
|
16
|
+
"devDependencies": {
|
17
|
+
"axios": "^1.1.3",
|
18
|
+
"commander": "^1.3.2",
|
16
19
|
"compressing": "^1.5.1",
|
17
20
|
"request": "2.88.2",
|
18
21
|
"single-line-log": "1.1.2"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const { f_file_copy } = require('../cmd.install/tools');
|
3
|
+
const fs = require('fs');
|
4
|
+
|
5
|
+
module.exports = stdin => {
|
6
|
+
/**
|
7
|
+
* 下发数据根路径
|
8
|
+
* @type {string}
|
9
|
+
*/
|
10
|
+
const root_path = path.resolve('./');
|
11
|
+
if (stdin === 'micro-app') {
|
12
|
+
if (
|
13
|
+
!fs.existsSync(`${root_path}\\jjb.script`) &&
|
14
|
+
!fs.existsSync(`${root_path}\\public`) &&
|
15
|
+
!fs.existsSync(`${root_path}\\src`) &&
|
16
|
+
!fs.existsSync(`${root_path}\\.gitignore`) &&
|
17
|
+
!fs.existsSync(`${root_path}\\jjb.config.json`) &&
|
18
|
+
!fs.existsSync(`${root_path}\\package.json`) &&
|
19
|
+
!fs.existsSync(`${root_path}\\webstorm.config.js`)
|
20
|
+
) {
|
21
|
+
f_file_copy(`${__dirname}\\..\\cmd.init.copy\\micro-app`, root_path);
|
22
|
+
console.log('初始化完成!');
|
23
|
+
process.exit(0);
|
24
|
+
} else {
|
25
|
+
console.log('初始化失败,文件已存在!');
|
26
|
+
process.exit(0);
|
27
|
+
}
|
28
|
+
} else if ([
|
29
|
+
'lib',
|
30
|
+
'react-component'
|
31
|
+
].includes(stdin)) {
|
32
|
+
if (
|
33
|
+
!fs.existsSync(`${root_path}\\jjb.script`) &&
|
34
|
+
!fs.existsSync(`${root_path}\\src`) &&
|
35
|
+
!fs.existsSync(`${root_path}\\.gitignore`) &&
|
36
|
+
!fs.existsSync(`${root_path}\\jjb.config.json`) &&
|
37
|
+
!fs.existsSync(`${root_path}\\package.json`) &&
|
38
|
+
!fs.existsSync(`${root_path}\\webstorm.config.js`)
|
39
|
+
) {
|
40
|
+
f_file_copy(`${__dirname}\\..\\cmd.init.copy\\${stdin}`, root_path);
|
41
|
+
console.log('初始化完成!');
|
42
|
+
process.exit(0);
|
43
|
+
} else {
|
44
|
+
console.log('初始化失败,文件已存在!');
|
45
|
+
process.exit(0);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
};
|
@@ -1,10 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"projectType": "micro-spa",
|
3
3
|
"installTarget": "node_modules",
|
4
|
-
"installResources": [
|
5
|
-
"common",
|
6
|
-
"react-admin-component"
|
7
|
-
],
|
4
|
+
"installResources": [],
|
8
5
|
"environment": {
|
9
6
|
"development": {
|
10
7
|
"API_HOSE": ""
|
@@ -20,11 +17,9 @@
|
|
20
17
|
}
|
21
18
|
},
|
22
19
|
"contextInject": {},
|
23
|
-
"windowInject": {
|
24
|
-
"title": "JJB Micro APP"
|
25
|
-
},
|
20
|
+
"windowInject": {},
|
26
21
|
"server": {
|
27
|
-
"port": "
|
22
|
+
"port": "8066",
|
28
23
|
"host": "127.0.0.1"
|
29
24
|
},
|
30
25
|
"framework": {
|
File without changes
|
@@ -0,0 +1,149 @@
|
|
1
|
+
// noinspection JSUnresolvedVariable
|
2
|
+
|
3
|
+
const path = require('path');
|
4
|
+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
5
|
+
const { requireResolve } = require('./utils');
|
6
|
+
const webpack = require('webpack');
|
7
|
+
|
8
|
+
const config = require(requireResolve('jjb.config.json'));
|
9
|
+
const packageJSON = require(requireResolve('package.json'));
|
10
|
+
const server = (config.server || {});
|
11
|
+
const environment = (config.environment || {})[ process.env.NODE_ENV ];
|
12
|
+
const windowInject = (config.windowInject || {});
|
13
|
+
const contextInject = (config.contextInject || {});
|
14
|
+
const contextData = {
|
15
|
+
...environment,
|
16
|
+
...contextInject
|
17
|
+
};
|
18
|
+
|
19
|
+
module.exports = mode => {
|
20
|
+
return {
|
21
|
+
server,
|
22
|
+
webpack: {
|
23
|
+
// 模式 ‘development’ | ‘production’
|
24
|
+
mode,
|
25
|
+
// 入口
|
26
|
+
entry: './src/index.js',
|
27
|
+
// 输出
|
28
|
+
output: {
|
29
|
+
// 指定输出目录文件名
|
30
|
+
path: path.resolve(__dirname, '../dist'),
|
31
|
+
// 定义全局变量,暴露到‘window’对象中
|
32
|
+
library: 'libName',
|
33
|
+
// 指定编译的‘js’存放目录文件名称
|
34
|
+
filename: 'index.js',
|
35
|
+
// 输出公共路径
|
36
|
+
publicPath: '/',
|
37
|
+
// 默认暴露‘window’此处修改为暴露到‘exports’中 window | umd
|
38
|
+
libraryTarget: 'window'
|
39
|
+
},
|
40
|
+
// ‘node.module’
|
41
|
+
module: {
|
42
|
+
// 文件处理
|
43
|
+
rules: [
|
44
|
+
{
|
45
|
+
// 处理‘less’和‘css’文件
|
46
|
+
test: /\.(less|css)$/,
|
47
|
+
// 以此从下到上处理‘css’
|
48
|
+
use: [
|
49
|
+
{
|
50
|
+
loader: 'style-loader'
|
51
|
+
},
|
52
|
+
// 2:将被‘less-loader’处理的‘css’
|
53
|
+
// 由‘css-loader’再次处理
|
54
|
+
{
|
55
|
+
loader: 'css-loader'
|
56
|
+
},
|
57
|
+
// 1:处理‘less’文件
|
58
|
+
{
|
59
|
+
// 使用‘less-loader’
|
60
|
+
loader: 'less-loader',
|
61
|
+
// 配置‘less-loader’
|
62
|
+
options: {
|
63
|
+
// ‘less-loader’特殊配置
|
64
|
+
lessOptions: {
|
65
|
+
// 定义‘less’全局变量,从jjb.config.antd获取
|
66
|
+
modifyVars: (config.framework || {}).antd || {},
|
67
|
+
// 启用‘less-javascript’功能
|
68
|
+
javascriptEnabled: true
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
]
|
73
|
+
},
|
74
|
+
{
|
75
|
+
// 处理‘js’文件
|
76
|
+
test: /\.js$/,
|
77
|
+
// 使用‘babel-loader’
|
78
|
+
loader: 'babel-loader',
|
79
|
+
// 允许‘babel-loader’操作目录
|
80
|
+
include: [
|
81
|
+
// 整个‘src’目录
|
82
|
+
path.resolve(__dirname, '../src')
|
83
|
+
],
|
84
|
+
// 配置‘babel-loader’
|
85
|
+
options: {
|
86
|
+
// 加入一个‘babel-plugin-import’插件,特殊处理‘antd’文件过大问题
|
87
|
+
plugins: [
|
88
|
+
[
|
89
|
+
'import',
|
90
|
+
{
|
91
|
+
// ‘webpack’定义全局变量‘antd’
|
92
|
+
libraryName: 'antd',
|
93
|
+
// 按需将‘es’文件夹中组件导出,绑定到‘antd’变量
|
94
|
+
// 除了‘es’,也可以修改为‘lib’
|
95
|
+
libraryDirectory: 'es'
|
96
|
+
// 这里设为‘true’,表示自动导入‘antd/dist/less’
|
97
|
+
// 或修改为‘css’ | ‘less’
|
98
|
+
// style: true
|
99
|
+
}
|
100
|
+
],
|
101
|
+
[
|
102
|
+
'@babel/plugin-proposal-decorators',
|
103
|
+
{
|
104
|
+
'legacy': true
|
105
|
+
}
|
106
|
+
]
|
107
|
+
],
|
108
|
+
// 考虑到使用‘React JSX’语法‘babel-loader’的编译预设要改为‘preset-react’
|
109
|
+
// 可选值‘preset-env’
|
110
|
+
presets: [ '@babel/preset-react' ]
|
111
|
+
}
|
112
|
+
},
|
113
|
+
{
|
114
|
+
// 处理图片文件
|
115
|
+
test: /\.(png|jpg|jpeg|gif|ico|bmp)/,
|
116
|
+
// 使用‘url-loader’或‘raw-loader’
|
117
|
+
loader: 'url-loader',
|
118
|
+
// 配置‘url-loader’
|
119
|
+
options: {
|
120
|
+
// 当文件大小处于(?)byte,输出‘base64’,反之为‘url’.
|
121
|
+
// 这里设为‘false’,表示无论多大多小,都为‘url’.
|
122
|
+
limit: true
|
123
|
+
}
|
124
|
+
}
|
125
|
+
]
|
126
|
+
},
|
127
|
+
// 解析
|
128
|
+
resolve: {
|
129
|
+
// 为‘import’或‘require’定义别名路径
|
130
|
+
alias: {
|
131
|
+
'~': requireResolve('src')
|
132
|
+
}
|
133
|
+
},
|
134
|
+
// 插件
|
135
|
+
plugins: [
|
136
|
+
// 注入全局变量到项目中,从‘jjb.config.contextData’读取
|
137
|
+
new webpack.DefinePlugin({ 'process.env.app': JSON.stringify(contextData) }),
|
138
|
+
// 解决‘moment.js’本地化文件过多问题
|
139
|
+
// 按需加载本地化文件当前项目只需要‘zh_CN.js’
|
140
|
+
new webpack.IgnorePlugin({
|
141
|
+
contextRegExp: /moment$/,
|
142
|
+
resourceRegExp: /^\.\/locale$/
|
143
|
+
}),
|
144
|
+
// 每次打包前删除‘dist’目录
|
145
|
+
new CleanWebpackPlugin()
|
146
|
+
]
|
147
|
+
}
|
148
|
+
};
|
149
|
+
};
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
File without changes
|
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"projectType": "micro-spa",
|
3
|
+
"installTarget": "node_modules",
|
4
|
+
"installResources": [
|
5
|
+
"jjb-dva-runtime",
|
6
|
+
"jjb-common-decorator"
|
7
|
+
],
|
8
|
+
"environment": {
|
9
|
+
"development": {
|
10
|
+
"API_HOSE": ""
|
11
|
+
},
|
12
|
+
"test": {
|
13
|
+
"API_HOSE": ""
|
14
|
+
},
|
15
|
+
"release": {
|
16
|
+
"API_HOSE": ""
|
17
|
+
},
|
18
|
+
"production": {
|
19
|
+
"API_HOSE": ""
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"contextInject": {
|
23
|
+
"notRouter": true
|
24
|
+
},
|
25
|
+
"windowInject": {
|
26
|
+
"title": "application",
|
27
|
+
"jjbCommonLibUrl": ""
|
28
|
+
},
|
29
|
+
"server": {
|
30
|
+
"port": "8080",
|
31
|
+
"host": "127.0.0.1"
|
32
|
+
},
|
33
|
+
"framework": {
|
34
|
+
"antd": {
|
35
|
+
"link-color": "#021e43",
|
36
|
+
"primary-color": "#021e43",
|
37
|
+
"border-radius-base": "2px"
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
const { hasEnvironment } = require('./utils');
|
2
|
+
|
3
|
+
if (!hasEnvironment()) {
|
4
|
+
throw Error('jjb.script[build]: 启动build需要提供NODE_ENV变量,请确认你所运行的脚本是否正确?');
|
5
|
+
}
|
6
|
+
|
7
|
+
require('webpack')(require('./config')('production').webpack).run(err => {
|
8
|
+
if (!err) {
|
9
|
+
console.log('项目打包完成!');
|
10
|
+
}
|
11
|
+
});
|