arui-scripts 18.2.0 → 18.4.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.
@@ -149,7 +149,7 @@
149
149
  66:47 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
150
150
 
151
151
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/plugins/postcss-prefix-selector.ts
152
- 38:79 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
152
+ 40:79 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
153
153
 
154
154
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/dockerfile-compiled.template.ts
155
155
  2:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
@@ -1,20 +1,24 @@
1
+ ts-jest[versions] (WARN) Version 29.7.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=28.0.0 <29.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
2
+ ts-jest[versions] (WARN) Version 29.7.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=28.0.0 <29.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
3
+ ts-jest[versions] (WARN) Version 29.7.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=28.0.0 <29.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
4
+ ts-jest[versions] (WARN) Version 29.7.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=28.0.0 <29.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
1
5
  ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
2
6
  ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
3
7
  ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
4
- PASS src/configs/util/__tests__/get-polyfills.tests.ts (31.522 s)
5
- PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (32.969 s)
8
+ PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (33.169 s)
6
9
  PASS src/configs/util/__tests__/apply-overrides.tests.ts
7
- PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
8
10
  PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
11
+ PASS src/configs/util/__tests__/get-polyfills.tests.ts (34.718 s)
12
+ PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
9
13
  PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
10
14
  Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
11
15
  Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
12
16
  Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
13
17
  Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
14
- PASS src/configs/util/__tests__/find-plugin.tests.ts (42.181 s)
18
+ PASS src/configs/util/__tests__/find-plugin.tests.ts (43.016 s)
15
19
 
16
20
  Test Suites: 7 passed, 7 total
17
21
  Tests: 21 passed, 21 total
18
22
  Snapshots: 0 total
19
- Time: 44.125 s
23
+ Time: 44.555 s
20
24
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+ ## 18.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#282](https://github.com/core-ds/arui-scripts/pull/282) [`5c94eea`](https://github.com/core-ds/arui-scripts/commit/5c94eea4895e3c4094fbb0824d22f6c547f86ec5) Thanks [@e-ogri](https://github.com/e-ogri)! - Добавление возможности использовать preset в jest конфигурации приложений, для переопределения настроек тестирования
8
+
9
+ ## 18.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#283](https://github.com/core-ds/arui-scripts/pull/283) [`c84f2f6`](https://github.com/core-ds/arui-scripts/commit/c84f2f6260101a886b86029841f6fce4b3145ead) Thanks [@dryabinin94](https://github.com/dryabinin94)! - Исправление реализации префикса для :root селектора для правильной работы css переменных
14
+
3
15
  ## 18.2.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1 @@
1
+ export declare const getJestConfig: () => Promise<any>;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __rest = (this && this.__rest) || function (s, e) {
35
+ var t = {};
36
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
37
+ t[p] = s[p];
38
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
39
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
40
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
41
+ t[p[i]] = s[p[i]];
42
+ }
43
+ return t;
44
+ };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.getJestConfig = void 0;
50
+ const fs_1 = __importDefault(require("fs"));
51
+ const path_1 = __importDefault(require("path"));
52
+ const jest_config_1 = require("jest-config");
53
+ const jest_resolve_1 = __importDefault(require("jest-resolve"));
54
+ const lodash_merge_1 = __importDefault(require("lodash.merge"));
55
+ const app_configs_1 = require("../../configs/app-configs");
56
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
+ // @ts-ignore
58
+ const settings_1 = __importDefault(require("../../configs/jest/settings"));
59
+ const PRESET_EXTENSIONS = ['.json', '.js', '.cjs', '.mjs'];
60
+ const PRESET_NAME = 'jest-preset';
61
+ const getJestConfig = () => __awaiter(void 0, void 0, void 0, function* () {
62
+ const _a = yield getAppJestConfig(), { preset } = _a, appJestConfig = __rest(_a, ["preset"]);
63
+ let presetConfig = {};
64
+ if (preset) {
65
+ presetConfig = yield getPresetConfig(preset);
66
+ }
67
+ return (0, lodash_merge_1.default)(settings_1.default, presetConfig, appJestConfig);
68
+ });
69
+ exports.getJestConfig = getJestConfig;
70
+ function getAppJestConfig() {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const jestConfigPath = path_1.default.resolve(process.cwd(), 'jest.config.js');
73
+ if (fs_1.default.existsSync(jestConfigPath)) {
74
+ return (yield Promise.resolve(`${jestConfigPath}`).then(s => __importStar(require(s)))).default;
75
+ }
76
+ if (app_configs_1.configs.appPackage.jest) {
77
+ return app_configs_1.configs.appPackage.jest;
78
+ }
79
+ return {};
80
+ });
81
+ }
82
+ function getPresetConfig(presetPath) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ if (!presetPath) {
85
+ return {};
86
+ }
87
+ const rootDir = process.cwd();
88
+ const normalizedPresetPath = (0, jest_config_1.replaceRootDirInPath)(rootDir, presetPath);
89
+ const presetModule = jest_resolve_1.default.findNodeModule(normalizedPresetPath.startsWith('.')
90
+ ? normalizedPresetPath
91
+ : path_1.default.join(normalizedPresetPath, PRESET_NAME), {
92
+ basedir: rootDir,
93
+ extensions: PRESET_EXTENSIONS,
94
+ });
95
+ if (!presetModule) {
96
+ throw new Error(`Cannot find module '${normalizedPresetPath}'`);
97
+ }
98
+ const _a = (yield Promise.resolve(`${presetModule}`).then(s => __importStar(require(s)))).default, { preset: subPreset } = _a, preset = __rest(_a, ["preset"]);
99
+ if (subPreset) {
100
+ console.warn(`Jest can't handle preset chaining. Preset "${subPreset}" will be ignored.`);
101
+ }
102
+ return preset;
103
+ });
104
+ }
@@ -1,3 +1 @@
1
- declare const jestRunner: any;
2
- declare const jestConfig: any;
3
- declare const argv: string[];
1
+ export {};
@@ -1,16 +1,43 @@
1
1
  "use strict";
2
- // TODO: remove eslint-disable and eslint-disable-next-line
3
- /* eslint-disable @typescript-eslint/no-var-requires */
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ const jestRunner = __importStar(require("jest"));
36
+ const get_config_1 = require("./get-config");
4
37
  // Do this as the first thing so that any code reading it knows the right env.
5
38
  process.env.BABEL_ENV = 'test';
6
39
  process.env.NODE_ENV = 'test';
7
40
  process.env.PUBLIC_URL = '';
8
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
9
- // @ts-ignore
10
- const jestRunner = require('jest');
11
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
12
- // @ts-ignore
13
- const jestConfig = require('../../configs/jest');
14
41
  // Makes the script crash on unhandled rejections instead of silently
15
42
  // ignoring them. In the future, promise rejections that are not handled will
16
43
  // terminate the Node.js process with a non-zero exit code.
@@ -22,5 +49,12 @@ process.on('unhandledRejection', (err) => {
22
49
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
50
  // @ts-ignore
24
51
  const argv = process.argv.slice(3);
25
- argv.push('--config', JSON.stringify(jestConfig));
26
- jestRunner.run(argv);
52
+ const runJest = () => __awaiter(void 0, void 0, void 0, function* () {
53
+ const jestConfig = yield (0, get_config_1.getJestConfig)();
54
+ argv.push('--config', JSON.stringify(jestConfig));
55
+ jestRunner.run(argv);
56
+ });
57
+ runJest().catch((error) => {
58
+ console.error('Error running Jest:', error);
59
+ process.exit(1);
60
+ });
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.postCssPrefix = void 0;
4
4
  const VisitedRule = Symbol('VisitedRule');
5
+ const ROOT_SELECTOR = ':root';
5
6
  const KEYFRAME_RULES = ['keyframes', '-webkit-keyframes', '-moz-keyframes', '-o-keyframes'];
6
7
  const postCssPrefix = (options) => {
7
8
  const prefix = (options === null || options === void 0 ? void 0 : options.prefix) || '.prefix ';
@@ -25,7 +26,17 @@ const postCssPrefix = (options) => {
25
26
  // если хотя бы один из родителей (кроме root) был посещен, то не добавляем префикс
26
27
  return;
27
28
  }
28
- rule.selectors = rule.selectors.map((selector) => `${prefix}${selector}`);
29
+ rule.selectors = rule.selectors.map((selector) => {
30
+ /**
31
+ * Оборачивам только самим префиксом без :root.
32
+ * Позволяет инкапсулировать css переменные под классом.
33
+ * В таком случае они будут доступны в модулях приложений после использования флага keepCssVars.
34
+ */
35
+ if (selector === ROOT_SELECTOR) {
36
+ return prefix;
37
+ }
38
+ return `${prefix}${selector}`;
39
+ });
29
40
  });
30
41
  },
31
42
  };