arui-scripts 13.4.0-feat-vite-dev-build.4 → 13.5.0-feat-NEWCLICKUI-1746.1

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 (51) hide show
  1. package/CHANGELOG.md +6 -16
  2. package/build/bin/index.js +1 -1
  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 +26 -0
  11. package/build/commands/changelog/index.js +105 -0
  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 +2 -3
  24. package/build/configs/app-configs/index.js +6 -6
  25. package/build/configs/app-configs/types.d.ts +1 -2
  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/file-transform.d.ts +2 -1
  35. package/build/configs/jest/index.d.ts +8 -8
  36. package/build/configs/postcss.config.d.ts +1 -1
  37. package/build/configs/postcss.js +1 -1
  38. package/build/configs/stats-options.js +1 -1
  39. package/build/configs/supporting-browsers.js +1 -1
  40. package/build/configs/util/apply-overrides.d.ts +3 -6
  41. package/build/configs/webpack.client.dev.js +2 -7
  42. package/build/configs/webpack.client.prod.js +3 -5
  43. package/build/configs/webpack.server.dev.js +3 -3
  44. package/build/configs/webpack.server.prod.js +3 -3
  45. package/build/index.js +0 -1
  46. package/build/templates/dockerfile-compiled.template.js +3 -3
  47. package/build/templates/dockerfile.template.js +4 -4
  48. package/build/templates/nginx.conf.template.js +1 -1
  49. package/build/templates/start.template.js +1 -1
  50. package/build/tsconfig-local.tsbuildinfo +8829 -1
  51. package/package.json +2 -9
package/CHANGELOG.md CHANGED
@@ -1,31 +1,21 @@
1
- # [13.4.0-feat-vite-dev-build.4](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.4.0-feat-vite-dev-build.3...v13.4.0-feat-vite-dev-build.4) (2023-01-20)
1
+ # [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
2
 
3
3
 
4
- ### Bug Fixes
5
-
6
- * **vite:** hide warnings about css imports ([e21cd2c](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/e21cd2cce47f4c8e9a212183f4ff9bab90a267fe))
7
-
8
- # [13.4.0-feat-vite-dev-build.3](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.4.0-feat-vite-dev-build.2...v13.4.0-feat-vite-dev-build.3) (2023-01-20)
9
-
10
-
11
- ### Bug Fixes
4
+ ### Features
12
5
 
13
- * **vite:** correct module resolution ([e8332ed](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/e8332ed13d964ba4c190554aa69ff5f4d109ca99))
14
- * **vite:** increase reload timeout ([93568f0](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/93568f0eaf62be5029edf6d568078c3911b46960))
6
+ * added a new command "changelog" ([95d5a34](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/95d5a34558322108a7f8afab7608491291f4d4aa))
15
7
 
16
- # [13.4.0-feat-vite-dev-build.2](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.4.0-feat-vite-dev-build.1...v13.4.0-feat-vite-dev-build.2) (2023-01-20)
8
+ # [13.4.0](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.3.1...v13.4.0) (2023-02-06)
17
9
 
18
10
 
19
11
  ### Bug Fixes
20
12
 
21
- * **vite:** small fixes in start up process ([aa1588e](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/aa1588e186dafb93a9169f64f71a93fb0741448a))
22
-
23
- # [13.4.0-feat-vite-dev-build.1](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.3.1...v13.4.0-feat-vite-dev-build.1) (2023-01-20)
13
+ * **dockerfile:** reduce image size ([13fc2f8](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/13fc2f894569db24d362e3aaf13bc9a15f34378f))
24
14
 
25
15
 
26
16
  ### Features
27
17
 
28
- * add vite as dev build server ([7a2059e](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/7a2059e00c86c3cb21fb5e23bb29574c2360007f))
18
+ * **get-defaults.ts:** run from non root by default ([b9130b7](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/b9130b7c518ad6023fa0d3f8bf6818af7d7e9081))
29
19
 
30
20
  ## [13.3.1](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.3.0...v13.3.1) (2022-12-13)
31
21
 
@@ -3,7 +3,6 @@
3
3
  /* eslint import/no-dynamic-require: 0 */
4
4
  const commands = {
5
5
  start: () => require('../commands/start'),
6
- 'start-vite': () => require('../commands/start-vite'),
7
6
  build: () => require('../commands/build'),
8
7
  'docker-build': () => require('../commands/docker-build'),
9
8
  'docker-build:compiled': () => require('../commands/docker-build-compiled'),
@@ -11,6 +10,7 @@ const commands = {
11
10
  'ensure-yarn': () => require('../commands/ensure-yarn'),
12
11
  'archive-build': () => require('../commands/archive-build'),
13
12
  'bundle-analyze': () => require('../commands/bundle-analyze'),
13
+ changelog: () => require('../commands/changelog'),
14
14
  };
15
15
  const command = process.argv[2];
16
16
  if (!command || !commands[command]) {
@@ -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 (0, exec_1.default)('npm run build');
49
+ yield exec_1.default('npm run build');
50
50
  console.timeEnd('Build application time');
51
51
  console.time('Remove build dependencies time');
52
- const pruneCommand = (0, yarn_1.getPruningCommand)();
53
- yield (0, exec_1.default)(pruneCommand);
52
+ const pruneCommand = yarn_1.getPruningCommand();
53
+ yield 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
- type BuildResult = {
2
+ declare 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 = (0, webpack_1.default)(config);
12
+ let compiler = 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 = (0, format_webpack_messages_1.default)(stats === null || stats === void 0 ? void 0 : stats.toJson({}));
18
+ const messages = 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
- (0, build_wrapper_1.default)(webpack_client_prod_1.default)
14
+ 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 @@ console.log(chalk_1.default.magenta('Building client...'));
24
24
  }
25
25
  function printOutputSizes(webpackConfig) {
26
26
  var _a;
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);
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);
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 @@ console.log(chalk_1.default.magenta('Building client...'));
36
36
  })
37
37
  .catch((err) => {
38
38
  console.log(chalk_1.default.red('Failed to compile client.\n'));
39
- (0, printBuildError_1.default)(err);
39
+ 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 (!(0, check_required_files_1.default)()) {
17
+ if (!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 = (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' });
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' });
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
- (0, build_wrapper_1.default)(webpack_server_prod_1.default)
13
+ 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 @@ console.log(chalk_1.default.magenta('Building server...'));
24
24
  })
25
25
  .catch((err) => {
26
26
  console.log(chalk_1.default.red('Failed to compile server.\n'));
27
- (0, printBuildError_1.default)(err);
27
+ 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 (0, make_tmp_dir_1.default)();
22
+ const tmpDir = yield 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
- (0, webpack_1.default)(clientWebpackConfig).run(() => { });
34
+ webpack_1.default(clientWebpackConfig).run(() => { });
35
35
  }))();
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Формирует описание версии в `CHANGELOG.md` на основе данных введенных в Jenkins при старте пайплайна.
3
+ * `standard-version` запускает этот скрипт как `postchangelog` хук.
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;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /**
3
+ * Формирует описание версии в `CHANGELOG.md` на основе данных введенных в Jenkins при старте пайплайна.
4
+ * `standard-version` запускает этот скрипт как `postchangelog` хук.
5
+ */
6
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
13
+ });
14
+ };
15
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
16
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
17
+ var m = o[Symbol.asyncIterator], i;
18
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
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
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
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');
30
+ /**
31
+ * Сюда пайплайн Jenkins складывает соответствующие части описания версии. Не получается использовать
32
+ * переменные окружения, т.к. `standard-version` запускает хуки через `child_process.exec`, не передавая туда
33
+ * ни аргументы ни переменные окружения.
34
+ */
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');
38
+ // Пример заголовка – `## [50.1.0](http://git.moscow.alfaintra.net/...) (2022-07-27)`.
39
+ const changelogHeaderRegExp = /^###? \[\d+\.\d+\.\d+]\([^)]+\) \(\d{4}-\d{2}-\d{2}\)/;
40
+ (() => __awaiter(void 0, void 0, void 0, function* () {
41
+ var e_1, _a;
42
+ const rl = readline.createInterface({
43
+ input: createReadStream(changelogPath),
44
+ });
45
+ const ws = createWriteStream(changelogTmpPath);
46
+ let modifyingStatus = 'PENDING'; // 'PENDING' | 'MODIFYING' | 'MODIFIED'
47
+ 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 }));
70
+ ws.write(`${line}\n`);
71
+ }
72
+ break;
73
+ // Дальше просто копируем всё как есть.
74
+ case 'MODIFIED':
75
+ ws.write(`${line}\n`);
76
+ break;
77
+ }
78
+ }
79
+ }
80
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
81
+ finally {
82
+ try {
83
+ if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield _a.call(rl_1);
84
+ }
85
+ finally { if (e_1) throw e_1.error; }
86
+ }
87
+ ws.close();
88
+ execSync(`${nodeModulesBinPath}/prettier -w "${changelogTmpPath}"`);
89
+ yield unlink(changelogPath);
90
+ yield rename(changelogTmpPath, changelogPath);
91
+ process.exit(0);
92
+ }))();
93
+ function getVersionDescription({ features, bugFixes, breakingChanges }) {
94
+ let versionDescription = '';
95
+ if (features) {
96
+ versionDescription += `### Features\n${features}\n`;
97
+ }
98
+ if (bugFixes) {
99
+ versionDescription += `### Bug Fixes\n${bugFixes}\n`;
100
+ }
101
+ if (breakingChanges) {
102
+ versionDescription += `### ⚠ BREAKING CHANGES\n${breakingChanges}\n`;
103
+ }
104
+ return versionDescription;
105
+ }
@@ -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 } = (0, docker_build_1.getBuildParamsFromArgs)();
24
+ const { imageFullName, pathToTempDir, tempDirName } = 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 (0, docker_build_1.prepareFilesForDocker)({
29
+ yield 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 (0, exec_1.default)('npm run build');
40
+ yield 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 = (0, yarn_1.getPruningCommand)();
45
- yield (0, exec_1.default)(pruneCommand);
44
+ const pruneCommand = yarn_1.getPruningCommand();
45
+ yield exec_1.default(pruneCommand);
46
46
  console.timeEnd('Remove dev dependencies time');
47
47
  }
48
48
  console.time('Build docker image time');
49
- yield (0, exec_1.default)(`docker build -f "./${tempDirName}/Dockerfile" \\
49
+ yield 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 (0, exec_1.default)(`docker push ${imageFullName}`);
58
+ yield 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 } = (0, docker_build_1.getBuildParamsFromArgs)();
23
+ const { imageFullName, pathToTempDir, tempDirName } = docker_build_1.getBuildParamsFromArgs();
24
24
  try {
25
25
  console.log(`Build docker image ${imageFullName}`);
26
26
  console.time('Total time');
27
- yield (0, docker_build_1.prepareFilesForDocker)({
27
+ yield 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 (0, exec_1.default)('echo "node_modules" >> .dockerignore');
35
- yield (0, exec_1.default)(`docker build -f "./${tempDirName}/Dockerfile" \\
34
+ yield exec_1.default('echo "node_modules" >> .dockerignore');
35
+ yield 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 (0, exec_1.default)(`docker push ${imageFullName}`);
41
+ yield 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 = (0, webpack_1.default)(webpack_client_dev_1.default);
12
+ const clientCompiler = 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) => (0, print_compiler_output_1.default)('Client', stats));
18
+ clientCompiler.hooks.done.tap('client', (stats) => 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
- (0, WebpackDevServerUtils_1.choosePort)(HOST, +(DEFAULT_PORT || 0))
21
+ 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 (!(0, check_required_files_1.default)()) {
12
+ if (!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 = (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' });
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' });
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 = (0, webpack_1.default)(webpack_server_dev_1.default);
10
+ const serverCompiler = 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) => (0, print_compiler_output_1.default)('Server', stats));
13
+ serverCompiler.hooks.done.tap('server', (stats) => 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
- type AssetSize = {
2
+ declare type AssetSize = {
3
3
  name: string;
4
4
  fullName: string;
5
5
  gzipSize: number;
@@ -9,7 +9,7 @@ type AssetSize = {
9
9
  gzipLabel: string;
10
10
  brotliLabel: string;
11
11
  };
12
- type TotalSizes = {
12
+ declare type TotalSizes = {
13
13
  size: number;
14
14
  sizeLabel: string;
15
15
  gzipSize: number;
@@ -17,7 +17,7 @@ type TotalSizes = {
17
17
  brotliSize: number;
18
18
  brotliLabel: string;
19
19
  };
20
- type ClientAssetsSizes = {
20
+ declare 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 = (0, gzip_size_1.sync)(fileContents);
37
+ const size = 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: (0, filesize_1.default)(asset.size),
47
- gzipLabel: (0, filesize_1.default)(size),
48
- brotliLabel: brSize ? (0, filesize_1.default)(brSize) : '-'
46
+ sizeLabel: filesize_1.default(asset.size),
47
+ gzipLabel: filesize_1.default(size),
48
+ brotliLabel: brSize ? 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 = (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) : '-';
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) : '-';
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 = (0, strip_ansi_1.default)(a.gzipLabel).length;
69
+ const sizeLength = 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 = (0, strip_ansi_1.default)(sizeLabel).length;
75
+ const sizeLength = 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
- type PrepareFilesForDockerParams = {
6
+ declare type PrepareFilesForDockerParams = {
7
7
  dockerfileTemplate: string;
8
8
  nginxConfTemplate: string;
9
9
  startScript: string;
@@ -1,4 +1,4 @@
1
- type YarnVersion = '1' | '2+' | 'unavailable';
1
+ declare 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
- type ArrayElementType<ArrayType extends ReadonlyArray<unknown>> = ArrayType[number];
7
- export type PackageSettings = Partial<Pick<AppConfigs, ArrayElementType<typeof availablePackageSettings>>>;
6
+ declare type ArrayElementType<ArrayType extends ReadonlyArray<unknown>> = ArrayType[number];
7
+ export declare type PackageSettings = Partial<Pick<AppConfigs, ArrayElementType<typeof availablePackageSettings>>>;
8
8
  export {};
@@ -20,17 +20,17 @@ function calculateDependentConfig(config) {
20
20
  // Поэтому мы читаем версию того babel/runtime, который установлен в проекте.
21
21
  // Так же мы не можем использовать require для получения контента из babel/runtime/package.json,
22
22
  // потому что webpack.cache будет ругаться на то, что мы пытаемся импортировать файлы НЕ из своего node_modules.
23
- const pathToProjectBabelRuntime = (0, resolve_1.resolveNodeModuleRelativeTo)(config.cwd, '@babel/runtime/package.json');
23
+ const pathToProjectBabelRuntime = resolve_1.resolveNodeModuleRelativeTo(config.cwd, '@babel/runtime/package.json');
24
24
  babelRuntimeVersion = JSON.parse(fs_1.default.readFileSync(pathToProjectBabelRuntime, 'utf8')).version;
25
25
  }
26
26
  catch (e) {
27
27
  babelRuntimeVersion = require('@babel/runtime/package.json').version;
28
28
  }
29
- return (0, lodash_merge_1.default)(config, {
29
+ return lodash_merge_1.default(config, {
30
30
  publicPath: `${config.assetsPath}/`,
31
31
  serverOutputPath: path_1.default.resolve(config.cwd, config.buildPath),
32
32
  clientOutputPath: path_1.default.resolve(config.cwd, config.buildPath, config.assetsPath),
33
- clientPolyfillsEntry: (0, get_polyfills_1.getPolyfills)(config),
33
+ clientPolyfillsEntry: get_polyfills_1.getPolyfills(config),
34
34
  statsOutputPath: path_1.default.resolve(config.cwd, config.buildPath, config.statsOutputFilename),
35
35
  watchIgnorePath: ['node_modules', config.buildPath],
36
36
  babelRuntimeVersion,
@@ -17,7 +17,7 @@ function getDefaults() {
17
17
  const absoluteNodeModulesPath = path_1.default.resolve(CWD, 'node_modules');
18
18
  const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
19
19
  const yarnLockFilePath = path_1.default.join(CWD, 'yarn.lock');
20
- const overridesPath = (0, resolve_1.tryResolve)(path_1.default.join(CWD, 'arui-scripts.overrides'));
20
+ const overridesPath = resolve_1.tryResolve(path_1.default.join(CWD, 'arui-scripts.overrides'));
21
21
  const nginxConfFilePath = path_1.default.join(CWD, 'nginx.conf');
22
22
  const dockerfileFilePath = path_1.default.join(CWD, 'Dockerfile');
23
23
  return {
@@ -34,7 +34,7 @@ function getDefaults() {
34
34
  assetsPath: 'assets',
35
35
  additionalBuildPath: ['config'],
36
36
  nginxRootPath: '/src',
37
- runFromNonRootUser: false,
37
+ runFromNonRootUser: true,
38
38
  archiveName: 'build.tar',
39
39
  babelRuntimeVersion: '7.0.0-beta.0',
40
40
  // server compilation configs
@@ -56,7 +56,6 @@ function getDefaults() {
56
56
  clientServerPort: 8080,
57
57
  serverPort: 3000,
58
58
  installServerSourceMaps: false,
59
- viteDevPort: 23891,
60
59
  debug: false,
61
60
  overridesPath: overridesPath ? [overridesPath] : [],
62
61
  statsOutputFilename: 'stats.json',
@@ -7,10 +7,10 @@ const update_with_package_1 = require("./update-with-package");
7
7
  const update_with_presets_1 = require("./update-with-presets");
8
8
  const calculate_dependent_config_1 = require("./calculate-dependent-config");
9
9
  const update_with_config_file_1 = require("./update-with-config-file");
10
- let config = (0, get_defaults_1.getDefaults)();
11
- config = (0, update_with_presets_1.updateWithPresets)(config);
12
- config = (0, update_with_package_1.updateWithPackage)(config);
13
- config = (0, update_with_config_file_1.updateWithConfigFile)(config);
14
- config = (0, update_with_env_1.updateWithEnv)(config);
15
- config = (0, calculate_dependent_config_1.calculateDependentConfig)(config);
10
+ let config = get_defaults_1.getDefaults();
11
+ config = update_with_presets_1.updateWithPresets(config);
12
+ config = update_with_package_1.updateWithPackage(config);
13
+ config = update_with_config_file_1.updateWithConfigFile(config);
14
+ config = update_with_env_1.updateWithEnv(config);
15
+ config = calculate_dependent_config_1.calculateDependentConfig(config);
16
16
  exports.default = config;