ics-builder 4.4.2 → 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,6 +1,6 @@
1
1
  {
2
2
  "name": "ics-builder",
3
- "version": "4.4.2",
3
+ "version": "4.4.3",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "preferGlobal": true,
@@ -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",
@@ -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
  });
@@ -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,8 +47,12 @@ 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.cleanPackageLock = function (config) {
51
- return this.exec("clean -fdx '*/package-lock.json'", config.paths.source);
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);
52
56
  };
53
57
  GitScmProvider.prototype._getGitUrl = function (config) {
54
58
  var _a;
@@ -44,8 +44,7 @@ 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.cleanPackageLock = function (config) {
48
- return null;
47
+ HgScmProvider.prototype.clean = function (config) {
49
48
  };
50
49
  return HgScmProvider;
51
50
  }());
@@ -31,7 +31,7 @@ var SourceManager = /** @class */ (function () {
31
31
  if (!skipLoad) {
32
32
  try {
33
33
  if (utils_1.Utils.ensurePath(path.join(sourceConfig.paths.source, "." + sourceType.toLowerCase()))) {
34
- scmProvider.cleanPackageLock(sourceConfig);
34
+ scmProvider.clean(sourceConfig);
35
35
  scmProvider.pull(sourceConfig);
36
36
  }
37
37
  else {