@zeppos/zeus-cli 1.1.7 → 1.1.8

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.
Files changed (2) hide show
  1. package/modules/build.js +17 -23
  2. package/package.json +2 -2
package/modules/build.js CHANGED
@@ -162,16 +162,16 @@ exports.chooseBuildPackages = chooseBuildPackages;
162
162
  var build = function (mode, buildConfigOption) {
163
163
  if (mode === void 0) { mode = BuildMode.PROD; }
164
164
  return __awaiter(void 0, void 0, void 0, function () {
165
- var workspace, packages, choosePackages, buildOptions, _a, js2c, js2bin, png2vg, prune, curJscMode, curOpt, productName_1, DistDir_1, appId, name_1, newName_1, error_1;
166
- return __generator(this, function (_b) {
167
- switch (_b.label) {
165
+ var workspace, packages, choosePackages, buildOptions, _a, js2c, _b, js2bin, _c, png2vg, _d, prune, curOpt, productName_1, DistDir_1, appId, name_1, newName_1, error_1;
166
+ return __generator(this, function (_e) {
167
+ switch (_e.label) {
168
168
  case 0:
169
169
  workspace = path.resolve('./');
170
170
  process.env._targetDeviceToBuild = (buildConfigOption === null || buildConfigOption === void 0 ? void 0 : buildConfigOption.target) || '';
171
171
  packages = [];
172
172
  return [4, chooseBuildPackages(mode)];
173
173
  case 1:
174
- choosePackages = _b.sent();
174
+ choosePackages = _e.sent();
175
175
  if (!choosePackages || !choosePackages.length) {
176
176
  logger.error('please choose at least one package.');
177
177
  return [2];
@@ -187,32 +187,26 @@ var build = function (mode, buildConfigOption) {
187
187
  jsc: TransformType.Default
188
188
  };
189
189
  if (mode === BuildMode.PROD || mode === BuildMode.PREVIEW) {
190
- _a = buildConfigOption || {}, js2c = _a.js2c, js2bin = _a.js2bin, png2vg = _a.png2vg, prune = _a.prune;
191
- js2c = js2c === 'false' ? false : true;
192
- js2bin = ((js2bin === 'true') || (js2bin === true)) ? true : false;
193
- png2vg = ((png2vg === 'false') && (png2vg !== undefined)) ? false : true;
194
- prune = ((prune === 'false') && (prune !== undefined)) ? false : true;
195
- curJscMode = js2c && js2bin ? TransformType.Bin : TransformType.C;
196
- if (js2bin && !js2c) {
197
- curJscMode = TransformType.Bin;
198
- }
199
- else if ((!js2bin && !js2c) || !js2c) {
200
- curJscMode = TransformType.Default;
201
- }
190
+ _a = buildConfigOption || {}, js2c = _a.js2c, _b = _a.js2bin, js2bin = _b === void 0 ? true : _b, _c = _a.png2vg, png2vg = _c === void 0 ? true : _c, _d = _a.prune, prune = _d === void 0 ? true : _d;
191
+ js2c = !!((js2c === 'true') || (js2c === true));
192
+ js2bin = !!((js2bin === 'true') || (js2bin === true));
193
+ png2vg = !!((png2vg === 'true') || (png2vg === true));
194
+ prune = !!((prune === 'true') || (prune === true));
195
+ js2c && Object.assign(buildOptions, { jsc: TransformType.C });
196
+ js2bin && Object.assign(buildOptions, { jsc: TransformType.Bin });
202
197
  Object.assign(buildOptions, {
203
198
  png2vg: png2vg,
204
- prune: prune,
205
- jsc: curJscMode
199
+ prune: prune
206
200
  });
207
201
  }
208
- _b.label = 2;
202
+ _e.label = 2;
209
203
  case 2:
210
- _b.trys.push([2, 7, , 8]);
204
+ _e.trys.push([2, 7, , 8]);
211
205
  curOpt = (buildConfigOption ? buildConfigOption._ : [''])[0];
212
206
  if (!(mode !== BuildMode.DEV || (mode === BuildMode.DEV && curOpt === 'install'))) return [3, 4];
213
207
  return [4, (0, node_js_1.start)(buildOptions)];
214
208
  case 3:
215
- productName_1 = _b.sent();
209
+ productName_1 = _e.sent();
216
210
  if (productName_1) {
217
211
  DistDir_1 = path.join(workspace, 'dist');
218
212
  appId = (0, lodash_1.get)(appJsonContent, 'app.appId');
@@ -234,11 +228,11 @@ var build = function (mode, buildConfigOption) {
234
228
  if (!(mode === BuildMode.DEV)) return [3, 6];
235
229
  return [4, (0, node_js_1.startWithoutDist)(buildOptions)];
236
230
  case 5:
237
- _b.sent();
231
+ _e.sent();
238
232
  return [2, (0, node_js_1.getZpkBuf)(packages[0])];
239
233
  case 6: return [3, 8];
240
234
  case 7:
241
- error_1 = _b.sent();
235
+ error_1 = _e.sent();
242
236
  logger.error(error_1);
243
237
  return [3, 8];
244
238
  case 8: return [2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeppos/zeus-cli",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "zeus mini-program tools",
5
5
  "main": "index.js",
6
6
  "author": "zepp",
@@ -41,7 +41,7 @@
41
41
  "webpack": "^5.52.0"
42
42
  },
43
43
  "dependencies": {
44
- "@zeppos/zpm": "^2.3.10",
44
+ "@zeppos/zpm": "^2.4.0",
45
45
  "axios": "^0.23.0",
46
46
  "chalk": "^4.1.2",
47
47
  "chokidar": "^3.5.2",