@tmsfe/tmskit 0.0.47 → 0.0.49

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 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
- isDev
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
- isDev
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
- if (['dev', 'build'].includes(commandName)) {
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.47",
4198
+ version: "0.0.49",
4200
4199
  description: "tmskit",
4201
4200
  main: "dist/index.cjs",
4202
4201
  bin: {
@@ -4255,7 +4254,7 @@ var require$$12 = {
4255
4254
  lodash: "^4.17.21",
4256
4255
  metalsmith: "^2.3.0",
4257
4256
  minimatch: "^5.1.0",
4258
- "miniprogram-ci": "2.1.14",
4257
+ "miniprogram-ci": "1.8.25",
4259
4258
  moment: "^2.29.2",
4260
4259
  "object-assign": "^4.0.1",
4261
4260
  ora: "^5.4.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmsfe/tmskit",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "description": "tmskit",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {
@@ -59,7 +59,7 @@
59
59
  "lodash": "^4.17.21",
60
60
  "metalsmith": "^2.3.0",
61
61
  "minimatch": "^5.1.0",
62
- "miniprogram-ci": "2.1.14",
62
+ "miniprogram-ci": "1.8.25",
63
63
  "moment": "^2.29.2",
64
64
  "object-assign": "^4.0.1",
65
65
  "ora": "^5.4.1",
@@ -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) => {
@@ -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 isDev = global.getData('isDev');
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
- const isDev = global.getData('isDev');
45
- tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn({ isDev }) : tmsPrivateFn;
45
+ tmsPrivateCf = typeof tmsPrivateFn === 'function' ? tmsPrivateFn({ env }) : tmsPrivateFn;
46
46
  }
47
47
 
48
48
  return tmsPrivateCf;
@@ -50,10 +50,7 @@ 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
- }
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;