@teams-max/mwsp 2.0.2 → 2.0.4

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/es/cli/build.js CHANGED
@@ -73,7 +73,7 @@ function _build() {
73
73
  env.MAX_SUB_APP = MAX_SUB_APP;
74
74
  env.RESOURCE_URL = RESOURCE_URL;
75
75
  _context.next = 32;
76
- return exec('MAX', ['build'], {
76
+ return exec('max', ['build'], {
77
77
  env: env
78
78
  });
79
79
  case 32:
@@ -6,15 +6,17 @@ var _require = require("./index"),
6
6
  function defineConfig(config) {
7
7
  var cfg = getCfg();
8
8
  var ASG_DIR = cfg.ASG_DIR;
9
- var env = Object.create(process.env);
10
- env.ASG_DIR = ASG_DIR;
9
+ var nextAsgEnv = process.env.ASG_DIR || ASG_DIR;
11
10
  if (!process.env.ASG_DIR) {
11
+ logStep('Process ASG_DIR not set, and use scoped environment');
12
+ }
13
+ if (!nextAsgEnv) {
12
14
  logStep('The Asgard directory does not exist, using default config...');
13
15
  return config;
14
16
  }
15
17
  var iConfigFromPlugins = null;
16
18
  try {
17
- iConfigFromPlugins = require(path.join(process.env.ASG_DIR, 'base', 'pluginConfig.js'));
19
+ iConfigFromPlugins = require(path.join(nextAsgEnv, 'base', 'pluginConfig.js'));
18
20
  } catch (error) {
19
21
  printErrorAndExit('The Asgard directory does not exist.', "Reason: ".concat(error.message));
20
22
  return;
package/es/utils/index.js CHANGED
@@ -62,7 +62,7 @@ function getCfg() {
62
62
  var args = yParser(process.argv.slice(2));
63
63
  var JENKINS_BUILD = args.jenkinsBuild || args.JENKINSBUILD || args.jenkins_build || args.JENKINS_BUILD;
64
64
  var APP_ENV = args.env || args.ENV || '';
65
- var ASG_BRAHCH = args.asg_branch || args.ASG_BRAHCH || '';
65
+ var ASG_BRANCH = args.asg_branch || args.ASG_BRANCH || '';
66
66
  var RESOURCE_URL = '';
67
67
  var SUB_APP = '';
68
68
  var archStr = 'unknown';
@@ -81,7 +81,7 @@ function getCfg() {
81
81
  },
82
82
  ASG_DIR: asgDir,
83
83
  JENKINS_BUILD: JENKINS_BUILD,
84
- ASG_BRAHCH: ASG_BRAHCH,
84
+ ASG_BRANCH: ASG_BRANCH,
85
85
  APP_ENV: APP_ENV,
86
86
  RESOURCE_URL: RESOURCE_URL,
87
87
  SUB_APP: SUB_APP
@@ -108,12 +108,12 @@ function fetchRemoteRepository() {
108
108
  }
109
109
  function _fetchRemoteRepository() {
110
110
  _fetchRemoteRepository = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
111
- var cfg, infra, directory, ASG_BRAHCH, JENKINS_BUILD, remoteUrl, doesExist, proDevDeps, proDeps, maxDevDeps, maxDeps, _yield$inquirer$promp, syncUp, infraBranchsOutput, infraBranchArray, filteredBranches, defaultBrancheIdx, questions;
111
+ var cfg, infra, directory, ASG_BRANCH, JENKINS_BUILD, remoteUrl, doesExist, proDevDeps, proDeps, maxDevDeps, maxDeps, _yield$inquirer$promp, syncUp, infraBranchsOutput, infraBranchArray, filteredBranches, defaultBrancheIdx, questions;
112
112
  return _regeneratorRuntime().wrap(function _callee$(_context) {
113
113
  while (1) switch (_context.prev = _context.next) {
114
114
  case 0:
115
115
  cfg = getCfg();
116
- infra = cfg.infra, directory = cfg.ASG_DIR, ASG_BRAHCH = cfg.ASG_BRAHCH, JENKINS_BUILD = cfg.JENKINS_BUILD;
116
+ infra = cfg.infra, directory = cfg.ASG_DIR, ASG_BRANCH = cfg.ASG_BRANCH, JENKINS_BUILD = cfg.JENKINS_BUILD;
117
117
  remoteUrl = infra.url;
118
118
  doesExist = checkDirectoryExistsSync(directory);
119
119
  if (doesExist) {
@@ -175,7 +175,7 @@ function _fetchRemoteRepository() {
175
175
  _context.next = 48;
176
176
  break;
177
177
  case 36:
178
- if (!(JENKINS_BUILD && !ASG_BRAHCH)) {
178
+ if (!(JENKINS_BUILD && !ASG_BRANCH)) {
179
179
  _context.next = 41;
180
180
  break;
181
181
  }
@@ -202,7 +202,7 @@ function _fetchRemoteRepository() {
202
202
  }
203
203
  return _context.abrupt("return");
204
204
  case 48:
205
- if (!(!doesExist && JENKINS_BUILD && !ASG_BRAHCH)) {
205
+ if (!(!doesExist && JENKINS_BUILD && !ASG_BRANCH)) {
206
206
  _context.next = 51;
207
207
  break;
208
208
  }
@@ -213,12 +213,12 @@ function _fetchRemoteRepository() {
213
213
  process.chdir(directory);
214
214
  _context.prev = 53;
215
215
  execa.sync('git', ['fetch', 'origin', '--prune']);
216
- if (!(JENKINS_BUILD && ASG_BRAHCH)) {
216
+ if (!(JENKINS_BUILD && ASG_BRANCH)) {
217
217
  _context.next = 60;
218
218
  break;
219
219
  }
220
- execa.sync('git', ['checkout', ASG_BRAHCH]);
221
- logStep("Anto switched to branch:", ASG_BRAHCH);
220
+ execa.sync('git', ['checkout', ASG_BRANCH]);
221
+ logStep("Anto switched to branch:", ASG_BRANCH);
222
222
  _context.next = 70;
223
223
  break;
224
224
  case 60:
package/lib/cli/build.js CHANGED
@@ -71,7 +71,7 @@ async function build() {
71
71
  env.MAX_APP_KEY = appKey;
72
72
  env.MAX_SUB_APP = MAX_SUB_APP;
73
73
  env.RESOURCE_URL = RESOURCE_URL;
74
- await exec("MAX", ["build"], {
74
+ await exec("max", ["build"], {
75
75
  env
76
76
  });
77
77
  }
@@ -4,16 +4,18 @@ var { logStep, printErrorAndExit, getCfg } = require("./index");
4
4
  function defineConfig(config) {
5
5
  const cfg = getCfg();
6
6
  const { ASG_DIR } = cfg;
7
- const env = Object.create(process.env);
8
- env.ASG_DIR = ASG_DIR;
7
+ const nextAsgEnv = process.env.ASG_DIR || ASG_DIR;
9
8
  if (!process.env.ASG_DIR) {
9
+ logStep("Process ASG_DIR not set, and use scoped environment");
10
+ }
11
+ if (!nextAsgEnv) {
10
12
  logStep("The Asgard directory does not exist, using default config...");
11
13
  return config;
12
14
  }
13
15
  let iConfigFromPlugins = null;
14
16
  try {
15
17
  iConfigFromPlugins = require(path.join(
16
- process.env.ASG_DIR,
18
+ nextAsgEnv,
17
19
  "base",
18
20
  "pluginConfig.js"
19
21
  ));
@@ -41,7 +41,7 @@ function getCfg() {
41
41
  const args = yParser(process.argv.slice(2));
42
42
  const JENKINS_BUILD = args.jenkinsBuild || args.JENKINSBUILD || args.jenkins_build || args.JENKINS_BUILD;
43
43
  const APP_ENV = args.env || args.ENV || "";
44
- const ASG_BRAHCH = args.asg_branch || args.ASG_BRAHCH || "";
44
+ const ASG_BRANCH = args.asg_branch || args.ASG_BRANCH || "";
45
45
  let RESOURCE_URL = "";
46
46
  let SUB_APP = "";
47
47
  let archStr = "unknown";
@@ -60,7 +60,7 @@ function getCfg() {
60
60
  },
61
61
  ASG_DIR: asgDir,
62
62
  JENKINS_BUILD,
63
- ASG_BRAHCH,
63
+ ASG_BRANCH,
64
64
  APP_ENV,
65
65
  RESOURCE_URL,
66
66
  SUB_APP
@@ -80,7 +80,7 @@ function checkDirectoryExistsSync(dirPath) {
80
80
  }
81
81
  async function fetchRemoteRepository() {
82
82
  const cfg = getCfg();
83
- const { infra, ASG_DIR: directory, ASG_BRAHCH, JENKINS_BUILD } = cfg;
83
+ const { infra, ASG_DIR: directory, ASG_BRANCH, JENKINS_BUILD } = cfg;
84
84
  const remoteUrl = infra.url;
85
85
  const doesExist = checkDirectoryExistsSync(directory);
86
86
  if (!doesExist) {
@@ -112,7 +112,7 @@ async function fetchRemoteRepository() {
112
112
  !!maxDeps.length && await exec("pnpm", ["add", ...maxDeps]);
113
113
  }
114
114
  logStep("Installation completed.");
115
- } else if (JENKINS_BUILD && !ASG_BRAHCH) {
115
+ } else if (JENKINS_BUILD && !ASG_BRANCH) {
116
116
  logStep("Jenkins build detected. Skipping sync up.");
117
117
  return;
118
118
  } else {
@@ -129,7 +129,7 @@ async function fetchRemoteRepository() {
129
129
  return;
130
130
  }
131
131
  }
132
- if (!doesExist && JENKINS_BUILD && !ASG_BRAHCH) {
132
+ if (!doesExist && JENKINS_BUILD && !ASG_BRANCH) {
133
133
  printErrorAndExit(
134
134
  "Jenkins build detected. The branch parameter is missing!"
135
135
  );
@@ -139,9 +139,9 @@ async function fetchRemoteRepository() {
139
139
  process.chdir(directory);
140
140
  try {
141
141
  execa.sync("git", ["fetch", "origin", "--prune"]);
142
- if (JENKINS_BUILD && ASG_BRAHCH) {
143
- execa.sync("git", ["checkout", ASG_BRAHCH]);
144
- logStep(`Anto switched to branch:`, ASG_BRAHCH);
142
+ if (JENKINS_BUILD && ASG_BRANCH) {
143
+ execa.sync("git", ["checkout", ASG_BRANCH]);
144
+ logStep(`Anto switched to branch:`, ASG_BRANCH);
145
145
  } else {
146
146
  const infraBranchsOutput = execa.sync("git", ["branch", "-r"]).stdout;
147
147
  const infraBranchArray = infraBranchsOutput.trim().split("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teams-max/mwsp",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "@teams-max/mwsp",
5
5
  "homepage": "https://gitlab.daikuan.qihoo.net/efficacy-fe/teams-max/-/tree/master/packages/mwsp",
6
6
  "repository": {