arui-scripts 12.0.3 → 12.3.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 (77) hide show
  1. package/CHANGELOG.md +4 -3
  2. package/README.md +68 -8
  3. package/build/bin/index.d.ts +3 -0
  4. package/build/commands/archive-build/index.d.ts +1 -0
  5. package/build/commands/build/build-wrapper.d.ts +8 -0
  6. package/build/commands/build/client.d.ts +1 -0
  7. package/build/commands/build/index.d.ts +1 -0
  8. package/build/commands/build/server.d.ts +1 -0
  9. package/build/commands/bundle-analyze/index.d.ts +1 -0
  10. package/build/commands/bundle-analyze/index.js +6 -1
  11. package/build/commands/docker-build/index.d.ts +1 -0
  12. package/build/commands/ensure-yarn/index.d.ts +0 -0
  13. package/build/commands/start/client.d.ts +1 -0
  14. package/build/commands/start/index.d.ts +1 -0
  15. package/build/commands/start/print-compiler-output.d.ts +1 -0
  16. package/build/commands/start/server.d.ts +1 -0
  17. package/build/commands/test/index.d.ts +1 -0
  18. package/build/commands/util/check-required-files.d.ts +2 -0
  19. package/build/commands/util/client-assets-sizes.d.ts +26 -0
  20. package/build/commands/util/exec.d.ts +2 -0
  21. package/build/commands/util/format-webpack-messages.d.ts +5 -0
  22. package/build/commands/util/make-tmp-dir.d.ts +6 -0
  23. package/build/configs/app-configs/available-package-settings.d.ts +8 -0
  24. package/build/configs/app-configs/available-package-settings.js +1 -0
  25. package/build/configs/app-configs/calculate-dependent-config.d.ts +11 -0
  26. package/build/configs/app-configs/calculate-dependent-config.js +1 -0
  27. package/build/configs/app-configs/get-defaults.d.ts +2 -0
  28. package/build/configs/app-configs/get-defaults.js +5 -2
  29. package/build/configs/app-configs/index.d.ts +4 -0
  30. package/build/configs/app-configs/index.js +3 -0
  31. package/build/configs/app-configs/types.d.ts +38 -0
  32. package/build/configs/app-configs/update-with-config-file.d.ts +2 -0
  33. package/build/configs/app-configs/update-with-config-file.js +25 -0
  34. package/build/configs/app-configs/update-with-env.d.ts +2 -0
  35. package/build/configs/app-configs/update-with-package.d.ts +2 -0
  36. package/build/configs/app-configs/update-with-presets.d.ts +2 -0
  37. package/build/configs/app-configs/update-with-presets.js +7 -3
  38. package/build/configs/app-configs/validate-settings-keys.d.ts +7 -0
  39. package/build/configs/babel-client.d.ts +2 -0
  40. package/build/configs/babel-server.d.ts +2 -0
  41. package/build/configs/dev-server.d.ts +3 -0
  42. package/build/configs/jest/babel-transform.d.ts +7 -0
  43. package/build/configs/jest/css-mock.d.ts +1 -0
  44. package/build/configs/jest/file-transform.d.ts +2 -0
  45. package/build/configs/jest/index.d.ts +19 -0
  46. package/build/configs/jest/setup.d.ts +1 -0
  47. package/build/configs/mq.d.ts +24 -0
  48. package/build/configs/postcss.config.d.ts +27 -0
  49. package/build/configs/postcss.d.ts +2 -0
  50. package/build/configs/stats-options.d.ts +3 -0
  51. package/build/configs/stats-options.js +0 -2
  52. package/build/configs/supporting-browsers.d.ts +2 -0
  53. package/build/configs/util/apply-overrides.d.ts +37 -0
  54. package/build/configs/util/apply-overrides.js +12 -4
  55. package/build/configs/util/check-node-version.d.ts +2 -0
  56. package/build/configs/util/get-entry.d.ts +7 -0
  57. package/build/configs/util/get-polyfills.d.ts +3 -0
  58. package/build/configs/util/install-sourcemap-support.d.ts +1 -0
  59. package/build/configs/util/node-assets-ignore.d.ts +0 -0
  60. package/build/configs/util/noop.d.ts +1 -0
  61. package/build/configs/util/register-ts-node.d.ts +0 -0
  62. package/build/configs/util/register-ts-node.js +15 -0
  63. package/build/configs/util/try-resolve.d.ts +1 -0
  64. package/build/configs/webpack.client.dev.d.ts +3 -0
  65. package/build/configs/webpack.client.prod.d.ts +3 -0
  66. package/build/configs/webpack.server.dev.d.ts +3 -0
  67. package/build/configs/webpack.server.prod.d.ts +3 -0
  68. package/build/index.d.ts +2 -0
  69. package/build/index.js +2 -0
  70. package/build/plugins/reload-server-webpack-plugin.d.ts +9 -0
  71. package/build/templates/dockerfile.template.d.ts +2 -0
  72. package/build/templates/nginx.conf.template.d.ts +2 -0
  73. package/build/templates/start.template.d.ts +2 -0
  74. package/build/tsconfig-local.tsbuildinfo +411 -343
  75. package/package.json +3 -2
  76. package/release.config.js +1 -2
  77. package/tsconfig-local.json +4 -2
package/CHANGELOG.md CHANGED
@@ -1,6 +1,7 @@
1
- ## [12.0.3](https://github.com/alfa-laboratory/arui-scripts/compare/v12.0.2...v12.0.3) (2021-11-29)
1
+ # [12.3.0](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v12.2.0...v12.3.0) (2022-04-18)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Features
5
5
 
6
- * **webpack-dev:** disable default override of NODE_ENV ([49b1464](https://github.com/alfa-laboratory/arui-scripts/commit/49b1464d2574514374aec223c5fde3fed025c93a))
6
+ * add support for ts override files ([d36b5da](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/d36b5dac0ac73dc580cc0a22c47438d6136e6b9e))
7
+ * allow using config files instead of package config ([5063d23](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/5063d23abc1a13b503c73b0906d68aaa57840a74))
package/README.md CHANGED
@@ -51,12 +51,14 @@ npm install arui-scripts --save-dev
51
51
  ---
52
52
 
53
53
  Несмотря на то, что все работает из коробки, вы можете захотеть поменять некоторые настройки сборщиков.
54
- Сделать это можно в `package.json`, определив там свойство `aruiScripts`.
54
+ Сделать это можно в `package.json`, определив там свойство `aruiScripts`, или положить в корень проекта файл
55
+ `arui-scripts.config.(js|ts)`.
55
56
 
56
57
  Доступные настройки:
57
58
 
58
59
  - `dockerRegistry` - адрес используемого docker registry, по умолчанию `''`, то есть используется публичный registry
59
60
  - `baseDockerImage` - имя базового образа, используемого для построения docker образа. По умолчанию `alfabankui/arui-scripts:latest`.
61
+ - `runFromNonRootUser` - сборка образа под пользователем `nginx`. Нужна для совместимости с k8s, т.к там зачастую запрещен запуск контейнера из под `root` По умолчанию `false`.
60
62
  - `serverEntry` - точка входа для исходников сервера, по умолчанию `src/server/index`.
61
63
  - `serverOutput` - имя файла для компиляции сервера, по умолчанию `server.js`.
62
64
  - `clientPolyfillsEntry` - точка входа для полифилов. Будет подключаться до основной точки входа. По умолчанию подтягивает полифилы из `arui-feather`, если он установлен.
@@ -68,6 +70,7 @@ npm install arui-scripts --save-dev
68
70
  - `archiveName` - имя архива, который будет создан при использовании команды `archive-build`. По умолчанию `build.tar`.
69
71
  - `keepPropTypes` - если `true`, пакеты с prop-types не будут удалены из production билда.
70
72
  - `debug` - режим отладки, в котором не выполняются некоторые нежелательные операции и выводится больше сообщений об ошибках, по умолчанию `false`.
73
+ - `statsOutputFilename` - имя [stats-файла](https://webpack.js.org/api/stats/), которое будет использоваться в [bundle-analyze](#анализ-бандла) команде
71
74
  - `useTscLoader` - использовать ts-loader вместо babel-loader для обработки ts файлов. У babel-loader есть [ряд ограничений](https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/). По умолчанию `false`.
72
75
  - `componentsTheme` - путь к css файлу с темой для [core-components](https://alfa-laboratory.github.io/core-components). Используется для настройки [postcss-custom-properties](https://github.com/postcss/postcss-custom-properties#importfrom).
73
76
  - `keepCssVars` - отключает `postcss-custom-properties`, css переменные будут оставаться в бандле.
@@ -81,6 +84,24 @@ ARUI_SCRIPTS_CONFIG="{\"serverPort\":3333}" yarn start
81
84
  Так же, читаются настройки jest (см. [документацию](https://facebook.github.io/jest/docs/en/configuration.html))
82
85
  и `proxy` (см. [документацию](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#proxying-api-requests-in-development)).
83
86
 
87
+ Использование отдельных конфигурационных файлов
88
+ ---
89
+ Для сложных конфигураций может быть удобно вынести их из package.json в отдельный файл. Конфигурация будет загружаться из файла
90
+ `arui-scripts.config.js` или `arui-scripts.config.ts`
91
+ Пример `arui-scripts.config.ts`:
92
+ ```ts
93
+ import { PackageSettings } from 'arui-scripts';
94
+
95
+ const settings: PackageSettings = {
96
+ clientEntry: {
97
+ mobile: './src/mobile',
98
+ desktop: './src/desktop',
99
+ },
100
+ };
101
+
102
+ export default settings;
103
+ ```
104
+
84
105
  Несколько entry point
85
106
  ---
86
107
  Ключи `serverEntry` и `clientEntry` принимают не только строки, но и любые возможные в [webpack варианты](https://webpack.js.org/concepts/entry-points/).
@@ -426,14 +447,23 @@ require node.js на таких местах ломается. Поэтому н
426
447
  воспользоваться механизмом `overrides`, описанным ниже.
427
448
  По умолчанию же все не-js файлы из внешних модулей будут проигнорированы.
428
449
 
429
-
450
+ Анализ бандла
451
+ ---
452
+ Для изучения итогового бандла приложения и просмотра его размеров и включенных файлов в arui-scripts есть команда
453
+ ```
454
+ arui-scripts bundle-analyze
455
+ ```
456
+ Она запускает [webpack-bundle-analyzer](https://www.npmjs.com/package/webpack-bundle-analyzer) для клиентского кода.
457
+ Так же при запуске будет генерироваться [stats-файл](https://webpack.js.org/api/stats/), который можно использовать в
458
+ [сторонних](http://webpack.github.io/analyse/) инструментах, например для понимания почему тот или иной модуль попал в бандл.
459
+ По умолчанию файл будет писаться в `.build/stats.json`.
430
460
 
431
461
  Тонкая настройка
432
462
  ===
433
463
  Если вам не хватает гибкости при использовании `arui-scripts`, например вы хотите добавить свой плагин для вебпака -
434
464
  вы можете воспользоваться механизмом `overrides`.
435
465
 
436
- Для этого вам необходимо создать в корне вашего проекта файл `arui-scripts.overrides.js`, из которого вы сможете управлять
466
+ Для этого вам необходимо создать в корне вашего проекта файл `arui-scripts.overrides.js` или `arui-scripts.overrides.ts`, из которого вы сможете управлять
437
467
  конфигурацией почти всех инструментов, используемых в `arui-scripts`.
438
468
 
439
469
  Принцип работы тут следующий. Для всех конфигураций определен набор ключей, которые они будут искать в `arui-scripts.overrides.js`,
@@ -441,7 +471,7 @@ require node.js на таких местах ломается. Поэтому н
441
471
  существующая конфигурация и полный конфиг приложения (см [AppConfig](./src/configs/app-configs/types.ts)).
442
472
  Возвращать такая функция должна так же конфигурацию.
443
473
 
444
- Например такое содержимое `arui-scripts.overrides.js`:
474
+ Пример `arui-scripts.overrides.js`:
445
475
  ```javascript
446
476
  const path = require('path');
447
477
  module.exports = {
@@ -454,6 +484,25 @@ module.exports = {
454
484
  };
455
485
  ```
456
486
 
487
+ Пример `arui-scripts.overrides.ts`:
488
+ ```ts
489
+ import type { OverrideFile } from 'arui-scripts';
490
+ import path from 'path';
491
+
492
+ const overrides: OverrideFile = {
493
+ webpack: (config, applicationConfig) => {
494
+ config.resolve.alias = {
495
+ components: path.resolve(__dirname, 'src/components')
496
+ };
497
+ return config;
498
+ }
499
+ };
500
+
501
+ export default overrides;
502
+ ```
503
+
504
+ **В случае, если у вас на проекте лежит и ts, и js файл с overrides, использоваться будет js версия.**
505
+
457
506
  С помощью этой конфигурации ко всем настройкам вебпака будет добавлен `alias` *components*.
458
507
 
459
508
  На данный момент можно переопределять следующие конфигурации:
@@ -522,10 +571,10 @@ module.exports = {
522
571
  от папки, содержащей package.json. Так что это может быть как папка в проекте, так и пакет из node_modules).
523
572
 
524
573
  Сам пакет с пресетами может содержать два файла:
525
- - `arui-scirpts.config.js`
526
- - `arui-scripts.overrides.js`
574
+ - `arui-scirpts.config.js` (или `arui-scripts.config.ts`)
575
+ - `arui-scripts.overrides.js` (или `arui-scirpts.overrides.ts`)
527
576
 
528
- ### arui-scripts.config.js
577
+ ### arui-scripts.config (js | ts)
529
578
  С помощью этого файла можно задать любые ключи [конфигурации](#настройки).
530
579
  ```js
531
580
  module.exports = {
@@ -533,6 +582,17 @@ module.exports = {
533
582
  };
534
583
  ```
535
584
 
585
+ Или в виде ts:
586
+ ```ts
587
+ import type { PackageSettings } from 'arui-scripts';
588
+
589
+ const settings: PackageSettings = {
590
+ baseDockerImage: 'my-company-artifactory.com/arui-scripts-base:11.2'
591
+ };
592
+
593
+ export default settings;
594
+ ```
595
+
536
596
  На проекте конфиурация будет загружаться в следующем порядке:
537
597
  1. базовые настройки из arui-scripts
538
598
  2. настройки из presets
@@ -545,7 +605,7 @@ module.exports = {
545
605
  они будут вычисляться относительно корня проекта, а не вашей конфигурации.
546
606
  Вы можете использовать абсолютные пути при необходимости задать путь до файла внутри пакета с пресетами.
547
607
 
548
- ### arui-scripts.overrides.js
608
+ ### arui-scripts.overrides (js | ts)
549
609
  С помощью этого файла можно задать базовые оверрайды проекта, аналогично [заданию оверрайдов на проекте](#тонкая-настройка).
550
610
  ```js
551
611
  module.exports = {
@@ -0,0 +1,3 @@
1
+ #! /usr/bin/env node
2
+ declare const commands: string[];
3
+ declare const command: string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import webpack from 'webpack';
2
+ declare type BuildResult = {
3
+ stats: webpack.Stats;
4
+ warnings: string[];
5
+ previousFileSizes: unknown;
6
+ };
7
+ declare function build(config: webpack.Configuration, previousFileSizes?: unknown): Promise<BuildResult>;
8
+ export default build;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -16,10 +16,15 @@ const webpack_1 = __importDefault(require("webpack"));
16
16
  const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
17
17
  const make_tmp_dir_1 = __importDefault(require("../util/make-tmp-dir"));
18
18
  const webpack_client_prod_1 = __importDefault(require("../../configs/webpack.client.prod"));
19
+ const app_configs_1 = __importDefault(require("../../configs/app-configs"));
19
20
  (() => __awaiter(void 0, void 0, void 0, function* () {
20
21
  var _a;
21
22
  const tmpDir = yield make_tmp_dir_1.default();
22
- (_a = webpack_client_prod_1.default === null || webpack_client_prod_1.default === void 0 ? void 0 : webpack_client_prod_1.default.plugins) === null || _a === void 0 ? void 0 : _a.push((new webpack_bundle_analyzer_1.BundleAnalyzerPlugin()));
23
+ const plugin = new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
24
+ generateStatsFile: true,
25
+ statsFilename: app_configs_1.default.statsOutputPath,
26
+ });
27
+ (_a = webpack_client_prod_1.default.plugins) === null || _a === void 0 ? void 0 : _a.push(plugin);
23
28
  webpack_client_prod_1.default.output.path = tmpDir;
24
29
  webpack_1.default(webpack_client_prod_1.default).run(() => { });
25
30
  }))();
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export default function printCompilerOutput(compilerName: string, stats: any): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare function checkRequiredFiles(): boolean;
2
+ export default checkRequiredFiles;
@@ -0,0 +1,26 @@
1
+ import { Stats } from 'webpack';
2
+ declare type AssetSize = {
3
+ name: string;
4
+ fullName: string;
5
+ gzipSize: number;
6
+ brotliSize: number;
7
+ size: number;
8
+ sizeLabel: string;
9
+ gzipLabel: string;
10
+ brotliLabel: string;
11
+ };
12
+ declare type TotalSizes = {
13
+ size: number;
14
+ sizeLabel: string;
15
+ gzipSize: number;
16
+ gzipLabel: string;
17
+ brotliSize: number;
18
+ brotliLabel: string;
19
+ };
20
+ declare type ClientAssetsSizes = {
21
+ totalSizes: TotalSizes;
22
+ assets: AssetSize[];
23
+ };
24
+ export declare function calculateAssetsSizes(webpackStats: Stats, rootDir?: string): ClientAssetsSizes;
25
+ export declare function printAssetsSizes(sizes: ClientAssetsSizes): void;
26
+ export {};
@@ -0,0 +1,2 @@
1
+ declare function exec(command: string): Promise<unknown>;
2
+ export default exec;
@@ -0,0 +1,5 @@
1
+ export = formatWebpackMessages;
2
+ declare function formatWebpackMessages(json: any): {
3
+ errors: any;
4
+ warnings: any;
5
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Создает и возвращает временную папку
3
+ * @returns {Promise<string>}
4
+ */
5
+ declare function makeTmpDir(): Promise<string>;
6
+ export default makeTmpDir;
@@ -0,0 +1,8 @@
1
+ import { AppConfigs } from './types';
2
+ /**
3
+ * Эти ключи из конфига будут обновляться из package.json при их наличии
4
+ */
5
+ export declare const availablePackageSettings: readonly ["dockerRegistry", "baseDockerImage", "serverEntry", "buildPath", "assetsPath", "additionalBuildPath", "nginxRootPath", "runFromNonRootUser", "archiveName", "serverOutput", "clientPolyfillsEntry", "clientEntry", "keepPropTypes", "useTscLoader", "useServerHMR", "clientServerPort", "serverPort", "debug", "statsOutputFilename", "componentsTheme", "keepCssVars"];
6
+ declare type ArrayElementType<ArrayType extends ReadonlyArray<unknown>> = ArrayType[number];
7
+ export declare type PackageSettings = Partial<Pick<AppConfigs, ArrayElementType<typeof availablePackageSettings>>>;
8
+ export {};
@@ -23,6 +23,7 @@ exports.availablePackageSettings = [
23
23
  'clientServerPort',
24
24
  'serverPort',
25
25
  'debug',
26
+ 'statsOutputFilename',
26
27
  'componentsTheme',
27
28
  'keepCssVars',
28
29
  ];
@@ -0,0 +1,11 @@
1
+ import { AppConfigs } from './types';
2
+ /**
3
+ * Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
4
+ */
5
+ export declare function calculateDependentConfig(config: AppConfigs): AppConfigs & {
6
+ publicPath: string;
7
+ serverOutputPath: string;
8
+ clientOutputPath: string;
9
+ clientPolyfillsEntry: string[];
10
+ statsOutputPath: string;
11
+ };
@@ -16,6 +16,7 @@ function calculateDependentConfig(config) {
16
16
  serverOutputPath: path_1.default.resolve(config.cwd, config.buildPath),
17
17
  clientOutputPath: path_1.default.resolve(config.cwd, config.buildPath, config.assetsPath),
18
18
  clientPolyfillsEntry: get_polyfills_1.getPolyfills(config),
19
+ statsOutputPath: path_1.default.resolve(config.cwd, config.buildPath, config.statsOutputFilename),
19
20
  });
20
21
  }
21
22
  exports.calculateDependentConfig = calculateDependentConfig;
@@ -0,0 +1,2 @@
1
+ import { AppConfigs } from './types';
2
+ export declare function getDefaults(): AppConfigs;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getDefaults = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const try_resolve_1 = require("../util/try-resolve");
9
10
  function getDefaults() {
10
11
  const CWD = process.cwd();
11
12
  const appPackage = JSON.parse(fs_1.default.readFileSync(path_1.default.join(CWD, 'package.json'), 'utf8'));
@@ -16,7 +17,7 @@ function getDefaults() {
16
17
  const absoluteNodeModulesPath = path_1.default.resolve(CWD, 'node_modules');
17
18
  const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
18
19
  const yarnLockFilePath = path_1.default.join(CWD, 'yarn.lock');
19
- const overridesPath = path_1.default.join(CWD, 'arui-scripts.overrides.js');
20
+ const overridesPath = try_resolve_1.tryResolve(path_1.default.join(CWD, 'arui-scripts.overrides'));
20
21
  const nginxConfFilePath = path_1.default.join(CWD, 'nginx.conf');
21
22
  const dockerfileFilePath = path_1.default.join(CWD, 'Dockerfile');
22
23
  return {
@@ -52,13 +53,15 @@ function getDefaults() {
52
53
  clientServerPort: 8080,
53
54
  serverPort: 3000,
54
55
  debug: false,
55
- overridesPath: [overridesPath],
56
+ overridesPath: overridesPath ? [overridesPath] : [],
57
+ statsOutputFilename: 'stats.json',
56
58
  componentsTheme: undefined,
57
59
  keepCssVars: false,
58
60
  // Эти пути зависят от других настроек, которые могут быть переопределены пользователем
59
61
  publicPath: '',
60
62
  serverOutputPath: '',
61
63
  clientOutputPath: '',
64
+ statsOutputPath: '',
62
65
  };
63
66
  }
64
67
  exports.getDefaults = getDefaults;
@@ -0,0 +1,4 @@
1
+ import '../util/register-ts-node';
2
+ import { AppConfigs } from './types';
3
+ declare let config: AppConfigs;
4
+ export default config;
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("../util/register-ts-node");
3
4
  const get_defaults_1 = require("./get-defaults");
4
5
  const update_with_env_1 = require("./update-with-env");
5
6
  const update_with_package_1 = require("./update-with-package");
6
7
  const update_with_presets_1 = require("./update-with-presets");
7
8
  const calculate_dependent_config_1 = require("./calculate-dependent-config");
9
+ const update_with_config_file_1 = require("./update-with-config-file");
8
10
  let config = get_defaults_1.getDefaults();
9
11
  config = update_with_presets_1.updateWithPresets(config);
10
12
  config = update_with_package_1.updateWithPackage(config);
13
+ config = update_with_config_file_1.updateWithConfigFile(config);
11
14
  config = update_with_env_1.updateWithEnv(config);
12
15
  config = calculate_dependent_config_1.calculateDependentConfig(config);
13
16
  exports.default = config;
@@ -0,0 +1,38 @@
1
+ export declare type AppConfigs = {
2
+ appPackage: any;
3
+ name: string;
4
+ version: string;
5
+ dockerRegistry: string;
6
+ baseDockerImage: string;
7
+ cwd: string;
8
+ appSrc: string;
9
+ appNodeModules: string;
10
+ buildPath: string;
11
+ assetsPath: string;
12
+ additionalBuildPath: string[];
13
+ nginxRootPath: string;
14
+ runFromNonRootUser: boolean;
15
+ archiveName: string;
16
+ serverEntry: string | string[] | Record<string, string | string[]>;
17
+ serverOutput: string;
18
+ clientPolyfillsEntry: null | string | string[];
19
+ clientEntry: string;
20
+ keepPropTypes: boolean;
21
+ tsconfig: string | null;
22
+ localNginxConf: string | null;
23
+ localDockerfile: string | null;
24
+ useTscLoader: boolean;
25
+ useServerHMR: boolean;
26
+ useYarn: boolean;
27
+ clientServerPort: number;
28
+ serverPort: number;
29
+ debug: boolean;
30
+ overridesPath: string[];
31
+ statsOutputFilename: string;
32
+ componentsTheme: string | undefined;
33
+ keepCssVars: boolean;
34
+ publicPath: string;
35
+ serverOutputPath: string;
36
+ clientOutputPath: string;
37
+ statsOutputPath: string;
38
+ };
@@ -0,0 +1,2 @@
1
+ import { AppConfigs } from './types';
2
+ export declare function updateWithConfigFile(config: AppConfigs): AppConfigs;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.updateWithConfigFile = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const lodash_merge_1 = __importDefault(require("lodash.merge"));
9
+ const try_resolve_1 = require("../util/try-resolve");
10
+ const validate_settings_keys_1 = __importDefault(require("./validate-settings-keys"));
11
+ const available_package_settings_1 = require("./available-package-settings");
12
+ function updateWithConfigFile(config) {
13
+ const appConfigPath = try_resolve_1.tryResolve(path_1.default.join(config.cwd, '/arui-scripts.config'));
14
+ if (appConfigPath) {
15
+ let appSettings = require(appConfigPath);
16
+ if (appSettings.__esModule) {
17
+ // ts-node импортирует esModules, из них надо вытягивать default именно так
18
+ appSettings = appSettings.default;
19
+ }
20
+ validate_settings_keys_1.default(available_package_settings_1.availablePackageSettings, appSettings);
21
+ config = lodash_merge_1.default(config, appSettings);
22
+ }
23
+ return config;
24
+ }
25
+ exports.updateWithConfigFile = updateWithConfigFile;
@@ -0,0 +1,2 @@
1
+ import { AppConfigs } from './types';
2
+ export declare function updateWithEnv(config: AppConfigs): any;
@@ -0,0 +1,2 @@
1
+ import { AppConfigs } from './types';
2
+ export declare function updateWithPackage(config: AppConfigs): any;
@@ -0,0 +1,2 @@
1
+ import { AppConfigs } from './types';
2
+ export declare function updateWithPresets(config: AppConfigs): AppConfigs;
@@ -13,10 +13,14 @@ function updateWithPresets(config) {
13
13
  if (!packageSettings.presets) {
14
14
  return config;
15
15
  }
16
- const presetsConfigPath = try_resolve_1.tryResolve(`${packageSettings.presets}/arui-scripts.config.js`, { paths: [config.cwd] });
17
- const presetsOverridesPath = try_resolve_1.tryResolve(`${packageSettings.presets}/arui-scripts.overrides.js`, { paths: [config.cwd] });
16
+ const presetsConfigPath = try_resolve_1.tryResolve(`${packageSettings.presets}/arui-scripts.config`, { paths: [config.cwd] });
17
+ const presetsOverridesPath = try_resolve_1.tryResolve(`${packageSettings.presets}/arui-scripts.overrides`, { paths: [config.cwd] });
18
18
  if (presetsConfigPath) {
19
- const presetsSettings = require(presetsConfigPath);
19
+ let presetsSettings = require(presetsConfigPath);
20
+ if (presetsSettings.__esModule) {
21
+ // ts-node импортирует esModules, из них надо вытягивать default именно так
22
+ presetsSettings = presetsSettings.default;
23
+ }
20
24
  validate_settings_keys_1.default(available_package_settings_1.availablePackageSettings, presetsSettings);
21
25
  config = lodash_merge_1.default(config, presetsSettings);
22
26
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Функция проверяет что все ключи объекта settingsObject есть в массиве availableKeys
3
+ * @param {string[]} availableKeys Массив допустимых настроек
4
+ * @param settingsObject Объект с настройками
5
+ */
6
+ declare function validateSettingsKeys(availableKeys: ReadonlyArray<string>, settingsObject: Record<string, unknown>): void;
7
+ export default validateSettingsKeys;
@@ -0,0 +1,2 @@
1
+ declare const babelClientConfig: any;
2
+ export default babelClientConfig;
@@ -0,0 +1,2 @@
1
+ declare const config: any;
2
+ export default config;
@@ -0,0 +1,3 @@
1
+ /// <reference types="webpack-dev-server" />
2
+ declare const devServerConfig: import("webpack-dev-server").Configuration;
3
+ export default devServerConfig;
@@ -0,0 +1,7 @@
1
+ declare const _exports: {
2
+ canInstrument?: boolean | undefined;
3
+ createTransformer?: ((options?: any) => import("@jest/transform").Transformer) | undefined;
4
+ getCacheKey?: ((fileData: string, filePath: string, configStr: string, options: import("@jest/transform").CacheKeyOptions) => string) | undefined;
5
+ process: (sourceText: string, sourcePath: string, config: import("@jest/types/build/Config").ProjectConfig, options?: import("@jest/transform").TransformOptions | undefined) => import("@jest/transform").TransformedSource;
6
+ };
7
+ export = _exports;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function process(src: any, filename: any): string;
2
+ export declare function process(src: any, filename: any): string;
@@ -0,0 +1,19 @@
1
+ export declare const testRegex: string;
2
+ export declare const moduleFileExtensions: string[];
3
+ export declare const collectCoverageFrom: string[];
4
+ export declare const transform: {
5
+ '^.+\\.jsx?$': string;
6
+ '^.+\\.tsx?$': string;
7
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': string;
8
+ };
9
+ export declare const moduleNameMapper: {
10
+ '\\.css$': string;
11
+ };
12
+ export declare const setupFiles: string[];
13
+ export declare const snapshotSerializers: string[];
14
+ export declare const globals: {
15
+ 'ts-jest': {
16
+ tsconfig: string | null;
17
+ babelConfig: any;
18
+ };
19
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ export declare const customMedia: {
2
+ "--small": string;
3
+ "--small-only": string;
4
+ "--medium": string;
5
+ "--medium-only": string;
6
+ "--large": string;
7
+ "--large-only": string;
8
+ "--xlarge": string;
9
+ "--xlarge-only": string;
10
+ "--xxlarge": string;
11
+ "--xxlarge-only": string;
12
+ "--mobile-s": string;
13
+ "--mobile-m": string;
14
+ "--mobile-l": string;
15
+ "--mobile": string;
16
+ "--tablet-s": string;
17
+ "--tablet-m": string;
18
+ "--tablet": string;
19
+ "--desktop-s": string;
20
+ "--desktop-m": string;
21
+ "--desktop-l": string;
22
+ "--desktop-xl": string;
23
+ "--desktop": string;
24
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Функция для создания конфигурационного файла postcss
3
+ * @param {String[]} plugins список плагинов
4
+ * @param {Object} options коллекция конфигураций плагинов, где ключ - название плагина, а значение - аргумент для инициализации
5
+ * @returns {*}
6
+ */
7
+ export declare function createPostcssConfig(plugins: string[], options: Record<string, unknown>): any[];
8
+ export declare const postcssPlugins: string[];
9
+ export declare const postcssPluginsOptions: {
10
+ 'postcss-custom-properties'?: {
11
+ preserve: boolean;
12
+ importFrom: string | undefined;
13
+ };
14
+ 'postcss-import': {
15
+ path: string[];
16
+ plugins: any[];
17
+ };
18
+ 'postcss-url': {
19
+ url: string;
20
+ };
21
+ 'postcss-custom-media': {
22
+ importFrom: string;
23
+ };
24
+ 'postcss-color-mod-function': {
25
+ unresolved: string;
26
+ };
27
+ };
@@ -0,0 +1,2 @@
1
+ declare const postcssConfig: any[];
2
+ export default postcssConfig;
@@ -0,0 +1,3 @@
1
+ import type { WebpackOptionsNormalized } from 'webpack';
2
+ declare const statsOptions: WebpackOptionsNormalized['stats'];
3
+ export default statsOptions;
@@ -29,8 +29,6 @@ const statsOptions = apply_overrides_1.default('stats', {
29
29
  hash: false,
30
30
  // Add built modules information
31
31
  modules: true,
32
- // Set the maximum number of modules to be shown
33
- maxModules: 0,
34
32
  // Show dependencies and origin of warnings/errors (since webpack 2.5.0)
35
33
  moduleTrace: true,
36
34
  // Show performance hint when file size exceeds `performance.maxAssetSize`
@@ -0,0 +1,2 @@
1
+ declare const supportingBrowsers: string[];
2
+ export default supportingBrowsers;