arui-scripts 18.3.0 → 18.5.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.
- package/.turbo/turbo-lint.log +11 -8
- package/.turbo/turbo-test.log +9 -5
- package/CHANGELOG.md +26 -0
- package/build/commands/docker-build/index.js +2 -0
- package/build/commands/docker-build-compiled/index.js +2 -0
- package/build/commands/test/get-config.d.ts +1 -0
- package/build/commands/test/get-config.js +104 -0
- package/build/commands/test/index.d.ts +1 -3
- package/build/commands/test/index.js +44 -10
- package/build/commands/util/docker-build.d.ts +2 -1
- package/build/commands/util/docker-build.js +20 -5
- package/build/configs/app-configs/get-defaults.d.ts +2 -0
- package/build/configs/app-configs/get-defaults.js +7 -1
- package/build/configs/app-configs/types.d.ts +8 -0
- package/build/configs/util/apply-overrides.d.ts +1 -0
- package/build/templates/base-nginx.conf.template.d.ts +2 -0
- package/build/templates/base-nginx.conf.template.js +61 -0
- package/build/templates/dockerfile-compiled.template.js +3 -0
- package/build/templates/dockerfile.template.js +3 -0
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/docs/overrides.md +3 -0
- package/docs/settings.md +16 -0
- package/package.json +5 -3
- package/build/configs/jest/index.d.ts +0 -24
- package/build/configs/jest/index.js +0 -19
package/.turbo/turbo-lint.log
CHANGED
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
32:8 warning Prefer named exports import/no-default-export
|
|
50
50
|
|
|
51
51
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/app-configs/types.ts
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
105:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
53
|
+
128:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
54
54
|
|
|
55
55
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/babel-client.ts
|
|
56
56
|
69:8 warning Prefer named exports import/no-default-export
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
28:18 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
108
108
|
29:24 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
109
109
|
36:14 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
50:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
111
|
+
128:48 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
112
|
+
151:8 warning Prefer named exports import/no-default-export
|
|
113
113
|
|
|
114
114
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/check-node-version.ts
|
|
115
115
|
7:8 warning Prefer named exports import/no-default-export
|
|
@@ -151,12 +151,15 @@
|
|
|
151
151
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/plugins/postcss-prefix-selector.ts
|
|
152
152
|
40:79 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
153
153
|
|
|
154
|
+
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/base-nginx.conf.template.ts
|
|
155
|
+
62:8 warning Prefer named exports import/no-default-export
|
|
156
|
+
|
|
154
157
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/dockerfile-compiled.template.ts
|
|
155
158
|
2:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
|
|
156
|
-
|
|
159
|
+
52:8 warning Prefer named exports import/no-default-export
|
|
157
160
|
|
|
158
161
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/dockerfile.template.ts
|
|
159
|
-
|
|
162
|
+
40:8 warning Prefer named exports import/no-default-export
|
|
160
163
|
|
|
161
164
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/nginx.conf.template.ts
|
|
162
165
|
36:8 warning Prefer named exports import/no-default-export
|
|
@@ -167,6 +170,6 @@
|
|
|
167
170
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/types.d.ts
|
|
168
171
|
4:12 warning Prefer named exports import/no-default-export
|
|
169
172
|
|
|
170
|
-
✖
|
|
173
|
+
✖ 77 problems (0 errors, 77 warnings)
|
|
171
174
|
0 errors and 2 warnings potentially fixable with the `--fix` option.
|
|
172
175
|
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -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 (
|
|
5
|
-
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (34.017 s)
|
|
8
|
+
PASS src/configs/util/__tests__/get-polyfills.tests.ts (22 s)
|
|
6
9
|
PASS src/configs/util/__tests__/apply-overrides.tests.ts
|
|
7
10
|
PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
|
|
8
|
-
PASS src/configs/app-configs/__tests__/update-with-
|
|
11
|
+
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (23.524 s)
|
|
9
12
|
PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
|
|
13
|
+
PASS src/configs/app-configs/__tests__/update-with-package.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 (
|
|
18
|
+
PASS src/configs/util/__tests__/find-plugin.tests.ts (28.952 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:
|
|
23
|
+
Time: 30.509 s
|
|
20
24
|
Ran all test suites.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
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.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#286](https://github.com/core-ds/arui-scripts/pull/286) [`d003647`](https://github.com/core-ds/arui-scripts/commit/d00364743ab9a11e11393841b31a5ead2fd12b2f) Thanks [@makdv](https://github.com/makdv)! - #### Добавлена возможность перезаписывать некоторые параметры для базового конфига nginx (/etc/nginx/nginx.conf).
|
|
8
|
+
|
|
9
|
+
Пример добавления нового свойства `nginx` (в примере указаны значения, которые и так будут использованы по-умолчанию)
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
"aruiScripts": {
|
|
13
|
+
"nginx": {
|
|
14
|
+
"workerProcesses": 2,
|
|
15
|
+
"workerRlimitNoFile": 20000,
|
|
16
|
+
"workerConnections": 19000,
|
|
17
|
+
"eventsUse": "epoll",
|
|
18
|
+
"daemon": "off"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 18.4.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- [#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 конфигурации приложений, для переопределения настроек тестирования
|
|
28
|
+
|
|
3
29
|
## 18.3.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
16
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
17
|
+
const base_nginx_conf_template_1 = __importDefault(require("../../templates/base-nginx.conf.template"));
|
|
17
18
|
const dockerfile_template_1 = __importDefault(require("../../templates/dockerfile.template"));
|
|
18
19
|
const nginx_conf_template_1 = __importDefault(require("../../templates/nginx.conf.template"));
|
|
19
20
|
const start_template_1 = __importDefault(require("../../templates/start.template"));
|
|
@@ -30,6 +31,7 @@ const yarn_1 = require("../util/yarn");
|
|
|
30
31
|
pathToTempDir,
|
|
31
32
|
dockerfileTemplate: dockerfile_template_1.default,
|
|
32
33
|
nginxConfTemplate: nginx_conf_template_1.default,
|
|
34
|
+
nginxBaseConfTemplate: base_nginx_conf_template_1.default,
|
|
33
35
|
startScriptTemplate: start_template_1.default,
|
|
34
36
|
allowLocalDockerfile: true,
|
|
35
37
|
allowLocalStartScript: true,
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
16
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
17
|
+
const base_nginx_conf_template_1 = __importDefault(require("../../templates/base-nginx.conf.template"));
|
|
17
18
|
const dockerfile_compiled_template_1 = __importDefault(require("../../templates/dockerfile-compiled.template"));
|
|
18
19
|
const nginx_conf_template_1 = __importDefault(require("../../templates/nginx.conf.template"));
|
|
19
20
|
const start_template_1 = __importDefault(require("../../templates/start.template"));
|
|
@@ -28,6 +29,7 @@ const exec_1 = __importDefault(require("../util/exec"));
|
|
|
28
29
|
pathToTempDir,
|
|
29
30
|
dockerfileTemplate: dockerfile_compiled_template_1.default,
|
|
30
31
|
nginxConfTemplate: nginx_conf_template_1.default,
|
|
32
|
+
nginxBaseConfTemplate: base_nginx_conf_template_1.default,
|
|
31
33
|
startScriptTemplate: start_template_1.default,
|
|
32
34
|
allowLocalDockerfile: false,
|
|
33
35
|
allowLocalStartScript: false,
|
|
@@ -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,16 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
+
});
|
|
@@ -6,13 +6,14 @@ export declare function getBuildParamsFromArgs(): {
|
|
|
6
6
|
type PrepareFilesForDockerParams = {
|
|
7
7
|
dockerfileTemplate: string;
|
|
8
8
|
nginxConfTemplate: string;
|
|
9
|
+
nginxBaseConfTemplate: string;
|
|
9
10
|
startScriptTemplate: string;
|
|
10
11
|
pathToTempDir: string;
|
|
11
12
|
allowLocalDockerfile: boolean;
|
|
12
13
|
allowLocalStartScript: boolean;
|
|
13
14
|
addNodeModulesToDockerIgnore: boolean;
|
|
14
15
|
};
|
|
15
|
-
export declare function prepareFilesForDocker({ dockerfileTemplate, nginxConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }: PrepareFilesForDockerParams): Promise<void>;
|
|
16
|
+
export declare function prepareFilesForDocker({ dockerfileTemplate, nginxConfTemplate, nginxBaseConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }: PrepareFilesForDockerParams): Promise<void>;
|
|
16
17
|
export declare function dockerVersionSatisfies(request: string): boolean;
|
|
17
18
|
type DockerBuildCommandParams = {
|
|
18
19
|
tempDirName: string;
|
|
@@ -21,6 +21,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
21
21
|
const satisfies_1 = __importDefault(require("semver/functions/satisfies"));
|
|
22
22
|
const shelljs_1 = __importDefault(require("shelljs"));
|
|
23
23
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
24
|
+
const get_defaults_1 = require("../../configs/app-configs/get-defaults");
|
|
24
25
|
function getBuildParamsFromArgs() {
|
|
25
26
|
let imageVersion = app_configs_1.default.version;
|
|
26
27
|
let imageName = app_configs_1.default.name;
|
|
@@ -54,8 +55,14 @@ function getBuildParamsFromArgs() {
|
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
function prepareFilesForDocker(_a) {
|
|
57
|
-
return __awaiter(this, arguments, void 0, function* ({ dockerfileTemplate, nginxConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }) {
|
|
58
|
+
return __awaiter(this, arguments, void 0, function* ({ dockerfileTemplate, nginxConfTemplate, nginxBaseConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }) {
|
|
58
59
|
yield fs_extra_1.default.emptyDir(pathToTempDir);
|
|
60
|
+
let nginxBaseConf = '';
|
|
61
|
+
if (app_configs_1.default.nginx) {
|
|
62
|
+
nginxBaseConf = app_configs_1.default.localNginxBaseConf
|
|
63
|
+
? yield fs_extra_1.default.readFile(app_configs_1.default.localNginxBaseConf, 'utf8')
|
|
64
|
+
: nginxBaseConfTemplate;
|
|
65
|
+
}
|
|
59
66
|
const nginxConf = app_configs_1.default.localNginxConf
|
|
60
67
|
? yield fs_extra_1.default.readFile(app_configs_1.default.localNginxConf, 'utf8')
|
|
61
68
|
: nginxConfTemplate;
|
|
@@ -70,7 +77,9 @@ function prepareFilesForDocker(_a) {
|
|
|
70
77
|
(yield getAndModifyDockerIgnoreContent(dockerIgnoreFilePath));
|
|
71
78
|
yield Promise.all([
|
|
72
79
|
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir, 'Dockerfile'), dockerfile, 'utf8'),
|
|
73
|
-
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir,
|
|
80
|
+
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir, get_defaults_1.nginxConfigFileName), nginxConf, 'utf8'),
|
|
81
|
+
nginxBaseConf &&
|
|
82
|
+
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir, get_defaults_1.baseNginxConfigFileName), nginxBaseConf, 'utf8'),
|
|
74
83
|
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir, 'start.sh'), startScript, {
|
|
75
84
|
encoding: 'utf8',
|
|
76
85
|
mode: 0o555,
|
|
@@ -78,7 +87,7 @@ function prepareFilesForDocker(_a) {
|
|
|
78
87
|
addNodeModulesToDockerIgnore &&
|
|
79
88
|
dockerIgnoreFileContent &&
|
|
80
89
|
fs_extra_1.default.writeFile(dockerIgnoreFilePath, dockerIgnoreFileContent, 'utf-8'),
|
|
81
|
-
]);
|
|
90
|
+
].filter(Boolean));
|
|
82
91
|
});
|
|
83
92
|
}
|
|
84
93
|
function dockerVersionSatisfies(request) {
|
|
@@ -88,7 +97,8 @@ function dockerVersionSatisfies(request) {
|
|
|
88
97
|
const dockerClientVersion = shelljs_1.default.exec("docker version --format '{{.Client.Version}}'", {
|
|
89
98
|
silent: true,
|
|
90
99
|
});
|
|
91
|
-
return (0, satisfies_1.default)(dockerServerVersion.toString(), request) &&
|
|
100
|
+
return ((0, satisfies_1.default)(dockerServerVersion.toString(), request) &&
|
|
101
|
+
(0, satisfies_1.default)(dockerClientVersion.toString(), request));
|
|
92
102
|
}
|
|
93
103
|
function getDockerBuildCommand({ tempDirName, imageFullName }) {
|
|
94
104
|
// если пытаться собрать проект на маках с m1, докер будет пытаться вытянуть базовый образ под свою платформу и
|
|
@@ -97,7 +107,12 @@ function getDockerBuildCommand({ tempDirName, imageFullName }) {
|
|
|
97
107
|
// Соответственно они будут падать при наличии этого флага.
|
|
98
108
|
// https://docs.docker.com/engine/release-notes/20.10/
|
|
99
109
|
const canUsePlatformFlag = dockerVersionSatisfies('>=20.10.21');
|
|
100
|
-
return `docker build ${canUsePlatformFlag ? '--platform linux/x86_64' : ''}
|
|
110
|
+
return `docker build ${canUsePlatformFlag ? '--platform linux/x86_64' : ''} \
|
|
111
|
+
-f "./${tempDirName}/Dockerfile" \
|
|
112
|
+
--build-arg START_SH_LOCATION="./${tempDirName}/start.sh" \
|
|
113
|
+
--build-arg NGINX_CONF_LOCATION="./${tempDirName}/${get_defaults_1.nginxConfigFileName}" \
|
|
114
|
+
--build-arg NGINX_BASE_CONF_LOCATION="./${tempDirName}/${get_defaults_1.baseNginxConfigFileName}" \
|
|
115
|
+
-t ${imageFullName} .`;
|
|
101
116
|
}
|
|
102
117
|
function getAndModifyDockerIgnoreContent(dockerIgnoreFilePath) {
|
|
103
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { AppConfigs, AppContext } from './types';
|
|
2
|
+
export declare const nginxConfigFileName = "nginx.conf";
|
|
3
|
+
export declare const baseNginxConfigFileName = "base-nginx.conf";
|
|
2
4
|
export declare function getDefaultAppConfig(): AppConfigs;
|
|
3
5
|
export declare function getDefaultAppContext(): AppContext;
|
|
@@ -3,6 +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.baseNginxConfigFileName = exports.nginxConfigFileName = void 0;
|
|
6
7
|
exports.getDefaultAppConfig = getDefaultAppConfig;
|
|
7
8
|
exports.getDefaultAppContext = getDefaultAppContext;
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -11,6 +12,8 @@ const resolve_1 = require("../util/resolve");
|
|
|
11
12
|
const read_config_file_1 = require("./read-config-file");
|
|
12
13
|
const CWD = process.cwd();
|
|
13
14
|
const absoluteSrcPath = path_1.default.resolve(CWD, 'src');
|
|
15
|
+
exports.nginxConfigFileName = 'nginx.conf';
|
|
16
|
+
exports.baseNginxConfigFileName = 'base-nginx.conf';
|
|
14
17
|
function getDefaultAppConfig() {
|
|
15
18
|
var _a;
|
|
16
19
|
const appPackage = getPackageJson();
|
|
@@ -39,6 +42,7 @@ function getDefaultAppConfig() {
|
|
|
39
42
|
dockerRegistry: '',
|
|
40
43
|
baseDockerImage: 'alfabankui/arui-scripts:16.20.2-slim',
|
|
41
44
|
nginxRootPath: '/src',
|
|
45
|
+
nginx: null,
|
|
42
46
|
runFromNonRootUser: true,
|
|
43
47
|
removeDevDependenciesDuringDockerBuild: true,
|
|
44
48
|
// archive compilation configs
|
|
@@ -97,7 +101,8 @@ function getDefaultAppContext() {
|
|
|
97
101
|
const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
|
|
98
102
|
const yarnLockFilePath = path_1.default.join(CWD, 'yarn.lock');
|
|
99
103
|
const overridesPath = (0, resolve_1.tryResolve)(path_1.default.join(CWD, 'arui-scripts.overrides'));
|
|
100
|
-
const nginxConfFilePath = path_1.default.join(CWD,
|
|
104
|
+
const nginxConfFilePath = path_1.default.join(CWD, exports.nginxConfigFileName);
|
|
105
|
+
const nginxBaseConfFilePath = path_1.default.join(CWD, exports.baseNginxConfigFileName);
|
|
101
106
|
const dockerfileFilePath = path_1.default.join(CWD, 'Dockerfile');
|
|
102
107
|
const startScriptFilePath = path_1.default.join(CWD, 'start.sh');
|
|
103
108
|
return {
|
|
@@ -117,6 +122,7 @@ function getDefaultAppContext() {
|
|
|
117
122
|
// compilation configs locations
|
|
118
123
|
tsconfig: fs_1.default.existsSync(projectTsConfigPath) ? projectTsConfigPath : null,
|
|
119
124
|
localNginxConf: fs_1.default.existsSync(nginxConfFilePath) ? nginxConfFilePath : null,
|
|
125
|
+
localNginxBaseConf: fs_1.default.existsSync(nginxBaseConfFilePath) ? nginxBaseConfFilePath : null,
|
|
120
126
|
localDockerfile: fs_1.default.existsSync(dockerfileFilePath) ? dockerfileFilePath : null,
|
|
121
127
|
localStartScript: fs_1.default.existsSync(startScriptFilePath) ? startScriptFilePath : null,
|
|
122
128
|
// Эти пути зависят от других настроек, которые могут быть переопределены пользователем
|
|
@@ -25,6 +25,13 @@ export type AppConfigs = {
|
|
|
25
25
|
dockerRegistry: string;
|
|
26
26
|
baseDockerImage: string;
|
|
27
27
|
nginxRootPath: string;
|
|
28
|
+
nginx: {
|
|
29
|
+
workerProcesses?: number;
|
|
30
|
+
workerRlimitNoFile?: number;
|
|
31
|
+
workerConnections?: number;
|
|
32
|
+
eventsUse?: string;
|
|
33
|
+
daemon?: string;
|
|
34
|
+
} | null;
|
|
28
35
|
runFromNonRootUser: boolean;
|
|
29
36
|
removeDevDependenciesDuringDockerBuild: boolean;
|
|
30
37
|
archiveName: string;
|
|
@@ -111,6 +118,7 @@ export type AppContext = {
|
|
|
111
118
|
useYarn: boolean;
|
|
112
119
|
tsconfig: string | null;
|
|
113
120
|
localNginxConf: string | null;
|
|
121
|
+
localNginxBaseConf: string | null;
|
|
114
122
|
localDockerfile: string | null;
|
|
115
123
|
localStartScript: string | null;
|
|
116
124
|
overridesPath: string[];
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
const app_configs_1 = require("../configs/app-configs");
|
|
7
|
+
const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
|
|
8
|
+
const baseNginxConfig = {
|
|
9
|
+
workerProcesses: 2,
|
|
10
|
+
workerRlimitNoFile: 20000,
|
|
11
|
+
workerConnections: 19000,
|
|
12
|
+
eventsUse: 'epoll',
|
|
13
|
+
daemon: 'off',
|
|
14
|
+
};
|
|
15
|
+
const nginx = Object.assign(Object.assign({}, baseNginxConfig), app_configs_1.configs.nginx);
|
|
16
|
+
const baseNginxTemplate = `
|
|
17
|
+
worker_processes ${nginx.workerProcesses};
|
|
18
|
+
worker_rlimit_nofile ${nginx.workerRlimitNoFile};
|
|
19
|
+
daemon ${nginx.daemon};
|
|
20
|
+
|
|
21
|
+
error_log /var/log/nginx/error.log;
|
|
22
|
+
pid /var/run/nginx.pid;
|
|
23
|
+
|
|
24
|
+
events {
|
|
25
|
+
worker_connections ${nginx.workerConnections};
|
|
26
|
+
use ${nginx.eventsUse};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
http {
|
|
30
|
+
include /etc/nginx/mime.types;
|
|
31
|
+
default_type application/octet-stream;
|
|
32
|
+
|
|
33
|
+
server_tokens off;
|
|
34
|
+
access_log off;
|
|
35
|
+
keepalive_timeout 65;
|
|
36
|
+
proxy_read_timeout 200;
|
|
37
|
+
sendfile on;
|
|
38
|
+
tcp_nopush on;
|
|
39
|
+
tcp_nodelay on;
|
|
40
|
+
|
|
41
|
+
gzip_static on;
|
|
42
|
+
brotli on;
|
|
43
|
+
brotli_static on;
|
|
44
|
+
brotli_types application/atom+xml application/javascript application/json application/rss+xml
|
|
45
|
+
application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
|
|
46
|
+
application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
|
|
47
|
+
font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
|
|
48
|
+
image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml application/wasm;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Only retry if there was a communication error, not a timeout
|
|
52
|
+
# on the Node server (to avoid propagating "queries of death"
|
|
53
|
+
# to all frontends)
|
|
54
|
+
proxy_next_upstream error;
|
|
55
|
+
|
|
56
|
+
#cache
|
|
57
|
+
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=all:32m max_size=1g;
|
|
58
|
+
|
|
59
|
+
include /etc/nginx/conf.d/*.conf;
|
|
60
|
+
}`;
|
|
61
|
+
exports.default = (0, apply_overrides_1.default)('nginxConf', baseNginxTemplate);
|
|
@@ -8,6 +8,7 @@ const app_configs_1 = __importDefault(require("../configs/app-configs"));
|
|
|
8
8
|
const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
|
|
9
9
|
const installProductionCommand = (0, yarn_1.getInstallProductionCommand)();
|
|
10
10
|
const yarnVersion = (0, yarn_1.getYarnVersion)();
|
|
11
|
+
const { nginx } = app_configs_1.default;
|
|
11
12
|
// В зависимости от используемого мендежера зависимостей для их установки нужно копировать разный набор файлов
|
|
12
13
|
const filesRequiredToInstallDependencies = [
|
|
13
14
|
'package.json',
|
|
@@ -20,12 +21,14 @@ const dockerfileTemplate = `
|
|
|
20
21
|
FROM ${app_configs_1.default.baseDockerImage}
|
|
21
22
|
ARG START_SH_LOCATION
|
|
22
23
|
ARG NGINX_CONF_LOCATION
|
|
24
|
+
ARG NGINX_BASE_CONF_LOCATION
|
|
23
25
|
|
|
24
26
|
WORKDIR /src
|
|
25
27
|
|
|
26
28
|
# Полу-статичные файлы, могут легко кешироваться
|
|
27
29
|
ADD $START_SH_LOCATION /src/start.sh
|
|
28
30
|
ADD $NGINX_CONF_LOCATION /src/nginx.conf
|
|
31
|
+
${nginx ? 'ADD $NGINX_BASE_CONF_LOCATION /etc/nginx/nginx.conf' : ''}
|
|
29
32
|
|
|
30
33
|
# Зависимости. При некоторой удаче могут кешироваться и соответственно кешировать установку зависимостей
|
|
31
34
|
${filesRequiredToInstallDependencies
|
|
@@ -8,6 +8,7 @@ const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrid
|
|
|
8
8
|
const appPathToAdd = app_configs_1.configs.clientOnly ? app_configs_1.configs.buildPath : '.';
|
|
9
9
|
const appTargetPath = app_configs_1.configs.clientOnly ? `/src/${app_configs_1.configs.buildPath}` : '/src';
|
|
10
10
|
const nginxConfTargetLocation = app_configs_1.configs.clientOnly ? '/etc/nginx/conf.d/default.conf' : '/src/nginx.conf';
|
|
11
|
+
const { nginx } = app_configs_1.configs;
|
|
11
12
|
const nginxNonRootPart = app_configs_1.configs.runFromNonRootUser
|
|
12
13
|
? `RUN chown -R nginx:nginx /src && \\
|
|
13
14
|
mkdir -p /var/lib/nginx && \\
|
|
@@ -24,10 +25,12 @@ const dockerfileTemplate = `
|
|
|
24
25
|
FROM ${app_configs_1.configs.baseDockerImage}
|
|
25
26
|
ARG START_SH_LOCATION
|
|
26
27
|
ARG NGINX_CONF_LOCATION
|
|
28
|
+
ARG NGINX_BASE_CONF_LOCATION
|
|
27
29
|
|
|
28
30
|
WORKDIR /src
|
|
29
31
|
ADD $START_SH_LOCATION /src/start.sh
|
|
30
32
|
ADD $NGINX_CONF_LOCATION ${nginxConfTargetLocation}
|
|
33
|
+
${nginx ? 'ADD $NGINX_BASE_CONF_LOCATION /etc/nginx/nginx.conf' : ''}
|
|
31
34
|
|
|
32
35
|
${nginxNonRootPart}
|
|
33
36
|
|