ics-builder 4.1.98 → 4.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ics-builder",
3
- "version": "4.1.98",
3
+ "version": "4.2.2",
4
4
  "description": "",
5
5
  "main": "./src/app.js",
6
6
  "preferGlobal": true,
@@ -61,7 +61,6 @@ var autoprefixer = require("autoprefixer");
61
61
  var webpack = require("webpack");
62
62
  var WebpackDevServer = require("webpack-dev-server");
63
63
  var path = require("path");
64
- var shell = require("shelljs");
65
64
  var glob = require("glob");
66
65
  var yaml = require("yamljs");
67
66
  var fs = require("fs");
@@ -72,7 +71,6 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
72
71
  __extends(WebpackUiBuilder, _super);
73
72
  function WebpackUiBuilder(config) {
74
73
  var _this = _super.call(this, config) || this;
75
- _this.nodeModulesPaths = new Array();
76
74
  _this.isLegacy = false;
77
75
  return _this;
78
76
  }
@@ -126,6 +124,9 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
126
124
  .getModuleSourcePaths(p, "ui", _this.config)
127
125
  .forEach(function (_a) {
128
126
  var moduleName = _a.moduleName, sourcePath = _a.sourcePath;
127
+ var packagePath = path.join(sourcePath, "package.json");
128
+ if (!utils_1.Utils.ensurePath(packagePath))
129
+ return;
129
130
  utils_1.Utils.exec("npm run build", { cwd: sourcePath });
130
131
  var moduleFile = path.join(sourcePath, "dist/module.js");
131
132
  var outputModuleFile = path.join(outputModulesPath, p.name, p.isSingleModule ? "index.js" : path.join(moduleName, "index.js"));
@@ -353,36 +354,6 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
353
354
  }
354
355
  };
355
356
  };
356
- WebpackUiBuilder.prototype.checkNpm = function (dir) {
357
- var _this = this;
358
- var packageJsons = glob.sync(dir).filter(function (x) { return x; });
359
- if (packageJsons.length) {
360
- packageJsons.forEach(function (pkg) {
361
- utils_1.Logger.info("Found package.json at path " + path.dirname(pkg) + ", install dependecies...");
362
- var nodeModulesPath = path.join(path.dirname(pkg), "node_modules");
363
- _this.nodeModulesPaths.push(nodeModulesPath);
364
- });
365
- if (this.nodeModulesPaths.every(function (dir) {
366
- return utils_1.Utils.ensurePath(dir);
367
- }))
368
- return true;
369
- this.nodeModulesPaths
370
- .filter(function (dir) {
371
- return !utils_1.Utils.ensurePath(dir);
372
- })
373
- .forEach(function (dir) {
374
- utils_1.Utils.exec("npm install --no-save", { cwd: path.dirname(dir), silent: true });
375
- });
376
- return true;
377
- }
378
- return false;
379
- };
380
- WebpackUiBuilder.prototype.removeNodeModules = function (paths) {
381
- utils_1.Logger.info("Removing " + paths.join("\n"));
382
- paths.forEach(function (p) {
383
- shell.rm("-rf", p);
384
- });
385
- };
386
357
  WebpackUiBuilder.prototype.importThemes = function (modules, theme) {
387
358
  var themesDir = "_core/themes";
388
359
  return ("@import '" + path.join(themesDir, "_base/vars.less") + "';\n").concat("@import '" + path.join(themesDir, theme + "/vars.less") + "';\n", modules.map(function (module) { return "@import '" + module + "';"; }).join("\n") + "\n", "@import '" + path.join(themesDir, "_base/theme.less") + "';\n", "@import '" + path.join(themesDir, theme + "/theme.less") + "';\n");
@@ -54,6 +54,7 @@ var CommandManager = /** @class */ (function () {
54
54
  CommandManager.prototype.initTasks = function () {
55
55
  var _this = this;
56
56
  index_1.task("source", function () { return _this.packageManager.loadAllPackages(); });
57
+ index_1.task("source:ci", function () { return _this.packageManager.loadAllPackages(false, true); });
57
58
  index_1.task("build-api", function () { return _this.runBuilder(_this.builderManager.buildApi()); });
58
59
  index_1.task("build-db", function () { return _this.runBuilder(_this.builderManager.buildDb()); });
59
60
  index_1.task("generate-schema", function () { return _this.runBuilder(_this.builderManager.buildSchema()); });
@@ -19,8 +19,9 @@ var PackageManager = /** @class */ (function () {
19
19
  }
20
20
  return PackageManager.instance;
21
21
  };
22
- PackageManager.prototype.loadAllPackages = function (skipLoad) {
23
- this.loadPackages(null, null, skipLoad);
22
+ PackageManager.prototype.loadAllPackages = function (skipLoad, mainPackageSkipLoad) {
23
+ if (!mainPackageSkipLoad)
24
+ this.loadPackages(null, null, skipLoad);
24
25
  if (this.config.using) {
25
26
  this.loadPackages(this.config.using, "build.yml", skipLoad);
26
27
  }
@@ -68,7 +68,7 @@ var PackageStructureManager = /** @class */ (function () {
68
68
  if (!moduleInfoPath)
69
69
  return [];
70
70
  var moduleInfo = yaml.load(moduleInfoPath);
71
- return (_a = moduleInfo.dependencies) !== null && _a !== void 0 ? _a : [];
71
+ return (_a = moduleInfo === null || moduleInfo === void 0 ? void 0 : moduleInfo.dependencies) !== null && _a !== void 0 ? _a : [];
72
72
  };
73
73
  return PackageStructureManager;
74
74
  }());
@@ -6,8 +6,8 @@ var GitScmProvider = /** @class */ (function () {
6
6
  function GitScmProvider(options) {
7
7
  this.options = options;
8
8
  }
9
- GitScmProvider.prototype.exec = function (cmd, targetDir) {
10
- return utils_1.Utils.exec("git " + cmd, { silent: true, cwd: targetDir || "" });
9
+ GitScmProvider.prototype.exec = function (cmd, targetDir, skipError) {
10
+ return utils_1.Utils.exec("git " + cmd, { silent: true, cwd: targetDir || "", skipError: skipError });
11
11
  };
12
12
  GitScmProvider.prototype.clone = function (config) {
13
13
  utils_1.Logger.info("Cloning repository " + config.package.name + " in " + config.paths.source + ", please wait...");
@@ -19,8 +19,11 @@ var GitScmProvider = /** @class */ (function () {
19
19
  };
20
20
  GitScmProvider.prototype.update = function (config, version) {
21
21
  var update = this.exec("checkout " + version.branch + " --force", config.paths.source);
22
- if (!version.isTag)
23
- this.exec("merge", config.paths.source);
22
+ if (!version.isTag) {
23
+ var result = this.exec("merge", config.paths.source, true);
24
+ if (result.code !== 0)
25
+ throw result.stderr || result.stdout;
26
+ }
24
27
  utils_1.Logger.info(config.package.name + " updated to " + version.branch + " (rev. " + version.revision + ")");
25
28
  return update;
26
29
  };
@@ -29,16 +29,39 @@ var SourceManager = /** @class */ (function () {
29
29
  var scmProvider = sourceType === "git" ? new gitScmProvider_1.GitScmProvider(scmOptions) : new hgScmProvider_1.HgScmProvider(scmOptions);
30
30
  var version;
31
31
  if (!skipLoad) {
32
- utils_1.Utils.ensurePath(path.join(sourceConfig.paths.source, "." + sourceType.toLowerCase()))
33
- ? scmProvider.pull(sourceConfig)
34
- : scmProvider.clone(sourceConfig);
35
- version = scmProvider.getVersion(sourceConfig);
36
- scmProvider.update(sourceConfig, version);
32
+ try {
33
+ utils_1.Utils.ensurePath(path.join(sourceConfig.paths.source, "." + sourceType.toLowerCase()))
34
+ ? scmProvider.pull(sourceConfig)
35
+ : scmProvider.clone(sourceConfig);
36
+ version = this.update(scmProvider, sourceConfig, true);
37
+ }
38
+ catch (e) {
39
+ if (e.includes("Merge conflict")) {
40
+ utils_1.Logger.warn("Merge conflict, retrying");
41
+ utils_1.Utils.prepareDir(sourceConfig.paths.source);
42
+ scmProvider.clone(sourceConfig);
43
+ version = this.update(scmProvider, sourceConfig, false);
44
+ }
45
+ else
46
+ throw e;
47
+ }
37
48
  }
38
49
  else
39
50
  version = scmProvider.getVersion(sourceConfig);
40
51
  return version;
41
52
  };
53
+ SourceManager.prototype.update = function (scmProvider, sourceConfig, throwError) {
54
+ try {
55
+ var version = scmProvider.getVersion(sourceConfig);
56
+ scmProvider.update(sourceConfig, version);
57
+ return version;
58
+ }
59
+ catch (e) {
60
+ if (throwError)
61
+ throw e;
62
+ utils_1.Logger.error(e);
63
+ }
64
+ };
42
65
  return SourceManager;
43
66
  }());
44
67
  exports.SourceManager = SourceManager;