@tmsfe/tmskit 0.0.44 → 0.0.45
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/dist/index.cjs.js +27 -39
- package/package.json +1 -1
- package/src/core/tmsMpconfig.js +2 -6
- package/src/scripts/run/index.js +2 -4
package/dist/index.cjs.js
CHANGED
|
@@ -542,28 +542,6 @@ var defaultTmsConfig = {
|
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
544
|
|
|
545
|
-
const global$c = {
|
|
546
|
-
data: {},
|
|
547
|
-
setData(...args) {
|
|
548
|
-
if (args.length === 1) {
|
|
549
|
-
Object.keys(args[0]).forEach(k => {
|
|
550
|
-
if (args[0][k]) {
|
|
551
|
-
this.data[k] = args[0][k];
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
} else {
|
|
555
|
-
const [name, value] = args;
|
|
556
|
-
this.data[name] = value;
|
|
557
|
-
}
|
|
558
|
-
},
|
|
559
|
-
getData(name) {
|
|
560
|
-
return this.data[name];
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
var global_1 = {
|
|
564
|
-
global: global$c
|
|
565
|
-
};
|
|
566
|
-
|
|
567
545
|
/**
|
|
568
546
|
* 用来读取处理tms.config.js与module.config.json字段
|
|
569
547
|
*/
|
|
@@ -586,9 +564,6 @@ var global_1 = {
|
|
|
586
564
|
getAbsolutePath
|
|
587
565
|
} = widgets;
|
|
588
566
|
const defaultTmsConfig$1 = defaultTmsConfig;
|
|
589
|
-
const {
|
|
590
|
-
global
|
|
591
|
-
} = global_1;
|
|
592
567
|
const {
|
|
593
568
|
fail
|
|
594
569
|
} = log$1;
|
|
@@ -603,11 +578,8 @@ var global_1 = {
|
|
|
603
578
|
fail(`${path.dirname(tmsConfigPath)}没有找到tms.config.js,请进行配置`);
|
|
604
579
|
process.exit(1);
|
|
605
580
|
}
|
|
606
|
-
const isDev = global.getData('isDev');
|
|
607
581
|
const tmsConfigFn = require(tmsConfigPath);
|
|
608
|
-
const tmsConfig = typeof tmsConfigFn === 'function' ? tmsConfigFn(
|
|
609
|
-
isDev
|
|
610
|
-
}) : tmsConfigFn;
|
|
582
|
+
const tmsConfig = typeof tmsConfigFn === 'function' ? tmsConfigFn() : tmsConfigFn;
|
|
611
583
|
|
|
612
584
|
// 合并默认值
|
|
613
585
|
return loadash.mergeWith({}, defaultTmsConfig$1, tmsConfig);
|
|
@@ -621,12 +593,8 @@ var global_1 = {
|
|
|
621
593
|
let tmsPrivateCf = {};
|
|
622
594
|
const tmsPrivatePath = configPath ? `${configPath}/${TMS_PRIVATE_FILENAME}` : resolve(TMS_PRIVATE_FILENAME);
|
|
623
595
|
if (fs.existsSync(tmsPrivatePath)) {
|
|
624
|
-
const isDev = global.getData('isDev');
|
|
625
|
-
console.log(isDev, 'isDev');
|
|
626
596
|
const tmsPrivateFn = require(tmsPrivatePath);
|
|
627
|
-
tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn(
|
|
628
|
-
isDev
|
|
629
|
-
}) : tmsPrivateFn;
|
|
597
|
+
tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn() : tmsPrivateFn;
|
|
630
598
|
}
|
|
631
599
|
return tmsPrivateCf;
|
|
632
600
|
};
|
|
@@ -1342,6 +1310,28 @@ var extendCmd = {
|
|
|
1342
1310
|
loadExtendCmd: loadExtendCmd$1
|
|
1343
1311
|
};
|
|
1344
1312
|
|
|
1313
|
+
const global$c = {
|
|
1314
|
+
data: {},
|
|
1315
|
+
setData(...args) {
|
|
1316
|
+
if (args.length === 1) {
|
|
1317
|
+
Object.keys(args[0]).forEach(k => {
|
|
1318
|
+
if (args[0][k]) {
|
|
1319
|
+
this.data[k] = args[0][k];
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
} else {
|
|
1323
|
+
const [name, value] = args;
|
|
1324
|
+
this.data[name] = value;
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
getData(name) {
|
|
1328
|
+
return this.data[name];
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
var global_1 = {
|
|
1332
|
+
global: global$c
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1345
1335
|
const {
|
|
1346
1336
|
fail: fail$7
|
|
1347
1337
|
} = log$1;
|
|
@@ -4015,10 +4005,6 @@ const getSpecificModuleNames = (moduleArg, modules) => {
|
|
|
4015
4005
|
return all.map(item => item.moduleName);
|
|
4016
4006
|
};
|
|
4017
4007
|
async function run(commandName, cmdOptions) {
|
|
4018
|
-
if (['dev', 'build'].includes(commandName)) {
|
|
4019
|
-
// 先缓存环境,因为tmsConfig可能会用到
|
|
4020
|
-
global.setData('isDev', commandName === 'dev');
|
|
4021
|
-
}
|
|
4022
4008
|
// 用户本地的配置
|
|
4023
4009
|
const tmsConfig = getTmsConfig$1();
|
|
4024
4010
|
try {
|
|
@@ -4073,6 +4059,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
4073
4059
|
});
|
|
4074
4060
|
return;
|
|
4075
4061
|
case 'dev':
|
|
4062
|
+
global.setData('isDev', true);
|
|
4076
4063
|
dev(tmsConfig, newModules);
|
|
4077
4064
|
report$1('run:dev', {
|
|
4078
4065
|
appName: tmsConfig.appName
|
|
@@ -4085,6 +4072,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
4085
4072
|
});
|
|
4086
4073
|
return;
|
|
4087
4074
|
case 'build':
|
|
4075
|
+
global.setData('isDev', false);
|
|
4088
4076
|
build(tmsConfig, newModules);
|
|
4089
4077
|
report$1('run:build', {
|
|
4090
4078
|
appName: tmsConfig.appName
|
|
@@ -4197,7 +4185,7 @@ var entry = [{
|
|
|
4197
4185
|
|
|
4198
4186
|
var require$$12 = {
|
|
4199
4187
|
name: "@tmsfe/tmskit",
|
|
4200
|
-
version: "0.0.
|
|
4188
|
+
version: "0.0.45",
|
|
4201
4189
|
description: "tmskit",
|
|
4202
4190
|
main: "dist/index.cjs",
|
|
4203
4191
|
bin: {
|
package/package.json
CHANGED
package/src/core/tmsMpconfig.js
CHANGED
|
@@ -10,7 +10,6 @@ const JSON5 = require('json5');
|
|
|
10
10
|
const { TMS_CONFIG_FILENAME, MODULE_CONFIG_FILENAME, TMS_PRIVATE_FILENAME } = require('../config/constant');
|
|
11
11
|
const { resolve, isObject, isArray, getAbsolutePath } = require('../utils/widgets');
|
|
12
12
|
const defaultTmsConfig = require('../config/defaultTmsConfig');
|
|
13
|
-
const { global } = require('../utils/global');
|
|
14
13
|
const { fail } = require('../utils/log');
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -23,9 +22,8 @@ const readTmsConfig = function (configPath) {
|
|
|
23
22
|
fail(`${path.dirname(tmsConfigPath)}没有找到tms.config.js,请进行配置`);
|
|
24
23
|
process.exit(1);
|
|
25
24
|
}
|
|
26
|
-
const isDev = global.getData('isDev');
|
|
27
25
|
const tmsConfigFn = require(tmsConfigPath);
|
|
28
|
-
const tmsConfig = typeof tmsConfigFn === 'function' ? tmsConfigFn(
|
|
26
|
+
const tmsConfig = typeof tmsConfigFn === 'function' ? tmsConfigFn() : tmsConfigFn;
|
|
29
27
|
|
|
30
28
|
// 合并默认值
|
|
31
29
|
return loadash.mergeWith({}, defaultTmsConfig, tmsConfig);
|
|
@@ -40,10 +38,8 @@ const readTmsPrivateCf = function (configPath) {
|
|
|
40
38
|
let tmsPrivateCf = {};
|
|
41
39
|
const tmsPrivatePath = configPath ? `${configPath}/${TMS_PRIVATE_FILENAME}` : resolve(TMS_PRIVATE_FILENAME);
|
|
42
40
|
if (fs.existsSync(tmsPrivatePath)) {
|
|
43
|
-
const isDev = global.getData('isDev');
|
|
44
|
-
console.log(isDev, 'isDev');
|
|
45
41
|
const tmsPrivateFn = require(tmsPrivatePath);
|
|
46
|
-
tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn(
|
|
42
|
+
tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn() : tmsPrivateFn;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
return tmsPrivateCf;
|
package/src/scripts/run/index.js
CHANGED
|
@@ -50,10 +50,6 @@ const getSpecificModuleNames = (moduleArg, modules) => {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
async function run(commandName, cmdOptions) {
|
|
53
|
-
if (['dev', 'build'].includes(commandName)) {
|
|
54
|
-
// 先缓存环境,因为tmsConfig可能会用到
|
|
55
|
-
global.setData('isDev', commandName === 'dev');
|
|
56
|
-
}
|
|
57
53
|
// 用户本地的配置
|
|
58
54
|
const tmsConfig = getTmsConfig();
|
|
59
55
|
try {
|
|
@@ -105,6 +101,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
105
101
|
report('run:init', { appName: tmsConfig.appName });
|
|
106
102
|
return;
|
|
107
103
|
case 'dev':
|
|
104
|
+
global.setData('isDev', true);
|
|
108
105
|
dev(tmsConfig, newModules);
|
|
109
106
|
report('run:dev', { appName: tmsConfig.appName });
|
|
110
107
|
return;
|
|
@@ -113,6 +110,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
113
110
|
report('run:install', { appName: tmsConfig.appName });
|
|
114
111
|
return;
|
|
115
112
|
case 'build':
|
|
113
|
+
global.setData('isDev', false);
|
|
116
114
|
build(tmsConfig, newModules);
|
|
117
115
|
report('run:build', { appName: tmsConfig.appName });
|
|
118
116
|
return;
|