arui-scripts 18.4.0 → 18.6.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 +16 -9
- package/.turbo/turbo-test.log +10 -7
- package/CHANGELOG.md +49 -0
- package/build/commands/docker-build/index.js +2 -0
- package/build/commands/docker-build-compiled/index.js +2 -0
- 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/postcss.config.d.ts +12 -4
- package/build/configs/postcss.config.js +13 -6
- package/build/configs/postcss.d.ts +1 -1
- package/build/configs/postcss.js +3 -1
- package/build/configs/util/apply-overrides.d.ts +1 -0
- package/build/plugins/postcss-global-variables/postcss-global-variables.d.ts +6 -0
- package/build/plugins/postcss-global-variables/postcss-global-variables.js +38 -0
- package/build/plugins/postcss-global-variables/utils/utils.d.ts +7 -0
- package/build/plugins/postcss-global-variables/utils/utils.js +77 -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 +1 -2
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
|
|
@@ -76,8 +76,12 @@
|
|
|
76
76
|
35:5 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion
|
|
77
77
|
126:54 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
78
78
|
|
|
79
|
+
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/postcss.config.ts
|
|
80
|
+
10:49 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
81
|
+
11:88 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
82
|
+
|
|
79
83
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/postcss.ts
|
|
80
|
-
|
|
84
|
+
13:8 warning Prefer named exports import/no-default-export
|
|
81
85
|
|
|
82
86
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/process-assets-plugin-output.ts
|
|
83
87
|
5:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
|
|
@@ -107,9 +111,9 @@
|
|
|
107
111
|
28:18 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
108
112
|
29:24 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
109
113
|
36:14 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
50:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
115
|
+
128:48 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
116
|
+
151:8 warning Prefer named exports import/no-default-export
|
|
113
117
|
|
|
114
118
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/check-node-version.ts
|
|
115
119
|
7:8 warning Prefer named exports import/no-default-export
|
|
@@ -151,12 +155,15 @@
|
|
|
151
155
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/plugins/postcss-prefix-selector.ts
|
|
152
156
|
40:79 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
153
157
|
|
|
158
|
+
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/base-nginx.conf.template.ts
|
|
159
|
+
62:8 warning Prefer named exports import/no-default-export
|
|
160
|
+
|
|
154
161
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/dockerfile-compiled.template.ts
|
|
155
162
|
2:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
|
|
156
|
-
|
|
163
|
+
52:8 warning Prefer named exports import/no-default-export
|
|
157
164
|
|
|
158
165
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/dockerfile.template.ts
|
|
159
|
-
|
|
166
|
+
40:8 warning Prefer named exports import/no-default-export
|
|
160
167
|
|
|
161
168
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/nginx.conf.template.ts
|
|
162
169
|
36:8 warning Prefer named exports import/no-default-export
|
|
@@ -167,6 +174,6 @@
|
|
|
167
174
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/types.d.ts
|
|
168
175
|
4:12 warning Prefer named exports import/no-default-export
|
|
169
176
|
|
|
170
|
-
✖
|
|
177
|
+
✖ 79 problems (0 errors, 79 warnings)
|
|
171
178
|
0 errors and 2 warnings potentially fixable with the `--fix` option.
|
|
172
179
|
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -5,20 +5,23 @@ ts-jest[versions] (WARN) Version 29.7.0 of jest installed has not been tested wi
|
|
|
5
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.
|
|
6
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.
|
|
7
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.
|
|
8
|
-
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (
|
|
9
|
-
PASS src/configs/util/__tests__/
|
|
8
|
+
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (18.153 s)
|
|
9
|
+
PASS src/configs/util/__tests__/get-polyfills.tests.ts
|
|
10
|
+
PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (18.679 s)
|
|
10
11
|
PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
|
|
11
|
-
PASS src/configs/util/__tests__/
|
|
12
|
+
PASS src/configs/util/__tests__/apply-overrides.tests.ts
|
|
13
|
+
PASS src/plugins/postcss-global-variables/utils/__tests__/parse-variables.tests.ts
|
|
12
14
|
PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
|
|
13
15
|
PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
|
|
16
|
+
PASS src/plugins/postcss-global-variables/utils/__tests__/get-media-query-name.tests.ts
|
|
14
17
|
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
15
18
|
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
16
19
|
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
17
20
|
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
18
|
-
PASS src/configs/util/__tests__/find-plugin.tests.ts (
|
|
21
|
+
PASS src/configs/util/__tests__/find-plugin.tests.ts (23.652 s)
|
|
19
22
|
|
|
20
|
-
Test Suites:
|
|
21
|
-
Tests:
|
|
23
|
+
Test Suites: 10 passed, 10 total
|
|
24
|
+
Tests: 27 passed, 27 total
|
|
22
25
|
Snapshots: 0 total
|
|
23
|
-
Time:
|
|
26
|
+
Time: 24.826 s
|
|
24
27
|
Ran all test suites.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
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.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#287](https://github.com/core-ds/arui-scripts/pull/287) [`fb3b80d`](https://github.com/core-ds/arui-scripts/commit/fb3b80db242978d88eb6c0eac382498b3aa04459) Thanks [@VladislavNsk](https://github.com/VladislavNsk)! - Добавлен кастомный плагин postcss-global-variables, для оптимизации времени обработки глобальных переменных.
|
|
8
|
+
@csstools/postcss-global-data _удален_
|
|
9
|
+
|
|
10
|
+
Проекты, которые использовали в оверрайдах кастомные настройки для плагина @csstools/postcss-global-data, должны перейти на использование postcss-global-variables следующим образом
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
postcss: (config) => {
|
|
14
|
+
const overrideConfig = config.map((plugin) => {
|
|
15
|
+
if (plugin.name === 'postCssGlobalVariables') {
|
|
16
|
+
return {
|
|
17
|
+
...plugin,
|
|
18
|
+
options: plugin.options.concat([
|
|
19
|
+
// ваши файлы
|
|
20
|
+
])
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return plugin;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return overrideConfig;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Плагин работает только с глобальными переменными, если вам надо вставить что-то другое, отличное от глобальных переменных, вам нужно будет добавить @csstools/postcss-global-data в свой проект самостоятельно
|
|
31
|
+
|
|
32
|
+
## 18.5.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- [#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).
|
|
37
|
+
|
|
38
|
+
Пример добавления нового свойства `nginx` (в примере указаны значения, которые и так будут использованы по-умолчанию)
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
"aruiScripts": {
|
|
42
|
+
"nginx": {
|
|
43
|
+
"workerProcesses": 2,
|
|
44
|
+
"workerRlimitNoFile": 20000,
|
|
45
|
+
"workerConnections": 19000,
|
|
46
|
+
"eventsUse": "epoll",
|
|
47
|
+
"daemon": "off"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
3
52
|
## 18.4.0
|
|
4
53
|
|
|
5
54
|
### 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,
|
|
@@ -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[];
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
+
import type { PluginCreator } from 'postcss';
|
|
2
|
+
type PostCssPluginName = string | PluginCreator<any>;
|
|
3
|
+
type PostcssPlugin = string | [string, unknown] | {
|
|
4
|
+
name: string;
|
|
5
|
+
plugin: PluginCreator<any>;
|
|
6
|
+
options?: unknown;
|
|
7
|
+
};
|
|
1
8
|
/**
|
|
2
9
|
* Функция для создания конфигурационного файла postcss
|
|
3
|
-
* @param {
|
|
10
|
+
* @param {PostCssPluginName[]} plugins список плагинов
|
|
4
11
|
* @param {Object} options коллекция конфигураций плагинов, где ключ - название плагина, а значение - аргумент для инициализации
|
|
5
12
|
* @returns {*}
|
|
6
13
|
*/
|
|
7
|
-
export declare function createPostcssConfig(plugins:
|
|
8
|
-
export declare const postcssPlugins:
|
|
14
|
+
export declare function createPostcssConfig(plugins: PostCssPluginName[], options: Record<string, unknown>): PostcssPlugin[];
|
|
15
|
+
export declare const postcssPlugins: PostCssPluginName[];
|
|
9
16
|
export declare const postcssPluginsOptions: {
|
|
10
17
|
'postcss-import': {
|
|
11
18
|
path: string[];
|
|
12
19
|
};
|
|
13
|
-
|
|
20
|
+
postCssGlobalVariables: {
|
|
14
21
|
files: string[];
|
|
15
22
|
};
|
|
16
23
|
'postcss-url': {
|
|
@@ -26,3 +33,4 @@ export declare const postcssPluginsOptions: {
|
|
|
26
33
|
overrideBrowserslist: string[];
|
|
27
34
|
};
|
|
28
35
|
};
|
|
36
|
+
export {};
|
|
@@ -6,20 +6,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.postcssPluginsOptions = exports.postcssPlugins = void 0;
|
|
7
7
|
exports.createPostcssConfig = createPostcssConfig;
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const postcss_global_variables_1 = require("../plugins/postcss-global-variables/postcss-global-variables");
|
|
9
10
|
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
10
11
|
const supporting_browsers_1 = __importDefault(require("./supporting-browsers"));
|
|
11
12
|
/**
|
|
12
13
|
* Функция для создания конфигурационного файла postcss
|
|
13
|
-
* @param {
|
|
14
|
+
* @param {PostCssPluginName[]} plugins список плагинов
|
|
14
15
|
* @param {Object} options коллекция конфигураций плагинов, где ключ - название плагина, а значение - аргумент для инициализации
|
|
15
16
|
* @returns {*}
|
|
16
17
|
*/
|
|
17
18
|
function createPostcssConfig(plugins, options) {
|
|
18
19
|
return plugins.map((pluginName) => {
|
|
19
|
-
if (pluginName
|
|
20
|
-
return
|
|
20
|
+
if (typeof pluginName === 'string') {
|
|
21
|
+
return pluginName in options
|
|
22
|
+
? [pluginName, options[pluginName]]
|
|
23
|
+
: pluginName;
|
|
21
24
|
}
|
|
22
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
name: pluginName.name,
|
|
27
|
+
plugin: pluginName,
|
|
28
|
+
options: options[pluginName.name]
|
|
29
|
+
};
|
|
23
30
|
});
|
|
24
31
|
}
|
|
25
32
|
exports.postcssPlugins = [
|
|
@@ -29,7 +36,7 @@ exports.postcssPlugins = [
|
|
|
29
36
|
'postcss-mixins',
|
|
30
37
|
'postcss-for',
|
|
31
38
|
'postcss-each',
|
|
32
|
-
|
|
39
|
+
postcss_global_variables_1.postCssGlobalVariables,
|
|
33
40
|
'postcss-custom-media',
|
|
34
41
|
'postcss-color-mod-function',
|
|
35
42
|
!app_configs_1.default.keepCssVars && 'postcss-custom-properties',
|
|
@@ -46,7 +53,7 @@ exports.postcssPluginsOptions = {
|
|
|
46
53
|
'postcss-import': {
|
|
47
54
|
path: ['./src'],
|
|
48
55
|
},
|
|
49
|
-
'
|
|
56
|
+
'postCssGlobalVariables': {
|
|
50
57
|
files: [path_1.default.join(__dirname, 'mq.css'), app_configs_1.default.componentsTheme].filter(Boolean),
|
|
51
58
|
},
|
|
52
59
|
'postcss-url': {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const postcssConfig: string
|
|
1
|
+
declare const postcssConfig: (string | import("postcss").Processor | import("postcss").Plugin | [string, unknown])[];
|
|
2
2
|
export default postcssConfig;
|
package/build/configs/postcss.js
CHANGED
|
@@ -5,5 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
7
7
|
const postcss_config_1 = require("./postcss.config");
|
|
8
|
-
const postcssConfig = (0, apply_overrides_1.default)('postcss', (0, postcss_config_1.createPostcssConfig)(postcss_config_1.postcssPlugins, postcss_config_1.postcssPluginsOptions))
|
|
8
|
+
const postcssConfig = (0, apply_overrides_1.default)('postcss', (0, postcss_config_1.createPostcssConfig)(postcss_config_1.postcssPlugins, postcss_config_1.postcssPluginsOptions)).map((plugin) => typeof plugin === 'string' || Array.isArray(plugin)
|
|
9
|
+
? plugin
|
|
10
|
+
: plugin.plugin(plugin.options));
|
|
9
11
|
exports.default = postcssConfig;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postCssGlobalVariables = void 0;
|
|
4
|
+
const utils_1 = require("./utils/utils");
|
|
5
|
+
const postCssGlobalVariables = (opts) => {
|
|
6
|
+
const options = Object.assign({ files: [] }, opts);
|
|
7
|
+
const parsedVariables = {};
|
|
8
|
+
const parsedCustomMedia = {};
|
|
9
|
+
let rulesSelectors = new Set();
|
|
10
|
+
return {
|
|
11
|
+
postcssPlugin: '@alfalab/postcss-global-variables',
|
|
12
|
+
prepare() {
|
|
13
|
+
return {
|
|
14
|
+
postcssPlugin: '@alfalab/postcss-global-variables',
|
|
15
|
+
Once(root, postcssHelpers) {
|
|
16
|
+
if (!Object.keys(parsedVariables).length) {
|
|
17
|
+
options.files.forEach((filePath) => {
|
|
18
|
+
const importedCss = (0, utils_1.parseImport)(root, postcssHelpers, filePath);
|
|
19
|
+
(0, utils_1.parseVariables)(importedCss, parsedVariables);
|
|
20
|
+
(0, utils_1.parseMediaQuery)(importedCss, parsedCustomMedia);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const rootRule = (0, utils_1.insertParsedCss)(root, parsedVariables, parsedCustomMedia);
|
|
24
|
+
root.append(rootRule);
|
|
25
|
+
rulesSelectors.add(rootRule);
|
|
26
|
+
},
|
|
27
|
+
OnceExit() {
|
|
28
|
+
rulesSelectors.forEach((rule) => {
|
|
29
|
+
rule.remove();
|
|
30
|
+
});
|
|
31
|
+
rulesSelectors = new Set();
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.postCssGlobalVariables = postCssGlobalVariables;
|
|
38
|
+
postCssGlobalVariables.postcss = true;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AtRule, Helpers, Root, Rule } from 'postcss';
|
|
2
|
+
export declare const getMediaQueryName: (rule: AtRule) => string;
|
|
3
|
+
export declare function parseImport(root: Root, postcssHelpers: Helpers, filePath: string): Root;
|
|
4
|
+
export declare const parseVariables: (importedFile: Root, parsedVariables: Record<string, string>) => void;
|
|
5
|
+
export declare const parseMediaQuery: (importedFile: Root, parsedCustomMedia: Record<string, AtRule>) => void;
|
|
6
|
+
export declare function addGlobalVariable(cssValue: string, rootSelector: Rule, parsedVariables: Record<string, string>): void;
|
|
7
|
+
export declare const insertParsedCss: (root: Root, parsedVariables: Record<string, string>, parsedCustomMedia: Record<string, AtRule>) => Rule;
|
|
@@ -0,0 +1,77 @@
|
|
|
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.insertParsedCss = exports.parseMediaQuery = exports.parseVariables = exports.getMediaQueryName = void 0;
|
|
7
|
+
exports.parseImport = parseImport;
|
|
8
|
+
exports.addGlobalVariable = addGlobalVariable;
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const postcss_1 = require("postcss");
|
|
12
|
+
const getMediaQueryName = (rule) => rule.params.split(' ')[0];
|
|
13
|
+
exports.getMediaQueryName = getMediaQueryName;
|
|
14
|
+
function parseImport(root, postcssHelpers, filePath) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
let resolvedPath = '';
|
|
17
|
+
try {
|
|
18
|
+
resolvedPath = path_1.default.resolve(filePath);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
throw new Error(`Failed to read ${filePath} with error ${(err instanceof Error) ? err.message : err}`);
|
|
22
|
+
}
|
|
23
|
+
postcssHelpers.result.messages.push({
|
|
24
|
+
type: 'dependency',
|
|
25
|
+
plugin: 'postcss-global-environments',
|
|
26
|
+
file: resolvedPath,
|
|
27
|
+
parent: (_b = (_a = root.source) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.file,
|
|
28
|
+
});
|
|
29
|
+
const fileContents = fs_1.default.readFileSync(resolvedPath, 'utf8');
|
|
30
|
+
return postcssHelpers.postcss.parse(fileContents, { from: resolvedPath });
|
|
31
|
+
}
|
|
32
|
+
const parseVariables = (importedFile, parsedVariables) => {
|
|
33
|
+
importedFile.walkDecls((decl) => {
|
|
34
|
+
// eslint-disable-next-line no-param-reassign
|
|
35
|
+
parsedVariables[decl.prop] = decl.value;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.parseVariables = parseVariables;
|
|
39
|
+
const parseMediaQuery = (importedFile, parsedCustomMedia) => {
|
|
40
|
+
importedFile.walkAtRules('custom-media', (mediaRule) => {
|
|
41
|
+
const mediaName = (0, exports.getMediaQueryName)(mediaRule);
|
|
42
|
+
// eslint-disable-next-line no-param-reassign
|
|
43
|
+
parsedCustomMedia[mediaName] = mediaRule;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.parseMediaQuery = parseMediaQuery;
|
|
47
|
+
function addGlobalVariable(cssValue, rootSelector, parsedVariables) {
|
|
48
|
+
const variableMatches = cssValue.match(/var\(\s*--([^)]+)\s*\)/g);
|
|
49
|
+
if (variableMatches) {
|
|
50
|
+
variableMatches.forEach((match) => {
|
|
51
|
+
// var(--gap-24) => --gap-24
|
|
52
|
+
const variableName = match.slice(4, -1).trim();
|
|
53
|
+
if (parsedVariables[variableName]) {
|
|
54
|
+
rootSelector.append(new postcss_1.Declaration({ prop: variableName, value: parsedVariables[variableName] }));
|
|
55
|
+
// Рекурсивно проходимся по значениям css, там тоже могут использоваться переменные
|
|
56
|
+
addGlobalVariable(parsedVariables[variableName], rootSelector, parsedVariables);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const insertParsedCss = (root, parsedVariables, parsedCustomMedia) => {
|
|
62
|
+
const rootRule = new postcss_1.Rule({ selector: ':root' });
|
|
63
|
+
root.walkDecls((decl) => {
|
|
64
|
+
addGlobalVariable(decl.value, rootRule, parsedVariables);
|
|
65
|
+
});
|
|
66
|
+
root.walkAtRules('media', (rule) => {
|
|
67
|
+
const mediaFullName = (0, exports.getMediaQueryName)(rule);
|
|
68
|
+
if (mediaFullName.startsWith('(--')) {
|
|
69
|
+
const mediaName = mediaFullName.slice(1, -1);
|
|
70
|
+
if (parsedCustomMedia[mediaName]) {
|
|
71
|
+
root.append(parsedCustomMedia[mediaName]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return rootRule;
|
|
76
|
+
};
|
|
77
|
+
exports.insertParsedCss = insertParsedCss;
|