ics-builder 4.4.1 → 4.4.3

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,12 +1,12 @@
1
1
  {
2
2
  "name": "ics-builder",
3
- "version": "4.4.1",
3
+ "version": "4.4.3",
4
4
  "description": "",
5
- "main": "./src/app.js",
5
+ "main": "./src/index.js",
6
6
  "preferGlobal": true,
7
7
  "scripts": {
8
8
  "test": "jest",
9
- "dev": "ts-node ./src/app.ts",
9
+ "dev": "ts-node ./src/index.ts",
10
10
  "copy-assets": "xcopy \"src/services/source/assets\" \"dist/src/services/source/assets\" /e /i",
11
11
  "patch": "npx tsc && npm run copy-assets && npm version patch && copy package.json dist && copy jest.config.js dist && cd dist && npm publish",
12
12
  "minor": "npx tsc && npm run copy-assets && npm version minor && copy package.json dist && copy jest.config.js dist && cd dist && npm publish",
@@ -14,7 +14,7 @@
14
14
  "pack": "npx tsc && npm run copy-assets && copy package.json dist && copy jest.config.js dist && cd dist && npm pack"
15
15
  },
16
16
  "bin": {
17
- "builder": "./src/app.js"
17
+ "builder": "./src/index.js"
18
18
  },
19
19
  "keywords": [
20
20
  "build tool"
@@ -39,6 +39,7 @@
39
39
  "dependencies": {
40
40
  "autoprefixer": "^9.5.1",
41
41
  "bundle-loader": "^0.5.6",
42
+ "chokidar": "^4.0.1",
42
43
  "copy-webpack-plugin": "^5.0.3",
43
44
  "css-loader": "^2.1.1",
44
45
  "file-loader": "^3.0.1",
package/src/app.js CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  "use strict";
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  var path = require("path");
@@ -40,56 +40,80 @@ var DbBuilder = /** @class */ (function (_super) {
40
40
  utils_1.Utils.copyAllFilesByPattern(path.join(sourcePath, "data"), path.join(moduleDestinationDir, "data"), "**/*.xml");
41
41
  utils_1.Utils.copyAllFilesByPattern(path.join(sourcePath, "scripts"), path.join(moduleDestinationDir, "scripts"), "**/*.sql");
42
42
  utils_1.Utils.copyAllFilesByPattern(path.join(sourcePath, "updates"), path.join(moduleDestinationDir, "updates"), "**/*.sql");
43
+ var otherUpdatesDirs = fs.readdirSync(sourcePath, { withFileTypes: true })
44
+ .filter(function (d) { return d.isDirectory(); })
45
+ .map(function (d) { return d.name; })
46
+ .filter(function (d) { return d.startsWith("updates."); });
47
+ for (var _i = 0, otherUpdatesDirs_1 = otherUpdatesDirs; _i < otherUpdatesDirs_1.length; _i++) {
48
+ var updateDir = otherUpdatesDirs_1[_i];
49
+ utils_1.Utils.copyAllFilesByPattern(path.join(sourcePath, updateDir), path.join(moduleDestinationDir, updateDir), "**/*.sql");
50
+ }
51
+ var otherScriptsDirs = fs.readdirSync(sourcePath, { withFileTypes: true })
52
+ .filter(function (d) { return d.isDirectory(); })
53
+ .map(function (d) { return d.name; })
54
+ .filter(function (d) { return d.startsWith("scripts."); });
55
+ for (var _b = 0, otherScriptsDirs_1 = otherScriptsDirs; _b < otherScriptsDirs_1.length; _b++) {
56
+ var scriptDir = otherScriptsDirs_1[_b];
57
+ utils_1.Utils.copyAllFilesByPattern(path.join(sourcePath, scriptDir), path.join(moduleDestinationDir, scriptDir), "**/*.sql");
58
+ }
43
59
  if (utils_1.Utils.ensurePath(moduleDestinationDir)) {
44
- var order_1 = new Array();
45
- var files_1 = new Array();
46
- var dependencies_1 = {};
47
- var scriptsPath_1 = path.join(sourcePath, "scripts");
48
- var dirs = ["view*", "function*", "procedure*", "trigger*", "index*"];
49
- dirs.forEach(function (dir) {
50
- files_1 = files_1.concat(glob.sync(path.join(scriptsPath_1, dir, "**/*.sql")));
51
- });
52
- for (var i = 0; i < files_1.length; i++)
53
- files_1[i] = files_1[i].replace(/\//g, path.sep);
54
- var reorder_1 = function (file, parent) {
55
- if (file == parent)
56
- throw "Circular dependencies! " + parent;
57
- var deps = dependencies_1[file];
58
- deps &&
59
- deps.forEach(function (dep) {
60
- dep = path.resolve(scriptsPath_1, dep);
61
- if (files_1.indexOf(dep) != -1)
62
- reorder_1(dep, parent || file);
63
- });
64
- if (!parent || order_1.indexOf(parent) > order_1.indexOf(file))
65
- return;
66
- order_1.splice(order_1.indexOf(file), 1);
67
- order_1.splice(order_1.indexOf(parent), 0, file);
68
- };
69
- files_1.forEach(function (file) {
70
- var deps = (dependencies_1[file] = []);
71
- var data = fs.readFileSync(file).toString();
72
- data.split("\n").forEach(function (line) {
73
- var m = line.replace(/^\uFEFF/, "").match(/^--\s*\$dep\s+(.+?)\s*$/);
74
- if (m) {
75
- deps.push(m[1]);
76
- }
77
- });
78
- order_1.push(file);
79
- });
80
- // reorder
81
- files_1.forEach(function (file) {
82
- reorder_1(file);
83
- });
84
- if (order_1.length)
85
- fs.writeFileSync(moduleDestinationDir + "/scripts/order.txt", order_1
86
- .map(function (f) {
87
- return path.relative(scriptsPath_1, f);
88
- })
89
- .join("\n"));
60
+ var scriptsPath = path.join(sourcePath, "scripts");
61
+ _this.GenerateOrderFile(scriptsPath, moduleDestinationDir + "/scripts");
62
+ for (var _c = 0, otherScriptsDirs_2 = otherScriptsDirs; _c < otherScriptsDirs_2.length; _c++) {
63
+ var scriptDir = otherScriptsDirs_2[_c];
64
+ var otherScriptPath = path.join(sourcePath, scriptDir);
65
+ _this.GenerateOrderFile(otherScriptPath, moduleDestinationDir + "/" + scriptDir);
66
+ }
67
+ }
68
+ });
69
+ });
70
+ };
71
+ DbBuilder.prototype.GenerateOrderFile = function (scriptsPath, destinationScriptsPath) {
72
+ var order = new Array();
73
+ var files = new Array();
74
+ var dependencies = {};
75
+ var dirs = ["view*", "function*", "procedure*", "trigger*", "index*"];
76
+ dirs.forEach(function (dir) {
77
+ files = files.concat(glob.sync(path.join(scriptsPath, dir, "**/*.sql")));
78
+ });
79
+ for (var i = 0; i < files.length; i++)
80
+ files[i] = files[i].replace(/\//g, path.sep);
81
+ var reorder = function (file, parent) {
82
+ if (file == parent)
83
+ throw "Circular dependencies! " + parent;
84
+ var deps = dependencies[file];
85
+ deps &&
86
+ deps.forEach(function (dep) {
87
+ dep = path.resolve(scriptsPath, dep);
88
+ if (files.indexOf(dep) != -1)
89
+ reorder(dep, parent || file);
90
+ });
91
+ if (!parent || order.indexOf(parent) > order.indexOf(file))
92
+ return;
93
+ order.splice(order.indexOf(file), 1);
94
+ order.splice(order.indexOf(parent), 0, file);
95
+ };
96
+ files.forEach(function (file) {
97
+ var deps = (dependencies[file] = []);
98
+ var data = fs.readFileSync(file).toString();
99
+ data.split("\n").forEach(function (line) {
100
+ var m = line.replace(/^\uFEFF/, "").match(/^--\s*\$dep\s+(.+?)\s*$/);
101
+ if (m) {
102
+ deps.push(m[1]);
90
103
  }
91
104
  });
105
+ order.push(file);
106
+ });
107
+ // reorder
108
+ files.forEach(function (file) {
109
+ reorder(file);
92
110
  });
111
+ if (order.length)
112
+ fs.writeFileSync(destinationScriptsPath + "/order.txt", order
113
+ .map(function (f) {
114
+ return path.relative(scriptsPath, f);
115
+ })
116
+ .join("\n"));
93
117
  };
94
118
  DbBuilder.prototype.convertToXml = function (paths, module, destinationDir) {
95
119
  paths.forEach(function (p) {
@@ -12,6 +12,17 @@ var __extends = (this && this.__extends) || (function () {
12
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
13
  };
14
14
  })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
15
26
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
27
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
28
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -120,6 +131,7 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
120
131
  this.config.packages
121
132
  .filter(function (p) { return !p.isLegacy; })
122
133
  .forEach(function (p) {
134
+ utils_1.Logger.info("Building package " + p.name);
123
135
  var outputModulesPath = path.join(_this.config.paths.build, "ui", "modules");
124
136
  packageStructureManager_1.packageStructureManager
125
137
  .getModuleSourcePaths(p, "ui", _this.config)
@@ -130,6 +142,9 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
130
142
  return;
131
143
  utils_1.Utils.exec("npm run build", { cwd: sourcePath });
132
144
  var moduleFile = path.join(sourcePath, "dist/module.js");
145
+ if (!fs.existsSync(moduleFile)) {
146
+ moduleFile = path.join(sourcePath, "dist/index.js");
147
+ }
133
148
  var outputModuleFile = path.join(outputModulesPath, p.name, p.isSingleModule ? "index.js" : path.join(moduleName, "index.js"));
134
149
  utils_1.Utils.copyFile(moduleFile, outputModuleFile);
135
150
  });
@@ -172,6 +187,7 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
172
187
  this.config.packages.forEach(function (pkg) {
173
188
  if (!pkg.isLegacy)
174
189
  return;
190
+ utils_1.Logger.info("Adding package " + pkg.name + " to webpack config");
175
191
  resolvePlugins.push.apply(resolvePlugins, glob
176
192
  .sync(path.join(_this.config.paths.source, pkg.name, "{!(node_modules),}/tsconfig.json"))
177
193
  .map(function (tsconfig) { return new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({ configFile: tsconfig }); }));
@@ -220,6 +236,17 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
220
236
  fileName: "[name].js" + (this.isProd() ? "?[hash:8]" : ""),
221
237
  filesToConcat: libs
222
238
  }));
239
+ // Настройка React для MDT
240
+ var resolveAlias = {};
241
+ if (this.config.packages.length) {
242
+ if (this.config.packages.length > 1) {
243
+ console.warn("\n\t\t\t\t\t\u0412\u043D\u0438\u043C\u0430\u043D\u0438\u0435: \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u043E \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043F\u0430\u043A\u0435\u0442\u043E\u0432 \u0432 \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.\n\t\t\t\t\t\n\t\t\t\t\t\u0414\u043B\u044F \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0439 \u0440\u0430\u0431\u043E\u0442\u044B React \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E:\n\t\t\t\t\t1. \u0423\u0431\u0435\u0434\u0438\u0442\u044C\u0441\u044F, \u0447\u0442\u043E \u0432 \u043F\u0435\u0440\u0432\u043E\u043C \u043F\u0430\u043A\u0435\u0442\u0435 \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u044B \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438 react \u0438 react-dom\n\t\t\t\t\t2. \u042D\u0442\u0438 \u0432\u0435\u0440\u0441\u0438\u0438 React \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u044B \u0434\u043B\u044F \u0432\u0441\u0435\u0445 \u043E\u0441\u0442\u0430\u043B\u044C\u043D\u044B\u0445 \u043F\u0430\u043A\u0435\u0442\u043E\u0432\n\t\t\t\t\t\n\t\t\t\t\t\u0412\u0430\u0436\u043D\u043E: \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435 \u0440\u0430\u0437\u043D\u044B\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 React \u0432 \u043E\u0434\u043D\u043E\u043C \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0438 \u043C\u043E\u0436\u0435\u0442 \u043F\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043A \u0441\u0435\u0440\u044C\u0435\u0437\u043D\u044B\u043C \u043E\u0448\u0438\u0431\u043A\u0430\u043C.\n\t\t\t\t\t");
244
+ }
245
+ var pack = this.config.packages[0];
246
+ var basePath = path.join(this.config.paths.source, pack.name);
247
+ resolveAlias["react"] = path.resolve(basePath, "ui", "./node_modules/react");
248
+ resolveAlias["react-dom"] = path.resolve(basePath, "ui", "./node_modules/react-dom");
249
+ }
223
250
  return {
224
251
  context: path.join(this.config.paths.source, "mdt/ui"),
225
252
  mode: this.isProd() ? "production" : "development",
@@ -234,9 +261,7 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
234
261
  modules: ["node_modules"],
235
262
  extensions: [".ts", ".tsx", ".js", ".less", ".css", ".md", ".json"],
236
263
  plugins: resolvePlugins,
237
- alias: {
238
- mithril: "node_modules/mithril"
239
- }
264
+ alias: __assign({ mithril: "node_modules/mithril" }, resolveAlias)
240
265
  },
241
266
  plugins: plugins,
242
267
  optimization: {
@@ -279,6 +304,17 @@ var WebpackUiBuilder = /** @class */ (function (_super) {
279
304
  outputPath: "./_res/fonts"
280
305
  }
281
306
  }
307
+ },
308
+ {
309
+ test: /\.css$/,
310
+ use: ["style-loader", "css-loader"],
311
+ include: function (path) {
312
+ // Стили для monaco-editor обрабатываются отдельно в самой библиотеке
313
+ if (path.includes("monaco-editor")) {
314
+ return false;
315
+ }
316
+ return true;
317
+ }
282
318
  }
283
319
  ]
284
320
  }
@@ -28,6 +28,7 @@ var UIDependencyBuilder = /** @class */ (function (_super) {
28
28
  this.config.packages.forEach(function (pkg) {
29
29
  if (pkg.isLegacy) {
30
30
  var sourcePath = Path.join(_this.config.paths.source, pkg.name, "ui");
31
+ utils_1.Logger.info("Loading ui dependencies for package " + pkg.name);
31
32
  _this.runNpmInstall(sourcePath);
32
33
  return;
33
34
  }
@@ -35,6 +36,7 @@ var UIDependencyBuilder = /** @class */ (function (_super) {
35
36
  .getModuleSourcePaths(pkg, "ui", _this.config)
36
37
  .forEach(function (_a) {
37
38
  var moduleName = _a.moduleName, sourcePath = _a.sourcePath;
39
+ utils_1.Logger.info("Loading ui dependencies for module " + pkg.name + "." + moduleName);
38
40
  _this.runNpmInstall(sourcePath);
39
41
  });
40
42
  });
@@ -45,9 +47,9 @@ var UIDependencyBuilder = /** @class */ (function (_super) {
45
47
  utils_1.Logger.warn("File package.json not found!");
46
48
  return;
47
49
  }
48
- var packageLockPath = Path.join(cwd, "package-lock.json");
49
- var hasPackageLockPath = utils_1.Utils.ensurePath(packageLockPath);
50
- utils_1.Utils.exec("npm " + (hasPackageLockPath ? "ci" : "install") + " --force", { silent: true, cwd: cwd });
50
+ // let packageLockPath = Path.join(cwd, "package-lock.json");
51
+ // let hasPackageLockPath = Utils.ensurePath(packageLockPath);
52
+ utils_1.Utils.exec("npm install --no-save --prefer-offline --force", { silent: true, cwd: cwd });
51
53
  };
52
54
  return UIDependencyBuilder;
53
55
  }(baseBuilder_1.BaseBuilder));
package/src/index.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __assign = (this && this.__assign) || function () {
4
+ __assign = Object.assign || function(t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
+ t[p] = s[p];
9
+ }
10
+ return t;
11
+ };
12
+ return __assign.apply(this, arguments);
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ var utils_1 = require("./utils");
16
+ var path = require("path");
17
+ function isLegacyProviderNeeded() {
18
+ var nodeJsMajorVersion = parseInt(process.versions.node.split(".")[0]);
19
+ return nodeJsMajorVersion > 16;
20
+ }
21
+ function getCliArgs() {
22
+ return process.argv.slice(2);
23
+ }
24
+ function envWithLagacyProvider() {
25
+ return __assign(__assign({}, process.env), { NODE_OPTIONS: "--openssl-legacy-provider" });
26
+ }
27
+ function run() {
28
+ var options = {
29
+ stdio: "inherit",
30
+ cwd: process.cwd()
31
+ };
32
+ if (isLegacyProviderNeeded())
33
+ options.env = envWithLagacyProvider();
34
+ var pathToApp = path.resolve(__dirname, "app");
35
+ utils_1.Utils.execModule(pathToApp, getCliArgs(), options);
36
+ }
37
+ run();
@@ -17,7 +17,7 @@ var ConfigManager = /** @class */ (function () {
17
17
  config = yaml.load(configPath);
18
18
  // if (!config.paths) Logger.error(`paths section is required in build config.`);
19
19
  // if (!config.package) Logger.error("'package' section is required in build config");
20
- config.modules = config.modules || [];
20
+ config.modules = Array.from(new Set(config.modules).values()) || [];
21
21
  config.ui = config.ui || { theme: "mdt.coffee", themes: ["mdt.coffee"], port: 9002, checkTypes: false };
22
22
  if (["boolean", "undefined"].includes(typeof config.ui.checkTypes)) {
23
23
  config.ui.checkTypes = !!config.ui.checkTypes;
@@ -44,23 +44,23 @@ var PackageManager = /** @class */ (function () {
44
44
  else {
45
45
  var packagesNames = Object.keys(using).map(function (packageName) { return packageName; });
46
46
  packagesNames.forEach(function (packageName) {
47
- if (packageName === _this.config.package.name)
48
- utils_1.Logger.error("Circular dependency. Package config " + packageInfoPath + " has circular reference to main package \"" + _this.config.package.name + "\".");
49
- if (_this.packages.has(packageName)) {
50
- utils_1.Logger.warn("Package " + packageName + " with version " + _this.packages.get(packageName).version + " already added to build packages list. Version " + using[packageName] + " from " + packageInfoPath + " is skipped.");
51
- return;
52
- }
53
47
  var pkg = { name: packageName, version: using[packageName] };
54
48
  var gitRepositoryNameRegexResult = /([^\/\\:]*)\.git\/?$/.exec(packageName);
55
49
  if (gitRepositoryNameRegexResult) {
56
50
  pkg.name = gitRepositoryNameRegexResult[1];
57
51
  pkg.url = packageName;
58
52
  }
53
+ if (pkg.name === _this.config.package.name)
54
+ utils_1.Logger.error("Circular dependency. Package config " + packageInfoPath + " has circular reference to main package \"" + _this.config.package.name + "\".");
55
+ if (_this.packages.has(pkg.name)) {
56
+ utils_1.Logger.warn("Package " + pkg.name + " with version " + _this.packages.get(pkg.name).version + " already added to build packages list. Version " + using[packageName] + " from " + packageInfoPath + " is skipped.");
57
+ return;
58
+ }
59
59
  _this.sourceManager.loadSource(pkg, skipload);
60
60
  pkg.packageInfo = _this.getPackageInfo(pkg.name);
61
61
  var pkgDependencies = _this.getPackageDependencies(pkg, skipload);
62
62
  packageStructureManager_1.packageStructureManager.writePackageStructureInfo(pkg, _this.config);
63
- _this.packages.set(packageName, _this.preparePackageModules(pkg, pkgDependencies));
63
+ _this.packages.set(pkg.name, _this.preparePackageModules(pkg, pkgDependencies));
64
64
  });
65
65
  }
66
66
  };
@@ -47,6 +47,13 @@ var GitScmProvider = /** @class */ (function () {
47
47
  utils_1.Logger.error("Cannot find version " + config.package.version + " of module " + config.package.name);
48
48
  return version;
49
49
  };
50
+ GitScmProvider.prototype.clean = function (config) {
51
+ this.exec("clean -fdx '*/package-lock.json'", config.paths.source);
52
+ this.exec("clean -fdx 'api/*/bin/*'", config.paths.source);
53
+ this.exec("clean -fdx '*/api/*/bin/*'", config.paths.source);
54
+ this.exec("clean -fdx 'api/*/obj/*'", config.paths.source);
55
+ this.exec("clean -fdx '*/api/*/obj/*'", config.paths.source);
56
+ };
50
57
  GitScmProvider.prototype._getGitUrl = function (config) {
51
58
  var _a;
52
59
  return (_a = config.package.url) !== null && _a !== void 0 ? _a : this.options.url + this.options.group + "/" + config.package.name;
@@ -44,6 +44,8 @@ var HgScmProvider = /** @class */ (function () {
44
44
  utils_1.Logger.error("Cannot find version " + config.package.version + " of module " + config.package.name);
45
45
  return version;
46
46
  };
47
+ HgScmProvider.prototype.clean = function (config) {
48
+ };
47
49
  return HgScmProvider;
48
50
  }());
49
51
  exports.HgScmProvider = HgScmProvider;
@@ -30,9 +30,13 @@ var SourceManager = /** @class */ (function () {
30
30
  var version;
31
31
  if (!skipLoad) {
32
32
  try {
33
- utils_1.Utils.ensurePath(path.join(sourceConfig.paths.source, "." + sourceType.toLowerCase()))
34
- ? scmProvider.pull(sourceConfig)
35
- : scmProvider.clone(sourceConfig);
33
+ if (utils_1.Utils.ensurePath(path.join(sourceConfig.paths.source, "." + sourceType.toLowerCase()))) {
34
+ scmProvider.clean(sourceConfig);
35
+ scmProvider.pull(sourceConfig);
36
+ }
37
+ else {
38
+ scmProvider.clone(sourceConfig);
39
+ }
36
40
  version = this.update(scmProvider, sourceConfig, true);
37
41
  }
38
42
  catch (e) {
package/src/utils.js CHANGED
@@ -29,6 +29,7 @@ var fs = require("fs");
29
29
  var path = require("path");
30
30
  var glob = require("glob");
31
31
  var stripBomBuffer = require("strip-bom-buf");
32
+ var child_process = require("child_process");
32
33
  var Utils = /** @class */ (function () {
33
34
  function Utils() {
34
35
  }
@@ -52,6 +53,21 @@ var Utils = /** @class */ (function () {
52
53
  throw e;
53
54
  }
54
55
  };
56
+ Utils.execModule = function (path, args, options) {
57
+ var proc = child_process.fork(path, args, options);
58
+ process.on("SIGTERM", function () { return proc.kill("SIGTERM"); });
59
+ process.on("SIGINT", function () { return proc.kill("SIGINT"); });
60
+ process.on("SIGBREAK", function () { return proc.kill("SIGBREAK"); });
61
+ process.on("SIGHUP", function () { return proc.kill("SIGHUP"); });
62
+ proc.on("exit", function (code, signal) {
63
+ var exitCode = code;
64
+ if (exitCode === null) {
65
+ exitCode = signal === "SIGINT" ? 0 : 1;
66
+ }
67
+ process.exit(exitCode);
68
+ });
69
+ return proc;
70
+ };
55
71
  Utils.ensurePath = function (path) {
56
72
  return fs.existsSync(path);
57
73
  };
Binary file