@tmsfe/tmskit 0.0.47 → 0.0.48
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 +10 -11
- package/package.json +1 -1
- package/src/core/buildAppJson.js +2 -2
- package/src/core/tmsMpconfig.js +4 -4
- package/src/scripts/run/index.js +3 -4
package/dist/index.cjs.js
CHANGED
|
@@ -603,10 +603,10 @@ var global_1 = {
|
|
|
603
603
|
fail(`${path.dirname(tmsConfigPath)}没有找到tms.config.js,请进行配置`);
|
|
604
604
|
process.exit(1);
|
|
605
605
|
}
|
|
606
|
+
const env = global.getData('commandName');
|
|
606
607
|
const tmsConfigFn = require(tmsConfigPath);
|
|
607
|
-
const isDev = global.getData('isDev');
|
|
608
608
|
const tmsConfig = typeof tmsConfigFn === 'function' ? tmsConfigFn({
|
|
609
|
-
|
|
609
|
+
env
|
|
610
610
|
}) : tmsConfigFn;
|
|
611
611
|
|
|
612
612
|
// 合并默认值
|
|
@@ -621,10 +621,10 @@ var global_1 = {
|
|
|
621
621
|
let tmsPrivateCf = {};
|
|
622
622
|
const tmsPrivatePath = configPath ? `${configPath}/${TMS_PRIVATE_FILENAME}` : resolve(TMS_PRIVATE_FILENAME);
|
|
623
623
|
if (fs.existsSync(tmsPrivatePath)) {
|
|
624
|
+
const env = global.getData('commandName');
|
|
624
625
|
const tmsPrivateFn = require(tmsPrivatePath);
|
|
625
|
-
const isDev = global.getData('isDev');
|
|
626
626
|
tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn({
|
|
627
|
-
|
|
627
|
+
env
|
|
628
628
|
}) : tmsPrivateFn;
|
|
629
629
|
}
|
|
630
630
|
return tmsPrivateCf;
|
|
@@ -1406,8 +1406,8 @@ function updateMainPackages(appJson, mainPackages = []) {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
// 拼装 app.pages
|
|
1408
1408
|
foundMainPackages.forEach(subpackage => {
|
|
1409
|
-
if (!subpackage.pages || !subpackage.pages.length) {
|
|
1410
|
-
fail$6(`主包 ${subpackage} 不能没有 pages
|
|
1409
|
+
if (!subpackage.allowNoPages && (!subpackage.pages || !subpackage.pages.length)) {
|
|
1410
|
+
fail$6(`主包 ${subpackage} 不能没有 pages`, foundMainPackages, subpackage);
|
|
1411
1411
|
process.exit(-1);
|
|
1412
1412
|
}
|
|
1413
1413
|
subpackage.pages.forEach(page => {
|
|
@@ -4014,10 +4014,7 @@ const getSpecificModuleNames = (moduleArg, modules) => {
|
|
|
4014
4014
|
return all.map(item => item.moduleName);
|
|
4015
4015
|
};
|
|
4016
4016
|
async function run(commandName, cmdOptions) {
|
|
4017
|
-
|
|
4018
|
-
// 先缓存环境,因为tmsConfig可能会用到
|
|
4019
|
-
global.setData('isDev', commandName === 'dev');
|
|
4020
|
-
}
|
|
4017
|
+
global.setData('commandName', commandName);
|
|
4021
4018
|
// 用户本地的配置
|
|
4022
4019
|
const tmsConfig = getTmsConfig$1();
|
|
4023
4020
|
try {
|
|
@@ -4072,6 +4069,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
4072
4069
|
});
|
|
4073
4070
|
return;
|
|
4074
4071
|
case 'dev':
|
|
4072
|
+
global.setData('isDev', true);
|
|
4075
4073
|
dev(tmsConfig, newModules);
|
|
4076
4074
|
report$1('run:dev', {
|
|
4077
4075
|
appName: tmsConfig.appName
|
|
@@ -4084,6 +4082,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
4084
4082
|
});
|
|
4085
4083
|
return;
|
|
4086
4084
|
case 'build':
|
|
4085
|
+
global.setData('isDev', false);
|
|
4087
4086
|
build(tmsConfig, newModules);
|
|
4088
4087
|
report$1('run:build', {
|
|
4089
4088
|
appName: tmsConfig.appName
|
|
@@ -4196,7 +4195,7 @@ var entry = [{
|
|
|
4196
4195
|
|
|
4197
4196
|
var require$$12 = {
|
|
4198
4197
|
name: "@tmsfe/tmskit",
|
|
4199
|
-
version: "0.0.
|
|
4198
|
+
version: "0.0.48",
|
|
4200
4199
|
description: "tmskit",
|
|
4201
4200
|
main: "dist/index.cjs",
|
|
4202
4201
|
bin: {
|
package/package.json
CHANGED
package/src/core/buildAppJson.js
CHANGED
|
@@ -26,8 +26,8 @@ function updateMainPackages(appJson, mainPackages = []) {
|
|
|
26
26
|
}
|
|
27
27
|
// 拼装 app.pages
|
|
28
28
|
foundMainPackages.forEach((subpackage) => {
|
|
29
|
-
if (!subpackage.pages || !subpackage.pages.length) {
|
|
30
|
-
fail(`主包 ${subpackage} 不能没有 pages
|
|
29
|
+
if (!subpackage.allowNoPages && (!subpackage.pages || !subpackage.pages.length)) {
|
|
30
|
+
fail(`主包 ${subpackage} 不能没有 pages`, foundMainPackages, subpackage);
|
|
31
31
|
process.exit(-1);
|
|
32
32
|
}
|
|
33
33
|
subpackage.pages.forEach((page) => {
|
package/src/core/tmsMpconfig.js
CHANGED
|
@@ -23,9 +23,9 @@ const readTmsConfig = function (configPath) {
|
|
|
23
23
|
fail(`${path.dirname(tmsConfigPath)}没有找到tms.config.js,请进行配置`);
|
|
24
24
|
process.exit(1);
|
|
25
25
|
}
|
|
26
|
+
const env = global.getData('commandName');
|
|
26
27
|
const tmsConfigFn = require(tmsConfigPath);
|
|
27
|
-
const
|
|
28
|
-
const tmsConfig = typeof tmsConfigFn === 'function' ? tmsConfigFn({ isDev }) : tmsConfigFn;
|
|
28
|
+
const tmsConfig = typeof tmsConfigFn === 'function' ? tmsConfigFn({ env }) : tmsConfigFn;
|
|
29
29
|
|
|
30
30
|
// 合并默认值
|
|
31
31
|
return loadash.mergeWith({}, defaultTmsConfig, tmsConfig);
|
|
@@ -40,9 +40,9 @@ const readTmsPrivateCf = function (configPath) {
|
|
|
40
40
|
let tmsPrivateCf = {};
|
|
41
41
|
const tmsPrivatePath = configPath ? `${configPath}/${TMS_PRIVATE_FILENAME}` : resolve(TMS_PRIVATE_FILENAME);
|
|
42
42
|
if (fs.existsSync(tmsPrivatePath)) {
|
|
43
|
+
const env = global.getData('commandName');
|
|
43
44
|
const tmsPrivateFn = require(tmsPrivatePath);
|
|
44
|
-
|
|
45
|
-
tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn({ isDev }) : tmsPrivateFn;
|
|
45
|
+
tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn({ env }) : tmsPrivateFn;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return tmsPrivateCf;
|
package/src/scripts/run/index.js
CHANGED
|
@@ -50,10 +50,7 @@ const getSpecificModuleNames = (moduleArg, modules) => {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
async function run(commandName, cmdOptions) {
|
|
53
|
-
|
|
54
|
-
// 先缓存环境,因为tmsConfig可能会用到
|
|
55
|
-
global.setData('isDev', commandName === 'dev');
|
|
56
|
-
}
|
|
53
|
+
global.setData('commandName', commandName);
|
|
57
54
|
// 用户本地的配置
|
|
58
55
|
const tmsConfig = getTmsConfig();
|
|
59
56
|
try {
|
|
@@ -105,6 +102,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
105
102
|
report('run:init', { appName: tmsConfig.appName });
|
|
106
103
|
return;
|
|
107
104
|
case 'dev':
|
|
105
|
+
global.setData('isDev', true);
|
|
108
106
|
dev(tmsConfig, newModules);
|
|
109
107
|
report('run:dev', { appName: tmsConfig.appName });
|
|
110
108
|
return;
|
|
@@ -113,6 +111,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
113
111
|
report('run:install', { appName: tmsConfig.appName });
|
|
114
112
|
return;
|
|
115
113
|
case 'build':
|
|
114
|
+
global.setData('isDev', false);
|
|
116
115
|
build(tmsConfig, newModules);
|
|
117
116
|
report('run:build', { appName: tmsConfig.appName });
|
|
118
117
|
return;
|