arui-scripts 13.5.0-feat-NEWCLICKUI-1746.1 → 14.0.0

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 (56) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +13 -5
  3. package/build/commands/archive-build/index.js +3 -3
  4. package/build/commands/build/build-wrapper.d.ts +1 -1
  5. package/build/commands/build/build-wrapper.js +2 -2
  6. package/build/commands/build/client.js +4 -4
  7. package/build/commands/build/index.js +3 -3
  8. package/build/commands/build/server.js +2 -2
  9. package/build/commands/bundle-analyze/index.js +2 -2
  10. package/build/commands/changelog/index.d.ts +1 -22
  11. package/build/commands/changelog/index.js +57 -46
  12. package/build/commands/docker-build/index.js +7 -7
  13. package/build/commands/docker-build-compiled/index.js +5 -5
  14. package/build/commands/start/client.js +3 -3
  15. package/build/commands/start/index.js +3 -3
  16. package/build/commands/start/server.js +2 -2
  17. package/build/commands/util/client-assets-sizes.d.ts +3 -3
  18. package/build/commands/util/client-assets-sizes.js +9 -9
  19. package/build/commands/util/docker-build.d.ts +1 -1
  20. package/build/commands/util/yarn.d.ts +1 -1
  21. package/build/configs/app-configs/available-package-settings.d.ts +2 -2
  22. package/build/configs/app-configs/calculate-dependent-config.js +3 -3
  23. package/build/configs/app-configs/get-defaults.js +9 -1
  24. package/build/configs/app-configs/index.js +6 -6
  25. package/build/configs/app-configs/types.d.ts +7 -1
  26. package/build/configs/app-configs/update-with-config-file.js +3 -3
  27. package/build/configs/app-configs/update-with-env.js +2 -2
  28. package/build/configs/app-configs/update-with-package.js +2 -2
  29. package/build/configs/app-configs/update-with-presets.js +4 -4
  30. package/build/configs/babel-client.js +1 -1
  31. package/build/configs/babel-dependencies.js +1 -1
  32. package/build/configs/babel-server.js +1 -1
  33. package/build/configs/dev-server.js +1 -1
  34. package/build/configs/jest/babel-transform.d.ts +1 -6
  35. package/build/configs/jest/file-transform.d.ts +3 -2
  36. package/build/configs/jest/file-transform.js +1 -1
  37. package/build/configs/jest/index.d.ts +8 -8
  38. package/build/configs/jest/index.js +1 -1
  39. package/build/configs/postcss.config.d.ts +1 -1
  40. package/build/configs/postcss.js +1 -1
  41. package/build/configs/server-externals-exemptions.d.ts +1 -0
  42. package/build/configs/server-externals-exemptions.js +20 -0
  43. package/build/configs/stats-options.js +1 -1
  44. package/build/configs/supporting-browsers.js +1 -1
  45. package/build/configs/util/apply-overrides.d.ts +4 -3
  46. package/build/configs/webpack.client.dev.js +7 -2
  47. package/build/configs/webpack.client.prod.js +5 -3
  48. package/build/configs/webpack.server.dev.js +5 -14
  49. package/build/configs/webpack.server.prod.js +5 -14
  50. package/build/index.js +1 -0
  51. package/build/templates/dockerfile-compiled.template.js +3 -3
  52. package/build/templates/dockerfile.template.js +1 -1
  53. package/build/templates/nginx.conf.template.js +1 -1
  54. package/build/templates/start.template.js +1 -1
  55. package/build/tsconfig-local.tsbuildinfo +1 -8829
  56. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ # [14.0.0](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.5.0...v14.0.0) (2023-03-02)
2
+
3
+
4
+ ### Features
5
+
6
+ * update jest to 28 ([14d1af7](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/14d1af7c4502e20adaf200716f6ed941784643ef))
7
+ * update minimal ts version to 4.3 ([ce4910a](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/ce4910afb2efc0cc351e73a07a286afe58f621fd))
8
+
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ * minimal supported version of ts it now 4.3
13
+ * now we use jest@28
14
+
15
+ For complete list of breaking changes see https://jestjs.io/docs/28.x/upgrading-to-jest28
16
+
17
+ # [13.5.0](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.4.0...v13.5.0) (2023-03-02)
18
+
19
+
20
+ ### Features
21
+
22
+ * added a new command "changelog" ([95d5a34](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/95d5a34558322108a7f8afab7608491291f4d4aa))
23
+ * refactor changelog script ([a4b0f34](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/a4b0f3444fdc2e2593105488059357eaa717d5db))
24
+ * refactor changelog script ([ae54ce8](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/ae54ce877dea6ec5b3840e6fa366c7ead15bf1bf))
25
+ * **webpack-server:** add serverExternalsExemptions override ([8cb8479](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/8cb847914632e806725c84d73678bdc88c17534e))
26
+
27
+ # [13.5.0](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.4.0...v13.5.0) (2023-03-01)
28
+
29
+
30
+ ### Features
31
+
32
+ * added a new command "changelog" ([95d5a34](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/95d5a34558322108a7f8afab7608491291f4d4aa))
33
+ * refactor changelog script ([a4b0f34](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/a4b0f3444fdc2e2593105488059357eaa717d5db))
34
+ * refactor changelog script ([ae54ce8](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/ae54ce877dea6ec5b3840e6fa366c7ead15bf1bf))
35
+ * **webpack-server:** add serverExternalsExemptions override ([8cb8479](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/8cb847914632e806725c84d73678bdc88c17534e))
36
+
1
37
  # [13.5.0-feat-NEWCLICKUI-1746.1](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.4.0...v13.5.0-feat-NEWCLICKUI-1746.1) (2023-02-28)
2
38
 
3
39
 
package/README.md CHANGED
@@ -46,6 +46,7 @@ npm install arui-scripts --save-dev
46
46
  - `arui-scripts test` - запускает jest тесты.
47
47
  - `arui-scripts archive-build` - собирает архив с production билдом
48
48
  - `arui-scripts bundle-analyze` - запускает [webpack-bundle-analyzer](https://www.npmjs.com/package/webpack-bundle-analyzer) для prod версии клиентского кода
49
+ - `arui-scripts changelog` - запускает скрипт changelog через standard-version, который добавляет новое описание в `CHANGELOG.MD`, которое указали при сборке нового билда в Jenkins
49
50
 
50
51
 
51
52
  Настройки
@@ -455,16 +456,22 @@ docker run my-awesome-app --env SERVICE_NAME=my-app
455
456
  }
456
457
  ```
457
458
 
459
+ <a name="node-externals"></a>
460
+
458
461
  require не js файлов в node_modules в node.js
459
462
  ---
460
- Сборка серверной части устроена таким образом, что большая часть `node_modules` не вкомпиливается
461
- в итоговый бандл, а загружается стандартным `require` node.js. Как правило - это нам и нужно.
463
+ Сборка серверной части устроена таким образом, что большая часть `node_modules` не попадает в сборку (в файл `.build/server.js`),
464
+ а загружается стандартным `require` node.js.
465
+ Основной мотивацией для это являются многие старые пакеты, которые делают "странные" вещи с require - например, пытаются
466
+ подключать файлы динамически, используют `require.extensions` и т.д. Это может приводить к ошибкам сборки или даже к
467
+ ошибкам во время выполнения.
468
+
462
469
  Но в случае react-компонентов, мы зачастую запрашиваем кроме кода компонентов еще и `.css`, `.png` и другие файлы.
463
- require node.js на таких местах ломается. Поэтому наши внутренние библиотеки компонентов все же вкомпиливаются
464
- в итоговый бандл сервера. Это сделанно с помощью [добавления их в исключение](src/configs/webpack.server.dev.ts#L59)
470
+ `require` из node.js на таких местах ломается. Поэтому наши внутренние библиотеки компонентов все же должны попадать в
471
+ собранный файл `.build/server.js`. Всё это сделано с помощью [добавления их в исключение](src/configs/webpack.server.dev.ts#L59)
465
472
  плагина [webpack-node-externals](https://www.npmjs.com/package/webpack-node-externals).
466
473
  В случае, если вам необходима обработка не-js файлов из других внешних модулей - вы можете
467
- воспользоваться механизмом `overrides`, описанным ниже.
474
+ воспользоваться механизмом `overrides`, и ключом `serverExternalsExemptions`.
468
475
  По умолчанию же все не-js файлы из внешних модулей будут проигнорированы.
469
476
 
470
477
  Кеширование билда
@@ -593,6 +600,7 @@ export default overrides;
593
600
  Базовый шаблон [тут](./src/templates/nginx.conf.template.ts).
594
601
  [Файл `nginx.conf`](#конфигурация-nginx) в корне имеет приоритет над оверрайдами.
595
602
  - `start.sh` - шаблон entrypoint докер контейнера. Базовый шаблон [тут](./src/templates/start.template.ts).
603
+ - `serverExternalsExemptions` - список модулей, которые не будут добавлены в список внешних зависимостей сервера. [Подробнее](#node-externals).
596
604
 
597
605
  Для некоторых конфигураций определены несколько ключей, они будут применяться в том порядке, в котором они приведены в этом файле.
598
606
 
@@ -46,11 +46,11 @@ const packageJsonPath = path_1.default.join(app_configs_1.default.cwd, packageJs
46
46
  console.timeEnd('Setting up time');
47
47
  console.time('Build application time');
48
48
  // run build script
49
- yield exec_1.default('npm run build');
49
+ yield (0, exec_1.default)('npm run build');
50
50
  console.timeEnd('Build application time');
51
51
  console.time('Remove build dependencies time');
52
- const pruneCommand = yarn_1.getPruningCommand();
53
- yield exec_1.default(pruneCommand);
52
+ const pruneCommand = (0, yarn_1.getPruningCommand)();
53
+ yield (0, exec_1.default)(pruneCommand);
54
54
  console.timeEnd('Remove build dependencies time');
55
55
  console.time('Archive build time');
56
56
  yield Promise.all([
@@ -1,5 +1,5 @@
1
1
  import webpack from 'webpack';
2
- declare type BuildResult = {
2
+ type BuildResult = {
3
3
  stats: webpack.Stats;
4
4
  warnings: string[];
5
5
  previousFileSizes: unknown;
@@ -9,13 +9,13 @@ const chalk_1 = __importDefault(require("chalk"));
9
9
  const webpack_1 = __importDefault(require("webpack"));
10
10
  const format_webpack_messages_1 = __importDefault(require("../util/format-webpack-messages"));
11
11
  function build(config, previousFileSizes) {
12
- let compiler = webpack_1.default(config);
12
+ let compiler = (0, webpack_1.default)(config);
13
13
  return new Promise((resolve, reject) => {
14
14
  compiler.run((err, stats) => {
15
15
  if (err) {
16
16
  return reject(err);
17
17
  }
18
- const messages = format_webpack_messages_1.default(stats === null || stats === void 0 ? void 0 : stats.toJson({}));
18
+ const messages = (0, format_webpack_messages_1.default)(stats === null || stats === void 0 ? void 0 : stats.toJson({}));
19
19
  if (messages.errors.length) {
20
20
  // Only keep the first error. Others are often indicative
21
21
  // of the same problem, but confuse the reader with noise.
@@ -11,7 +11,7 @@ const build_wrapper_1 = __importDefault(require("./build-wrapper"));
11
11
  const client_assets_sizes_1 = require("../util/client-assets-sizes");
12
12
  const webpack_client_prod_1 = __importDefault(require("../../configs/webpack.client.prod"));
13
13
  console.log(chalk_1.default.magenta('Building client...'));
14
- build_wrapper_1.default(webpack_client_prod_1.default)
14
+ (0, build_wrapper_1.default)(webpack_client_prod_1.default)
15
15
  .then(({ stats, warnings }) => {
16
16
  if (warnings.length) {
17
17
  console.log(chalk_1.default.yellow('Client compiled with warnings.\n'));
@@ -24,8 +24,8 @@ build_wrapper_1.default(webpack_client_prod_1.default)
24
24
  }
25
25
  function printOutputSizes(webpackConfig) {
26
26
  var _a;
27
- const sizes = client_assets_sizes_1.calculateAssetsSizes(stats, (_a = webpackConfig === null || webpackConfig === void 0 ? void 0 : webpackConfig.output) === null || _a === void 0 ? void 0 : _a.path);
28
- client_assets_sizes_1.printAssetsSizes(sizes);
27
+ const sizes = (0, client_assets_sizes_1.calculateAssetsSizes)(stats, (_a = webpackConfig === null || webpackConfig === void 0 ? void 0 : webpackConfig.output) === null || _a === void 0 ? void 0 : _a.path);
28
+ (0, client_assets_sizes_1.printAssetsSizes)(sizes);
29
29
  }
30
30
  if (Array.isArray(webpack_client_prod_1.default)) {
31
31
  webpack_client_prod_1.default.forEach(printOutputSizes);
@@ -36,6 +36,6 @@ build_wrapper_1.default(webpack_client_prod_1.default)
36
36
  })
37
37
  .catch((err) => {
38
38
  console.log(chalk_1.default.red('Failed to compile client.\n'));
39
- printBuildError_1.default(err);
39
+ (0, printBuildError_1.default)(err);
40
40
  process.exit(1);
41
41
  });
@@ -14,14 +14,14 @@ const app_configs_1 = __importDefault(require("../../configs/app-configs"));
14
14
  process.env.BABEL_ENV = 'production';
15
15
  process.env.NODE_ENV = 'production';
16
16
  process.env.BROWSERSLIST_CONFIG = process.env.BROWSERSLIST_CONFIG || require.resolve('../../../.browserslistrc');
17
- if (!check_required_files_1.default()) {
17
+ if (!(0, check_required_files_1.default)()) {
18
18
  process.exit(1);
19
19
  }
20
20
  if (fs_extra_1.default.pathExistsSync(app_configs_1.default.serverOutputPath)) {
21
21
  fs_extra_1.default.removeSync(app_configs_1.default.serverOutputPath);
22
22
  }
23
- const compileServer = child_process_1.spawn('node', [path_1.default.join(__dirname, './server')], { stdio: 'inherit' });
24
- const compileClient = child_process_1.spawn('node', [path_1.default.join(__dirname, './client')], { stdio: 'inherit' });
23
+ const compileServer = (0, child_process_1.spawn)('node', [path_1.default.join(__dirname, './server')], { stdio: 'inherit' });
24
+ const compileClient = (0, child_process_1.spawn)('node', [path_1.default.join(__dirname, './client')], { stdio: 'inherit' });
25
25
  const onProcessExit = (code) => {
26
26
  if (code !== 0) {
27
27
  compileServer.kill();
@@ -10,7 +10,7 @@ const printBuildError_1 = __importDefault(require("react-dev-utils/printBuildErr
10
10
  const build_wrapper_1 = __importDefault(require("./build-wrapper"));
11
11
  const webpack_server_prod_1 = __importDefault(require("../../configs/webpack.server.prod"));
12
12
  console.log(chalk_1.default.magenta('Building server...'));
13
- build_wrapper_1.default(webpack_server_prod_1.default)
13
+ (0, build_wrapper_1.default)(webpack_server_prod_1.default)
14
14
  .then(({ warnings }) => {
15
15
  if (warnings.length) {
16
16
  console.log(chalk_1.default.yellow('Server compiled with warnings.\n'));
@@ -24,6 +24,6 @@ build_wrapper_1.default(webpack_server_prod_1.default)
24
24
  })
25
25
  .catch((err) => {
26
26
  console.log(chalk_1.default.red('Failed to compile server.\n'));
27
- printBuildError_1.default(err);
27
+ (0, printBuildError_1.default)(err);
28
28
  process.exit(1);
29
29
  });
@@ -19,7 +19,7 @@ const webpack_client_prod_1 = __importDefault(require("../../configs/webpack.cli
19
19
  const app_configs_1 = __importDefault(require("../../configs/app-configs"));
20
20
  (() => __awaiter(void 0, void 0, void 0, function* () {
21
21
  var _a;
22
- const tmpDir = yield make_tmp_dir_1.default();
22
+ const tmpDir = yield (0, make_tmp_dir_1.default)();
23
23
  const plugin = new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
24
24
  generateStatsFile: true,
25
25
  statsFilename: app_configs_1.default.statsOutputPath,
@@ -31,5 +31,5 @@ const app_configs_1 = __importDefault(require("../../configs/app-configs"));
31
31
  }
32
32
  (_a = clientWebpackConfig.plugins) === null || _a === void 0 ? void 0 : _a.push(plugin);
33
33
  clientWebpackConfig.output.path = tmpDir;
34
- webpack_1.default(clientWebpackConfig).run(() => { });
34
+ (0, webpack_1.default)(clientWebpackConfig).run(() => { });
35
35
  }))();
@@ -2,25 +2,4 @@
2
2
  * Формирует описание версии в `CHANGELOG.md` на основе данных введенных в Jenkins при старте пайплайна.
3
3
  * `standard-version` запускает этот скрипт как `postchangelog` хук.
4
4
  */
5
- declare const execSync: any;
6
- declare const createReadStream: any, createWriteStream: any, readFile: any, rename: any, unlink: any;
7
- declare const resolve: any;
8
- declare const readline: any;
9
- declare const nodeModulesBinPath: any;
10
- declare const changelogPath: any;
11
- declare const changelogTmpPath: any;
12
- /**
13
- * Сюда пайплайн Jenkins складывает соответствующие части описания версии. Не получается использовать
14
- * переменные окружения, т.к. `standard-version` запускает хуки через `child_process.exec`, не передавая туда
15
- * ни аргументы ни переменные окружения.
16
- */
17
- declare const changelogFeaturesPath: any;
18
- declare const changelogBugfixesPath: any;
19
- declare const changelogBreakingChangesPath: any;
20
- declare const changelogHeaderRegExp: RegExp;
21
- declare type getVersionDescriptionParams = {
22
- features: string;
23
- bugFixes: string;
24
- breakingChanges: string;
25
- };
26
- declare function getVersionDescription({ features, bugFixes, breakingChanges }: getVersionDescriptionParams): string;
5
+ export {};
@@ -19,75 +19,86 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
19
19
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
20
20
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
21
21
  };
22
- /* eslint-disable @typescript-eslint/no-var-requires */
23
- const { execSync } = require('child_process');
24
- const { createReadStream, createWriteStream, promises: { readFile, rename, unlink }, } = require('fs');
25
- const { resolve } = require('path');
26
- const readline = require('readline');
27
- const nodeModulesBinPath = resolve(__dirname, './node_modules/.bin');
28
- const changelogPath = resolve(__dirname, './CHANGELOG.md');
29
- const changelogTmpPath = resolve(__dirname, './CHANGELOG_TMP.md');
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const child_process_1 = require("child_process");
27
+ const fs_1 = require("fs");
28
+ const readline_1 = __importDefault(require("readline"));
29
+ const get_defaults_1 = require("../../configs/app-configs/get-defaults");
30
+ const { readFile, rename, unlink } = fs_1.promises;
30
31
  /**
31
32
  * Сюда пайплайн Jenkins складывает соответствующие части описания версии. Не получается использовать
32
33
  * переменные окружения, т.к. `standard-version` запускает хуки через `child_process.exec`, не передавая туда
33
34
  * ни аргументы ни переменные окружения.
34
35
  */
35
- const changelogFeaturesPath = resolve(__dirname, './changelog_features.tmp');
36
- const changelogBugfixesPath = resolve(__dirname, './changelog_bugfixes.tmp');
37
- const changelogBreakingChangesPath = resolve(__dirname, './changelog_breaking_changes.tmp');
36
+ const { appNodeModulesBin, changelogPath, changelogTmpPath, changelogFeaturesPath, changelogBugfixesPath, changelogBreakingChangesPath } = (0, get_defaults_1.getDefaults)();
38
37
  // Пример заголовка – `## [50.1.0](http://git.moscow.alfaintra.net/...) (2022-07-27)`.
39
38
  const changelogHeaderRegExp = /^###? \[\d+\.\d+\.\d+]\([^)]+\) \(\d{4}-\d{2}-\d{2}\)/;
40
39
  (() => __awaiter(void 0, void 0, void 0, function* () {
41
- var e_1, _a;
42
- const rl = readline.createInterface({
43
- input: createReadStream(changelogPath),
40
+ var _a, e_1, _b, _c;
41
+ const rl = readline_1.default.createInterface({
42
+ input: (0, fs_1.createReadStream)(changelogPath),
43
+ });
44
+ const ws = (0, fs_1.createWriteStream)(changelogTmpPath);
45
+ let modifyingStatus = 'PENDING';
46
+ const addVersionDescription = () => __awaiter(void 0, void 0, void 0, function* () {
47
+ const [features, bugFixes, breakingChanges] = yield Promise.all([
48
+ readFile(changelogFeaturesPath, 'utf-8'),
49
+ readFile(changelogBugfixesPath, 'utf-8'),
50
+ readFile(changelogBreakingChangesPath, 'utf-8'),
51
+ ]).then((files) => files.map((content) => content.trim()));
52
+ ws.write(getVersionDescription({ features, bugFixes, breakingChanges }));
44
53
  });
45
- const ws = createWriteStream(changelogTmpPath);
46
- let modifyingStatus = 'PENDING'; // 'PENDING' | 'MODIFYING' | 'MODIFIED'
47
54
  try {
48
- // eslint-disable-next-line no-restricted-syntax
49
- for (var rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(), !rl_1_1.done;) {
50
- const line = rl_1_1.value;
51
- switch (modifyingStatus) {
52
- // Копируем всё как есть до первого заголовка.
53
- case 'PENDING':
54
- if (changelogHeaderRegExp.test(line)) {
55
- modifyingStatus = 'MODIFYING';
56
- }
57
- ws.write(`${line}\n`);
58
- break;
59
- // Игнорируем описание версии, сгенерированное пакетом `standard-version`, пишем своё
60
- // до второго заголовка. См. описание задачи http://jira.moscow.alfaintra.net/browse/NEWCLICKUI-1048
61
- case 'MODIFYING':
62
- if (changelogHeaderRegExp.test(line)) {
63
- modifyingStatus = 'MODIFIED';
64
- const [features, bugFixes, breakingChanges] = yield Promise.all([
65
- readFile(changelogFeaturesPath, 'utf-8'),
66
- readFile(changelogBugfixesPath, 'utf-8'),
67
- readFile(changelogBreakingChangesPath, 'utf-8'),
68
- ]).then((files) => files.map((content) => content.trim()));
69
- ws.write(getVersionDescription({ features, bugFixes, breakingChanges }));
55
+ for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(), _a = rl_1_1.done, !_a;) {
56
+ _c = rl_1_1.value;
57
+ _d = false;
58
+ try {
59
+ const line = _c;
60
+ switch (modifyingStatus) {
61
+ // Копируем всё как есть до первого заголовка.
62
+ case 'PENDING':
63
+ if (changelogHeaderRegExp.test(line)) {
64
+ modifyingStatus = 'MODIFYING';
65
+ }
66
+ ws.write(`${line}\n`);
67
+ break;
68
+ // Игнорируем описание версии, сгенерированное пакетом `standard-version`, пишем своё
69
+ // до второго заголовка. См. описание задачи http://jira.moscow.alfaintra.net/browse/NEWCLICKUI-1048
70
+ case 'MODIFYING':
71
+ if (changelogHeaderRegExp.test(line)) {
72
+ modifyingStatus = 'MODIFIED';
73
+ yield addVersionDescription();
74
+ ws.write(`${line}\n`);
75
+ }
76
+ break;
77
+ // Дальше просто копируем всё как есть.
78
+ case 'MODIFIED':
70
79
  ws.write(`${line}\n`);
71
- }
72
- break;
73
- // Дальше просто копируем всё как есть.
74
- case 'MODIFIED':
75
- ws.write(`${line}\n`);
76
- break;
80
+ break;
81
+ }
82
+ }
83
+ finally {
84
+ _d = true;
77
85
  }
78
86
  }
79
87
  }
80
88
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
81
89
  finally {
82
90
  try {
83
- if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield _a.call(rl_1);
91
+ if (!_d && !_a && (_b = rl_1.return)) yield _b.call(rl_1);
84
92
  }
85
93
  finally { if (e_1) throw e_1.error; }
86
94
  }
95
+ if (modifyingStatus !== 'MODIFIED') {
96
+ yield addVersionDescription();
97
+ }
87
98
  ws.close();
88
- execSync(`${nodeModulesBinPath}/prettier -w "${changelogTmpPath}"`);
89
99
  yield unlink(changelogPath);
90
100
  yield rename(changelogTmpPath, changelogPath);
101
+ (0, child_process_1.execSync)(`${appNodeModulesBin}/prettier -w "${changelogPath}"`);
91
102
  process.exit(0);
92
103
  }))();
93
104
  function getVersionDescription({ features, bugFixes, breakingChanges }) {
@@ -21,12 +21,12 @@ const exec_1 = __importDefault(require("../util/exec"));
21
21
  const docker_build_1 = require("../util/docker-build");
22
22
  const yarn_1 = require("../util/yarn");
23
23
  (() => __awaiter(void 0, void 0, void 0, function* () {
24
- const { imageFullName, pathToTempDir, tempDirName } = docker_build_1.getBuildParamsFromArgs();
24
+ const { imageFullName, pathToTempDir, tempDirName } = (0, docker_build_1.getBuildParamsFromArgs)();
25
25
  try {
26
26
  console.log(`Build docker image ${imageFullName}`);
27
27
  console.time('Total time');
28
28
  console.time('Setting up time');
29
- yield docker_build_1.prepareFilesForDocker({
29
+ yield (0, docker_build_1.prepareFilesForDocker)({
30
30
  pathToTempDir,
31
31
  dockerfileTemplate: dockerfile_template_1.default,
32
32
  nginxConfTemplate: nginx_conf_template_1.default,
@@ -37,16 +37,16 @@ const yarn_1 = require("../util/yarn");
37
37
  console.timeEnd('Setting up time');
38
38
  console.time('Build application time');
39
39
  // run build script
40
- yield exec_1.default('npm run build');
40
+ yield (0, exec_1.default)('npm run build');
41
41
  console.timeEnd('Build application time');
42
42
  if (app_configs_1.default.removeDevDependenciesDuringDockerBuild) {
43
43
  console.time('Remove dev dependencies time');
44
- const pruneCommand = yarn_1.getPruningCommand();
45
- yield exec_1.default(pruneCommand);
44
+ const pruneCommand = (0, yarn_1.getPruningCommand)();
45
+ yield (0, exec_1.default)(pruneCommand);
46
46
  console.timeEnd('Remove dev dependencies time');
47
47
  }
48
48
  console.time('Build docker image time');
49
- yield exec_1.default(`docker build -f "./${tempDirName}/Dockerfile" \\
49
+ yield (0, exec_1.default)(`docker build -f "./${tempDirName}/Dockerfile" \\
50
50
  --build-arg START_SH_LOCATION="./${tempDirName}/start.sh" \\
51
51
  --build-arg NGINX_CONF_LOCATION="./${tempDirName}/nginx.conf" -t ${imageFullName} .`);
52
52
  console.timeEnd('Build docker image time');
@@ -55,7 +55,7 @@ const yarn_1 = require("../util/yarn");
55
55
  yield fs_extra_1.default.remove(pathToTempDir);
56
56
  // guard against pushing the image during tests
57
57
  if (!app_configs_1.default.debug) {
58
- yield exec_1.default(`docker push ${imageFullName}`);
58
+ yield (0, exec_1.default)(`docker push ${imageFullName}`);
59
59
  }
60
60
  console.timeEnd('Cleanup time');
61
61
  console.timeEnd('Total time');
@@ -20,25 +20,25 @@ const start_template_1 = __importDefault(require("../../templates/start.template
20
20
  const exec_1 = __importDefault(require("../util/exec"));
21
21
  const docker_build_1 = require("../util/docker-build");
22
22
  (() => __awaiter(void 0, void 0, void 0, function* () {
23
- const { imageFullName, pathToTempDir, tempDirName } = docker_build_1.getBuildParamsFromArgs();
23
+ const { imageFullName, pathToTempDir, tempDirName } = (0, docker_build_1.getBuildParamsFromArgs)();
24
24
  try {
25
25
  console.log(`Build docker image ${imageFullName}`);
26
26
  console.time('Total time');
27
- yield docker_build_1.prepareFilesForDocker({
27
+ yield (0, docker_build_1.prepareFilesForDocker)({
28
28
  pathToTempDir,
29
29
  dockerfileTemplate: dockerfile_compiled_template_1.default,
30
30
  nginxConfTemplate: nginx_conf_template_1.default,
31
31
  startScript: start_template_1.default,
32
32
  allowLocalDockerfile: false,
33
33
  });
34
- yield exec_1.default('echo "node_modules" >> .dockerignore');
35
- yield exec_1.default(`docker build -f "./${tempDirName}/Dockerfile" \\
34
+ yield (0, exec_1.default)('echo "node_modules" >> .dockerignore');
35
+ yield (0, exec_1.default)(`docker build -f "./${tempDirName}/Dockerfile" \\
36
36
  --build-arg START_SH_LOCATION="./${tempDirName}/start.sh" \\
37
37
  --build-arg NGINX_CONF_LOCATION="./${tempDirName}/nginx.conf" -t ${imageFullName} .`);
38
38
  yield fs_extra_1.default.remove(pathToTempDir);
39
39
  // guard against pushing the image during tests
40
40
  if (!app_configs_1.default.debug) {
41
- yield exec_1.default(`docker push ${imageFullName}`);
41
+ yield (0, exec_1.default)(`docker push ${imageFullName}`);
42
42
  }
43
43
  console.timeEnd('Total time');
44
44
  }
@@ -9,16 +9,16 @@ const WebpackDevServerUtils_1 = require("react-dev-utils/WebpackDevServerUtils")
9
9
  const print_compiler_output_1 = __importDefault(require("./print-compiler-output"));
10
10
  const webpack_client_dev_1 = __importDefault(require("../../configs/webpack.client.dev"));
11
11
  const dev_server_1 = __importDefault(require("../../configs/dev-server"));
12
- const clientCompiler = webpack_1.default(webpack_client_dev_1.default);
12
+ const clientCompiler = (0, webpack_1.default)(webpack_client_dev_1.default);
13
13
  // не резолвиться constructor(config: WebpackDevServer.Configuration, webpack?: webpack.Compiler | webpack.MultiCompiler);
14
14
  // clientCompiler: webpack.Compiler
15
15
  // @ts-ignore
16
16
  const clientDevServer = new webpack_dev_server_1.default(dev_server_1.default, clientCompiler);
17
17
  clientCompiler.hooks.invalid.tap('client', () => console.log('Compiling client...'));
18
- clientCompiler.hooks.done.tap('client', (stats) => print_compiler_output_1.default('Client', stats));
18
+ clientCompiler.hooks.done.tap('client', (stats) => (0, print_compiler_output_1.default)('Client', stats));
19
19
  const DEFAULT_PORT = dev_server_1.default.port;
20
20
  const HOST = '0.0.0.0';
21
- WebpackDevServerUtils_1.choosePort(HOST, +(DEFAULT_PORT || 0))
21
+ (0, WebpackDevServerUtils_1.choosePort)(HOST, +(DEFAULT_PORT || 0))
22
22
  .then((port) => {
23
23
  if (!port) {
24
24
  // We have not found a port.
@@ -9,14 +9,14 @@ const path_1 = __importDefault(require("path"));
9
9
  const check_required_files_1 = __importDefault(require("../util/check-required-files"));
10
10
  const app_configs_1 = __importDefault(require("../../configs/app-configs"));
11
11
  process.env.BROWSERSLIST_CONFIG = process.env.BROWSERSLIST_CONFIG || require.resolve('../../../.browserslistrc');
12
- if (!check_required_files_1.default()) {
12
+ if (!(0, check_required_files_1.default)()) {
13
13
  process.exit(1);
14
14
  }
15
15
  if (fs_extra_1.default.pathExistsSync(app_configs_1.default.serverOutputPath)) {
16
16
  fs_extra_1.default.removeSync(app_configs_1.default.serverOutputPath);
17
17
  }
18
- const compileServer = child_process_1.spawn('node', [path_1.default.join(__dirname, './server')], { stdio: 'inherit' });
19
- const compileClient = child_process_1.spawn('node', [path_1.default.join(__dirname, './client')], { stdio: 'inherit' });
18
+ const compileServer = (0, child_process_1.spawn)('node', [path_1.default.join(__dirname, './server')], { stdio: 'inherit' });
19
+ const compileClient = (0, child_process_1.spawn)('node', [path_1.default.join(__dirname, './client')], { stdio: 'inherit' });
20
20
  const onProcessExit = (code) => {
21
21
  if (code !== 0) {
22
22
  compileServer.kill();
@@ -7,10 +7,10 @@ const webpack_1 = __importDefault(require("webpack"));
7
7
  const print_compiler_output_1 = __importDefault(require("./print-compiler-output"));
8
8
  const webpack_server_dev_1 = __importDefault(require("../../configs/webpack.server.dev"));
9
9
  const app_configs_1 = __importDefault(require("../../configs/app-configs"));
10
- const serverCompiler = webpack_1.default(webpack_server_dev_1.default);
10
+ const serverCompiler = (0, webpack_1.default)(webpack_server_dev_1.default);
11
11
  serverCompiler.hooks.compile.tap('server', () => console.log('Compiling server...'));
12
12
  serverCompiler.hooks.invalid.tap('server', () => console.log('Compiling server...'));
13
- serverCompiler.hooks.done.tap('server', (stats) => print_compiler_output_1.default('Server', stats));
13
+ serverCompiler.hooks.done.tap('server', (stats) => (0, print_compiler_output_1.default)('Server', stats));
14
14
  serverCompiler.watch({
15
15
  aggregateTimeout: 50,
16
16
  ignored: new RegExp(app_configs_1.default.watchIgnorePath.join('|')),
@@ -1,5 +1,5 @@
1
1
  import { Stats } from 'webpack';
2
- declare type AssetSize = {
2
+ type AssetSize = {
3
3
  name: string;
4
4
  fullName: string;
5
5
  gzipSize: number;
@@ -9,7 +9,7 @@ declare type AssetSize = {
9
9
  gzipLabel: string;
10
10
  brotliLabel: string;
11
11
  };
12
- declare type TotalSizes = {
12
+ type TotalSizes = {
13
13
  size: number;
14
14
  sizeLabel: string;
15
15
  gzipSize: number;
@@ -17,7 +17,7 @@ declare type TotalSizes = {
17
17
  brotliSize: number;
18
18
  brotliLabel: string;
19
19
  };
20
- declare type ClientAssetsSizes = {
20
+ type ClientAssetsSizes = {
21
21
  totalSizes: TotalSizes;
22
22
  assets: AssetSize[];
23
23
  };
@@ -34,7 +34,7 @@ function calculateAssetsSizes(webpackStats, rootDir = '') {
34
34
  .filter((asset) => canReadAsset(asset.name))
35
35
  .map((asset) => {
36
36
  const fileContents = fs_1.default.readFileSync(path_1.default.join(rootDir, asset.name));
37
- const size = gzip_size_1.sync(fileContents);
37
+ const size = (0, gzip_size_1.sync)(fileContents);
38
38
  const brSize = brotliSize(fileContents);
39
39
  const filename = path_1.default.basename(asset.name);
40
40
  return {
@@ -43,9 +43,9 @@ function calculateAssetsSizes(webpackStats, rootDir = '') {
43
43
  gzipSize: size,
44
44
  brotliSize: brSize,
45
45
  size: asset.size,
46
- sizeLabel: filesize_1.default(asset.size),
47
- gzipLabel: filesize_1.default(size),
48
- brotliLabel: brSize ? filesize_1.default(brSize) : '-'
46
+ sizeLabel: (0, filesize_1.default)(asset.size),
47
+ gzipLabel: (0, filesize_1.default)(size),
48
+ brotliLabel: brSize ? (0, filesize_1.default)(brSize) : '-'
49
49
  };
50
50
  });
51
51
  const totalSizes = (assets || []).reduce((file, total) => {
@@ -55,9 +55,9 @@ function calculateAssetsSizes(webpackStats, rootDir = '') {
55
55
  brotliSize: total.brotliSize + file.brotliSize
56
56
  };
57
57
  }, { size: 0, gzipSize: 0, brotliSize: 0 });
58
- totalSizes.sizeLabel = filesize_1.default(totalSizes.size || 0);
59
- totalSizes.gzipLabel = filesize_1.default(totalSizes.gzipSize || 0);
60
- totalSizes.brotliLabel = totalSizes.brotliSize ? filesize_1.default(totalSizes.brotliSize) : '-';
58
+ totalSizes.sizeLabel = (0, filesize_1.default)(totalSizes.size || 0);
59
+ totalSizes.gzipLabel = (0, filesize_1.default)(totalSizes.gzipSize || 0);
60
+ totalSizes.brotliLabel = totalSizes.brotliSize ? (0, filesize_1.default)(totalSizes.brotliSize) : '-';
61
61
  return {
62
62
  totalSizes: totalSizes,
63
63
  assets
@@ -66,13 +66,13 @@ function calculateAssetsSizes(webpackStats, rootDir = '') {
66
66
  exports.calculateAssetsSizes = calculateAssetsSizes;
67
67
  function printAssetsSizes(sizes) {
68
68
  const longestSizeLabelLength = Math.max.apply(null, sizes.assets.map(a => {
69
- const sizeLength = strip_ansi_1.default(a.gzipLabel).length;
69
+ const sizeLength = (0, strip_ansi_1.default)(a.gzipLabel).length;
70
70
  return sizeLength + sizeLength + 8;
71
71
  }));
72
72
  console.log(chalk_1.default.blueBright('Assets sizes:'));
73
73
  sizes.assets.forEach(asset => {
74
74
  let sizeLabel = `${asset.sizeLabel} (${asset.gzipLabel} gzip, ${asset.brotliLabel} br)`;
75
- const sizeLength = strip_ansi_1.default(sizeLabel).length;
75
+ const sizeLength = (0, strip_ansi_1.default)(sizeLabel).length;
76
76
  if (sizeLength < longestSizeLabelLength) {
77
77
  const rightPadding = ' '.repeat(longestSizeLabelLength - sizeLength);
78
78
  sizeLabel += rightPadding;
@@ -3,7 +3,7 @@ export declare function getBuildParamsFromArgs(): {
3
3
  imageFullName: string;
4
4
  tempDirName: string;
5
5
  };
6
- declare type PrepareFilesForDockerParams = {
6
+ type PrepareFilesForDockerParams = {
7
7
  dockerfileTemplate: string;
8
8
  nginxConfTemplate: string;
9
9
  startScript: string;
@@ -1,4 +1,4 @@
1
- declare type YarnVersion = '1' | '2+' | 'unavailable';
1
+ type YarnVersion = '1' | '2+' | 'unavailable';
2
2
  export declare function getYarnVersion(): YarnVersion;
3
3
  export declare function getPruningCommand(): string;
4
4
  export declare function getInstallProductionCommand(): string;
@@ -3,6 +3,6 @@ import { AppConfigs } from './types';
3
3
  * Эти ключи из конфига будут обновляться из package.json при их наличии
4
4
  */
5
5
  export declare const availablePackageSettings: readonly ["dockerRegistry", "baseDockerImage", "serverEntry", "buildPath", "assetsPath", "additionalBuildPath", "nginxRootPath", "runFromNonRootUser", "archiveName", "serverOutput", "clientPolyfillsEntry", "clientEntry", "keepPropTypes", "devSourceMaps", "useTscLoader", "useServerHMR", "webpack4Compatibility", "clientServerPort", "serverPort", "debug", "statsOutputFilename", "componentsTheme", "keepCssVars", "removeDevDependenciesDuringDockerBuild"];
6
- declare type ArrayElementType<ArrayType extends ReadonlyArray<unknown>> = ArrayType[number];
7
- export declare type PackageSettings = Partial<Pick<AppConfigs, ArrayElementType<typeof availablePackageSettings>>>;
6
+ type ArrayElementType<ArrayType extends ReadonlyArray<unknown>> = ArrayType[number];
7
+ export type PackageSettings = Partial<Pick<AppConfigs, ArrayElementType<typeof availablePackageSettings>>>;
8
8
  export {};