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.
- package/.browserslistrc +5 -0
- package/.eslintignore +2 -0
- package/.eslintrc.js +17 -0
- package/.turbo/turbo-build.log +0 -0
- package/.turbo/turbo-test.log +23 -0
- package/CHANGELOG.md +1571 -0
- package/README.md +47 -0
- package/bin/build.sh +2 -0
- package/build/bin/index.d.ts +3 -0
- package/build/bin/index.js +29 -0
- package/build/commands/archive-build/index.d.ts +1 -0
- package/build/commands/archive-build/index.js +80 -0
- package/build/commands/build/build-wrapper.d.ts +8 -0
- package/build/commands/build/build-wrapper.js +42 -0
- package/build/commands/build/client.d.ts +1 -0
- package/build/commands/build/client.js +41 -0
- package/build/commands/build/index.d.ts +1 -0
- package/build/commands/build/index.js +15 -0
- package/build/commands/build/server.d.ts +1 -0
- package/build/commands/build/server.js +29 -0
- package/build/commands/bundle-analyze/index.d.ts +1 -0
- package/build/commands/bundle-analyze/index.js +40 -0
- package/build/commands/changelog/index.d.ts +5 -0
- package/build/commands/changelog/index.js +113 -0
- package/build/commands/docker-build/index.d.ts +1 -0
- package/build/commands/docker-build/index.js +73 -0
- package/build/commands/docker-build-compiled/index.d.ts +1 -0
- package/build/commands/docker-build-compiled/index.js +54 -0
- package/build/commands/ensure-yarn/index.d.ts +0 -0
- package/build/commands/ensure-yarn/index.js +8 -0
- package/build/commands/start/client.d.ts +1 -0
- package/build/commands/start/client.js +8 -0
- package/build/commands/start/index.d.ts +1 -0
- package/build/commands/start/index.js +17 -0
- package/build/commands/start/print-compiler-output.d.ts +1 -0
- package/build/commands/start/print-compiler-output.js +16 -0
- package/build/commands/start/server.d.ts +1 -0
- package/build/commands/start/server.js +8 -0
- package/build/commands/start-prod/client.d.ts +1 -0
- package/build/commands/start-prod/client.js +8 -0
- package/build/commands/start-prod/index.d.ts +1 -0
- package/build/commands/start-prod/index.js +17 -0
- package/build/commands/start-prod/server.d.ts +1 -0
- package/build/commands/start-prod/server.js +8 -0
- package/build/commands/test/get-config.d.ts +1 -0
- package/build/commands/test/get-config.js +104 -0
- package/build/commands/test/index.d.ts +1 -0
- package/build/commands/test/index.js +60 -0
- package/build/commands/util/client-assets-sizes.d.ts +26 -0
- package/build/commands/util/client-assets-sizes.js +82 -0
- package/build/commands/util/docker-build.d.ts +23 -0
- package/build/commands/util/docker-build.js +127 -0
- package/build/commands/util/exec.d.ts +2 -0
- package/build/commands/util/exec.js +20 -0
- package/build/commands/util/format-webpack-messages.d.ts +11 -0
- package/build/commands/util/format-webpack-messages.js +95 -0
- package/build/commands/util/make-tmp-dir.d.ts +6 -0
- package/build/commands/util/make-tmp-dir.js +29 -0
- package/build/commands/util/run-client-dev-server.d.ts +2 -0
- package/build/commands/util/run-client-dev-server.js +46 -0
- package/build/commands/util/run-compilers.d.ts +1 -0
- package/build/commands/util/run-compilers.js +37 -0
- package/build/commands/util/run-server-watch-compiler.d.ts +2 -0
- package/build/commands/util/run-server-watch-compiler.js +19 -0
- package/build/commands/util/tsc.d.ts +1 -0
- package/build/commands/util/tsc.js +13 -0
- package/build/commands/util/yarn.d.ts +5 -0
- package/build/commands/util/yarn.js +55 -0
- package/build/configs/app-configs/calculate-dependent-config.d.ts +9 -0
- package/build/configs/app-configs/calculate-dependent-config.js +38 -0
- package/build/configs/app-configs/get-defaults.d.ts +5 -0
- package/build/configs/app-configs/get-defaults.js +139 -0
- package/build/configs/app-configs/index.d.ts +6 -0
- package/build/configs/app-configs/index.js +24 -0
- package/build/configs/app-configs/read-config-file.d.ts +2 -0
- package/build/configs/app-configs/read-config-file.js +28 -0
- package/build/configs/app-configs/types.d.ts +126 -0
- package/build/configs/app-configs/types.js +2 -0
- package/build/configs/app-configs/update-with-config-file.d.ts +2 -0
- package/build/configs/app-configs/update-with-config-file.js +17 -0
- package/build/configs/app-configs/update-with-env.d.ts +2 -0
- package/build/configs/app-configs/update-with-env.js +23 -0
- package/build/configs/app-configs/update-with-package.d.ts +2 -0
- package/build/configs/app-configs/update-with-package.js +13 -0
- package/build/configs/app-configs/update-with-presets.d.ts +3 -0
- package/build/configs/app-configs/update-with-presets.js +41 -0
- package/build/configs/app-configs/validate-settings-keys.d.ts +4 -0
- package/build/configs/app-configs/validate-settings-keys.js +13 -0
- package/build/configs/app-configs/warn-about-deprecations.d.ts +2 -0
- package/build/configs/app-configs/warn-about-deprecations.js +20 -0
- package/build/configs/babel-client.d.ts +32 -0
- package/build/configs/babel-client.js +72 -0
- package/build/configs/babel-dependencies.d.ts +14 -0
- package/build/configs/babel-dependencies.js +39 -0
- package/build/configs/babel-server.d.ts +27 -0
- package/build/configs/babel-server.js +48 -0
- package/build/configs/client-env-config/add-env-to-html-template.d.ts +1 -0
- package/build/configs/client-env-config/add-env-to-html-template.js +7 -0
- package/build/configs/client-env-config/client-config-plugin.d.ts +5 -0
- package/build/configs/client-env-config/client-config-plugin.js +26 -0
- package/build/configs/client-env-config/constants.d.ts +1 -0
- package/build/configs/client-env-config/constants.js +4 -0
- package/build/configs/client-env-config/get-env-config.d.ts +2 -0
- package/build/configs/client-env-config/get-env-config.js +28 -0
- package/build/configs/client-env-config/index.d.ts +3 -0
- package/build/configs/client-env-config/index.js +9 -0
- package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +28 -0
- package/build/configs/config-extras/minimizers/imagemin/imagemin.js +65 -0
- package/build/configs/config-extras/minimizers/imagemin/index.d.ts +1 -0
- package/build/configs/config-extras/minimizers/imagemin/index.js +17 -0
- package/build/configs/config-extras/minimizers/index.d.ts +1 -0
- package/build/configs/config-extras/minimizers/index.js +17 -0
- package/build/configs/dev-server.d.ts +2 -0
- package/build/configs/dev-server.js +73 -0
- package/build/configs/jest/babel-transform.d.ts +2 -0
- package/build/configs/jest/babel-transform.js +6 -0
- package/build/configs/jest/css-mock.d.ts +1 -0
- package/build/configs/jest/css-mock.js +2 -0
- package/build/configs/jest/file-transform.d.ts +3 -0
- package/build/configs/jest/file-transform.js +11 -0
- package/build/configs/jest/settings.d.ts +21 -0
- package/build/configs/jest/settings.js +58 -0
- package/build/configs/modules.d.ts +16 -0
- package/build/configs/modules.js +149 -0
- package/build/configs/mq.css +22 -0
- package/build/configs/postcss.config.d.ts +36 -0
- package/build/configs/postcss.config.js +71 -0
- package/build/configs/postcss.d.ts +2 -0
- package/build/configs/postcss.js +11 -0
- package/build/configs/process-assets-plugin-output.d.ts +2 -0
- package/build/configs/process-assets-plugin-output.js +45 -0
- package/build/configs/server-externals-exemptions.d.ts +1 -0
- package/build/configs/server-externals-exemptions.js +21 -0
- package/build/configs/stats-options.d.ts +3 -0
- package/build/configs/stats-options.js +49 -0
- package/build/configs/supporting-browsers.d.ts +2 -0
- package/build/configs/supporting-browsers.js +8 -0
- package/build/configs/swc.d.ts +4 -0
- package/build/configs/swc.js +35 -0
- package/build/configs/util/apply-overrides.d.ts +76 -0
- package/build/configs/util/apply-overrides.js +52 -0
- package/build/configs/util/check-node-version.d.ts +2 -0
- package/build/configs/util/check-node-version.js +7 -0
- package/build/configs/util/find-loader.d.ts +2 -0
- package/build/configs/util/find-loader.js +24 -0
- package/build/configs/util/find-plugin.d.ts +85 -0
- package/build/configs/util/find-plugin.js +22 -0
- package/build/configs/util/get-entry.d.ts +9 -0
- package/build/configs/util/get-entry.js +22 -0
- package/build/configs/util/get-polyfills.d.ts +2 -0
- package/build/configs/util/get-polyfills.js +26 -0
- package/build/configs/util/get-webpack-cache-dependencies.d.ts +1 -0
- package/build/configs/util/get-webpack-cache-dependencies.js +18 -0
- package/build/configs/util/install-sourcemap-support.d.ts +1 -0
- package/build/configs/util/install-sourcemap-support.js +11 -0
- package/build/configs/util/node-assets-ignore.d.ts +0 -0
- package/build/configs/util/node-assets-ignore.js +33 -0
- package/build/configs/util/noop.d.ts +1 -0
- package/build/configs/util/noop.js +2 -0
- package/build/configs/util/register-ts-node.d.ts +0 -0
- package/build/configs/util/register-ts-node.js +18 -0
- package/build/configs/util/resolve.d.ts +12 -0
- package/build/configs/util/resolve.js +29 -0
- package/build/configs/webpack.client.d.ts +10 -0
- package/build/configs/webpack.client.dev.d.ts +2 -0
- package/build/configs/webpack.client.dev.js +15 -0
- package/build/configs/webpack.client.js +475 -0
- package/build/configs/webpack.client.prod.d.ts +2 -0
- package/build/configs/webpack.client.prod.js +15 -0
- package/build/configs/webpack.server.d.ts +2 -0
- package/build/configs/webpack.server.dev.d.ts +2 -0
- package/build/configs/webpack.server.dev.js +11 -0
- package/build/configs/webpack.server.js +256 -0
- package/build/configs/webpack.server.prod.d.ts +2 -0
- package/build/configs/webpack.server.prod.js +11 -0
- package/build/index.d.ts +5 -0
- package/build/index.js +9 -0
- package/build/plugins/arui-runtime/arui-runtime-module.d.ts +7 -0
- package/build/plugins/arui-runtime/arui-runtime-module.js +20 -0
- package/build/plugins/arui-runtime/index.d.ts +11 -0
- package/build/plugins/arui-runtime/index.js +47 -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 +91 -0
- package/build/plugins/postcss-prefix-selector.d.ts +6 -0
- package/build/plugins/postcss-prefix-selector.js +62 -0
- package/build/plugins/reload-server-plugin.d.ts +10 -0
- package/build/plugins/reload-server-plugin.js +44 -0
- package/build/plugins/turn-off-split-remote-entry.d.ts +11 -0
- package/build/plugins/turn-off-split-remote-entry.js +71 -0
- package/build/plugins/watch-missing-node-modules-plugin.d.ts +6 -0
- package/build/plugins/watch-missing-node-modules-plugin.js +20 -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.d.ts +2 -0
- package/build/templates/dockerfile-compiled.template.js +52 -0
- package/build/templates/dockerfile.template.d.ts +2 -0
- package/build/templates/dockerfile.template.js +41 -0
- package/build/templates/html.template.d.ts +1 -0
- package/build/templates/html.template.js +25 -0
- package/build/templates/nginx.conf.template.d.ts +2 -0
- package/build/templates/nginx.conf.template.js +39 -0
- package/build/templates/start.template.d.ts +2 -0
- package/build/templates/start.template.js +69 -0
- package/build/tsconfig-local.tsbuildinfo +1 -0
- package/docs/artifact.md +58 -0
- package/docs/caveats.md +41 -0
- package/docs/client-only.md +77 -0
- package/docs/commands.md +125 -0
- package/docs/compilers.md +18 -0
- package/docs/examples.md +100 -0
- package/docs/modules.md +780 -0
- package/docs/overrides.md +167 -0
- package/docs/presets.md +65 -0
- package/docs/settings.md +287 -0
- package/jest-preset.js +5 -0
- package/package.json +180 -0
- package/stylelint.config.js +11 -0
- package/tsconfig-local.json +16 -0
- package/tsconfig.eslint.json +5 -0
- package/tsconfig.json +71 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// TODO: remove eslint-disable and eslint-disable-next-line
|
|
3
|
+
/* eslint-disable no-param-reassign */
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
// WARNING: this code is untranspiled and is used in browser too.
|
|
12
|
+
// Please make sure any changes are in ES5 or contribute a Babel compile step.
|
|
13
|
+
// Some custom utilities to prettify Webpack output.
|
|
14
|
+
// This is quite hacky and hopefully won't be needed when Webpack fixes this.
|
|
15
|
+
// https://github.com/webpack/webpack/issues/2878
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
17
|
+
const chalk = require('chalk');
|
|
18
|
+
const friendlySyntaxErrorLabel = 'Syntax error:';
|
|
19
|
+
function isLikelyASyntaxError(message) {
|
|
20
|
+
return message.includes(friendlySyntaxErrorLabel);
|
|
21
|
+
}
|
|
22
|
+
// Cleans up webpack error messages.
|
|
23
|
+
// eslint-disable-next-line no-unused-vars
|
|
24
|
+
function formatMessage(message) {
|
|
25
|
+
if (typeof message !== 'string') {
|
|
26
|
+
message = message.message;
|
|
27
|
+
}
|
|
28
|
+
let lines = message.split('\n');
|
|
29
|
+
// Strip webpack-added headers off errors/warnings
|
|
30
|
+
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
|
|
31
|
+
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
|
|
32
|
+
// Transform parsing error into syntax error
|
|
33
|
+
// TODO: move this to our ESLint formatter?
|
|
34
|
+
lines = lines.map((line) => {
|
|
35
|
+
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
|
|
36
|
+
if (!parsingError) {
|
|
37
|
+
return line;
|
|
38
|
+
}
|
|
39
|
+
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
40
|
+
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
41
|
+
});
|
|
42
|
+
message = lines.join('\n');
|
|
43
|
+
// Smoosh syntax errors (commonly found in CSS)
|
|
44
|
+
message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`);
|
|
45
|
+
// Clean up export errors
|
|
46
|
+
message = message.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, "Attempted import error: '$1' is not exported from '$2'.");
|
|
47
|
+
message = message.replace(/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, "Attempted import error: '$2' does not contain a default export (imported as '$1').");
|
|
48
|
+
message = message.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, "Attempted import error: '$1' is not exported from '$3' (imported as '$2').");
|
|
49
|
+
lines = message.split('\n');
|
|
50
|
+
// Remove leading newline
|
|
51
|
+
if (lines.length > 2 && lines[1].trim() === '') {
|
|
52
|
+
lines.splice(1, 1);
|
|
53
|
+
}
|
|
54
|
+
// Clean up file name
|
|
55
|
+
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1');
|
|
56
|
+
// Cleans up verbose "module not found" messages for files and packages.
|
|
57
|
+
if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {
|
|
58
|
+
lines = [
|
|
59
|
+
lines[0],
|
|
60
|
+
lines[1]
|
|
61
|
+
.replace('Error: ', '')
|
|
62
|
+
.replace('Module not found: Cannot find file:', 'Cannot find file:'),
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
// Add helpful message for users trying to use Sass for the first time
|
|
66
|
+
if (lines[1] && lines[1].match(/Cannot find module.+node-sass/)) {
|
|
67
|
+
lines[1] = 'To import Sass files, you first need to install node-sass.\n';
|
|
68
|
+
lines[1] += 'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.';
|
|
69
|
+
}
|
|
70
|
+
lines[0] = chalk.inverse(lines[0]);
|
|
71
|
+
message = lines.join('\n');
|
|
72
|
+
// Internal stacks are generally useless so we strip them... with the
|
|
73
|
+
// exception of stacks containing `webpack:` because they're normally
|
|
74
|
+
// from user code generated by webpack. For more information see
|
|
75
|
+
// https://github.com/facebook/create-react-app/pull/1050
|
|
76
|
+
message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
|
|
77
|
+
message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
|
|
78
|
+
lines = message.split('\n');
|
|
79
|
+
// Remove duplicated newlines
|
|
80
|
+
lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim());
|
|
81
|
+
// Reassemble the message
|
|
82
|
+
message = lines.join('\n');
|
|
83
|
+
return message.trim();
|
|
84
|
+
}
|
|
85
|
+
function formatWebpackMessages(json) {
|
|
86
|
+
const formattedErrors = json.errors.map(formatMessage);
|
|
87
|
+
const formattedWarnings = json.warnings.map(formatMessage);
|
|
88
|
+
const result = { errors: formattedErrors, warnings: formattedWarnings };
|
|
89
|
+
if (result.errors.some(isLikelyASyntaxError)) {
|
|
90
|
+
// If there are any syntax errors, show just them.
|
|
91
|
+
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
exports.default = formatWebpackMessages;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const fs_1 = __importDefault(require("fs"));
|
|
16
|
+
const os_1 = __importDefault(require("os"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const util_1 = __importDefault(require("util"));
|
|
19
|
+
const nodeMakeTmpDir = util_1.default.promisify(fs_1.default.mkdtemp);
|
|
20
|
+
/**
|
|
21
|
+
* Создает и возвращает временную папку
|
|
22
|
+
* @returns {Promise<string>}
|
|
23
|
+
*/
|
|
24
|
+
function makeTmpDir(prefix) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return nodeMakeTmpDir(path_1.default.join(os_1.default.tmpdir(), prefix || ''));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.default = makeTmpDir;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.runClientDevServer = runClientDevServer;
|
|
16
|
+
const WebpackDevServerUtils_1 = require("react-dev-utils/WebpackDevServerUtils");
|
|
17
|
+
const core_1 = require("@rspack/core");
|
|
18
|
+
const dev_server_1 = require("@rspack/dev-server");
|
|
19
|
+
const dev_server_2 = __importDefault(require("../../configs/dev-server"));
|
|
20
|
+
const print_compiler_output_1 = __importDefault(require("../start/print-compiler-output"));
|
|
21
|
+
function runClientDevServer(configuration) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const clientCompiler = (0, core_1.rspack)(configuration);
|
|
24
|
+
const clientDevServer = new dev_server_1.RspackDevServer(dev_server_2.default, clientCompiler);
|
|
25
|
+
clientCompiler.hooks.invalid.tap('client', () => console.log('Compiling client...'));
|
|
26
|
+
clientCompiler.hooks.done.tap('client', (stats) => (0, print_compiler_output_1.default)('Client', stats));
|
|
27
|
+
const DEFAULT_PORT = dev_server_2.default.port;
|
|
28
|
+
const HOST = '0.0.0.0';
|
|
29
|
+
try {
|
|
30
|
+
const port = yield (0, WebpackDevServerUtils_1.choosePort)(HOST, +(DEFAULT_PORT || 0));
|
|
31
|
+
if (!port) {
|
|
32
|
+
// We have not found a port.
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
clientDevServer.startCallback(() => {
|
|
36
|
+
console.log(`Client dev server running at http://${HOST}:${port}...`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
if (err && err.message) {
|
|
41
|
+
console.log(err.message);
|
|
42
|
+
}
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCompilers(pathToCompilers: Array<string | string[]>): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
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.runCompilers = runCompilers;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const app_configs_1 = require("../../configs/app-configs");
|
|
10
|
+
function runCompilers(pathToCompilers) {
|
|
11
|
+
if (fs_extra_1.default.pathExistsSync(app_configs_1.configs.serverOutputPath)) {
|
|
12
|
+
fs_extra_1.default.removeSync(app_configs_1.configs.serverOutputPath);
|
|
13
|
+
}
|
|
14
|
+
const compilers = pathToCompilers.map((pathToCompiler) => {
|
|
15
|
+
if (Array.isArray(pathToCompiler)) {
|
|
16
|
+
const compiler = (0, child_process_1.spawn)('node', pathToCompiler, {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
cwd: app_configs_1.configs.cwd,
|
|
19
|
+
});
|
|
20
|
+
compiler.on('error', onProcessExit);
|
|
21
|
+
compiler.on('close', onProcessExit);
|
|
22
|
+
return compiler;
|
|
23
|
+
}
|
|
24
|
+
const compiler = (0, child_process_1.spawn)('node', [pathToCompiler], {
|
|
25
|
+
stdio: 'inherit',
|
|
26
|
+
});
|
|
27
|
+
compiler.on('error', onProcessExit);
|
|
28
|
+
compiler.on('close', onProcessExit);
|
|
29
|
+
return compiler;
|
|
30
|
+
});
|
|
31
|
+
function onProcessExit(code) {
|
|
32
|
+
if (code !== 0) {
|
|
33
|
+
compilers.forEach((compiler) => compiler.kill());
|
|
34
|
+
process.exit(code);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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.runServerWatchCompiler = runServerWatchCompiler;
|
|
7
|
+
const core_1 = require("@rspack/core");
|
|
8
|
+
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
9
|
+
const print_compiler_output_1 = __importDefault(require("../start/print-compiler-output"));
|
|
10
|
+
function runServerWatchCompiler(config) {
|
|
11
|
+
const serverCompiler = (0, core_1.rspack)(config);
|
|
12
|
+
serverCompiler.hooks.compile.tap('server', () => console.log('Compiling server...'));
|
|
13
|
+
serverCompiler.hooks.invalid.tap('server', () => console.log('Compiling server...'));
|
|
14
|
+
serverCompiler.hooks.done.tap('server', (stats) => (0, print_compiler_output_1.default)('Server', stats));
|
|
15
|
+
serverCompiler.watch({
|
|
16
|
+
aggregateTimeout: 50, // Делаем это значение меньше чем у клиента, чтобы сервер пересобирался быстрее
|
|
17
|
+
ignored: new RegExp(app_configs_1.default.watchIgnorePath.join('|')),
|
|
18
|
+
}, () => { });
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTscWatchCommand(tsconfig: string): string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTscWatchCommand = getTscWatchCommand;
|
|
4
|
+
function getTscWatchCommand(tsconfig) {
|
|
5
|
+
return [
|
|
6
|
+
require.resolve('typescript/lib/tsc.js'),
|
|
7
|
+
'--watch',
|
|
8
|
+
'--noEmit',
|
|
9
|
+
'--project',
|
|
10
|
+
tsconfig,
|
|
11
|
+
'--skipLibCheck',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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.getYarnVersion = getYarnVersion;
|
|
7
|
+
exports.getPruningCommand = getPruningCommand;
|
|
8
|
+
exports.getInstallProductionCommand = getInstallProductionCommand;
|
|
9
|
+
const shelljs_1 = __importDefault(require("shelljs"));
|
|
10
|
+
const app_configs_1 = require("../../configs/app-configs");
|
|
11
|
+
function getYarnVersion() {
|
|
12
|
+
if (app_configs_1.configs.useYarn && shelljs_1.default.which('yarn')) {
|
|
13
|
+
const yarnVersion = shelljs_1.default.exec('yarn -v', { silent: true });
|
|
14
|
+
const yarnMajorVersion = Number(yarnVersion.split('.')[0]);
|
|
15
|
+
return yarnMajorVersion > 1 ? '2+' : '1';
|
|
16
|
+
}
|
|
17
|
+
return 'unavailable';
|
|
18
|
+
}
|
|
19
|
+
function getPruningCommand() {
|
|
20
|
+
if (app_configs_1.configs.clientOnly) {
|
|
21
|
+
return 'echo "Skipping pruning in client only mode"';
|
|
22
|
+
}
|
|
23
|
+
const yarnVersion = getYarnVersion();
|
|
24
|
+
switch (yarnVersion) {
|
|
25
|
+
case '1': {
|
|
26
|
+
return 'yarn install --production --ignore-optional --frozen-lockfile --ignore-scripts --prefer-offline';
|
|
27
|
+
}
|
|
28
|
+
case '2+': {
|
|
29
|
+
return 'yarn workspaces focus --production --all';
|
|
30
|
+
}
|
|
31
|
+
case 'unavailable': {
|
|
32
|
+
return 'npm prune --production';
|
|
33
|
+
}
|
|
34
|
+
default: {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getInstallProductionCommand() {
|
|
40
|
+
const yarnVersion = getYarnVersion();
|
|
41
|
+
switch (yarnVersion) {
|
|
42
|
+
case '1': {
|
|
43
|
+
return 'yarn install --production --ignore-optional --frozen-lockfile --ignore-scripts --prefer-offline';
|
|
44
|
+
}
|
|
45
|
+
case '2+': {
|
|
46
|
+
return 'yarn workspaces focus --production --all';
|
|
47
|
+
}
|
|
48
|
+
case 'unavailable': {
|
|
49
|
+
return 'npm install --production';
|
|
50
|
+
}
|
|
51
|
+
default: {
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppConfigs, AppContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
4
|
+
*/
|
|
5
|
+
export declare function calculateDependentConfig(config: AppConfigs): AppConfigs;
|
|
6
|
+
/**
|
|
7
|
+
* Обновление контекста в зависимости от ключей конфига
|
|
8
|
+
*/
|
|
9
|
+
export declare function calculateDependentContext(config: AppConfigs, context: AppContext): AppContext;
|
|
@@ -0,0 +1,38 @@
|
|
|
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.calculateDependentConfig = calculateDependentConfig;
|
|
7
|
+
exports.calculateDependentContext = calculateDependentContext;
|
|
8
|
+
// TODO: remove eslint-disable-next-line
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const get_polyfills_1 = require("../util/get-polyfills");
|
|
12
|
+
const resolve_1 = require("../util/resolve");
|
|
13
|
+
/**
|
|
14
|
+
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
15
|
+
*/
|
|
16
|
+
function calculateDependentConfig(config) {
|
|
17
|
+
return Object.assign(Object.assign({}, config), { clientPolyfillsEntry: (0, get_polyfills_1.getPolyfills)(config) });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Обновление контекста в зависимости от ключей конфига
|
|
21
|
+
*/
|
|
22
|
+
function calculateDependentContext(config, context) {
|
|
23
|
+
let babelRuntimeVersion;
|
|
24
|
+
try {
|
|
25
|
+
// В проекте может стоять babel/runtime отличный от того, что установлен как зависимость arui-scripts.
|
|
26
|
+
// При этом webpack будет резолвить babel/runtime относительно проекта, а не относительно arui-scripts.
|
|
27
|
+
// Поэтому мы читаем версию того babel/runtime, который установлен в проекте.
|
|
28
|
+
// Так же мы не можем использовать require для получения контента из babel/runtime/package.json,
|
|
29
|
+
// потому что webpack.cache будет ругаться на то, что мы пытаемся импортировать файлы НЕ из своего node_modules.
|
|
30
|
+
const pathToProjectBabelRuntime = (0, resolve_1.resolveNodeModuleRelativeTo)(context.cwd, '@babel/runtime/package.json');
|
|
31
|
+
babelRuntimeVersion = JSON.parse(fs_1.default.readFileSync(pathToProjectBabelRuntime, 'utf8')).version;
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
35
|
+
babelRuntimeVersion = require('@babel/runtime/package.json').version;
|
|
36
|
+
}
|
|
37
|
+
return Object.assign(Object.assign({}, context), { publicPath: `${config.assetsPath}/`, serverOutputPath: path_1.default.resolve(context.cwd, config.buildPath), clientOutputPath: path_1.default.resolve(context.cwd, config.buildPath, config.assetsPath), statsOutputPath: path_1.default.resolve(context.cwd, config.buildPath, config.statsOutputFilename), watchIgnorePath: ['node_modules', config.buildPath], babelRuntimeVersion });
|
|
38
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AppConfigs, AppContext } from './types';
|
|
2
|
+
export declare const nginxConfigFileName = "nginx.conf";
|
|
3
|
+
export declare const baseNginxConfigFileName = "base-nginx.conf";
|
|
4
|
+
export declare function getDefaultAppConfig(): AppConfigs;
|
|
5
|
+
export declare function getDefaultAppContext(): AppContext;
|
|
@@ -0,0 +1,139 @@
|
|
|
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.baseNginxConfigFileName = exports.nginxConfigFileName = void 0;
|
|
7
|
+
exports.getDefaultAppConfig = getDefaultAppConfig;
|
|
8
|
+
exports.getDefaultAppContext = getDefaultAppContext;
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const resolve_1 = require("../util/resolve");
|
|
12
|
+
const read_config_file_1 = require("./read-config-file");
|
|
13
|
+
const CWD = process.cwd();
|
|
14
|
+
const absoluteSrcPath = path_1.default.resolve(CWD, 'src');
|
|
15
|
+
exports.nginxConfigFileName = 'nginx.conf';
|
|
16
|
+
exports.baseNginxConfigFileName = 'base-nginx.conf';
|
|
17
|
+
function getDefaultAppConfig() {
|
|
18
|
+
var _a;
|
|
19
|
+
const appPackage = getPackageJson();
|
|
20
|
+
const configFile = (0, read_config_file_1.readConfigFile)(CWD);
|
|
21
|
+
return {
|
|
22
|
+
/// general settings
|
|
23
|
+
clientServerPort: 8080,
|
|
24
|
+
serverPort: 3000,
|
|
25
|
+
debug: false,
|
|
26
|
+
devSourceMaps: 'inline-cheap-source-map', // так получаются нормальные сорсмапы, с eval - они не работают
|
|
27
|
+
devServerCors: false,
|
|
28
|
+
useServerHMR: false,
|
|
29
|
+
presets: (configFile === null || configFile === void 0 ? void 0 : configFile.presets) || ((_a = appPackage === null || appPackage === void 0 ? void 0 : appPackage.aruiScripts) === null || _a === void 0 ? void 0 : _a.presets) || null,
|
|
30
|
+
proxy: appPackage.proxy || [],
|
|
31
|
+
clientOnly: false,
|
|
32
|
+
// paths
|
|
33
|
+
buildPath: '.build',
|
|
34
|
+
assetsPath: 'assets',
|
|
35
|
+
additionalBuildPath: ['config'],
|
|
36
|
+
statsOutputFilename: 'stats.json',
|
|
37
|
+
serverEntry: path_1.default.resolve(absoluteSrcPath, 'server/index'),
|
|
38
|
+
serverOutput: 'server.js',
|
|
39
|
+
clientPolyfillsEntry: null,
|
|
40
|
+
clientEntry: path_1.default.resolve(absoluteSrcPath, 'index'),
|
|
41
|
+
// docker compilation configs
|
|
42
|
+
dockerRegistry: '',
|
|
43
|
+
baseDockerImage: 'alfabankui/arui-scripts:16.20.2-slim',
|
|
44
|
+
nginxRootPath: '/src',
|
|
45
|
+
nginx: null,
|
|
46
|
+
runFromNonRootUser: true,
|
|
47
|
+
removeDevDependenciesDuringDockerBuild: true,
|
|
48
|
+
// archive compilation configs
|
|
49
|
+
archiveName: 'build.tar',
|
|
50
|
+
// build tuning
|
|
51
|
+
keepPropTypes: false,
|
|
52
|
+
codeLoader: 'swc',
|
|
53
|
+
installServerSourceMaps: false,
|
|
54
|
+
disableDevWebpackTypecheck: true,
|
|
55
|
+
jestCodeTransformer: 'swc',
|
|
56
|
+
collectCoverage: process.env.NODE_ENV === 'cypress' || process.env.USE_ISTANBUL === 'enabled',
|
|
57
|
+
// image processing
|
|
58
|
+
dataUrlMaxSize: 1536,
|
|
59
|
+
imageMinimizer: {
|
|
60
|
+
svg: {
|
|
61
|
+
enabled: true,
|
|
62
|
+
},
|
|
63
|
+
gif: {
|
|
64
|
+
enabled: false,
|
|
65
|
+
optimizationLevel: 1,
|
|
66
|
+
},
|
|
67
|
+
jpg: {
|
|
68
|
+
enabled: false,
|
|
69
|
+
quality: 75,
|
|
70
|
+
},
|
|
71
|
+
png: {
|
|
72
|
+
enabled: false,
|
|
73
|
+
optimizationLevel: 3,
|
|
74
|
+
bitDepthReduction: false,
|
|
75
|
+
colorTypeReduction: false,
|
|
76
|
+
paletteReduction: false,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
// CSS
|
|
80
|
+
componentsTheme: null,
|
|
81
|
+
keepCssVars: false,
|
|
82
|
+
// Modules
|
|
83
|
+
disableModulesSupport: false,
|
|
84
|
+
compatModules: null,
|
|
85
|
+
modules: null,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function getPackageJson() {
|
|
89
|
+
const appPackage = JSON.parse(fs_1.default.readFileSync(path_1.default.join(CWD, 'package.json'), 'utf8'));
|
|
90
|
+
if (appPackage['arui-scripts']) {
|
|
91
|
+
throw Error('arui-scripts in package.json is not supported. Use aruiScripts instead.');
|
|
92
|
+
}
|
|
93
|
+
return appPackage;
|
|
94
|
+
}
|
|
95
|
+
function getDefaultAppContext() {
|
|
96
|
+
const appPackage = getPackageJson();
|
|
97
|
+
const absoluteNodeModulesPath = path_1.default.resolve(CWD, 'node_modules');
|
|
98
|
+
const absoluteNodeModulesBinPath = path_1.default.resolve(absoluteNodeModulesPath, '.bin');
|
|
99
|
+
const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
|
|
100
|
+
const yarnLockFilePath = path_1.default.join(CWD, 'yarn.lock');
|
|
101
|
+
const overridesPath = (0, resolve_1.tryResolve)(path_1.default.join(CWD, 'arui-scripts.overrides'));
|
|
102
|
+
const nginxConfFilePath = path_1.default.join(CWD, exports.nginxConfigFileName);
|
|
103
|
+
const nginxBaseConfFilePath = path_1.default.join(CWD, exports.baseNginxConfigFileName);
|
|
104
|
+
const dockerfileFilePath = path_1.default.join(CWD, 'Dockerfile');
|
|
105
|
+
const startScriptFilePath = path_1.default.join(CWD, 'start.sh');
|
|
106
|
+
return {
|
|
107
|
+
appPackage,
|
|
108
|
+
name: appPackage.name,
|
|
109
|
+
normalizedName: appPackage.name.replace(/-/g, '_'), // для использования в качестве имени переменной
|
|
110
|
+
version: appPackage.version,
|
|
111
|
+
// general paths
|
|
112
|
+
cwd: CWD,
|
|
113
|
+
appSrc: absoluteSrcPath,
|
|
114
|
+
appNodeModules: absoluteNodeModulesPath,
|
|
115
|
+
appNodeModulesBin: absoluteNodeModulesBinPath,
|
|
116
|
+
overridesPath: overridesPath ? [overridesPath] : [],
|
|
117
|
+
// tools availability
|
|
118
|
+
babelRuntimeVersion: '7.0.0-beta.0',
|
|
119
|
+
useYarn: fs_1.default.existsSync(yarnLockFilePath),
|
|
120
|
+
// compilation configs locations
|
|
121
|
+
tsconfig: fs_1.default.existsSync(projectTsConfigPath) ? projectTsConfigPath : null,
|
|
122
|
+
localNginxConf: fs_1.default.existsSync(nginxConfFilePath) ? nginxConfFilePath : null,
|
|
123
|
+
localNginxBaseConf: fs_1.default.existsSync(nginxBaseConfFilePath) ? nginxBaseConfFilePath : null,
|
|
124
|
+
localDockerfile: fs_1.default.existsSync(dockerfileFilePath) ? dockerfileFilePath : null,
|
|
125
|
+
localStartScript: fs_1.default.existsSync(startScriptFilePath) ? startScriptFilePath : null,
|
|
126
|
+
// Эти пути зависят от других настроек, которые могут быть переопределены пользователем
|
|
127
|
+
publicPath: '',
|
|
128
|
+
serverOutputPath: '',
|
|
129
|
+
clientOutputPath: '',
|
|
130
|
+
statsOutputPath: '',
|
|
131
|
+
watchIgnorePath: [],
|
|
132
|
+
// changelog paths
|
|
133
|
+
changelogPath: path_1.default.resolve(CWD, './CHANGELOG.md'),
|
|
134
|
+
changelogTmpPath: path_1.default.resolve(CWD, './CHANGELOG_TMP.md'),
|
|
135
|
+
changelogFeaturesPath: path_1.default.resolve(CWD, './changelog_features.tmp'),
|
|
136
|
+
changelogBugfixesPath: path_1.default.resolve(CWD, './changelog_bugfixes.tmp'),
|
|
137
|
+
changelogBreakingChangesPath: path_1.default.resolve(CWD, './changelog_breaking_changes.tmp'),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AppConfigs, AppContext, AppContextWithConfigs } from './types';
|
|
2
|
+
import '../util/register-ts-node';
|
|
3
|
+
export declare const appContext: AppContext;
|
|
4
|
+
export declare const appConfigs: AppConfigs;
|
|
5
|
+
export declare const configs: AppContextWithConfigs;
|
|
6
|
+
export default configs;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configs = exports.appConfigs = exports.appContext = void 0;
|
|
4
|
+
const calculate_dependent_config_1 = require("./calculate-dependent-config");
|
|
5
|
+
const get_defaults_1 = require("./get-defaults");
|
|
6
|
+
const update_with_config_file_1 = require("./update-with-config-file");
|
|
7
|
+
const update_with_env_1 = require("./update-with-env");
|
|
8
|
+
const update_with_package_1 = require("./update-with-package");
|
|
9
|
+
const update_with_presets_1 = require("./update-with-presets");
|
|
10
|
+
const warn_about_deprecations_1 = require("./warn-about-deprecations");
|
|
11
|
+
require("../util/register-ts-node");
|
|
12
|
+
let tmpConfig = (0, get_defaults_1.getDefaultAppConfig)();
|
|
13
|
+
let tmpContext = (0, get_defaults_1.getDefaultAppContext)();
|
|
14
|
+
tmpConfig = (0, update_with_presets_1.updateWithPresets)(tmpConfig, tmpContext);
|
|
15
|
+
tmpConfig = (0, update_with_package_1.updateWithPackage)(tmpConfig, tmpContext);
|
|
16
|
+
tmpConfig = (0, update_with_config_file_1.updateWithConfigFile)(tmpConfig, tmpContext);
|
|
17
|
+
tmpConfig = (0, update_with_env_1.updateWithEnv)(tmpConfig);
|
|
18
|
+
tmpConfig = (0, calculate_dependent_config_1.calculateDependentConfig)(tmpConfig);
|
|
19
|
+
tmpContext = (0, calculate_dependent_config_1.calculateDependentContext)(tmpConfig, tmpContext);
|
|
20
|
+
exports.appContext = tmpContext;
|
|
21
|
+
exports.appConfigs = tmpConfig;
|
|
22
|
+
exports.configs = Object.assign(Object.assign({}, exports.appConfigs), exports.appContext);
|
|
23
|
+
(0, warn_about_deprecations_1.warnAboutDeprecations)(exports.configs);
|
|
24
|
+
exports.default = exports.configs;
|
|
@@ -0,0 +1,28 @@
|
|
|
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.readConfigFile = readConfigFile;
|
|
7
|
+
exports.getConfigFilePath = getConfigFilePath;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const resolve_1 = require("../util/resolve");
|
|
10
|
+
function readConfigFile(cwd) {
|
|
11
|
+
const appConfigPath = getConfigFilePath(cwd);
|
|
12
|
+
if (appConfigPath) {
|
|
13
|
+
// Мы не можем использовать импорты, нам нужен именно require, потому что мы не знаем заранее не только путь до файла,
|
|
14
|
+
// но и то, на каком языке он написан
|
|
15
|
+
// eslint-disable-next-line import/no-dynamic-require, global-require, @typescript-eslint/no-var-requires
|
|
16
|
+
let appSettings = require(appConfigPath);
|
|
17
|
+
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
18
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
19
|
+
if (appSettings.__esModule) {
|
|
20
|
+
appSettings = appSettings.default;
|
|
21
|
+
}
|
|
22
|
+
return appSettings;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
function getConfigFilePath(cwd) {
|
|
27
|
+
return (0, resolve_1.tryResolve)(path_1.default.join(cwd, '/arui-scripts.config'));
|
|
28
|
+
}
|