arui-scripts 16.1.0 → 17.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.
@@ -119,11 +119,11 @@
119
119
  17:16 warning Unexpected console statement no-console
120
120
 
121
121
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/app-configs/index.ts
122
- 29:8 warning Prefer named exports import/no-default-export
122
+ 32:8 warning Prefer named exports import/no-default-export
123
123
 
124
124
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/app-configs/types.ts
125
- 84:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
126
- 103:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
125
+ 88:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
126
+ 107:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
127
127
 
128
128
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/app-configs/update-with-env.ts
129
129
  12:9 warning Unexpected console statement no-console
@@ -151,7 +151,7 @@
151
151
  71:8 warning Prefer named exports import/no-default-export
152
152
 
153
153
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/jest/index.js
154
- 47:13 warning Unexpected console statement no-console
154
+ 16:13 warning Unexpected console statement no-console
155
155
 
156
156
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/modules.ts
157
157
  9:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
@@ -210,6 +210,9 @@
210
210
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/get-entry.ts
211
211
  32:8 warning Prefer named exports import/no-default-export
212
212
 
213
+ /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/get-webpack-cache-dependencies.ts
214
+ 1:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
215
+
213
216
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/install-sourcemap-support.js
214
217
  8:5 warning Unexpected console statement no-console
215
218
 
@@ -225,9 +228,9 @@
225
228
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.client.ts
226
229
  4:1 warning Run autofix to sort these imports! simple-import-sort/imports
227
230
  24:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
228
- 163:47 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
229
- 182:58 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
230
- 425:52 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
231
+ 164:47 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
232
+ 183:58 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
233
+ 427:52 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
231
234
 
232
235
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.server.dev.ts
233
236
  12:8 warning Prefer named exports import/no-default-export
@@ -236,8 +239,9 @@
236
239
  12:8 warning Prefer named exports import/no-default-export
237
240
 
238
241
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.server.ts
242
+ 3:1 warning Run autofix to sort these imports! simple-import-sort/imports
239
243
  14:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
240
- 64:47 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
244
+ 65:47 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
241
245
 
242
246
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/plugins/postcss-prefix-selector.ts
243
247
  42:100 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
@@ -264,6 +268,6 @@
264
268
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/types.d.ts
265
269
  4:12 warning Prefer named exports import/no-default-export
266
270
 
267
- ✖ 147 problems (0 errors, 147 warnings)
268
- 0 errors and 1 warning potentially fixable with the `--fix` option.
271
+ ✖ 149 problems (0 errors, 149 warnings)
272
+ 0 errors and 2 warnings potentially fixable with the `--fix` option.
269
273
 
@@ -1,96 +1,17 @@
1
- PASS src/configs/util/__tests__/get-polyfills.tests.ts (34.463 s)
2
- PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (34.505 s)
3
- PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
4
- ● Console
5
-
6
- console.warn
7
- Используйте ARUI_SCRIPTS_CONFIG только для отладки
8
-
9
- 10 |
10
- 11 | try {
11
- > 12 | console.warn('Используйте ARUI_SCRIPTS_CONFIG только для отладки');
12
- | ^
13
- 13 | const envSettings = JSON.parse(process.env.ARUI_SCRIPTS_CONFIG);
14
- 14 |
15
- 15 | validateSettingsKeys(config, envSettings, 'ENV');
16
-
17
- at updateWithEnv (src/configs/app-configs/update-with-env.ts:12:17)
18
- at src/configs/app-configs/__tests__/update-with-env.tests.ts:30:26
19
- at Object.<anonymous> (../../node_modules/expect/build/toThrowMatchers.js:83:11)
20
- at Object.throwingMatcher [as toThrowError] (../../node_modules/expect/build/index.js:342:21)
21
- at Object.<anonymous> (src/configs/app-configs/__tests__/update-with-env.tests.ts:31:12)
22
-
23
- console.error
24
- SyntaxError: Unexpected token o in JSON at position 1
25
- at JSON.parse (<anonymous>)
26
- at updateWithEnv (/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/app-configs/update-with-env.ts:13:34)
27
- at /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/app-configs/__tests__/update-with-env.tests.ts:30:26
28
- at Object.<anonymous> (/home/runner/work/arui-scripts/arui-scripts/node_modules/expect/build/toThrowMatchers.js:83:11)
29
- at Object.throwingMatcher [as toThrowError] (/home/runner/work/arui-scripts/arui-scripts/node_modules/expect/build/index.js:342:21)
30
- at Object.<anonymous> (/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/app-configs/__tests__/update-with-env.tests.ts:31:12)
31
- at Promise.then.completed (/home/runner/work/arui-scripts/arui-scripts/node_modules/jest-circus/build/utils.js:333:28)
32
- at new Promise (<anonymous>)
33
- at callAsyncCircusFn (/home/runner/work/arui-scripts/arui-scripts/node_modules/jest-circus/build/utils.js:259:10)
34
- at _callCircusTest (/home/runner/work/arui-scripts/arui-scripts/node_modules/jest-circus/build/run.js:277:40)
35
-
36
- 17 | return merge(config, envSettings);
37
- 18 | } catch (e) {
38
- > 19 | console.error(e);
39
- | ^
40
- 20 | throw Error(
41
- 21 | 'Not valid JSON passed. Correct it. For example: ARUI_SCRIPTS_CONFIG="{"serverPort":3333}"',
42
- 22 | );
43
-
44
- at updateWithEnv (src/configs/app-configs/update-with-env.ts:19:17)
45
- at src/configs/app-configs/__tests__/update-with-env.tests.ts:30:26
46
- at Object.<anonymous> (../../node_modules/expect/build/toThrowMatchers.js:83:11)
47
- at Object.throwingMatcher [as toThrowError] (../../node_modules/expect/build/index.js:342:21)
48
- at Object.<anonymous> (src/configs/app-configs/__tests__/update-with-env.tests.ts:31:12)
49
-
50
- console.warn
51
- Используйте ARUI_SCRIPTS_CONFIG только для отладки
52
-
53
- 10 |
54
- 11 | try {
55
- > 12 | console.warn('Используйте ARUI_SCRIPTS_CONFIG только для отладки');
56
- | ^
57
- 13 | const envSettings = JSON.parse(process.env.ARUI_SCRIPTS_CONFIG);
58
- 14 |
59
- 15 | validateSettingsKeys(config, envSettings, 'ENV');
60
-
61
- at updateWithEnv (src/configs/app-configs/update-with-env.ts:12:17)
62
- at Object.<anonymous> (src/configs/app-configs/__tests__/update-with-env.tests.ts:40:44)
63
-
1
+ PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (33.883 s)
2
+ PASS src/configs/util/__tests__/get-polyfills.tests.ts (34.135 s)
64
3
  PASS src/configs/util/__tests__/apply-overrides.tests.ts
4
+ PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
65
5
  PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
66
6
  PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
67
- ● Console
68
-
69
- console.warn
70
- Неизвестная настройка "country" в конфигурации
71
-
72
- 9 | Object.keys(settingsObject).forEach((setting) => {
73
- 10 | if (typeof existingConfig[setting] === 'undefined') {
74
- > 11 | console.warn(`Неизвестная настройка "${setting}" в ${source || 'конфигурации'}`);
75
- | ^
76
- 12 | }
77
- 13 | });
78
- 14 | }
79
-
80
- at console.<anonymous> (../../node_modules/jest-mock/build/index.js:839:25)
81
- at src/configs/app-configs/validate-settings-keys.ts:11:21
82
- at Array.forEach (<anonymous>)
83
- at validateSettingsKeys (src/configs/app-configs/validate-settings-keys.ts:9:33)
84
- at Object.<anonymous> (src/configs/app-configs/__tests__/validate-settings-keys.tests.ts:15:29)
85
-
86
7
  Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
87
8
  Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
88
9
  Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
89
10
  Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
90
- PASS src/configs/util/__tests__/find-plugin.tests.ts (39.676 s)
11
+ PASS src/configs/util/__tests__/find-plugin.tests.ts (38.316 s)
91
12
 
92
13
  Test Suites: 7 passed, 7 total
93
14
  Tests: 21 passed, 21 total
94
15
  Snapshots: 0 total
95
- Time: 41.378 s
16
+ Time: 40.166 s
96
17
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # [15.3.0](https://github.com/core-ds/arui-scripts/compare/v15.2.0...v15.3.0) (2023-06-30)
2
2
 
3
+ ## 17.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#209](https://github.com/core-ds/arui-scripts/pull/209) [`4ae24e3`](https://github.com/core-ds/arui-scripts/commit/4ae24e35fd9234c9a819fcaef6dc81f06287d2b1) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - Теперь по умолчанию jest будет использовать babel для преобразования ts-кода. Если по какой-то причине это
8
+ вас не устраивает - вы можете использовать настройку `jestUseTsJest`.
9
+
10
+ - [#210](https://github.com/core-ds/arui-scripts/pull/210) [`156f551`](https://github.com/core-ds/arui-scripts/commit/156f5514003339470afcae571a1b5b5deed6837a) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - disableDevWebpackTypecheck теперь включён по умолчанию. Это означает что в консоль вашего браузера больше не будут
11
+ попадать ошибки тайпскрипта, так же ошибки больше не будут останавливать дев сборку.
12
+
13
+ В дев режиме тайп чекинг будет писать сообщения об ошибках только в stdout процесса сборщика.
14
+
15
+ Это позволяет значительно ускорить сборку, особенно в проектах со многими конфигурациями вебпака (десктоп/мобилка, модули и тд).
16
+
17
+ Если вы хотите вернуть старое поведение - вы можете это сделать установив настройку `disableDevWebpackTypecheck` в `false`.
18
+
19
+ - [#208](https://github.com/core-ds/arui-scripts/pull/208) [`cb515e1`](https://github.com/core-ds/arui-scripts/commit/cb515e1255b8fae812b01d7b965b4a8a2ad416ef) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - Флаг useTscLoader помечен как deprecated
20
+
21
+ ### Minor Changes
22
+
23
+ - [#213](https://github.com/core-ds/arui-scripts/pull/213) [`6eff863`](https://github.com/core-ds/arui-scripts/commit/6eff863b3ca56b1f77fb16f5c46afccd802621bd) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - Улучшен механизм инвалидации кешей вебпака
24
+
3
25
  ## 16.1.0
4
26
 
5
27
  ### Minor Changes
@@ -32,6 +32,7 @@ export declare function calculateDependentConfig(config: AppConfigs): {
32
32
  webpack4Compatibility: boolean;
33
33
  installServerSourceMaps: boolean;
34
34
  disableDevWebpackTypecheck: boolean;
35
+ jestUseTsJest: boolean;
35
36
  dataUrlMaxSize?: number | undefined;
36
37
  imageMinimizer?: {
37
38
  svg?: {
@@ -46,7 +46,8 @@ function getDefaultAppConfig() {
46
46
  useTscLoader: false,
47
47
  webpack4Compatibility: false,
48
48
  installServerSourceMaps: false,
49
- disableDevWebpackTypecheck: false,
49
+ disableDevWebpackTypecheck: true,
50
+ jestUseTsJest: false,
50
51
  // image processing
51
52
  dataUrlMaxSize: 1536,
52
53
  imageMinimizer: {
@@ -7,6 +7,7 @@ const update_with_config_file_1 = require("./update-with-config-file");
7
7
  const update_with_env_1 = require("./update-with-env");
8
8
  const update_with_package_1 = require("./update-with-package");
9
9
  const update_with_presets_1 = require("./update-with-presets");
10
+ const warn_about_deprecations_1 = require("./warn-about-deprecations");
10
11
  require("../util/register-ts-node");
11
12
  let tmpConfig = (0, get_defaults_1.getDefaultAppConfig)();
12
13
  let tmpContext = (0, get_defaults_1.getDefaultAppContext)();
@@ -19,4 +20,5 @@ tmpContext = (0, calculate_dependent_config_1.calculateDependentContext)(tmpConf
19
20
  exports.appContext = tmpContext;
20
21
  exports.appConfigs = tmpConfig;
21
22
  exports.configs = Object.assign(Object.assign({}, exports.appConfigs), exports.appContext);
23
+ (0, warn_about_deprecations_1.warnAboutDeprecations)(exports.configs);
22
24
  exports.default = exports.configs;
@@ -1 +1,2 @@
1
1
  export declare function readConfigFile(cwd: string): any;
2
+ export declare function getConfigFilePath(cwd: string): string | undefined;
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.readConfigFile = void 0;
6
+ exports.getConfigFilePath = exports.readConfigFile = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const resolve_1 = require("../util/resolve");
9
9
  function readConfigFile(cwd) {
10
- const appConfigPath = (0, resolve_1.tryResolve)(path_1.default.join(cwd, '/arui-scripts.config'));
10
+ const appConfigPath = getConfigFilePath(cwd);
11
11
  if (appConfigPath) {
12
12
  // Мы не можем использовать импорты, нам нужен именно require, потому что мы не знаем заранее не только путь до файла,
13
13
  // но и то, на каком языке он написан
@@ -23,3 +23,7 @@ function readConfigFile(cwd) {
23
23
  return null;
24
24
  }
25
25
  exports.readConfigFile = readConfigFile;
26
+ function getConfigFilePath(cwd) {
27
+ return (0, resolve_1.tryResolve)(path_1.default.join(cwd, '/arui-scripts.config'));
28
+ }
29
+ exports.getConfigFilePath = getConfigFilePath;
@@ -28,10 +28,14 @@ export type AppConfigs = {
28
28
  removeDevDependenciesDuringDockerBuild: boolean;
29
29
  archiveName: string;
30
30
  keepPropTypes: boolean;
31
+ /**
32
+ * @deprecated использование ts-loader крайне не рекомендуется - он медленнее и не имеет преимуществ перед babel
33
+ */
31
34
  useTscLoader: boolean;
32
35
  webpack4Compatibility: boolean;
33
36
  installServerSourceMaps: boolean;
34
37
  disableDevWebpackTypecheck: boolean;
38
+ jestUseTsJest: boolean;
35
39
  dataUrlMaxSize?: number;
36
40
  imageMinimizer?: {
37
41
  svg?: {
@@ -1,2 +1,3 @@
1
1
  import { AppConfigs, AppContext } from './types';
2
2
  export declare function updateWithPresets(config: AppConfigs, context: AppContext): AppConfigs;
3
+ export declare function getPresetsConfigPath(config: AppConfigs, cwd: string): string | undefined;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateWithPresets = void 0;
6
+ exports.getPresetsConfigPath = exports.updateWithPresets = void 0;
7
7
  // TODO: remove eslint-disable-next-line
8
8
  const lodash_merge_1 = __importDefault(require("lodash.merge"));
9
9
  const resolve_1 = require("../util/resolve");
@@ -12,9 +12,7 @@ function updateWithPresets(config, context) {
12
12
  if (!config.presets) {
13
13
  return config;
14
14
  }
15
- const presetsConfigPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.config`, {
16
- paths: [context.cwd],
17
- });
15
+ const presetsConfigPath = getPresetsConfigPath(config, context.cwd);
18
16
  const presetsOverridesPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.overrides`, {
19
17
  paths: [context.cwd],
20
18
  });
@@ -36,3 +34,9 @@ function updateWithPresets(config, context) {
36
34
  return config;
37
35
  }
38
36
  exports.updateWithPresets = updateWithPresets;
37
+ function getPresetsConfigPath(config, cwd) {
38
+ return (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.config`, {
39
+ paths: [cwd],
40
+ });
41
+ }
42
+ exports.getPresetsConfigPath = getPresetsConfigPath;
@@ -0,0 +1,2 @@
1
+ import { AppContextWithConfigs } from './types';
2
+ export declare function warnAboutDeprecations(config: AppContextWithConfigs): void;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.warnAboutDeprecations = void 0;
4
+ function warnAboutDeprecations(config) {
5
+ if (config.useTscLoader) {
6
+ // eslint-disable-next-line no-console
7
+ console.warn('Использование опции `useTscLoader` не рекомендуется и будет удалено в будущих версиях. ', 'Обратитесь к документации https://github.com/core-ds/arui-scripts/blob/master/packages/arui-scripts/docs/settings.md#usetscloader', 'для получения дополнительной информации.');
8
+ }
9
+ }
10
+ exports.warnAboutDeprecations = warnAboutDeprecations;
@@ -1,50 +1,23 @@
1
- export const testRegex: string;
2
- export const moduleFileExtensions: string[];
3
- export const collectCoverageFrom: string[];
4
- export const transform: {
5
- '^.+\\.jsx?$': string;
6
- '^.+\\.tsx?$': string;
7
- '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': string;
8
- };
9
- export const moduleNameMapper: {
10
- '\\.css$': string;
11
- };
12
- export const snapshotSerializers: string[];
13
- export const globals: {
14
- 'ts-jest': {
15
- tsconfig: string | null;
16
- babelConfig: {
17
- presets: (string | false | (string | {
18
- targets: {
19
- browsers: string[];
20
- };
21
- loose: boolean;
22
- useBuiltIns: string;
23
- corejs: number;
24
- exclude: string[];
25
- })[])[];
26
- plugins: (string | (string | {
27
- legacy: boolean;
28
- })[] | (string | {
29
- loose: boolean;
30
- })[] | (string | {
31
- useBuiltIns: boolean;
32
- })[] | (string | {
33
- corejs: boolean;
34
- helpers: boolean;
35
- version: string;
36
- regenerator: boolean;
37
- })[])[];
38
- env: {
39
- production: {
40
- plugins: (string | (string | {
41
- removeImport: boolean;
42
- })[])[];
43
- };
44
- test: {
45
- plugins: string[];
46
- };
47
- };
1
+ declare const _exports: {
2
+ testRegex: string;
3
+ moduleFileExtensions: string[];
4
+ collectCoverageFrom: string[];
5
+ testEnvironmentOptions: {
6
+ url: string;
7
+ };
8
+ transform: {
9
+ '^.+\\.jsx?$': string;
10
+ '^.+\\.tsx?$': string;
11
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': string;
12
+ };
13
+ moduleNameMapper: {
14
+ '\\.css$': string;
15
+ };
16
+ snapshotSerializers: string[];
17
+ globals: {
18
+ 'ts-jest': {
19
+ tsconfig: string | null;
48
20
  };
49
21
  };
50
22
  };
23
+ export = _exports;
@@ -1,38 +1,10 @@
1
1
  "use strict";
2
2
  // TODO: remove eslint-disable
3
- /* eslint-disable global-require */
4
3
  /* eslint-disable @typescript-eslint/no-var-requires */
5
- const fs = require('fs');
6
- const { pathsToModuleNameMapper } = require('ts-jest');
7
- const { parseConfigFileTextToJson } = require('typescript');
8
4
  const merge = require('lodash.merge');
9
5
  const configs = require('../app-configs').default;
10
- const tsConfigPath = configs.tsconfig;
11
- const tsConfigText = fs.readFileSync(configs.tsconfig, 'utf8');
12
- const tsConfig = parseConfigFileTextToJson(tsConfigPath, tsConfigText);
13
- const tsConfigPaths = tsConfig.config.compilerOptions.paths || {};
14
- const defaultJestConfig = {
15
- testRegex: '(^.*src).*(((/__test__/|/__tests__/).*)|(test|spec|tests)).(jsx?|tsx?)$',
16
- moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
17
- collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
18
- // transform project js and ts files using babel ant ts transformers
19
- transform: {
20
- '^.+\\.jsx?$': require.resolve('./babel-transform'),
21
- '^.+\\.tsx?$': require.resolve('ts-jest'),
22
- // transform other files to simple empty strings
23
- '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./file-transform'),
24
- },
25
- moduleNameMapper: Object.assign({
26
- // replace all css files with simple empty exports
27
- '\\.css$': require.resolve('./css-mock') }, pathsToModuleNameMapper(tsConfigPaths, { prefix: '<rootDir>/' })),
28
- snapshotSerializers: [require.resolve('jest-snapshot-serializer-class-name-to-string')],
29
- globals: {
30
- 'ts-jest': {
31
- tsconfig: configs.tsconfig,
32
- babelConfig: require('../babel-client').default,
33
- },
34
- },
35
- };
6
+ const aruiJestPresets = require('./settings');
7
+ const defaultJestConfig = aruiJestPresets;
36
8
  let appJestConfig = {};
37
9
  if (configs.appPackage.jest) {
38
10
  appJestConfig = configs.appPackage.jest;
@@ -0,0 +1,20 @@
1
+ export const testRegex: string;
2
+ export const moduleFileExtensions: string[];
3
+ export const collectCoverageFrom: string[];
4
+ export namespace testEnvironmentOptions {
5
+ const url: string;
6
+ }
7
+ export const transform: {
8
+ '^.+\\.jsx?$': string;
9
+ '^.+\\.tsx?$': string;
10
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': string;
11
+ };
12
+ export const moduleNameMapper: {
13
+ '\\.css$': string;
14
+ };
15
+ export const snapshotSerializers: string[];
16
+ export const globals: {
17
+ 'ts-jest': {
18
+ tsconfig: string | null;
19
+ };
20
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // Мы используем эти настройки сразу в двух местах - в jest-presets и в настройках jest-а, которые мы загружаем в самих скриптах
4
+ // jest-presets могут использоваться внешними утилитами, которые используют разработчики, настройки в скриптах
5
+ // используются при запуске `arui-scripts test`. Посколько в jest жестко зафиксировано где именно должен лежать файл с пресетами
6
+ // нам приходится отвязывать его от основного кода скриптов
7
+ const fs = require('fs');
8
+ const { pathsToModuleNameMapper } = require('ts-jest');
9
+ const { parseConfigFileTextToJson } = require('typescript');
10
+ const configs = require('../app-configs').default;
11
+ let tsConfigPaths = {};
12
+ if (configs.tsconfig) {
13
+ const tsConfigText = fs.readFileSync(configs.tsconfig, 'utf8');
14
+ const tsConfig = parseConfigFileTextToJson(configs.tsconfig, tsConfigText);
15
+ tsConfigPaths = tsConfig.config.compilerOptions.paths || {};
16
+ }
17
+ module.exports = {
18
+ testRegex: 'src/.*(((/__test__/|/__tests__/).*)|(test|spec|tests)).(jsx?|tsx?)$',
19
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
20
+ collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
21
+ testEnvironmentOptions: {
22
+ url: 'http://localhost',
23
+ },
24
+ transform: {
25
+ '^.+\\.jsx?$': require.resolve('./babel-transform'),
26
+ '^.+\\.tsx?$': configs.jestUseTsJest
27
+ ? require.resolve('ts-jest')
28
+ : require.resolve('./babel-transform'),
29
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./file-transform')
30
+ },
31
+ moduleNameMapper: Object.assign({
32
+ // replace all css files with simple empty exports
33
+ '\\.css$': require.resolve('./css-mock') }, pathsToModuleNameMapper(tsConfigPaths, { prefix: '<rootDir>/' })),
34
+ snapshotSerializers: [
35
+ require.resolve('jest-snapshot-serializer-class-name-to-string')
36
+ ],
37
+ globals: {
38
+ 'ts-jest': {
39
+ tsconfig: configs.tsconfig,
40
+ },
41
+ },
42
+ };
@@ -0,0 +1 @@
1
+ export declare function getWebpackCacheDependencies(): Record<string, string[]>;
@@ -0,0 +1,19 @@
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.getWebpackCacheDependencies = void 0;
7
+ const app_configs_1 = __importDefault(require("../app-configs"));
8
+ const read_config_file_1 = require("../app-configs/read-config-file");
9
+ const update_with_presets_1 = require("../app-configs/update-with-presets");
10
+ function getWebpackCacheDependencies() {
11
+ return {
12
+ overrides: app_configs_1.default.overridesPath,
13
+ appConfigs: [
14
+ (0, read_config_file_1.getConfigFilePath)(app_configs_1.default.cwd),
15
+ (0, update_with_presets_1.getPresetsConfigPath)(app_configs_1.default, app_configs_1.default.cwd),
16
+ ].filter(Boolean),
17
+ };
18
+ }
19
+ exports.getWebpackCacheDependencies = getWebpackCacheDependencies;
@@ -32,6 +32,7 @@ const modules_1 = require("./modules");
32
32
  const postcss_1 = __importDefault(require("./postcss"));
33
33
  const process_assets_plugin_output_1 = require("./process-assets-plugin-output");
34
34
  const arui_runtime_1 = require("../plugins/arui-runtime");
35
+ const get_webpack_cache_dependencies_1 = require("./util/get-webpack-cache-dependencies");
35
36
  const PnpWebpackPlugin = require('pnp-webpack-plugin');
36
37
  const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
37
38
  const noopPath = require.resolve('./util/noop');
@@ -207,9 +208,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
207
208
  }, cache: mode === 'dev'
208
209
  ? {
209
210
  type: 'filesystem',
210
- buildDependencies: {
211
- config: [__filename],
212
- },
211
+ buildDependencies: Object.assign({ config: [__filename] }, (0, get_webpack_cache_dependencies_1.getWebpackCacheDependencies)()),
213
212
  }
214
213
  : false, module: {
215
214
  // typescript interface will be removed from modules, and we will get an error on correct code
@@ -370,9 +369,10 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
370
369
  chunkFilename: mode === 'dev' ? '[id].css' : '[name].[contenthash:8].chunk.css',
371
370
  insert: (0, arui_runtime_1.getInsertCssRuntimeMethod)(),
372
371
  }),
373
- (mode === 'prod' || !app_configs_1.default.disableDevWebpackTypecheck) &&
374
- app_configs_1.default.tsconfig !== null &&
375
- new fork_ts_checker_webpack_plugin_1.default(),
372
+ (mode === 'prod' || !app_configs_1.default.disableDevWebpackTypecheck)
373
+ && app_configs_1.default.tsconfig !== null
374
+ && !app_configs_1.default.useTscLoader
375
+ && new fork_ts_checker_webpack_plugin_1.default(),
376
376
  // moment.js очень большая библиотека, которая включает в себя массу локализаций, которые мы не используем.
377
377
  // Поэтому мы их просто игнорируем, чтобы не включать в сборку.
378
378
  // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
@@ -20,6 +20,7 @@ const babel_dependencies_1 = require("./babel-dependencies");
20
20
  const babel_server_1 = __importDefault(require("./babel-server"));
21
21
  const postcss_1 = __importDefault(require("./postcss"));
22
22
  const server_externals_exemptions_1 = require("./server-externals-exemptions");
23
+ const get_webpack_cache_dependencies_1 = require("./util/get-webpack-cache-dependencies");
23
24
  const ReloadServerPlugin = require('../plugins/reload-server-webpack-plugin');
24
25
  const WatchMissingNodeModulesPlugin = require('../plugins/watch-missing-node-modules-plugin');
25
26
  const assetsIgnoreBanner = fs_1.default.readFileSync(require.resolve('./util/node-assets-ignore'), 'utf8');
@@ -61,9 +62,7 @@ const createServerConfig = (mode) => ({
61
62
  ? {
62
63
  type: 'filesystem',
63
64
  name: 'server',
64
- buildDependencies: {
65
- config: [__filename],
66
- },
65
+ buildDependencies: Object.assign({ config: [__filename] }, (0, get_webpack_cache_dependencies_1.getWebpackCacheDependencies)()),
67
66
  }
68
67
  : false,
69
68
  externalsPresets: { node: true },