ics-builder 4.4.10 → 4.4.11

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 (85) hide show
  1. package/package.json +1 -1
  2. package/{dist/src → src}/index.js +0 -0
  3. package/.prettierignore +0 -1
  4. package/.prettierrc +0 -7
  5. package/.vscode/launch.json +0 -15
  6. package/.vscode/settings.json +0 -6
  7. package/Dockerfile +0 -32
  8. package/build/modules.yaml +0 -7
  9. package/build.template.yml +0 -51
  10. package/dist/jest.config.js +0 -4
  11. package/dist/package.json +0 -76
  12. package/dist/src/services/source/assets/hostList.yml +0 -12
  13. package/dist/src/services/source/assets/sourceList.yml +0 -50
  14. package/src/app.ts +0 -64
  15. package/src/builder/api/csprojFile.ts +0 -15
  16. package/src/builder/api/dotnetApiBuilder.ts +0 -145
  17. package/src/builder/api/net5Builder.ts +0 -181
  18. package/src/builder/api/webConfigFile.ts +0 -11
  19. package/src/builder/api/xmlFile.ts +0 -24
  20. package/src/builder/baseBuilder.ts +0 -71
  21. package/src/builder/data/dataBuilder.ts +0 -28
  22. package/src/builder/db/dbBuilder.ts +0 -167
  23. package/src/builder/e2e/e2eBuilder.ts +0 -23
  24. package/src/builder/schema/schemaBuilder.ts +0 -156
  25. package/src/builder/ui/customUiBuilder.ts +0 -50
  26. package/src/builder/ui/webpackUiBuilder.ts +0 -497
  27. package/src/builder/uiDependency/dependencyBuilder.ts +0 -38
  28. package/src/builder/winservice/winserviceBuilder.ts +0 -11
  29. package/src/dotnetUtils.ts +0 -41
  30. package/src/exceptions/BuilderException.ts +0 -7
  31. package/src/index.ts +0 -34
  32. package/src/services/buildManager.ts +0 -151
  33. package/src/services/commandManager.ts +0 -78
  34. package/src/services/configManager.ts +0 -82
  35. package/src/services/packageManager.ts +0 -180
  36. package/src/services/packageStructure/legacyPackageStructureManager.ts +0 -34
  37. package/src/services/packageStructure/packageStructureManager.ts +0 -75
  38. package/src/services/packageStructure/structureUtils.ts +0 -66
  39. package/src/services/source/loadPackages.ts +0 -18
  40. package/src/services/source/loaders/baseLoader.ts +0 -28
  41. package/src/services/source/loaders/gitScmProvider.ts +0 -73
  42. package/src/services/source/loaders/hgScmProvider.ts +0 -63
  43. package/src/services/source/sourceManager.ts +0 -95
  44. package/src/services/testManager.ts +0 -27
  45. package/src/testRunners/apiTestRunner.ts +0 -68
  46. package/src/testRunners/baseTestRunner.ts +0 -19
  47. package/src/testRunners/uiTestRunner.ts +0 -8
  48. package/src/utils.ts +0 -228
  49. package/test/sourceManager.test.ts +0 -17
  50. package/tsconfig.json +0 -18
  51. package/wallaby.js +0 -14
  52. /package/{dist/src → src}/app.js +0 -0
  53. /package/{dist/src → src}/builder/api/csprojFile.js +0 -0
  54. /package/{dist/src → src}/builder/api/dotnetApiBuilder.js +0 -0
  55. /package/{dist/src → src}/builder/api/net5Builder.js +0 -0
  56. /package/{dist/src → src}/builder/api/webConfigFile.js +0 -0
  57. /package/{dist/src → src}/builder/api/xmlFile.js +0 -0
  58. /package/{dist/src → src}/builder/baseBuilder.js +0 -0
  59. /package/{dist/src → src}/builder/data/dataBuilder.js +0 -0
  60. /package/{dist/src → src}/builder/db/dbBuilder.js +0 -0
  61. /package/{dist/src → src}/builder/e2e/e2eBuilder.js +0 -0
  62. /package/{dist/src → src}/builder/schema/schemaBuilder.js +0 -0
  63. /package/{dist/src → src}/builder/ui/customUiBuilder.js +0 -0
  64. /package/{dist/src → src}/builder/ui/webpackUiBuilder.js +0 -0
  65. /package/{dist/src → src}/builder/uiDependency/dependencyBuilder.js +0 -0
  66. /package/{dist/src → src}/builder/winservice/winserviceBuilder.js +0 -0
  67. /package/{dist/src → src}/dotnetUtils.js +0 -0
  68. /package/{dist/src → src}/exceptions/BuilderException.js +0 -0
  69. /package/{dist/src → src}/services/buildManager.js +0 -0
  70. /package/{dist/src → src}/services/commandManager.js +0 -0
  71. /package/{dist/src → src}/services/configManager.js +0 -0
  72. /package/{dist/src → src}/services/packageManager.js +0 -0
  73. /package/{dist/src → src}/services/packageStructure/legacyPackageStructureManager.js +0 -0
  74. /package/{dist/src → src}/services/packageStructure/packageStructureManager.js +0 -0
  75. /package/{dist/src → src}/services/packageStructure/structureUtils.js +0 -0
  76. /package/{dist/src → src}/services/source/loadPackages.js +0 -0
  77. /package/{dist/src → src}/services/source/loaders/baseLoader.js +0 -0
  78. /package/{dist/src → src}/services/source/loaders/gitScmProvider.js +0 -0
  79. /package/{dist/src → src}/services/source/loaders/hgScmProvider.js +0 -0
  80. /package/{dist/src → src}/services/source/sourceManager.js +0 -0
  81. /package/{dist/src → src}/services/testManager.js +0 -0
  82. /package/{dist/src → src}/testRunners/apiTestRunner.js +0 -0
  83. /package/{dist/src → src}/testRunners/baseTestRunner.js +0 -0
  84. /package/{dist/src → src}/testRunners/uiTestRunner.js +0 -0
  85. /package/{dist/src → src}/utils.js +0 -0
@@ -1,50 +0,0 @@
1
- import * as path from "path";
2
- import { Utils } from "../../utils";
3
- import * as yaml from "yamljs";
4
-
5
- import { BaseBuilder, BuilderConfig } from "../baseBuilder";
6
-
7
- export class CustomUiBuilder extends BaseBuilder {
8
- constructor(config: BuilderConfig) {
9
- super(config);
10
- }
11
-
12
- run(): void | Promise<void> {
13
- this.config.packages.forEach(pkg => {
14
- let packageDir = path.join(this.config.paths.source, pkg.name);
15
- let packageYamlPath = path.join(packageDir, "package.yml");
16
- let pkgInfo = Utils.ensurePath(packageYamlPath) ? yaml.load(packageYamlPath) : {};
17
- let buildDir = path.join(packageDir, (pkgInfo?.builder?.ui?.path || "").replace(pkg.name, ""));
18
-
19
- let cmd = pkgInfo?.builder?.ui?.cmd || "";
20
-
21
- const envArgs = this.prepareEnvArgs();
22
- if (envArgs.length) cmd = this.prepareCmd(cmd, envArgs);
23
-
24
- Utils.exec(cmd, { cwd: buildDir });
25
- });
26
- }
27
-
28
- private prepareEnvArgs(): string[] {
29
- const env = this.config.ui.env || {};
30
- return Object.keys(env).map(k => {
31
- const v = env[k];
32
- const splitters = {
33
- space: " ",
34
- dot: "."
35
- };
36
- return `--env${splitters[this.config.ui.envSplitter] || "."}${k}=${
37
- v instanceof Array ? v.toString() : v
38
- }`;
39
- });
40
- }
41
-
42
- private prepareCmd(cmd: string, args: Record<string, any>): string {
43
- const newCmd = this.config.ui.cmd || cmd;
44
- let c = newCmd
45
- .replace(/^\(|\)$/g, "")
46
- .trim()
47
- .concat(" ", args.join(" "));
48
- return c;
49
- }
50
- }
@@ -1,497 +0,0 @@
1
- import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
2
- import * as VirtualModulePlugin from "virtual-module-webpack-plugin";
3
- import * as CopyWebpackPlugin from "copy-webpack-plugin";
4
- import * as HtmlWebpackPlugin from "html-webpack-plugin";
5
- import * as MiniCssExtractPlugin from "mini-css-extract-plugin";
6
- import * as FixStyleOnlyEntriesPlugin from "webpack-fix-style-only-entries";
7
- import * as WebpackConcatPlugin from "webpack-concat-plugin";
8
- import * as autoprefixer from "autoprefixer";
9
- import * as webpack from "webpack";
10
- import * as WebpackDevServer from "webpack-dev-server";
11
- import * as path from "path";
12
- import * as glob from "glob";
13
- import * as yaml from "yamljs";
14
- import * as fs from "fs";
15
-
16
- import { BaseBuilder, BuilderConfig } from "../baseBuilder";
17
- import { Utils, Logger } from "../../utils";
18
- import { packageStructureManager } from "../../services/packageStructure/packageStructureManager";
19
-
20
- export class WebpackUiBuilder extends BaseBuilder {
21
- private isLegacy = false;
22
-
23
- constructor(config: BuilderConfig) {
24
- super(config);
25
- }
26
-
27
- run(): void | Promise<void> {
28
- Utils.prepareDir(path.join(this.config.paths.build, "ui"));
29
-
30
- let mdtPath = path.join(this.config.paths.source, "mdt/ui");
31
- Utils.copyFile(
32
- path.join(mdtPath, "config.template.js"),
33
- path.join(this.config.paths.build, "ui/config.template.js")
34
- );
35
-
36
- if (!this.isProd())
37
- Utils.copyFile(path.join(mdtPath, "config.js"), path.join(this.config.paths.build, "ui/config.js"));
38
-
39
- if (this.config.packages.some(pkg => pkg.name === "mdt")) this.isLegacy = true;
40
-
41
- if (this.config.packages.every(p => !p.isLegacy)) {
42
- this.buildModules();
43
- return;
44
- }
45
-
46
- this.executePreBuildTask();
47
-
48
- let webpackStylesConfig = this.getWebpackStylesConfig();
49
- let webpackConfig = this.getWebpackConfig();
50
-
51
- return new Promise(async (resolve, reject) => {
52
- await Promise.all([
53
- await this.runWebpack(webpackStylesConfig),
54
- this.isProd()
55
- ? this.runWebpack(webpackConfig).then(() => {
56
- this.buildModules();
57
- })
58
- : this.runDevServer(webpackConfig)
59
- ]).catch(() => (this.isProd() ? reject() : resolve()));
60
-
61
- this.saveUiSettings();
62
- resolve();
63
- });
64
- }
65
-
66
- private buildModules(): void {
67
- this.config.packages
68
- .filter(p => !p.isLegacy)
69
- .forEach(p => {
70
- Logger.info(`Building package ${p.name}`);
71
- let outputModulesPath = path.join(this.config.paths.build, "ui", "modules");
72
- packageStructureManager
73
- .getModuleSourcePaths(p, "ui", this.config)
74
- .forEach(({ moduleName, sourcePath }) => {
75
- let packagePath = path.join(sourcePath, "package.json");
76
- if (!Utils.ensurePath(packagePath)) return;
77
- Utils.exec("npm run build", { cwd: sourcePath });
78
- let moduleFile = path.join(sourcePath, "dist/module.js");
79
- if (!fs.existsSync(moduleFile)) {
80
- moduleFile = path.join(sourcePath, "dist/index.js");
81
- }
82
- let outputModuleFile = path.join(
83
- outputModulesPath,
84
- p.name,
85
- p.isSingleModule ? "index.js" : path.join(moduleName, "index.js")
86
- );
87
- Utils.copyFile(moduleFile, outputModuleFile);
88
- });
89
- });
90
- }
91
-
92
- private executePreBuildTask() {
93
- this.config.packages.forEach(pkg => {
94
- const uiDirectory = path.join(this.config.paths.source, pkg.name, "ui");
95
- const packageJsonPath = path.join(uiDirectory, "package.json");
96
- if (!Utils.ensurePath(packageJsonPath)) return;
97
-
98
- const packageJsonContent = require(packageJsonPath);
99
- const preBuildTask = packageJsonContent?.scripts?.preBuild;
100
- if (preBuildTask) Utils.exec(preBuildTask, { cwd: uiDirectory });
101
- });
102
- }
103
-
104
- private saveUiSettings(): void {
105
- let settings = {
106
- builder: this.config.version || "4.1",
107
- version: this.config.packages.map(pkg => `${pkg.name} ${pkg.version}`).join(" / "),
108
- theme: (this.config.ui && this.config.ui.theme) || "mdt.coffee",
109
- themes: (this.config.ui && this.config.ui.themes) || ["mdt.coffee"]
110
- };
111
-
112
- let settingsPath = path.join(this.config.paths.build, "ui");
113
-
114
- if (Utils.ensurePath(settingsPath))
115
- fs.writeFileSync(path.join(settingsPath, "settings.yml"), yaml.stringify(settings, 4, 2));
116
- }
117
-
118
- private isProd(): boolean {
119
- return this.config.options.ui.mode !== "dev";
120
- }
121
-
122
- private getWebpackConfig(): webpack.Configuration {
123
- let entryModules = [];
124
- let resolvePlugins = [];
125
- let plugins = [];
126
- let libs = [];
127
-
128
- this.config.packages.forEach(pkg => {
129
- if (!pkg.isLegacy) return;
130
- Logger.info(`Adding package ${pkg.name} to webpack config`);
131
- resolvePlugins.push(
132
- ...glob
133
- .sync(path.join(this.config.paths.source, pkg.name, "{!(node_modules),}/tsconfig.json"))
134
- .map(tsconfig => new TsconfigPathsPlugin({ configFile: tsconfig }))
135
- );
136
-
137
- packageStructureManager
138
- .getModuleSourcePaths(pkg, "ui", this.config)
139
- .forEach(({ moduleName, sourcePath }) => {
140
- let fullModuleName = moduleName === "_core" ? pkg.name : pkg.name.concat(".", moduleName);
141
-
142
- entryModules = entryModules.concat(
143
- glob.sync(
144
- path.join(
145
- sourcePath,
146
- `**/${pkg.name === "mdt" && moduleName === "_core" ? "App" : "module"}.ts`
147
- )
148
- )
149
- );
150
-
151
- if (this.isLegacy) {
152
- libs = libs.concat(
153
- glob.sync(path.join(sourcePath, "_res/**/*.js"), {
154
- ignore: path.join(sourcePath, "_res/dynamic/**/*")
155
- })
156
- );
157
- plugins.push(
158
- new CopyWebpackPlugin(
159
- [
160
- {
161
- from: path.join(sourcePath, "_res/**/!(*.js)"),
162
- to: path.join(this.config.paths.build, "ui/_res", fullModuleName),
163
- context: path.join(sourcePath, "_res")
164
- },
165
- {
166
- from: path.join(sourcePath, "_res/dynamic/**/*"),
167
- to: path.join(this.config.paths.build, "ui/_res", fullModuleName, "dynamic"),
168
- context: path.join(sourcePath, "_res/dynamic")
169
- },
170
- {
171
- from: "modules.json",
172
- to: path.join(this.config.paths.build, "ui/modules.json")
173
- }
174
- ],
175
- { logLevel: "silent" }
176
- )
177
- );
178
- }
179
- });
180
- });
181
-
182
- plugins.push(
183
- new VirtualModulePlugin({
184
- moduleName: "./index.ts",
185
- contents: entryModules
186
- .map(x => `import "${x}";`)
187
- //.concat("if (module.hot) { module.hot.accept(); }")
188
- .join("\n")
189
- }),
190
- new HtmlWebpackPlugin({
191
- filename: "index.html",
192
- template: path.join("index.html")
193
- }),
194
- new CopyWebpackPlugin([{ from: path.join("web.config"), to: "web.config" }])
195
- );
196
-
197
- if (libs.length)
198
- plugins.push(
199
- new WebpackConcatPlugin({
200
- name: "libs",
201
- fileName: `[name].js${this.isProd() ? "?[hash:8]" : ""}`,
202
- filesToConcat: libs
203
- })
204
- );
205
-
206
- // Настройка React для MDT
207
- const resolveAlias = {};
208
- if (this.config.packages.length) {
209
- if (this.config.packages.length > 1) {
210
- console.warn(`
211
- Внимание: обнаружено несколько пакетов в конфигурации.
212
-
213
- Для корректной работы React необходимо:
214
- 1. Убедиться, что в первом пакете определены зависимости react и react-dom
215
- 2. Эти версии React будут использованы для всех остальных пакетов
216
-
217
- Важно: использование разных версий React в одном приложении может привести к серьезным ошибкам.
218
- `);
219
- }
220
- const pack = this.config.packages[0];
221
- const basePath = path.join(this.config.paths.source, pack.name);
222
- resolveAlias["react"] = path.resolve(basePath, "ui", "./node_modules/react");
223
- resolveAlias["react-dom"] = path.resolve(basePath, "ui", "./node_modules/react-dom");
224
- }
225
-
226
- // Библиотеки с современным синтаксисом, которые нужно транспилировать для webpack 4
227
- const packagesToTranspile = ["ics-ui-kit", "zustand-computed"];
228
- const transpileRegex = new RegExp(packagesToTranspile.join("|"));
229
-
230
- return {
231
- context: path.join(this.config.paths.source, "mdt/ui"),
232
- mode: this.isProd() ? "production" : "development",
233
- entry: {
234
- all: "./index.ts"
235
- },
236
-
237
- output: {
238
- path: path.join(this.config.paths.build, "ui"),
239
- filename: `[name].js${this.isProd() ? "?[chunkhash:8]" : ""}`
240
- },
241
- resolve: {
242
- modules: ["node_modules"],
243
- extensions: [".ts", ".tsx", ".js", ".less", ".css", ".md", ".json"],
244
- plugins: resolvePlugins,
245
- alias: {
246
- mithril: "node_modules/mithril",
247
- ...resolveAlias
248
- }
249
- },
250
- plugins: plugins,
251
- optimization: {
252
- minimize: false,
253
- splitChunks: {
254
- chunks: "all",
255
- cacheGroups: {
256
- vendors: false,
257
- vendor: {
258
- test: /[\\/]node_modules[\\/](?!ace-builds[\\/])/,
259
- name: "vendor"
260
- }
261
- }
262
- }
263
- },
264
- module: {
265
- rules: [
266
- // Обработка современного JS из библиотеки ics-ui-kit для совместимости со старыми браузерами (IE 10+)
267
- // Babel транспилирует ES2020+ синтаксис (nullish coalescing ??, optional chaining ?.) в ES5
268
- {
269
- test: /\.m?js$/,
270
- include: transpileRegex,
271
- use: {
272
- loader: require.resolve("babel-loader"),
273
- options: {
274
- cacheDirectory: true,
275
- cacheCompression: false,
276
- presets: [
277
- [
278
- require.resolve("@babel/preset-env"),
279
- {
280
- targets: {
281
- browsers: ["IE 10", "Chrome 33", "Firefox 33"]
282
- },
283
- exclude: ["transform-async-to-generator", "transform-regenerator"],
284
- modules: false,
285
- useBuiltIns: false
286
- }
287
- ]
288
- ],
289
- compact: this.isProd()
290
- }
291
- }
292
- },
293
- {
294
- test: /\.tsx?$/,
295
- use: {
296
- loader: require.resolve("ts-loader"),
297
- options: { transpileOnly: !this.config.ui.checkTypes, silent: false, logLevel: "info" }
298
- }
299
- },
300
- {
301
- test: /\.less$/,
302
- loader: `${require.resolve("style-loader")}!${require.resolve("css-loader")}!${require.resolve(
303
- "less-loader"
304
- )}`
305
- },
306
- {
307
- test: /\.svg?$/,
308
- loader: `${require.resolve("svg-inline-loader")}?removeSVGTagAttrs=false&idPrefix=true`
309
- },
310
- {
311
- test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
312
- exclude: [/monaco-editor/gi],
313
- use: {
314
- loader: "file-loader",
315
- options: {
316
- name: "[name].[ext]",
317
- outputPath: "./_res/fonts"
318
- }
319
- }
320
- },
321
- {
322
- test: /\.css$/,
323
- use: ["style-loader", "css-loader"],
324
- include: (path: string) => {
325
- // Стили для monaco-editor обрабатываются отдельно в самой библиотеке
326
- if (path.includes("monaco-editor")) {
327
- return false;
328
- }
329
- return true;
330
- }
331
- }
332
- ]
333
- }
334
- };
335
- }
336
-
337
- private getWebpackStylesConfig(): webpack.Configuration {
338
- let styles = new Array<string>();
339
- let entry = {};
340
- let plugins: Array<webpack.Plugin> = [
341
- new MiniCssExtractPlugin({ filename: "themes/mdt.[name].css" }),
342
- new FixStyleOnlyEntriesPlugin({ silent: true })
343
- ];
344
-
345
- let themes = (this.config.ui.themes || ["mdt.coffee"]).map(theme => theme.split(".")[1]).filter(x => x);
346
-
347
- this.config.packages.forEach(pkg => {
348
- styles = styles.concat(
349
- glob.sync(
350
- path.join(
351
- this.config.paths.source,
352
- `${pkg.name}/ui/{${pkg.modules.map<string>(m => m.name).join(",")}}`,
353
- "**/module.less"
354
- )
355
- )
356
- );
357
- });
358
-
359
- themes.forEach(theme => {
360
- let virtualStylesPath = `./${theme}.less`;
361
- (entry[theme] = virtualStylesPath),
362
- plugins.push(
363
- new VirtualModulePlugin({
364
- moduleName: virtualStylesPath,
365
- contents: this.importThemes(styles, theme)
366
- })
367
- );
368
- });
369
-
370
- return {
371
- context: path.join(this.config.paths.source, "mdt/ui"),
372
- mode: this.isProd() ? "production" : "development",
373
- entry: entry,
374
- output: {
375
- path: path.join(this.config.paths.build, "ui"),
376
- filename: "[name].js"
377
- },
378
- resolve: {
379
- modules: ["node_modules"]
380
- },
381
- plugins: plugins,
382
- module: {
383
- rules: [
384
- {
385
- test: /\.less$/,
386
- use: [
387
- MiniCssExtractPlugin.loader,
388
- { loader: require.resolve("css-loader"), options: { url: this.isLegacy ? false : true } },
389
- {
390
- loader: require.resolve("postcss-loader"),
391
- options: {
392
- plugins: [
393
- autoprefixer({
394
- remove: false,
395
- overrideBrowserslist: ["IE 10", "Chrome 33", "Firefox 33"]
396
- })
397
- ]
398
- }
399
- },
400
- {
401
- loader: require.resolve("less-loader"),
402
- options: {
403
- modifyVars: { "@fa-css-prefix": "icon" },
404
- relativeUrls: this.isLegacy ? false : true,
405
- javascriptEnabled: true,
406
- plugins: [
407
- {
408
- install: (lessObj, pluginManager) => {
409
- pluginManager.addPreProcessor(
410
- {
411
- process: function (lessCode) {
412
- return lessCode.replace(
413
- /^@import\s*(url\(https:\/\/fonts\.googleapis\.com\/.*)$/gim,
414
- "@import (css) $1"
415
- );
416
- }
417
- },
418
- 2000
419
- ); // 2000 sets priority to come after less imports, per code comments
420
- }
421
- }
422
- ]
423
- }
424
- }
425
- ]
426
- },
427
- {
428
- test: /\.(svg|ttf|eot|woff(2)?)(\?[a-z0-9=&.]+)?$/,
429
- loader: `${require.resolve(
430
- "file-loader"
431
- )}?name=[name].[ext]&publicPath=../fonts&outputPath=fonts`
432
- },
433
- {
434
- test: /\.(jpe?g|png|gif)(\?[a-z0-9=&.]+)?$/,
435
- loader: `${require.resolve(
436
- "file-loader"
437
- )}?name=[name].[ext]&publicPath=../images&outputPath=images`
438
- }
439
- ]
440
- }
441
- };
442
- }
443
-
444
- private importThemes(modules: Array<string>, theme: string): string {
445
- let themesDir = "_core/themes";
446
- return `@import \'${path.join(themesDir, "_base/vars.less")}';\n`.concat(
447
- `@import \'${path.join(themesDir, `${theme}/vars.less`)}';\n`,
448
- modules.map(module => `@import \'${module}\';`).join("\n") + "\n",
449
- `@import \'${path.join(themesDir, "_base/theme.less")}';\n`,
450
- `@import \'${path.join(themesDir, `${theme}/theme.less`)}';\n`
451
- );
452
- }
453
-
454
- private runWebpack(config: webpack.Configuration): Promise<void> {
455
- let compiler = webpack(config);
456
- return new Promise((resolve, reject) => {
457
- compiler.run((err, stats) => {
458
- if (stats?.compilation?.errors?.length) {
459
- Logger.error(
460
- stats.toString({
461
- colors: true,
462
- modules: false,
463
- children: false,
464
- chunks: false,
465
- chunkModules: false
466
- })
467
- );
468
- }
469
- resolve();
470
- });
471
- });
472
- }
473
-
474
- private runDevServer(config: webpack.Configuration): Promise<void> {
475
- return new Promise(resolve => {
476
- config.plugins.push(new webpack.HotModuleReplacementPlugin());
477
- let compiler = webpack(config);
478
- let server = new WebpackDevServer(compiler, {
479
- contentBase: config.output.path,
480
- open: true,
481
- hot: true
482
- });
483
-
484
- compiler.hooks.done.tap("run", () => {
485
- resolve();
486
- });
487
-
488
- return new Promise(async reject => {
489
- await server.listen(this.config.ui.port || 9002, "localhost", err => {
490
- if (err) {
491
- reject(err);
492
- }
493
- });
494
- });
495
- });
496
- }
497
- }
@@ -1,38 +0,0 @@
1
- import { BaseBuilder, BuilderConfig } from "../baseBuilder";
2
- import { Utils, Logger } from "../../utils";
3
- import * as Path from "path";
4
- import { packageStructureManager } from "../../services/packageStructure/packageStructureManager";
5
-
6
- export class UIDependencyBuilder extends BaseBuilder {
7
- constructor(config: BuilderConfig) {
8
- super(config);
9
- }
10
-
11
- run(): void | Promise<void> {
12
- this.config.packages.forEach(pkg => {
13
- if (pkg.isLegacy) {
14
- let sourcePath = Path.join(this.config.paths.source, pkg.name, "ui");
15
- Logger.info(`Loading ui dependencies for package ${pkg.name}`);
16
- this.runNpmInstall(sourcePath);
17
- return;
18
- }
19
- packageStructureManager
20
- .getModuleSourcePaths(pkg, "ui", this.config)
21
- .forEach(({ moduleName, sourcePath }) => {
22
- Logger.info(`Loading ui dependencies for module ${pkg.name}.${moduleName}`);
23
- this.runNpmInstall(sourcePath);
24
- });
25
- });
26
- }
27
-
28
- private runNpmInstall(cwd: string) {
29
- let packagePath = Path.join(cwd, "package.json");
30
- if (!Utils.ensurePath(packagePath)) {
31
- Logger.warn("File package.json not found!");
32
- return;
33
- }
34
- // let packageLockPath = Path.join(cwd, "package-lock.json");
35
- // let hasPackageLockPath = Utils.ensurePath(packageLockPath);
36
- Utils.exec(`npm install --no-save --prefer-offline --force`, { silent: true, cwd });
37
- }
38
- }
@@ -1,11 +0,0 @@
1
- import { BaseBuilder, BuilderConfig } from "../baseBuilder";
2
-
3
- export class WinserviceBuilder extends BaseBuilder {
4
- constructor(config: BuilderConfig) {
5
- super(config);
6
- }
7
-
8
- run() {
9
- console.log("BUILD WINSERVICE");
10
- }
11
- }
@@ -1,41 +0,0 @@
1
- import * as path from "path";
2
-
3
- import { Utils } from "./utils";
4
-
5
- export class DotnetUtils {
6
- static createTempSln(slnFilePath: string, slnFileName: string): void {
7
- Utils.deleteFiles(slnFilePath, [slnFileName + ".sln"]);
8
- Utils.exec(`dotnet new sln -n ${slnFileName} -o ${slnFilePath}`);
9
- }
10
-
11
- static restoreNugetPackages(projectPath: string): void {
12
- Utils.exec(`dotnet restore ${projectPath} -nologo -v q`);
13
- }
14
-
15
- static publish(projectPath: string, configuration: string, outputPath: string = null): void {
16
- let command = `dotnet publish ${projectPath} --no-restore -c ${configuration} -nologo -v q`;
17
- if (outputPath)
18
- command += ` -o ${outputPath}`;
19
- Utils.exec(
20
- command,
21
- {
22
- silent: false
23
- }
24
- );
25
- }
26
-
27
- static addProjectsToSln(slnFilePath: string, projects: Array<string>, dropSlnOnFail?: boolean): void {
28
- let projectFilesString = "";
29
- projects.forEach(pf => {
30
- projectFilesString += `"${pf}" `;
31
- });
32
- projectFilesString = projectFilesString.trim();
33
- Utils.exec(`dotnet sln "${slnFilePath}" add ${projectFilesString}`, {
34
- onProcessExit: dropSlnOnFail ? () => this.dropSln(slnFilePath) : null
35
- });
36
- }
37
-
38
- private static dropSln(slnFilePath: string): void {
39
- Utils.deleteFiles(path.dirname(slnFilePath), [path.basename(slnFilePath)]);
40
- }
41
- }
@@ -1,7 +0,0 @@
1
- export default class BuilderException {
2
- message: string;
3
-
4
- constructor(message: string) {
5
- this.message = message;
6
- }
7
- }
package/src/index.ts DELETED
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Utils } from "./utils";
4
- import * as child_process from "child_process";
5
- import * as path from "path";
6
-
7
- function isLegacyProviderNeeded() {
8
- const nodeJsMajorVersion = parseInt(process.versions.node.split(".")[0]);
9
- return nodeJsMajorVersion > 16;
10
- }
11
-
12
- function getCliArgs() {
13
- return process.argv.slice(2);
14
- }
15
-
16
- function envWithLagacyProvider(): NodeJS.ProcessEnv {
17
- return {
18
- ...process.env,
19
- NODE_OPTIONS: "--openssl-legacy-provider"
20
- };
21
- }
22
-
23
- function run() {
24
- const options: child_process.ForkOptions = {
25
- stdio: "inherit",
26
- cwd: process.cwd()
27
- };
28
- if (isLegacyProviderNeeded()) options.env = envWithLagacyProvider();
29
- const pathToApp = path.resolve(__dirname, "app");
30
-
31
- Utils.execModule(pathToApp, getCliArgs(), options);
32
- }
33
-
34
- run();