arui-scripts 23.8.1 → 23.9.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-test.log +7 -7
- package/CHANGELOG.md +52 -0
- package/build/commands/archive-build/index.js +2 -67
- package/build/commands/build/build-wrapper.d.ts +1 -1
- package/build/commands/build/build-wrapper.js +2 -2
- package/build/commands/build/index.js +1 -1
- package/build/commands/build/server.js +1 -1
- package/build/commands/docker-build/index.js +2 -60
- package/build/commands/docker-build-compiled/index.js +2 -41
- package/build/commands/util/artifacts-config.d.ts +25 -0
- package/build/commands/util/artifacts-config.js +120 -0
- package/build/commands/util/artifacts-deprecations.d.ts +9 -0
- package/build/commands/util/artifacts-deprecations.js +66 -0
- package/build/commands/util/arui-scripts-artifacts.d.ts +16 -0
- package/build/commands/util/arui-scripts-artifacts.js +29 -0
- package/build/commands/util/docker-build.d.ts +20 -8
- package/build/commands/util/docker-build.js +50 -101
- package/build/commands/util/exec.d.ts +1 -1
- package/build/commands/util/exec.js +4 -16
- package/build/commands/util/run-artifacts-cli.d.ts +7 -0
- package/build/commands/util/run-artifacts-cli.js +60 -0
- package/build/commands/util/yarn.d.ts +7 -2
- package/build/commands/util/yarn.js +15 -69
- package/build/configs/app-configs/get-defaults.js +13 -11
- package/build/configs/app-configs/types.d.ts +22 -15
- package/build/configs/app-configs/validate-settings-keys.d.ts +4 -1
- package/build/configs/app-configs/validate-settings-keys.js +5 -2
- package/build/configs/util/apply-overrides.d.ts +10 -0
- package/build/configs/util/apply-overrides.js +8 -0
- package/build/index.d.ts +13 -0
- package/build/index.js +25 -1
- package/docs/artifact.md +7 -3
- package/docs/overrides.md +14 -8
- package/docs/settings.md +10 -0
- package/package.json +11 -10
- package/tsconfig-local.tsbuildinfo +1 -1
- package/build/templates/base-nginx.conf.template.d.ts +0 -1
- package/build/templates/base-nginx.conf.template.js +0 -59
- package/build/templates/dockerfile-compiled.template.d.ts +0 -1
- package/build/templates/dockerfile-compiled.template.js +0 -56
- package/build/templates/dockerfile.template.d.ts +0 -1
- package/build/templates/dockerfile.template.js +0 -47
- package/build/templates/nginx.conf.template.d.ts +0 -1
- package/build/templates/nginx.conf.template.js +0 -50
- package/build/templates/start.template.d.ts +0 -1
- package/build/templates/start.template.js +0 -69
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const nginxBaseConfTemplate: string;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nginxBaseConfTemplate = void 0;
|
|
4
|
-
const app_configs_1 = require("../configs/app-configs");
|
|
5
|
-
const apply_overrides_1 = require("../configs/util/apply-overrides");
|
|
6
|
-
const baseNginxConfig = {
|
|
7
|
-
workerProcesses: 2,
|
|
8
|
-
workerRlimitNoFile: 20000,
|
|
9
|
-
workerConnections: 19000,
|
|
10
|
-
eventsUse: 'epoll',
|
|
11
|
-
daemon: 'off',
|
|
12
|
-
};
|
|
13
|
-
const nginx = Object.assign(Object.assign({}, baseNginxConfig), app_configs_1.configs.nginx);
|
|
14
|
-
const baseNginxTemplate = `
|
|
15
|
-
worker_processes ${nginx.workerProcesses};
|
|
16
|
-
worker_rlimit_nofile ${nginx.workerRlimitNoFile};
|
|
17
|
-
daemon ${nginx.daemon};
|
|
18
|
-
|
|
19
|
-
error_log /var/log/nginx/error.log;
|
|
20
|
-
pid /var/run/nginx.pid;
|
|
21
|
-
|
|
22
|
-
events {
|
|
23
|
-
worker_connections ${nginx.workerConnections};
|
|
24
|
-
use ${nginx.eventsUse};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
http {
|
|
28
|
-
include /etc/nginx/mime.types;
|
|
29
|
-
default_type application/octet-stream;
|
|
30
|
-
|
|
31
|
-
server_tokens off;
|
|
32
|
-
access_log off;
|
|
33
|
-
keepalive_timeout 65;
|
|
34
|
-
proxy_read_timeout 200;
|
|
35
|
-
sendfile on;
|
|
36
|
-
tcp_nopush on;
|
|
37
|
-
tcp_nodelay on;
|
|
38
|
-
|
|
39
|
-
gzip_static on;
|
|
40
|
-
brotli on;
|
|
41
|
-
brotli_static on;
|
|
42
|
-
brotli_types application/atom+xml application/javascript application/json application/rss+xml
|
|
43
|
-
application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
|
|
44
|
-
application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
|
|
45
|
-
font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
|
|
46
|
-
image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml application/wasm;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Only retry if there was a communication error, not a timeout
|
|
50
|
-
# on the Node server (to avoid propagating "queries of death"
|
|
51
|
-
# to all frontends)
|
|
52
|
-
proxy_next_upstream error;
|
|
53
|
-
|
|
54
|
-
#cache
|
|
55
|
-
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=all:32m max_size=1g;
|
|
56
|
-
|
|
57
|
-
include /etc/nginx/conf.d/*.conf;
|
|
58
|
-
}`;
|
|
59
|
-
exports.nginxBaseConfTemplate = (0, apply_overrides_1.applyOverrides)('nginxConf', baseNginxTemplate);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const dockerfileTemplate: string;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dockerfileTemplate = void 0;
|
|
4
|
-
const yarn_1 = require("../commands/util/yarn");
|
|
5
|
-
const app_configs_1 = require("../configs/app-configs");
|
|
6
|
-
const apply_overrides_1 = require("../configs/util/apply-overrides");
|
|
7
|
-
const installProductionCommand = (0, yarn_1.getInstallProductionCommand)();
|
|
8
|
-
const yarnVersion = (0, yarn_1.getYarnVersion)();
|
|
9
|
-
const yarnBinSymlinkCommand = (0, yarn_1.getYarnBinSymlinkCommand)();
|
|
10
|
-
const { nginx } = app_configs_1.configs;
|
|
11
|
-
// В зависимости от используемого мендежера зависимостей для их установки нужно копировать разный набор файлов
|
|
12
|
-
const filesRequiredToInstallDependencies = [
|
|
13
|
-
'package.json',
|
|
14
|
-
'yarn.lock',
|
|
15
|
-
yarnVersion === '2+' && '.yarnrc.yml',
|
|
16
|
-
yarnVersion === '2+' && '.yarn',
|
|
17
|
-
yarnVersion === 'unavailable' && 'package-lock.json',
|
|
18
|
-
].filter(Boolean);
|
|
19
|
-
const template = `
|
|
20
|
-
FROM ${app_configs_1.configs.baseDockerImage}
|
|
21
|
-
ARG START_SH_LOCATION
|
|
22
|
-
ARG NGINX_CONF_LOCATION
|
|
23
|
-
ARG NGINX_BASE_CONF_LOCATION
|
|
24
|
-
|
|
25
|
-
WORKDIR /src
|
|
26
|
-
|
|
27
|
-
# Полу-статичные файлы, могут легко кешироваться
|
|
28
|
-
ADD $START_SH_LOCATION /src/start.sh
|
|
29
|
-
ADD $NGINX_CONF_LOCATION /src/nginx.conf
|
|
30
|
-
${nginx ? 'ADD $NGINX_BASE_CONF_LOCATION /etc/nginx/nginx.conf' : ''}
|
|
31
|
-
|
|
32
|
-
# Зависимости. При некоторой удаче могут кешироваться и соответственно кешировать установку зависимостей
|
|
33
|
-
${filesRequiredToInstallDependencies
|
|
34
|
-
.map((file) => `ADD --chown=nginx:nginx ${file} /src/${file}`)
|
|
35
|
-
.join('\n')}
|
|
36
|
-
|
|
37
|
-
RUN ${yarnBinSymlinkCommand}${installProductionCommand} && \\
|
|
38
|
-
${yarnVersion === 'unavailable' ? 'npm cache clean --force' : 'yarn cache clean --all'}
|
|
39
|
-
|
|
40
|
-
ADD --chown=nginx:nginx . /src
|
|
41
|
-
|
|
42
|
-
# При необходимости удаляем npm и связанные библиотеки из образа
|
|
43
|
-
${app_configs_1.configs.deleteNpm
|
|
44
|
-
? 'RUN rm -rf /usr/local/bin/npm /usr/local/bin/npx /usr/local/lib/node_modules/npm'
|
|
45
|
-
: ''}
|
|
46
|
-
|
|
47
|
-
# Создаем директории для nginx и выставляем правильные права
|
|
48
|
-
RUN mkdir -p /var/lib/nginx && \
|
|
49
|
-
chown -R nginx:nginx /var/lib/nginx && \
|
|
50
|
-
chown -R nginx:nginx /var/log/nginx && \
|
|
51
|
-
chown -R nginx:nginx /etc/nginx/conf.d
|
|
52
|
-
RUN touch /var/run/nginx.pid && \
|
|
53
|
-
chown -R nginx:nginx /var/run/nginx.pid
|
|
54
|
-
USER nginx
|
|
55
|
-
`;
|
|
56
|
-
exports.dockerfileTemplate = (0, apply_overrides_1.applyOverrides)('DockerfileCompiled', template);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const dockerfileTemplate: string;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dockerfileTemplate = void 0;
|
|
4
|
-
const app_configs_1 = require("../configs/app-configs");
|
|
5
|
-
const apply_overrides_1 = require("../configs/util/apply-overrides");
|
|
6
|
-
const appPathToAdd = app_configs_1.configs.clientOnly ? app_configs_1.configs.buildPath : '.';
|
|
7
|
-
const appTargetPath = app_configs_1.configs.clientOnly ? `/src/${app_configs_1.configs.buildPath}` : '/src';
|
|
8
|
-
const nginxConfTargetLocation = app_configs_1.configs.clientOnly
|
|
9
|
-
? '/etc/nginx/conf.d/default.conf'
|
|
10
|
-
: '/src/nginx.conf';
|
|
11
|
-
const { nginx } = app_configs_1.configs;
|
|
12
|
-
const nginxNonRootPart = app_configs_1.configs.runFromNonRootUser
|
|
13
|
-
? `RUN chown -R nginx:nginx /src && \\
|
|
14
|
-
mkdir -p /var/lib/nginx && \\
|
|
15
|
-
chown -R nginx:nginx /var/lib/nginx && \\
|
|
16
|
-
chown -R nginx:nginx /var/log/nginx && \\
|
|
17
|
-
chown -R nginx:nginx /etc/nginx/conf.d
|
|
18
|
-
|
|
19
|
-
RUN touch /var/run/nginx.pid && \\
|
|
20
|
-
chown -R nginx:nginx /var/run/nginx.pid
|
|
21
|
-
|
|
22
|
-
USER nginx`
|
|
23
|
-
: '';
|
|
24
|
-
const template = `
|
|
25
|
-
FROM ${app_configs_1.configs.baseDockerImage}
|
|
26
|
-
ARG START_SH_LOCATION
|
|
27
|
-
ARG NGINX_CONF_LOCATION
|
|
28
|
-
ARG NGINX_BASE_CONF_LOCATION
|
|
29
|
-
|
|
30
|
-
WORKDIR /src
|
|
31
|
-
ADD $START_SH_LOCATION /src/start.sh
|
|
32
|
-
ADD $NGINX_CONF_LOCATION ${nginxConfTargetLocation}
|
|
33
|
-
${nginx ? 'ADD $NGINX_BASE_CONF_LOCATION /etc/nginx/nginx.conf' : ''}
|
|
34
|
-
|
|
35
|
-
${app_configs_1.configs.deleteNpm
|
|
36
|
-
? 'RUN rm -rf /usr/local/bin/npm /usr/local/bin/npx /usr/local/lib/node_modules/npm'
|
|
37
|
-
: ''}
|
|
38
|
-
|
|
39
|
-
${nginxNonRootPart}
|
|
40
|
-
|
|
41
|
-
${app_configs_1.configs.runFromNonRootUser
|
|
42
|
-
? `ADD --chown=nginx:nginx ${appPathToAdd} ${appTargetPath}`
|
|
43
|
-
: `ADD ${appPathToAdd} ${appTargetPath}`}
|
|
44
|
-
${app_configs_1.configs.clientOnly ? 'COPY env-config.jso[n] /src/' : ''}
|
|
45
|
-
${app_configs_1.configs.clientOnly ? 'CMD ["nginx"]' : ''}
|
|
46
|
-
`;
|
|
47
|
-
exports.dockerfileTemplate = (0, apply_overrides_1.applyOverrides)('Dockerfile', template);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const nginxConfTemplate: string;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nginxConfTemplate = void 0;
|
|
4
|
-
const app_configs_1 = require("../configs/app-configs");
|
|
5
|
-
const apply_overrides_1 = require("../configs/util/apply-overrides");
|
|
6
|
-
const nginxTemplate = `client_max_body_size 20m;
|
|
7
|
-
|
|
8
|
-
server {
|
|
9
|
-
listen ${app_configs_1.configs.clientServerPort};
|
|
10
|
-
server_tokens off;
|
|
11
|
-
${app_configs_1.configs.dictionaryCompression.enablePreviousVersionHeaders
|
|
12
|
-
? 'brotli_auto_dictionary on;'
|
|
13
|
-
: ''}
|
|
14
|
-
|
|
15
|
-
${app_configs_1.configs.clientOnly
|
|
16
|
-
? `location / {
|
|
17
|
-
root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
|
|
18
|
-
index index.html;
|
|
19
|
-
}`
|
|
20
|
-
: ` location / {
|
|
21
|
-
proxy_set_header Host $host;
|
|
22
|
-
proxy_pass http://127.0.0.1:${app_configs_1.configs.serverPort};
|
|
23
|
-
}`}
|
|
24
|
-
|
|
25
|
-
location /${app_configs_1.configs.publicPath} {
|
|
26
|
-
expires max;
|
|
27
|
-
add_header Cache-Control public;
|
|
28
|
-
root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
location = /${app_configs_1.configs.publicPath}remoteEntry.js {
|
|
32
|
-
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
|
33
|
-
add_header Pragma "no-cache";
|
|
34
|
-
add_header Expires "0";
|
|
35
|
-
root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
|
|
36
|
-
types {
|
|
37
|
-
text/javascript js;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
location ~ /${app_configs_1.configs.publicPath}.*\\.js$ {
|
|
42
|
-
expires max;
|
|
43
|
-
add_header Cache-Control public;
|
|
44
|
-
root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
|
|
45
|
-
types {
|
|
46
|
-
text/javascript js;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}`;
|
|
50
|
-
exports.nginxConfTemplate = (0, apply_overrides_1.applyOverrides)('nginx', nginxTemplate);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const startScript: string;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.startScript = void 0;
|
|
4
|
-
const app_configs_1 = require("../configs/app-configs");
|
|
5
|
-
const client_env_config_1 = require("../configs/client-env-config");
|
|
6
|
-
const apply_overrides_1 = require("../configs/util/apply-overrides");
|
|
7
|
-
const startTemplate = `#!/bin/sh
|
|
8
|
-
|
|
9
|
-
# Подменяем env переменные в nginx конфиге перед стартом
|
|
10
|
-
# Сначала заменяем все слова, начинающиеся на $ но без \${} на ~~слово~~
|
|
11
|
-
# затем запускаем envsubst, после этого обратно заменяем ~~слово~~ на $слово.
|
|
12
|
-
# Это нужно для того, чтоб специальные переменные nginx не подменялись envsubst'ом на
|
|
13
|
-
# пустые строки. envsubst будет заменять только \${слово}.
|
|
14
|
-
cat ./nginx.conf \\
|
|
15
|
-
| sed 's/\\$\\([a-zA-Z0-9_-]\\{1,\\}\\)/~~\\1~~/g' \\
|
|
16
|
-
| envsubst \\
|
|
17
|
-
| sed 's/~~\\([a-zA-Z0-9_-]\\{1,\\}\\)~~/$\\1/g' \\
|
|
18
|
-
> /etc/nginx/conf.d/default.conf
|
|
19
|
-
|
|
20
|
-
# Достаем лимит памяти из cgroup, это то, как его докер задает.
|
|
21
|
-
if [[ -f /sys/fs/cgroup/cgroup.controllers ]]; then
|
|
22
|
-
max_total_memory=$(cat /sys/fs/cgroup/memory.max)
|
|
23
|
-
else
|
|
24
|
-
max_total_memory=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
|
|
25
|
-
fi
|
|
26
|
-
# Самой nodejs мы не можем отдать совсем всю память, операционная система+nginx все же требуют какого то количества.
|
|
27
|
-
# Поэтому мы вычитаем 100мб на нужды ос
|
|
28
|
-
node_memory_limit="$(($max_total_memory / 1024 / 1024 - 100))"
|
|
29
|
-
|
|
30
|
-
# Start the nginx process in background
|
|
31
|
-
nginx &
|
|
32
|
-
|
|
33
|
-
# Start nodejs process
|
|
34
|
-
exec node --max-old-space-size="$node_memory_limit" ./${app_configs_1.configs.buildPath}/${app_configs_1.configs.serverOutput}
|
|
35
|
-
`;
|
|
36
|
-
const envConfigTargetPath = `/src/${app_configs_1.configs.buildPath}/${client_env_config_1.ENV_CONFIG_FILENAME}`;
|
|
37
|
-
const envConfigPath = `/src/${client_env_config_1.ENV_CONFIG_FILENAME}`;
|
|
38
|
-
const htmlPath = `/src/${app_configs_1.configs.buildPath}/index.html`;
|
|
39
|
-
const clientOnlyStartTemplate = `#!/bin/sh
|
|
40
|
-
|
|
41
|
-
# Мы подставляем значения из env в env-config.json если он есть, и кладем его в публичную папку.
|
|
42
|
-
# Дополнительно подставляем контент полученного файла в index.html
|
|
43
|
-
# Так как контент env-config может быть многострочным - дополнительно обрабатываем его через awk.
|
|
44
|
-
if [ -f ${envConfigPath} ]; then
|
|
45
|
-
cat ${envConfigPath} \\
|
|
46
|
-
| envsubst \\
|
|
47
|
-
> ${envConfigTargetPath}
|
|
48
|
-
|
|
49
|
-
# Define the placeholder and the file paths
|
|
50
|
-
PLACEHOLDER='<%= envConfig %>'
|
|
51
|
-
SETTINGS_FILE='${envConfigTargetPath}'
|
|
52
|
-
TARGET_FILE='${htmlPath}'
|
|
53
|
-
|
|
54
|
-
# Escape the placeholder for sed usage
|
|
55
|
-
ESCAPED_PLACEHOLDER=$(echo "$PLACEHOLDER" | sed 's/[\\/&]/\\\\&/g')
|
|
56
|
-
|
|
57
|
-
# Read the content of the settings and prepare it for substitution
|
|
58
|
-
SETTINGS_CONTENT=$(awk '{printf "%s\\\\n", $0}' "$SETTINGS_FILE")
|
|
59
|
-
|
|
60
|
-
# Replace the placeholder in the target file with the content of settings
|
|
61
|
-
cat ${htmlPath} \\
|
|
62
|
-
| sed "s/$ESCAPED_PLACEHOLDER/$SETTINGS_CONTENT/" \\
|
|
63
|
-
> /tmp/index.html
|
|
64
|
-
|
|
65
|
-
mv /tmp/index.html ${htmlPath}
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
nginx`;
|
|
69
|
-
exports.startScript = (0, apply_overrides_1.applyOverrides)('start.sh', app_configs_1.configs.clientOnly ? clientOnlyStartTemplate : startTemplate);
|