arui-scripts 17.0.2 → 17.1.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 -27
- package/.turbo/turbo-test.log +4 -4
- package/CHANGELOG.md +6 -0
- package/README.md +1 -0
- package/build/commands/build/index.js +8 -1
- package/build/commands/bundle-analyze/index.js +2 -2
- package/build/commands/start/index.js +10 -16
- package/build/commands/start-prod/index.js +12 -1
- package/build/commands/util/tsc.d.ts +1 -0
- package/build/commands/util/tsc.js +14 -0
- package/build/commands/util/yarn.js +5 -2
- package/build/configs/app-configs/calculate-dependent-config.d.ts +1 -0
- package/build/configs/app-configs/get-defaults.js +1 -0
- package/build/configs/app-configs/types.d.ts +1 -0
- package/build/configs/dev-server.js +37 -34
- package/build/configs/util/apply-overrides.d.ts +1 -0
- package/build/configs/webpack.client.js +43 -37
- package/build/templates/dockerfile.template.js +11 -6
- package/build/templates/html.template.d.ts +1 -0
- package/build/templates/html.template.js +22 -0
- package/build/templates/nginx.conf.template.js +14 -9
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/docs/client-only.md +11 -0
- package/docs/commands.md +2 -0
- package/docs/overrides.md +2 -1
- package/docs/settings.md +4 -0
- package/package.json +2 -1
|
@@ -15,6 +15,7 @@ const assets_webpack_plugin_1 = __importDefault(require("assets-webpack-plugin")
|
|
|
15
15
|
const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
|
|
16
16
|
const compression_webpack_plugin_1 = __importDefault(require("compression-webpack-plugin"));
|
|
17
17
|
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
18
|
+
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
18
19
|
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
19
20
|
const mini_svg_data_uri_1 = __importDefault(require("mini-svg-data-uri"));
|
|
20
21
|
const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
|
|
@@ -22,38 +23,39 @@ const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-
|
|
|
22
23
|
const webpack_1 = __importDefault(require("webpack"));
|
|
23
24
|
const webpack_deduplication_plugin_1 = require("webpack-deduplication-plugin");
|
|
24
25
|
const webpack_manifest_plugin_1 = require("webpack-manifest-plugin");
|
|
26
|
+
const arui_runtime_1 = require("../plugins/arui-runtime");
|
|
27
|
+
const html_template_1 = require("../templates/html.template");
|
|
25
28
|
const minimizers_1 = require("./config-extras/minimizers");
|
|
26
29
|
const check_node_version_1 = __importDefault(require("./util/check-node-version"));
|
|
27
30
|
const get_entry_1 = __importDefault(require("./util/get-entry"));
|
|
28
|
-
const
|
|
31
|
+
const get_webpack_cache_dependencies_1 = require("./util/get-webpack-cache-dependencies");
|
|
32
|
+
const app_configs_1 = require("./app-configs");
|
|
29
33
|
const babel_client_1 = __importDefault(require("./babel-client"));
|
|
30
34
|
const babel_dependencies_1 = require("./babel-dependencies");
|
|
31
35
|
const modules_1 = require("./modules");
|
|
32
36
|
const postcss_1 = __importDefault(require("./postcss"));
|
|
33
37
|
const process_assets_plugin_output_1 = require("./process-assets-plugin-output");
|
|
34
|
-
const arui_runtime_1 = require("../plugins/arui-runtime");
|
|
35
|
-
const get_webpack_cache_dependencies_1 = require("./util/get-webpack-cache-dependencies");
|
|
36
38
|
const PnpWebpackPlugin = require('pnp-webpack-plugin');
|
|
37
39
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
38
40
|
const noopPath = require.resolve('./util/noop');
|
|
39
41
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40
42
|
function getSingleEntry(entryPoint, mode) {
|
|
41
43
|
return [
|
|
42
|
-
...(Array.isArray(app_configs_1.
|
|
43
|
-
? app_configs_1.
|
|
44
|
-
: [app_configs_1.
|
|
44
|
+
...(Array.isArray(app_configs_1.configs.clientPolyfillsEntry)
|
|
45
|
+
? app_configs_1.configs.clientPolyfillsEntry
|
|
46
|
+
: [app_configs_1.configs.clientPolyfillsEntry]),
|
|
45
47
|
...entryPoint,
|
|
46
48
|
].filter(Boolean);
|
|
47
49
|
}
|
|
48
50
|
// Нам важно шарить assets plugin между разными сборками, чтобы файл не перезаписывался
|
|
49
51
|
const assetsPlugin = new assets_webpack_plugin_1.default({
|
|
50
|
-
path: app_configs_1.
|
|
52
|
+
path: app_configs_1.configs.serverOutputPath,
|
|
51
53
|
processOutput: process_assets_plugin_output_1.processAssetsPluginOutput,
|
|
52
54
|
});
|
|
53
55
|
// Этот плагин нужен для того, чтобы клиентский код так же могу получить информацию о сборке.
|
|
54
56
|
// Это позволяет нам использовать данные о сборки на клиенте.
|
|
55
57
|
const clientAssetsPlugin = new assets_webpack_plugin_1.default({
|
|
56
|
-
path: app_configs_1.
|
|
58
|
+
path: app_configs_1.configs.clientOutputPath,
|
|
57
59
|
processOutput: process_assets_plugin_output_1.processAssetsPluginOutput,
|
|
58
60
|
});
|
|
59
61
|
function getMinimizeConfig(mode) {
|
|
@@ -104,7 +106,7 @@ function getMinimizeConfig(mode) {
|
|
|
104
106
|
].filter(Boolean),
|
|
105
107
|
};
|
|
106
108
|
}
|
|
107
|
-
if (app_configs_1.
|
|
109
|
+
if (app_configs_1.configs.keepCssVars) {
|
|
108
110
|
// Каждый импорт css файла с переменными приводит к дублированию всего набора.
|
|
109
111
|
// Чтобы этого избежать — проходимся плагином, который удалит дубли из выходного файла.
|
|
110
112
|
return {
|
|
@@ -132,20 +134,20 @@ function getMinimizeConfig(mode) {
|
|
|
132
134
|
* @param configName Имя конфигурации, если не указано, то используется имя по умолчанию
|
|
133
135
|
*/
|
|
134
136
|
// eslint-disable-next-line complexity
|
|
135
|
-
const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.assign(Object.assign({}, (configName ? { name: configName } : {})), { target: 'web', mode: mode === 'dev' ? 'development' : 'production', devtool: mode === 'dev' ? app_configs_1.
|
|
137
|
+
const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.assign(Object.assign({}, (configName ? { name: configName } : {})), { target: 'web', mode: mode === 'dev' ? 'development' : 'production', devtool: mode === 'dev' ? app_configs_1.configs.devSourceMaps : 'source-map', entry: (0, get_entry_1.default)(entry, getSingleEntry, mode),
|
|
136
138
|
// in production mode we need to fail on first error
|
|
137
|
-
bail: mode === 'prod', context: app_configs_1.
|
|
139
|
+
bail: mode === 'prod', context: app_configs_1.configs.cwd, output: {
|
|
138
140
|
assetModuleFilename: 'static/media/[name].[hash:8][ext]',
|
|
139
141
|
// Add /* filename */ comments to generated require()s in the output.
|
|
140
142
|
pathinfo: mode === 'dev',
|
|
141
|
-
path: app_configs_1.
|
|
142
|
-
publicPath: app_configs_1.
|
|
143
|
+
path: app_configs_1.configs.clientOutputPath,
|
|
144
|
+
publicPath: app_configs_1.configs.publicPath,
|
|
143
145
|
filename: mode === 'dev' ? '[name].js' : '[name].[chunkhash:8].js',
|
|
144
146
|
chunkFilename: mode === 'dev'
|
|
145
147
|
? `${configName ? `${configName}-` : ''}[name].js`
|
|
146
148
|
: `${configName ? `${configName}-` : ''}[name].[chunkhash:8].chunk.js`,
|
|
147
149
|
// Point sourcemap entries to original disk location (format as URL on Windows)
|
|
148
|
-
devtoolModuleFilenameTemplate: (info) => path_1.default.relative(app_configs_1.
|
|
150
|
+
devtoolModuleFilenameTemplate: (info) => path_1.default.relative(app_configs_1.configs.appSrc, info.absoluteResourcePath).replace(/\\/g, '/'),
|
|
149
151
|
}, optimization: Object.assign(Object.assign({}, getMinimizeConfig(mode)), { splitChunks: mode === 'prod'
|
|
150
152
|
? {
|
|
151
153
|
chunks: 'all',
|
|
@@ -179,7 +181,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
179
181
|
// We placed these paths second because we want `node_modules` to "win"
|
|
180
182
|
// if there are any conflicts. This matches Node resolution mechanism.
|
|
181
183
|
// https://github.com/facebookincubator/create-react-app/issues/253
|
|
182
|
-
modules: ['node_modules', app_configs_1.
|
|
184
|
+
modules: ['node_modules', app_configs_1.configs.appNodeModules],
|
|
183
185
|
// These are the reasonable defaults supported by the Node ecosystem.
|
|
184
186
|
// We also include JSX as a common component filename extension to support
|
|
185
187
|
// some tools, although we do not recommend using it, see:
|
|
@@ -188,9 +190,9 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
188
190
|
// for React Native Web.
|
|
189
191
|
extensions: ['.web.js', '.mjs', '.cjs', '.js', '.json', '.web.jsx', '.jsx', '.ts', '.tsx'],
|
|
190
192
|
plugins: [
|
|
191
|
-
app_configs_1.
|
|
193
|
+
app_configs_1.configs.tsconfig &&
|
|
192
194
|
new tsconfig_paths_webpack_plugin_1.default({
|
|
193
|
-
configFile: app_configs_1.
|
|
195
|
+
configFile: app_configs_1.configs.tsconfig,
|
|
194
196
|
extensions: [
|
|
195
197
|
'.web.js',
|
|
196
198
|
'.mjs',
|
|
@@ -213,7 +215,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
213
215
|
: false, module: {
|
|
214
216
|
// typescript interface will be removed from modules, and we will get an error on correct code
|
|
215
217
|
// see https://github.com/webpack/webpack/issues/7378
|
|
216
|
-
strictExportPresence: !app_configs_1.
|
|
218
|
+
strictExportPresence: !app_configs_1.configs.tsconfig,
|
|
217
219
|
rules: [
|
|
218
220
|
{
|
|
219
221
|
// "oneOf" will traverse all following loaders until one will
|
|
@@ -222,10 +224,10 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
222
224
|
oneOf: [
|
|
223
225
|
// Process JS with Babel.
|
|
224
226
|
{
|
|
225
|
-
test: app_configs_1.
|
|
227
|
+
test: app_configs_1.configs.useTscLoader
|
|
226
228
|
? /\.(js|jsx|mjs|cjs)$/
|
|
227
229
|
: /\.(js|jsx|mjs|ts|tsx|cjs)$/,
|
|
228
|
-
include: app_configs_1.
|
|
230
|
+
include: app_configs_1.configs.appSrc,
|
|
229
231
|
loader: require.resolve('babel-loader'),
|
|
230
232
|
options: Object.assign(Object.assign({}, babel_client_1.default), { cacheDirectory: mode === 'dev', cacheCompression: false, plugins: [
|
|
231
233
|
...babel_client_1.default.plugins,
|
|
@@ -237,8 +239,8 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
237
239
|
: undefined,
|
|
238
240
|
].filter(Boolean) }),
|
|
239
241
|
},
|
|
240
|
-
app_configs_1.
|
|
241
|
-
app_configs_1.
|
|
242
|
+
app_configs_1.configs.tsconfig &&
|
|
243
|
+
app_configs_1.configs.useTscLoader && {
|
|
242
244
|
test: /\.tsx?$/,
|
|
243
245
|
use: [
|
|
244
246
|
{
|
|
@@ -262,7 +264,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
262
264
|
onlyCompileBundledFiles: true,
|
|
263
265
|
transpileOnly: true,
|
|
264
266
|
happyPackMode: true,
|
|
265
|
-
configFile: app_configs_1.
|
|
267
|
+
configFile: app_configs_1.configs.tsconfig,
|
|
266
268
|
},
|
|
267
269
|
},
|
|
268
270
|
],
|
|
@@ -337,7 +339,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
337
339
|
},
|
|
338
340
|
parser: {
|
|
339
341
|
dataUrlCondition: {
|
|
340
|
-
maxSize: app_configs_1.
|
|
342
|
+
maxSize: app_configs_1.configs.dataUrlMaxSize,
|
|
341
343
|
},
|
|
342
344
|
},
|
|
343
345
|
},
|
|
@@ -346,7 +348,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
346
348
|
type: 'asset',
|
|
347
349
|
parser: {
|
|
348
350
|
dataUrlCondition: {
|
|
349
|
-
maxSize: app_configs_1.
|
|
351
|
+
maxSize: app_configs_1.configs.dataUrlMaxSize,
|
|
350
352
|
},
|
|
351
353
|
},
|
|
352
354
|
},
|
|
@@ -369,9 +371,9 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
369
371
|
chunkFilename: mode === 'dev' ? '[id].css' : '[name].[contenthash:8].chunk.css',
|
|
370
372
|
insert: (0, arui_runtime_1.getInsertCssRuntimeMethod)(),
|
|
371
373
|
}),
|
|
372
|
-
(mode === 'prod' || !app_configs_1.
|
|
373
|
-
&& app_configs_1.
|
|
374
|
-
&& !app_configs_1.
|
|
374
|
+
(mode === 'prod' || !app_configs_1.configs.disableDevWebpackTypecheck)
|
|
375
|
+
&& app_configs_1.configs.tsconfig !== null
|
|
376
|
+
&& !app_configs_1.configs.useTscLoader
|
|
375
377
|
&& new fork_ts_checker_webpack_plugin_1.default(),
|
|
376
378
|
// moment.js очень большая библиотека, которая включает в себя массу локализаций, которые мы не используем.
|
|
377
379
|
// Поэтому мы их просто игнорируем, чтобы не включать в сборку.
|
|
@@ -385,10 +387,10 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
385
387
|
// например проект зависит от lodash@1, библиотеки A и B зависят от lodash@2. Тогда lodash@2 будет включен в сборку
|
|
386
388
|
// дважды, что приведет к увеличению размера бандла (и это не лечится дедубликацией в yarn/npm).
|
|
387
389
|
// Сама реализация плагина зависит от yarn.lock, поэтому если мы используем npm, то плагин не будет работать.
|
|
388
|
-
app_configs_1.
|
|
390
|
+
app_configs_1.configs.useYarn &&
|
|
389
391
|
new webpack_deduplication_plugin_1.WebpackDeduplicationPlugin({
|
|
390
|
-
cacheDir: path_1.default.join(app_configs_1.
|
|
391
|
-
rootPath: app_configs_1.
|
|
392
|
+
cacheDir: path_1.default.join(app_configs_1.configs.cwd, 'node_modules/.cache/deduplication-webpack-plugin/'),
|
|
393
|
+
rootPath: app_configs_1.configs.cwd,
|
|
392
394
|
}),
|
|
393
395
|
// dev plugins:
|
|
394
396
|
mode === 'dev' &&
|
|
@@ -400,6 +402,10 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
400
402
|
// See https://github.com/facebookincubator/create-react-app/issues/240
|
|
401
403
|
mode === 'dev' && new case_sensitive_paths_webpack_plugin_1.default(),
|
|
402
404
|
new arui_runtime_1.AruiRuntimePlugin(),
|
|
405
|
+
app_configs_1.configs.clientOnly && new html_webpack_plugin_1.default({
|
|
406
|
+
templateContent: html_template_1.htmlTemplate,
|
|
407
|
+
filename: '../index.html'
|
|
408
|
+
}),
|
|
403
409
|
// production plugins:
|
|
404
410
|
mode === 'prod' && new webpack_manifest_plugin_1.WebpackManifestPlugin(),
|
|
405
411
|
mode === 'prod' &&
|
|
@@ -425,17 +431,17 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
425
431
|
// Ignore prop-types packages in production mode
|
|
426
432
|
// This should works fine, since proptypes usage should be eliminated in production mode
|
|
427
433
|
mode === 'prod' &&
|
|
428
|
-
!app_configs_1.
|
|
434
|
+
!app_configs_1.configs.keepPropTypes &&
|
|
429
435
|
new webpack_1.default.NormalModuleReplacementPlugin(/^react-style-proptype$/, noopPath),
|
|
430
436
|
mode === 'prod' &&
|
|
431
|
-
!app_configs_1.
|
|
437
|
+
!app_configs_1.configs.keepPropTypes &&
|
|
432
438
|
new webpack_1.default.NormalModuleReplacementPlugin(/^thrift-services\/proptypes/, noopPath),
|
|
433
439
|
].filter(Boolean), experiments: {
|
|
434
|
-
backCompat: app_configs_1.
|
|
440
|
+
backCompat: app_configs_1.configs.webpack4Compatibility,
|
|
435
441
|
},
|
|
436
442
|
// Без этого комиляция трирегилась на изменение в node_modules и приводила к утечке памяти
|
|
437
443
|
watchOptions: {
|
|
438
|
-
ignored: new RegExp(app_configs_1.
|
|
444
|
+
ignored: new RegExp(app_configs_1.configs.watchIgnorePath.join('|')),
|
|
439
445
|
aggregateTimeout: 100,
|
|
440
446
|
},
|
|
441
447
|
// Выключаем performance hints, т.к. размеры бандлов контролируются не в рамках arui-scripts
|
|
@@ -445,8 +451,8 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
445
451
|
exports.createSingleClientWebpackConfig = createSingleClientWebpackConfig;
|
|
446
452
|
const createClientWebpackConfig = (mode) => {
|
|
447
453
|
var _a;
|
|
448
|
-
const appWebpackConfig = (0, modules_1.patchMainWebpackConfigForModules)((0, exports.createSingleClientWebpackConfig)(mode, app_configs_1.
|
|
449
|
-
const exposedCompatModules = (_a = app_configs_1.
|
|
454
|
+
const appWebpackConfig = (0, modules_1.patchMainWebpackConfigForModules)((0, exports.createSingleClientWebpackConfig)(mode, app_configs_1.configs.clientEntry));
|
|
455
|
+
const exposedCompatModules = (_a = app_configs_1.configs.compatModules) === null || _a === void 0 ? void 0 : _a.exposes;
|
|
450
456
|
if (!exposedCompatModules || Object.keys(exposedCompatModules).length === 0) {
|
|
451
457
|
return appWebpackConfig;
|
|
452
458
|
}
|
|
@@ -3,9 +3,12 @@ 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
|
-
const app_configs_1 =
|
|
6
|
+
const app_configs_1 = require("../configs/app-configs");
|
|
7
7
|
const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
|
|
8
|
-
const
|
|
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 nginxNonRootPart = app_configs_1.configs.runFromNonRootUser
|
|
9
12
|
? `RUN chown -R nginx:nginx /src && \\
|
|
10
13
|
mkdir -p /var/lib/nginx && \\
|
|
11
14
|
chown -R nginx:nginx /var/lib/nginx && \\
|
|
@@ -18,15 +21,17 @@ const nginxNonRootPart = app_configs_1.default.runFromNonRootUser
|
|
|
18
21
|
USER nginx`
|
|
19
22
|
: '';
|
|
20
23
|
const dockerfileTemplate = `
|
|
21
|
-
FROM ${app_configs_1.
|
|
24
|
+
FROM ${app_configs_1.configs.baseDockerImage}
|
|
22
25
|
ARG START_SH_LOCATION
|
|
23
26
|
ARG NGINX_CONF_LOCATION
|
|
24
27
|
|
|
25
28
|
WORKDIR /src
|
|
26
|
-
ADD $
|
|
27
|
-
|
|
29
|
+
ADD $NGINX_CONF_LOCATION ${nginxConfTargetLocation}
|
|
30
|
+
|
|
28
31
|
${nginxNonRootPart}
|
|
29
|
-
${app_configs_1.default.runFromNonRootUser ? 'ADD --chown=nginx:nginx . /src' : 'ADD . /src'}
|
|
30
32
|
|
|
33
|
+
${app_configs_1.configs.runFromNonRootUser ? `ADD --chown=nginx:nginx ${appPathToAdd} ${appTargetPath}` : `ADD ${appPathToAdd} ${appTargetPath}`}
|
|
34
|
+
|
|
35
|
+
${app_configs_1.configs.clientOnly ? 'CMD ["nginx"]' : 'CMD ["/bin/sh", "-c" "./start.sh"'}
|
|
31
36
|
`;
|
|
32
37
|
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 </body>\n</html>";
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
</body>
|
|
21
|
+
</html>`;
|
|
22
|
+
exports.htmlTemplate = (0, apply_overrides_1.default)('html', template);
|
|
@@ -3,29 +3,34 @@ 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
|
-
const app_configs_1 =
|
|
6
|
+
const app_configs_1 = require("../configs/app-configs");
|
|
7
7
|
const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
|
|
8
8
|
const nginxTemplate = `client_max_body_size 20m;
|
|
9
9
|
|
|
10
10
|
server {
|
|
11
|
-
listen ${app_configs_1.
|
|
11
|
+
listen ${app_configs_1.configs.clientServerPort};
|
|
12
12
|
server_tokens off;
|
|
13
13
|
|
|
14
|
-
|
|
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 / {
|
|
15
20
|
proxy_set_header Host $host;
|
|
16
|
-
proxy_pass http://127.0.0.1:${app_configs_1.
|
|
17
|
-
}
|
|
21
|
+
proxy_pass http://127.0.0.1:${app_configs_1.configs.serverPort};
|
|
22
|
+
}`}
|
|
18
23
|
|
|
19
|
-
location /${app_configs_1.
|
|
24
|
+
location /${app_configs_1.configs.publicPath} {
|
|
20
25
|
expires max;
|
|
21
26
|
add_header Cache-Control public;
|
|
22
|
-
root ${app_configs_1.
|
|
27
|
+
root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
location ~ /${app_configs_1.
|
|
30
|
+
location ~ /${app_configs_1.configs.publicPath}.*\\.js$ {
|
|
26
31
|
expires max;
|
|
27
32
|
add_header Cache-Control public;
|
|
28
|
-
root ${app_configs_1.
|
|
33
|
+
root ${app_configs_1.configs.nginxRootPath}/${app_configs_1.configs.buildPath};
|
|
29
34
|
types {
|
|
30
35
|
text/javascript js;
|
|
31
36
|
}
|