arui-scripts 0.0.0-client-only-envs-20250408153713

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.
Files changed (222) hide show
  1. package/.browserslistrc +5 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc.js +17 -0
  4. package/.turbo/turbo-build.log +0 -0
  5. package/.turbo/turbo-test.log +23 -0
  6. package/CHANGELOG.md +1571 -0
  7. package/README.md +47 -0
  8. package/bin/build.sh +2 -0
  9. package/build/bin/index.d.ts +3 -0
  10. package/build/bin/index.js +29 -0
  11. package/build/commands/archive-build/index.d.ts +1 -0
  12. package/build/commands/archive-build/index.js +80 -0
  13. package/build/commands/build/build-wrapper.d.ts +8 -0
  14. package/build/commands/build/build-wrapper.js +42 -0
  15. package/build/commands/build/client.d.ts +1 -0
  16. package/build/commands/build/client.js +41 -0
  17. package/build/commands/build/index.d.ts +1 -0
  18. package/build/commands/build/index.js +15 -0
  19. package/build/commands/build/server.d.ts +1 -0
  20. package/build/commands/build/server.js +29 -0
  21. package/build/commands/bundle-analyze/index.d.ts +1 -0
  22. package/build/commands/bundle-analyze/index.js +40 -0
  23. package/build/commands/changelog/index.d.ts +5 -0
  24. package/build/commands/changelog/index.js +113 -0
  25. package/build/commands/docker-build/index.d.ts +1 -0
  26. package/build/commands/docker-build/index.js +73 -0
  27. package/build/commands/docker-build-compiled/index.d.ts +1 -0
  28. package/build/commands/docker-build-compiled/index.js +54 -0
  29. package/build/commands/ensure-yarn/index.d.ts +0 -0
  30. package/build/commands/ensure-yarn/index.js +8 -0
  31. package/build/commands/start/client.d.ts +1 -0
  32. package/build/commands/start/client.js +8 -0
  33. package/build/commands/start/index.d.ts +1 -0
  34. package/build/commands/start/index.js +17 -0
  35. package/build/commands/start/print-compiler-output.d.ts +1 -0
  36. package/build/commands/start/print-compiler-output.js +16 -0
  37. package/build/commands/start/server.d.ts +1 -0
  38. package/build/commands/start/server.js +8 -0
  39. package/build/commands/start-prod/client.d.ts +1 -0
  40. package/build/commands/start-prod/client.js +8 -0
  41. package/build/commands/start-prod/index.d.ts +1 -0
  42. package/build/commands/start-prod/index.js +17 -0
  43. package/build/commands/start-prod/server.d.ts +1 -0
  44. package/build/commands/start-prod/server.js +8 -0
  45. package/build/commands/test/get-config.d.ts +1 -0
  46. package/build/commands/test/get-config.js +104 -0
  47. package/build/commands/test/index.d.ts +1 -0
  48. package/build/commands/test/index.js +60 -0
  49. package/build/commands/util/client-assets-sizes.d.ts +26 -0
  50. package/build/commands/util/client-assets-sizes.js +82 -0
  51. package/build/commands/util/docker-build.d.ts +23 -0
  52. package/build/commands/util/docker-build.js +127 -0
  53. package/build/commands/util/exec.d.ts +2 -0
  54. package/build/commands/util/exec.js +20 -0
  55. package/build/commands/util/format-webpack-messages.d.ts +11 -0
  56. package/build/commands/util/format-webpack-messages.js +95 -0
  57. package/build/commands/util/make-tmp-dir.d.ts +6 -0
  58. package/build/commands/util/make-tmp-dir.js +29 -0
  59. package/build/commands/util/run-client-dev-server.d.ts +2 -0
  60. package/build/commands/util/run-client-dev-server.js +46 -0
  61. package/build/commands/util/run-compilers.d.ts +1 -0
  62. package/build/commands/util/run-compilers.js +37 -0
  63. package/build/commands/util/run-server-watch-compiler.d.ts +2 -0
  64. package/build/commands/util/run-server-watch-compiler.js +19 -0
  65. package/build/commands/util/tsc.d.ts +1 -0
  66. package/build/commands/util/tsc.js +13 -0
  67. package/build/commands/util/yarn.d.ts +5 -0
  68. package/build/commands/util/yarn.js +55 -0
  69. package/build/configs/app-configs/calculate-dependent-config.d.ts +9 -0
  70. package/build/configs/app-configs/calculate-dependent-config.js +38 -0
  71. package/build/configs/app-configs/get-defaults.d.ts +5 -0
  72. package/build/configs/app-configs/get-defaults.js +139 -0
  73. package/build/configs/app-configs/index.d.ts +6 -0
  74. package/build/configs/app-configs/index.js +24 -0
  75. package/build/configs/app-configs/read-config-file.d.ts +2 -0
  76. package/build/configs/app-configs/read-config-file.js +28 -0
  77. package/build/configs/app-configs/types.d.ts +126 -0
  78. package/build/configs/app-configs/types.js +2 -0
  79. package/build/configs/app-configs/update-with-config-file.d.ts +2 -0
  80. package/build/configs/app-configs/update-with-config-file.js +17 -0
  81. package/build/configs/app-configs/update-with-env.d.ts +2 -0
  82. package/build/configs/app-configs/update-with-env.js +23 -0
  83. package/build/configs/app-configs/update-with-package.d.ts +2 -0
  84. package/build/configs/app-configs/update-with-package.js +13 -0
  85. package/build/configs/app-configs/update-with-presets.d.ts +3 -0
  86. package/build/configs/app-configs/update-with-presets.js +41 -0
  87. package/build/configs/app-configs/validate-settings-keys.d.ts +4 -0
  88. package/build/configs/app-configs/validate-settings-keys.js +13 -0
  89. package/build/configs/app-configs/warn-about-deprecations.d.ts +2 -0
  90. package/build/configs/app-configs/warn-about-deprecations.js +20 -0
  91. package/build/configs/babel-client.d.ts +32 -0
  92. package/build/configs/babel-client.js +72 -0
  93. package/build/configs/babel-dependencies.d.ts +14 -0
  94. package/build/configs/babel-dependencies.js +39 -0
  95. package/build/configs/babel-server.d.ts +27 -0
  96. package/build/configs/babel-server.js +48 -0
  97. package/build/configs/client-env-config/add-env-to-html-template.d.ts +1 -0
  98. package/build/configs/client-env-config/add-env-to-html-template.js +7 -0
  99. package/build/configs/client-env-config/client-config-plugin.d.ts +5 -0
  100. package/build/configs/client-env-config/client-config-plugin.js +26 -0
  101. package/build/configs/client-env-config/constants.d.ts +1 -0
  102. package/build/configs/client-env-config/constants.js +4 -0
  103. package/build/configs/client-env-config/get-env-config.d.ts +2 -0
  104. package/build/configs/client-env-config/get-env-config.js +28 -0
  105. package/build/configs/client-env-config/index.d.ts +3 -0
  106. package/build/configs/client-env-config/index.js +9 -0
  107. package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +28 -0
  108. package/build/configs/config-extras/minimizers/imagemin/imagemin.js +65 -0
  109. package/build/configs/config-extras/minimizers/imagemin/index.d.ts +1 -0
  110. package/build/configs/config-extras/minimizers/imagemin/index.js +17 -0
  111. package/build/configs/config-extras/minimizers/index.d.ts +1 -0
  112. package/build/configs/config-extras/minimizers/index.js +17 -0
  113. package/build/configs/dev-server.d.ts +2 -0
  114. package/build/configs/dev-server.js +73 -0
  115. package/build/configs/jest/babel-transform.d.ts +2 -0
  116. package/build/configs/jest/babel-transform.js +6 -0
  117. package/build/configs/jest/css-mock.d.ts +1 -0
  118. package/build/configs/jest/css-mock.js +2 -0
  119. package/build/configs/jest/file-transform.d.ts +3 -0
  120. package/build/configs/jest/file-transform.js +11 -0
  121. package/build/configs/jest/settings.d.ts +21 -0
  122. package/build/configs/jest/settings.js +58 -0
  123. package/build/configs/modules.d.ts +16 -0
  124. package/build/configs/modules.js +149 -0
  125. package/build/configs/mq.css +22 -0
  126. package/build/configs/postcss.config.d.ts +36 -0
  127. package/build/configs/postcss.config.js +71 -0
  128. package/build/configs/postcss.d.ts +2 -0
  129. package/build/configs/postcss.js +11 -0
  130. package/build/configs/process-assets-plugin-output.d.ts +2 -0
  131. package/build/configs/process-assets-plugin-output.js +45 -0
  132. package/build/configs/server-externals-exemptions.d.ts +1 -0
  133. package/build/configs/server-externals-exemptions.js +21 -0
  134. package/build/configs/stats-options.d.ts +3 -0
  135. package/build/configs/stats-options.js +49 -0
  136. package/build/configs/supporting-browsers.d.ts +2 -0
  137. package/build/configs/supporting-browsers.js +8 -0
  138. package/build/configs/swc.d.ts +4 -0
  139. package/build/configs/swc.js +35 -0
  140. package/build/configs/util/apply-overrides.d.ts +76 -0
  141. package/build/configs/util/apply-overrides.js +52 -0
  142. package/build/configs/util/check-node-version.d.ts +2 -0
  143. package/build/configs/util/check-node-version.js +7 -0
  144. package/build/configs/util/find-loader.d.ts +2 -0
  145. package/build/configs/util/find-loader.js +24 -0
  146. package/build/configs/util/find-plugin.d.ts +85 -0
  147. package/build/configs/util/find-plugin.js +22 -0
  148. package/build/configs/util/get-entry.d.ts +9 -0
  149. package/build/configs/util/get-entry.js +22 -0
  150. package/build/configs/util/get-polyfills.d.ts +2 -0
  151. package/build/configs/util/get-polyfills.js +26 -0
  152. package/build/configs/util/get-webpack-cache-dependencies.d.ts +1 -0
  153. package/build/configs/util/get-webpack-cache-dependencies.js +18 -0
  154. package/build/configs/util/install-sourcemap-support.d.ts +1 -0
  155. package/build/configs/util/install-sourcemap-support.js +11 -0
  156. package/build/configs/util/node-assets-ignore.d.ts +0 -0
  157. package/build/configs/util/node-assets-ignore.js +33 -0
  158. package/build/configs/util/noop.d.ts +1 -0
  159. package/build/configs/util/noop.js +2 -0
  160. package/build/configs/util/register-ts-node.d.ts +0 -0
  161. package/build/configs/util/register-ts-node.js +18 -0
  162. package/build/configs/util/resolve.d.ts +12 -0
  163. package/build/configs/util/resolve.js +29 -0
  164. package/build/configs/webpack.client.d.ts +10 -0
  165. package/build/configs/webpack.client.dev.d.ts +2 -0
  166. package/build/configs/webpack.client.dev.js +15 -0
  167. package/build/configs/webpack.client.js +475 -0
  168. package/build/configs/webpack.client.prod.d.ts +2 -0
  169. package/build/configs/webpack.client.prod.js +15 -0
  170. package/build/configs/webpack.server.d.ts +2 -0
  171. package/build/configs/webpack.server.dev.d.ts +2 -0
  172. package/build/configs/webpack.server.dev.js +11 -0
  173. package/build/configs/webpack.server.js +256 -0
  174. package/build/configs/webpack.server.prod.d.ts +2 -0
  175. package/build/configs/webpack.server.prod.js +11 -0
  176. package/build/index.d.ts +5 -0
  177. package/build/index.js +9 -0
  178. package/build/plugins/arui-runtime/arui-runtime-module.d.ts +7 -0
  179. package/build/plugins/arui-runtime/arui-runtime-module.js +20 -0
  180. package/build/plugins/arui-runtime/index.d.ts +11 -0
  181. package/build/plugins/arui-runtime/index.js +47 -0
  182. package/build/plugins/postcss-global-variables/postcss-global-variables.d.ts +6 -0
  183. package/build/plugins/postcss-global-variables/postcss-global-variables.js +38 -0
  184. package/build/plugins/postcss-global-variables/utils/utils.d.ts +7 -0
  185. package/build/plugins/postcss-global-variables/utils/utils.js +91 -0
  186. package/build/plugins/postcss-prefix-selector.d.ts +6 -0
  187. package/build/plugins/postcss-prefix-selector.js +62 -0
  188. package/build/plugins/reload-server-plugin.d.ts +10 -0
  189. package/build/plugins/reload-server-plugin.js +44 -0
  190. package/build/plugins/turn-off-split-remote-entry.d.ts +11 -0
  191. package/build/plugins/turn-off-split-remote-entry.js +71 -0
  192. package/build/plugins/watch-missing-node-modules-plugin.d.ts +6 -0
  193. package/build/plugins/watch-missing-node-modules-plugin.js +20 -0
  194. package/build/templates/base-nginx.conf.template.d.ts +2 -0
  195. package/build/templates/base-nginx.conf.template.js +61 -0
  196. package/build/templates/dockerfile-compiled.template.d.ts +2 -0
  197. package/build/templates/dockerfile-compiled.template.js +52 -0
  198. package/build/templates/dockerfile.template.d.ts +2 -0
  199. package/build/templates/dockerfile.template.js +41 -0
  200. package/build/templates/html.template.d.ts +1 -0
  201. package/build/templates/html.template.js +25 -0
  202. package/build/templates/nginx.conf.template.d.ts +2 -0
  203. package/build/templates/nginx.conf.template.js +39 -0
  204. package/build/templates/start.template.d.ts +2 -0
  205. package/build/templates/start.template.js +69 -0
  206. package/build/tsconfig-local.tsbuildinfo +1 -0
  207. package/docs/artifact.md +58 -0
  208. package/docs/caveats.md +41 -0
  209. package/docs/client-only.md +77 -0
  210. package/docs/commands.md +125 -0
  211. package/docs/compilers.md +18 -0
  212. package/docs/examples.md +100 -0
  213. package/docs/modules.md +780 -0
  214. package/docs/overrides.md +167 -0
  215. package/docs/presets.md +65 -0
  216. package/docs/settings.md +287 -0
  217. package/jest-preset.js +5 -0
  218. package/package.json +180 -0
  219. package/stylelint.config.js +11 -0
  220. package/tsconfig-local.json +16 -0
  221. package/tsconfig.eslint.json +5 -0
  222. package/tsconfig.json +71 -0
@@ -0,0 +1,11 @@
1
+ import { Compiler, RspackPluginInstance } from '@rspack/core';
2
+ /**
3
+ * Force remote entry not be affected by user's chunkSplit strategy,
4
+ * Otherwise, the remote chunk will not be loaded correctly.
5
+ * @see https://github.com/web-infra-dev/rsbuild/discussions/1461#discussioncomment-8329790
6
+ */
7
+ export declare class TurnOffSplitRemoteEntry implements RspackPluginInstance {
8
+ name: string;
9
+ constructor(wmfContainerName: string);
10
+ apply(compiler: Compiler): void;
11
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TurnOffSplitRemoteEntry = void 0;
4
+ const util_1 = require("util");
5
+ /**
6
+ * Force remote entry not be affected by user's chunkSplit strategy,
7
+ * Otherwise, the remote chunk will not be loaded correctly.
8
+ * @see https://github.com/web-infra-dev/rsbuild/discussions/1461#discussioncomment-8329790
9
+ */
10
+ class TurnOffSplitRemoteEntry {
11
+ constructor(wmfContainerName) {
12
+ this.name = wmfContainerName;
13
+ }
14
+ apply(compiler) {
15
+ const { splitChunks } = compiler.options.optimization;
16
+ if (!splitChunks) {
17
+ return;
18
+ }
19
+ /* eslint-disable no-param-reassign */
20
+ const applyPatch = (cacheGroup) => {
21
+ if (typeof cacheGroup !== 'object' || util_1.types.isRegExp(cacheGroup)) {
22
+ return;
23
+ }
24
+ // cacheGroup.chunks will inherit splitChunks.chunks
25
+ // so we only need to modify the chunks that are set separately.
26
+ const { chunks } = cacheGroup;
27
+ if (!chunks || chunks === 'async') {
28
+ return;
29
+ }
30
+ if (typeof chunks === 'function') {
31
+ const prevChunks = chunks;
32
+ cacheGroup.chunks = (chunk) => {
33
+ if (chunk.name && chunk.name === this.name) {
34
+ return false;
35
+ }
36
+ return prevChunks(chunk);
37
+ };
38
+ return;
39
+ }
40
+ if (chunks === 'all') {
41
+ cacheGroup.chunks = (chunk) => {
42
+ if (chunk.name && chunk.name === this.name) {
43
+ return false;
44
+ }
45
+ return true;
46
+ };
47
+ return;
48
+ }
49
+ if (chunks === 'initial') {
50
+ cacheGroup.chunks = (chunk) => {
51
+ if (chunk.name && chunk.name === this.name) {
52
+ return false;
53
+ }
54
+ return chunk.isOnlyInitial();
55
+ };
56
+ }
57
+ };
58
+ /* eslint-enable no-param-reassign */
59
+ // patch splitChunk.chunks
60
+ applyPatch(splitChunks);
61
+ const { cacheGroups } = splitChunks;
62
+ if (!cacheGroups) {
63
+ return;
64
+ }
65
+ // patch splitChunk.cacheGroups[key].chunks
66
+ for (const cacheGroupKey of Object.keys(cacheGroups)) {
67
+ applyPatch(cacheGroups[cacheGroupKey]);
68
+ }
69
+ }
70
+ }
71
+ exports.TurnOffSplitRemoteEntry = TurnOffSplitRemoteEntry;
@@ -0,0 +1,6 @@
1
+ import { type Compiler } from 'webpack';
2
+ export declare class WatchMissingNodeModulesPlugin {
3
+ nodeModulesPath: string;
4
+ constructor(nodeModulesPath: string);
5
+ apply(compiler: Compiler): void;
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WatchMissingNodeModulesPlugin = void 0;
4
+ class WatchMissingNodeModulesPlugin {
5
+ constructor(nodeModulesPath) {
6
+ this.nodeModulesPath = nodeModulesPath;
7
+ }
8
+ apply(compiler) {
9
+ compiler.hooks.emit.tap('WatchMissingNodeModulesPlugin', (compilation) => {
10
+ const missingDeps = Array.from(compilation.missingDependencies);
11
+ const { nodeModulesPath } = this;
12
+ // If any missing files are expected to appear in node_modules...
13
+ if (missingDeps.some((file) => file.includes(nodeModulesPath))) {
14
+ // ...tell webpack to watch node_modules recursively until they appear.
15
+ compilation.contextDependencies.add(nodeModulesPath);
16
+ }
17
+ });
18
+ }
19
+ }
20
+ exports.WatchMissingNodeModulesPlugin = WatchMissingNodeModulesPlugin;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -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);
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,52 @@
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 yarn_1 = require("../commands/util/yarn");
7
+ const app_configs_1 = __importDefault(require("../configs/app-configs"));
8
+ const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
9
+ const installProductionCommand = (0, yarn_1.getInstallProductionCommand)();
10
+ const yarnVersion = (0, yarn_1.getYarnVersion)();
11
+ const { nginx } = app_configs_1.default;
12
+ // В зависимости от используемого мендежера зависимостей для их установки нужно копировать разный набор файлов
13
+ const filesRequiredToInstallDependencies = [
14
+ 'package.json',
15
+ 'yarn.lock',
16
+ yarnVersion === '2+' && '.yarnrc.yml',
17
+ yarnVersion === '2+' && '.yarn',
18
+ yarnVersion === 'unavailable' && 'package-lock.json',
19
+ ].filter(Boolean);
20
+ const dockerfileTemplate = `
21
+ FROM ${app_configs_1.default.baseDockerImage}
22
+ ARG START_SH_LOCATION
23
+ ARG NGINX_CONF_LOCATION
24
+ ARG NGINX_BASE_CONF_LOCATION
25
+
26
+ WORKDIR /src
27
+
28
+ # Полу-статичные файлы, могут легко кешироваться
29
+ ADD $START_SH_LOCATION /src/start.sh
30
+ ADD $NGINX_CONF_LOCATION /src/nginx.conf
31
+ ${nginx ? 'ADD $NGINX_BASE_CONF_LOCATION /etc/nginx/nginx.conf' : ''}
32
+
33
+ # Зависимости. При некоторой удаче могут кешироваться и соответственно кешировать установку зависимостей
34
+ ${filesRequiredToInstallDependencies
35
+ .map((file) => `ADD --chown=nginx:nginx ${file} /src/${file}`)
36
+ .join('\n')}
37
+
38
+ RUN ${installProductionCommand} && \\
39
+ ${yarnVersion === 'unavailable' ? 'npm cache clean --force' : 'yarn cache clean'}
40
+
41
+ ADD --chown=nginx:nginx . /src
42
+
43
+ # Создаем директории для nginx и выставляем правильные права
44
+ RUN mkdir -p /var/lib/nginx && \
45
+ chown -R nginx:nginx /var/lib/nginx && \
46
+ chown -R nginx:nginx /var/log/nginx && \
47
+ chown -R nginx:nginx /etc/nginx/conf.d
48
+ RUN touch /var/run/nginx.pid && \
49
+ chown -R nginx:nginx /var/run/nginx.pid
50
+ USER nginx
51
+ `;
52
+ exports.default = (0, apply_overrides_1.default)('DockerfileCompiled', dockerfileTemplate);
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,41 @@
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 appPathToAdd = app_configs_1.configs.clientOnly ? app_configs_1.configs.buildPath : '.';
9
+ const appTargetPath = app_configs_1.configs.clientOnly ? `/src/${app_configs_1.configs.buildPath}` : '/src';
10
+ const nginxConfTargetLocation = app_configs_1.configs.clientOnly ? '/etc/nginx/conf.d/default.conf' : '/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 dockerfileTemplate = `
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
+ ${nginxNonRootPart}
36
+
37
+ ${app_configs_1.configs.runFromNonRootUser ? `ADD --chown=nginx:nginx ${appPathToAdd} ${appTargetPath}` : `ADD ${appPathToAdd} ${appTargetPath}`}
38
+ ${app_configs_1.configs.clientOnly ? 'COPY env-config.jso[n] /src/' : ''}
39
+ ${app_configs_1.configs.clientOnly ? 'CMD ["nginx"]' : ''}
40
+ `;
41
+ exports.default = (0, apply_overrides_1.default)('Dockerfile', dockerfileTemplate);
@@ -0,0 +1 @@
1
+ export declare const htmlTemplate = "<!doctype html>\n<html lang=\"ru\">\n <head>\n <meta charset=\"utf-8\" />\n <title>React-app</title>\n <link\n rel=\"shortcut icon\"\n href=\"data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='50' cy='50' r='50' fill='%23EF3124' /%3E%3C/svg%3E\"\n >\n </head>\n <body>\n <div id=\"react-app\"></div>\n <script id=\"env-settings\" type=\"application/json\">\n <%= envConfig %>\n </script>\n </body>\n</html>";
@@ -0,0 +1,25 @@
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.htmlTemplate = void 0;
7
+ const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
8
+ const template = `<!doctype html>
9
+ <html lang="ru">
10
+ <head>
11
+ <meta charset="utf-8" />
12
+ <title>React-app</title>
13
+ <link
14
+ rel="shortcut icon"
15
+ href="data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='50' cy='50' r='50' fill='%23EF3124' /%3E%3C/svg%3E"
16
+ >
17
+ </head>
18
+ <body>
19
+ <div id="react-app"></div>
20
+ <script id="env-settings" type="application/json">
21
+ <%= envConfig %>
22
+ </script>
23
+ </body>
24
+ </html>`;
25
+ exports.htmlTemplate = (0, apply_overrides_1.default)('html', template);
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,39 @@
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 nginxTemplate = `client_max_body_size 20m;
9
+
10
+ server {
11
+ listen ${app_configs_1.configs.clientServerPort};
12
+ server_tokens off;
13
+
14
+ ${app_configs_1.configs.clientOnly
15
+ ? `location / {
16
+ root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
17
+ index index.html;
18
+ }`
19
+ : ` location / {
20
+ proxy_set_header Host $host;
21
+ proxy_pass http://127.0.0.1:${app_configs_1.configs.serverPort};
22
+ }`}
23
+
24
+ location /${app_configs_1.configs.publicPath} {
25
+ expires max;
26
+ add_header Cache-Control public;
27
+ root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
28
+ }
29
+
30
+ location ~ /${app_configs_1.configs.publicPath}.*\\.js$ {
31
+ expires max;
32
+ add_header Cache-Control public;
33
+ root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
34
+ types {
35
+ text/javascript js;
36
+ }
37
+ }
38
+ }`;
39
+ exports.default = (0, apply_overrides_1.default)('nginx', nginxTemplate);
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,69 @@
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 client_env_config_1 = require("../configs/client-env-config");
8
+ const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
9
+ const startTemplate = `#!/bin/sh
10
+
11
+ # Подменяем env переменные в nginx конфиге перед стартом
12
+ # Сначала заменяем все слова, начинающиеся на $ но без \${} на ~~слово~~
13
+ # затем запускаем envsubst, после этого обратно заменяем ~~слово~~ на $слово.
14
+ # Это нужно для того, чтоб специальные переменные nginx не подменялись envsubst'ом на
15
+ # пустые строки. envsubst будет заменять только \${слово}.
16
+ cat ./nginx.conf \\
17
+ | sed 's/\\$\\([a-zA-Z0-9_-]\\{1,\\}\\)/~~\\1~~/g' \\
18
+ | envsubst \\
19
+ | sed 's/~~\\([a-zA-Z0-9_-]\\{1,\\}\\)~~/$\\1/g' \\
20
+ > /etc/nginx/conf.d/default.conf
21
+
22
+ # Достаем лимит памяти из cgroup, это то, как его докер задает.
23
+ if [[ -f /sys/fs/cgroup/cgroup.controllers ]]; then
24
+ max_total_memory=$(cat /sys/fs/cgroup/memory.max)
25
+ else
26
+ max_total_memory=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
27
+ fi
28
+ # Самой nodejs мы не можем отдать совсем всю память, операционная система+nginx все же требуют какого то количества.
29
+ # Поэтому мы вычитаем 100мб на нужды ос
30
+ node_memory_limit="$(($max_total_memory / 1024 / 1024 - 100))"
31
+
32
+ # Start the nginx process in background
33
+ nginx &
34
+
35
+ # Start nodejs process
36
+ node --max-old-space-size="$node_memory_limit" ./${app_configs_1.configs.buildPath}/${app_configs_1.configs.serverOutput}
37
+ `;
38
+ const envConfigTargetPath = `/src/${app_configs_1.configs.buildPath}/${client_env_config_1.ENV_CONFIG_FILENAME}`;
39
+ const envConfigPath = `/src/${client_env_config_1.ENV_CONFIG_FILENAME}`;
40
+ const htmlPath = `/src/${app_configs_1.configs.buildPath}/index.html`;
41
+ const clientOnlyStartTemplate = `#!/bin/sh
42
+
43
+ # Мы подставляем значения из env в env-config.json если он есть, и кладем его в публичную папку.
44
+ # Дополнительно подставляем контент полученного файла в index.html
45
+ # Так как контент env-config может быть многострочным - дополнительно обрабатываем его через awk.
46
+ if [ -f ${envConfigPath} ]; then
47
+ envsubst < ${envConfigPath} > ${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.default = (0, apply_overrides_1.default)('start.sh', app_configs_1.configs.clientOnly ? clientOnlyStartTemplate : startTemplate);