arui-scripts 14.5.0-feat-modules.1 → 14.5.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/CHANGELOG.md +1 -10
- package/build/commands/build/build-wrapper.d.ts +2 -2
- package/build/commands/build/client.js +3 -3
- package/build/commands/bundle-analyze/index.js +7 -5
- package/build/commands/changelog/index.js +2 -2
- package/build/commands/start/client.js +2 -2
- package/build/commands/start-prod/client.js +2 -2
- package/build/commands/util/{run-client-dev-derver.d.ts → run-client-dev-server.d.ts} +1 -1
- package/build/commands/util/{run-client-dev-derver.js → run-client-dev-server.js} +4 -1
- package/build/configs/app-configs/available-package-settings.d.ts +8 -0
- package/build/configs/app-configs/available-package-settings.js +32 -0
- package/build/configs/app-configs/calculate-dependent-config.d.ts +8 -48
- package/build/configs/app-configs/calculate-dependent-config.js +13 -11
- package/build/configs/app-configs/get-defaults.d.ts +2 -3
- package/build/configs/app-configs/get-defaults.js +34 -49
- package/build/configs/app-configs/index.d.ts +3 -5
- package/build/configs/app-configs/index.js +7 -13
- package/build/configs/app-configs/types.d.ts +26 -60
- package/build/configs/app-configs/update-with-config-file.d.ts +2 -2
- package/build/configs/app-configs/update-with-config-file.js +7 -5
- package/build/configs/app-configs/update-with-env.js +8 -3
- package/build/configs/app-configs/update-with-package.d.ts +2 -2
- package/build/configs/app-configs/update-with-package.js +10 -5
- package/build/configs/app-configs/update-with-presets.d.ts +2 -2
- package/build/configs/app-configs/update-with-presets.js +15 -8
- package/build/configs/app-configs/validate-settings-keys.d.ts +5 -2
- package/build/configs/app-configs/validate-settings-keys.js +7 -6
- package/build/configs/babel-client.d.ts +1 -33
- package/build/configs/babel-dependencies.d.ts +1 -14
- package/build/configs/babel-server.d.ts +1 -26
- package/build/configs/dev-server.d.ts +2 -15
- package/build/configs/jest/index.d.ts +1 -33
- package/build/configs/server-externals-exemptions.d.ts +1 -1
- package/build/configs/server-externals-exemptions.js +0 -1
- package/build/configs/util/apply-overrides.d.ts +6 -6
- package/build/configs/util/get-entry.d.ts +1 -2
- package/build/configs/webpack.client.d.ts +2 -5
- package/build/configs/webpack.client.dev.d.ts +1 -1
- package/build/configs/webpack.client.js +17 -71
- package/build/configs/webpack.client.prod.d.ts +1 -1
- package/build/index.d.ts +1 -1
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/build/configs/modules.d.ts +0 -15
- package/build/configs/modules.js +0 -78
- package/docs/modules.md +0 -423
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
# [14.5.0
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* **build:** correctly report build sized for multiple entrypoints ([cc41419](https://github.com/core-ds/arui-scripts/commit/cc414195915bdbd24867c45e291991568ac6e741))
|
|
7
|
-
* **webpack:** turn off performance hints from webpack ([d43f2c8](https://github.com/core-ds/arui-scripts/commit/d43f2c88b73176a173de570da8321b1f8cccc611))
|
|
1
|
+
# [14.5.0](https://github.com/core-ds/arui-scripts/compare/v14.4.1...v14.5.0) (2023-05-16)
|
|
8
2
|
|
|
9
3
|
|
|
10
4
|
### Features
|
|
11
5
|
|
|
12
|
-
* add initial modules implementation ([0e2093e](https://github.com/core-ds/arui-scripts/commit/0e2093e350af3a3abb557d15b075b43ce96efe67))
|
|
13
|
-
* add modules build support ([2a0f5c1](https://github.com/core-ds/arui-scripts/commit/2a0f5c10ee8fb496228e7b2e42d1a94727c895e5))
|
|
14
6
|
* add new `start:prod` command ([2944887](https://github.com/core-ds/arui-scripts/commit/2944887758527e65fdd0e11ea5bb7e59afa213c1))
|
|
15
|
-
* **modules:** automaticaly generate expose for embedded modules ([5ecadfc](https://github.com/core-ds/arui-scripts/commit/5ecadfca7ebfbb15a0b65331c1db27f091f4173c))
|
|
16
7
|
|
|
17
8
|
## [14.4.1](https://github.com/core-ds/arui-scripts/compare/v14.4.0...v14.4.1) (2023-05-07)
|
|
18
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import webpack from 'webpack';
|
|
2
2
|
type BuildResult = {
|
|
3
|
-
stats: webpack.Stats
|
|
3
|
+
stats: webpack.Stats;
|
|
4
4
|
warnings: string[];
|
|
5
5
|
previousFileSizes: unknown;
|
|
6
6
|
};
|
|
7
|
-
declare function build(config: webpack.Configuration
|
|
7
|
+
declare function build(config: webpack.Configuration, previousFileSizes?: unknown): Promise<BuildResult>;
|
|
8
8
|
export default build;
|
|
@@ -22,16 +22,16 @@ console.log(chalk_1.default.magenta('Building client...'));
|
|
|
22
22
|
else {
|
|
23
23
|
console.log(chalk_1.default.green('Client compiled successfully.\n'));
|
|
24
24
|
}
|
|
25
|
-
function printOutputSizes(webpackConfig
|
|
25
|
+
function printOutputSizes(webpackConfig) {
|
|
26
26
|
var _a;
|
|
27
27
|
const sizes = (0, client_assets_sizes_1.calculateAssetsSizes)(stats, (_a = webpackConfig === null || webpackConfig === void 0 ? void 0 : webpackConfig.output) === null || _a === void 0 ? void 0 : _a.path);
|
|
28
28
|
(0, client_assets_sizes_1.printAssetsSizes)(sizes);
|
|
29
29
|
}
|
|
30
30
|
if (Array.isArray(webpack_client_prod_1.default)) {
|
|
31
|
-
webpack_client_prod_1.default.forEach(
|
|
31
|
+
webpack_client_prod_1.default.forEach(printOutputSizes);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
printOutputSizes(webpack_client_prod_1.default
|
|
34
|
+
printOutputSizes(webpack_client_prod_1.default);
|
|
35
35
|
}
|
|
36
36
|
})
|
|
37
37
|
.catch((err) => {
|
|
@@ -25,9 +25,11 @@ const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
|
25
25
|
statsFilename: app_configs_1.default.statsOutputPath,
|
|
26
26
|
});
|
|
27
27
|
let clientWebpackConfig = webpack_client_prod_1.default;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(
|
|
28
|
+
if (Array.isArray(webpack_client_prod_1.default)) {
|
|
29
|
+
// В случае, если у пользователя несколько конфигов для клиента - запускаем bundle analyzer только для первого
|
|
30
|
+
clientWebpackConfig = webpack_client_prod_1.default[0];
|
|
31
|
+
}
|
|
32
|
+
(_a = clientWebpackConfig.plugins) === null || _a === void 0 ? void 0 : _a.push(plugin);
|
|
33
|
+
clientWebpackConfig.output.path = tmpDir;
|
|
34
|
+
(0, webpack_1.default)(clientWebpackConfig).run(() => { });
|
|
33
35
|
}))();
|
|
@@ -26,14 +26,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const child_process_1 = require("child_process");
|
|
27
27
|
const fs_1 = require("fs");
|
|
28
28
|
const readline_1 = __importDefault(require("readline"));
|
|
29
|
-
const
|
|
29
|
+
const get_defaults_1 = require("../../configs/app-configs/get-defaults");
|
|
30
30
|
const { readFile, rename, unlink } = fs_1.promises;
|
|
31
31
|
/**
|
|
32
32
|
* Сюда пайплайн Jenkins складывает соответствующие части описания версии. Не получается использовать
|
|
33
33
|
* переменные окружения, т.к. `standard-version` запускает хуки через `child_process.exec`, не передавая туда
|
|
34
34
|
* ни аргументы ни переменные окружения.
|
|
35
35
|
*/
|
|
36
|
-
const { appNodeModulesBin, changelogPath, changelogTmpPath, changelogFeaturesPath, changelogBugfixesPath, changelogBreakingChangesPath } =
|
|
36
|
+
const { appNodeModulesBin, changelogPath, changelogTmpPath, changelogFeaturesPath, changelogBugfixesPath, changelogBreakingChangesPath } = (0, get_defaults_1.getDefaults)();
|
|
37
37
|
// Пример заголовка – `## [50.1.0](http://git.moscow.alfaintra.net/...) (2022-07-27)`.
|
|
38
38
|
const changelogHeaderRegExp = /^###? \[\d+\.\d+\.\d+]\([^)]+\) \(\d{4}-\d{2}-\d{2}\)/;
|
|
39
39
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -4,5 +4,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const webpack_client_dev_1 = __importDefault(require("../../configs/webpack.client.dev"));
|
|
7
|
-
const
|
|
8
|
-
(0,
|
|
7
|
+
const run_client_dev_server_1 = require("../util/run-client-dev-server");
|
|
8
|
+
(0, run_client_dev_server_1.runClientDevServer)(webpack_client_dev_1.default);
|
|
@@ -4,5 +4,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const webpack_client_prod_1 = __importDefault(require("../../configs/webpack.client.prod"));
|
|
7
|
-
const
|
|
8
|
-
(0,
|
|
7
|
+
const run_client_dev_server_1 = require("../util/run-client-dev-server");
|
|
8
|
+
(0, run_client_dev_server_1.runClientDevServer)(webpack_client_prod_1.default);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
export declare function runClientDevServer(configuration: Configuration
|
|
2
|
+
export declare function runClientDevServer(configuration: Configuration): Promise<void>;
|
|
@@ -20,7 +20,10 @@ const print_compiler_output_1 = __importDefault(require("../start/print-compiler
|
|
|
20
20
|
const WebpackDevServerUtils_1 = require("react-dev-utils/WebpackDevServerUtils");
|
|
21
21
|
function runClientDevServer(configuration) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const clientCompiler = (0, webpack_1.default)(configuration);
|
|
23
|
+
const clientCompiler = (0, webpack_1.default)(configuration);
|
|
24
|
+
// не резолвиться constructor(config: WebpackDevServer.Configuration, webpack?: webpack.Compiler | webpack.MultiCompiler);
|
|
25
|
+
// clientCompiler: webpack.Compiler
|
|
26
|
+
// @ts-ignore
|
|
24
27
|
const clientDevServer = new webpack_dev_server_1.default(dev_server_1.default, clientCompiler);
|
|
25
28
|
clientCompiler.hooks.invalid.tap('client', () => console.log('Compiling client...'));
|
|
26
29
|
clientCompiler.hooks.done.tap('client', (stats) => (0, print_compiler_output_1.default)('Client', stats));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppConfigs } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Эти ключи из конфига будут обновляться из package.json при их наличии
|
|
4
|
+
*/
|
|
5
|
+
export declare const availablePackageSettings: readonly ["dockerRegistry", "baseDockerImage", "serverEntry", "buildPath", "assetsPath", "additionalBuildPath", "nginxRootPath", "runFromNonRootUser", "archiveName", "serverOutput", "clientPolyfillsEntry", "clientEntry", "keepPropTypes", "devSourceMaps", "useTscLoader", "useServerHMR", "webpack4Compatibility", "clientServerPort", "serverPort", "debug", "statsOutputFilename", "componentsTheme", "keepCssVars", "removeDevDependenciesDuringDockerBuild"];
|
|
6
|
+
type ArrayElementType<ArrayType extends ReadonlyArray<unknown>> = ArrayType[number];
|
|
7
|
+
export type PackageSettings = Partial<Pick<AppConfigs, ArrayElementType<typeof availablePackageSettings>>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.availablePackageSettings = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Эти ключи из конфига будут обновляться из package.json при их наличии
|
|
6
|
+
*/
|
|
7
|
+
exports.availablePackageSettings = [
|
|
8
|
+
'dockerRegistry',
|
|
9
|
+
'baseDockerImage',
|
|
10
|
+
'serverEntry',
|
|
11
|
+
'buildPath',
|
|
12
|
+
'assetsPath',
|
|
13
|
+
'additionalBuildPath',
|
|
14
|
+
'nginxRootPath',
|
|
15
|
+
'runFromNonRootUser',
|
|
16
|
+
'archiveName',
|
|
17
|
+
'serverOutput',
|
|
18
|
+
'clientPolyfillsEntry',
|
|
19
|
+
'clientEntry',
|
|
20
|
+
'keepPropTypes',
|
|
21
|
+
'devSourceMaps',
|
|
22
|
+
'useTscLoader',
|
|
23
|
+
'useServerHMR',
|
|
24
|
+
'webpack4Compatibility',
|
|
25
|
+
'clientServerPort',
|
|
26
|
+
'serverPort',
|
|
27
|
+
'debug',
|
|
28
|
+
'statsOutputFilename',
|
|
29
|
+
'componentsTheme',
|
|
30
|
+
'keepCssVars',
|
|
31
|
+
'removeDevDependenciesDuringDockerBuild'
|
|
32
|
+
];
|
|
@@ -1,53 +1,13 @@
|
|
|
1
|
-
import { AppConfigs
|
|
1
|
+
import { AppConfigs } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
4
4
|
*/
|
|
5
|
-
export declare function calculateDependentConfig(config: AppConfigs): {
|
|
5
|
+
export declare function calculateDependentConfig(config: AppConfigs): AppConfigs & {
|
|
6
|
+
publicPath: string;
|
|
7
|
+
serverOutputPath: string;
|
|
8
|
+
clientOutputPath: string;
|
|
6
9
|
clientPolyfillsEntry: string[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
devSourceMaps: string;
|
|
11
|
-
useServerHMR: boolean;
|
|
12
|
-
presets: string | null;
|
|
13
|
-
buildPath: string;
|
|
14
|
-
assetsPath: string;
|
|
15
|
-
additionalBuildPath: string[];
|
|
16
|
-
statsOutputFilename: string;
|
|
17
|
-
serverEntry: string | string[] | Record<string, string | string[]>;
|
|
18
|
-
serverOutput: string;
|
|
19
|
-
clientEntry: string;
|
|
20
|
-
dockerRegistry: string;
|
|
21
|
-
baseDockerImage: string;
|
|
22
|
-
nginxRootPath: string;
|
|
23
|
-
runFromNonRootUser: boolean;
|
|
24
|
-
removeDevDependenciesDuringDockerBuild: boolean;
|
|
25
|
-
archiveName: string;
|
|
26
|
-
keepPropTypes: boolean;
|
|
27
|
-
useTscLoader: boolean;
|
|
28
|
-
webpack4Compatibility: boolean;
|
|
29
|
-
installServerSourceMaps: boolean;
|
|
30
|
-
componentsTheme: string | undefined;
|
|
31
|
-
keepCssVars: boolean;
|
|
32
|
-
embeddedModules: {
|
|
33
|
-
shared?: {
|
|
34
|
-
[libraryName: string]: string;
|
|
35
|
-
} | undefined;
|
|
36
|
-
exposes?: {
|
|
37
|
-
[moduleId: string]: {
|
|
38
|
-
entry: string;
|
|
39
|
-
embeddedConfig?: Record<string, string> | undefined;
|
|
40
|
-
cssPrefix?: string | false | undefined;
|
|
41
|
-
};
|
|
42
|
-
} | undefined;
|
|
43
|
-
} | null;
|
|
44
|
-
mfModules: {
|
|
45
|
-
name?: string | undefined;
|
|
46
|
-
shared: any;
|
|
47
|
-
exposes?: Record<string, string> | undefined;
|
|
48
|
-
} | null;
|
|
10
|
+
statsOutputPath: string;
|
|
11
|
+
watchIgnorePath: string[];
|
|
12
|
+
babelRuntimeVersion: string;
|
|
49
13
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Обновление контекста в зависимости от ключей конфига
|
|
52
|
-
*/
|
|
53
|
-
export declare function calculateDependentContext(config: AppConfigs, context: AppContext): AppContext;
|
|
@@ -3,22 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.calculateDependentConfig = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
9
10
|
const get_polyfills_1 = require("../util/get-polyfills");
|
|
10
11
|
const resolve_1 = require("../util/resolve");
|
|
11
12
|
/**
|
|
12
13
|
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
13
14
|
*/
|
|
14
15
|
function calculateDependentConfig(config) {
|
|
15
|
-
return Object.assign(Object.assign({}, config), { clientPolyfillsEntry: (0, get_polyfills_1.getPolyfills)(config) });
|
|
16
|
-
}
|
|
17
|
-
exports.calculateDependentConfig = calculateDependentConfig;
|
|
18
|
-
/**
|
|
19
|
-
* Обновление контекста в зависимости от ключей конфига
|
|
20
|
-
*/
|
|
21
|
-
function calculateDependentContext(config, context) {
|
|
22
16
|
let babelRuntimeVersion;
|
|
23
17
|
try {
|
|
24
18
|
// В проекте может стоять babel/runtime отличный от того, что установлен как зависимость arui-scripts.
|
|
@@ -26,12 +20,20 @@ function calculateDependentContext(config, context) {
|
|
|
26
20
|
// Поэтому мы читаем версию того babel/runtime, который установлен в проекте.
|
|
27
21
|
// Так же мы не можем использовать require для получения контента из babel/runtime/package.json,
|
|
28
22
|
// потому что webpack.cache будет ругаться на то, что мы пытаемся импортировать файлы НЕ из своего node_modules.
|
|
29
|
-
const pathToProjectBabelRuntime = (0, resolve_1.resolveNodeModuleRelativeTo)(
|
|
23
|
+
const pathToProjectBabelRuntime = (0, resolve_1.resolveNodeModuleRelativeTo)(config.cwd, '@babel/runtime/package.json');
|
|
30
24
|
babelRuntimeVersion = JSON.parse(fs_1.default.readFileSync(pathToProjectBabelRuntime, 'utf8')).version;
|
|
31
25
|
}
|
|
32
26
|
catch (e) {
|
|
33
27
|
babelRuntimeVersion = require('@babel/runtime/package.json').version;
|
|
34
28
|
}
|
|
35
|
-
return
|
|
29
|
+
return (0, lodash_merge_1.default)(config, {
|
|
30
|
+
publicPath: `${config.assetsPath}/`,
|
|
31
|
+
serverOutputPath: path_1.default.resolve(config.cwd, config.buildPath),
|
|
32
|
+
clientOutputPath: path_1.default.resolve(config.cwd, config.buildPath, config.assetsPath),
|
|
33
|
+
clientPolyfillsEntry: (0, get_polyfills_1.getPolyfills)(config),
|
|
34
|
+
statsOutputPath: path_1.default.resolve(config.cwd, config.buildPath, config.statsOutputFilename),
|
|
35
|
+
watchIgnorePath: ['node_modules', config.buildPath],
|
|
36
|
+
babelRuntimeVersion,
|
|
37
|
+
});
|
|
36
38
|
}
|
|
37
|
-
exports.
|
|
39
|
+
exports.calculateDependentConfig = calculateDependentConfig;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { AppConfigs
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function getDefaultAppContext(): AppContext;
|
|
1
|
+
import { AppConfigs } from './types';
|
|
2
|
+
export declare function getDefaults(): AppConfigs;
|
|
@@ -3,57 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getDefaults = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const resolve_1 = require("../util/resolve");
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
function getDefaultAppConfig() {
|
|
13
|
-
return {
|
|
14
|
-
/// general settings
|
|
15
|
-
clientServerPort: 8080,
|
|
16
|
-
serverPort: 3000,
|
|
17
|
-
debug: false,
|
|
18
|
-
devSourceMaps: 'eval',
|
|
19
|
-
useServerHMR: false,
|
|
20
|
-
presets: null,
|
|
21
|
-
// paths
|
|
22
|
-
buildPath: '.build',
|
|
23
|
-
assetsPath: 'assets',
|
|
24
|
-
additionalBuildPath: ['config'],
|
|
25
|
-
statsOutputFilename: 'stats.json',
|
|
26
|
-
serverEntry: path_1.default.resolve(absoluteSrcPath, 'server/index'),
|
|
27
|
-
serverOutput: 'server.js',
|
|
28
|
-
clientPolyfillsEntry: null,
|
|
29
|
-
clientEntry: path_1.default.resolve(absoluteSrcPath, 'index'),
|
|
30
|
-
// docker compilation configs
|
|
31
|
-
dockerRegistry: '',
|
|
32
|
-
baseDockerImage: 'alfabankui/arui-scripts:latest',
|
|
33
|
-
nginxRootPath: '/src',
|
|
34
|
-
runFromNonRootUser: true,
|
|
35
|
-
removeDevDependenciesDuringDockerBuild: true,
|
|
36
|
-
// archive compilation configs
|
|
37
|
-
archiveName: 'build.tar',
|
|
38
|
-
// build tuning
|
|
39
|
-
keepPropTypes: false,
|
|
40
|
-
useTscLoader: false,
|
|
41
|
-
webpack4Compatibility: false,
|
|
42
|
-
installServerSourceMaps: false,
|
|
43
|
-
// CSS
|
|
44
|
-
componentsTheme: undefined,
|
|
45
|
-
keepCssVars: false,
|
|
46
|
-
// Modules
|
|
47
|
-
embeddedModules: null,
|
|
48
|
-
mfModules: null,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
exports.getDefaultAppConfig = getDefaultAppConfig;
|
|
52
|
-
function getDefaultAppContext() {
|
|
10
|
+
function getDefaults() {
|
|
11
|
+
const CWD = process.cwd();
|
|
53
12
|
const appPackage = JSON.parse(fs_1.default.readFileSync(path_1.default.join(CWD, 'package.json'), 'utf8'));
|
|
54
13
|
if (appPackage['arui-scripts']) {
|
|
55
14
|
throw Error('arui-scripts in package.json is not supported. Use aruiScripts instead.');
|
|
56
15
|
}
|
|
16
|
+
const absoluteSrcPath = path_1.default.resolve(CWD, 'src');
|
|
57
17
|
const absoluteNodeModulesPath = path_1.default.resolve(CWD, 'node_modules');
|
|
58
18
|
const absoluteNodeModulesBinPath = path_1.default.resolve(absoluteNodeModulesPath, '.bin');
|
|
59
19
|
const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
|
|
@@ -65,22 +25,47 @@ function getDefaultAppContext() {
|
|
|
65
25
|
return {
|
|
66
26
|
appPackage,
|
|
67
27
|
name: appPackage.name,
|
|
68
|
-
normalizedName: appPackage.name.replace(/-/g, '_'),
|
|
69
28
|
version: appPackage.version,
|
|
29
|
+
dockerRegistry: '',
|
|
30
|
+
baseDockerImage: 'alfabankui/arui-scripts:latest',
|
|
70
31
|
// general paths
|
|
71
32
|
cwd: CWD,
|
|
72
33
|
appSrc: absoluteSrcPath,
|
|
73
34
|
appNodeModules: absoluteNodeModulesPath,
|
|
74
35
|
appNodeModulesBin: absoluteNodeModulesBinPath,
|
|
75
|
-
|
|
76
|
-
|
|
36
|
+
buildPath: '.build',
|
|
37
|
+
assetsPath: 'assets',
|
|
38
|
+
additionalBuildPath: ['config'],
|
|
39
|
+
nginxRootPath: '/src',
|
|
40
|
+
runFromNonRootUser: true,
|
|
41
|
+
archiveName: 'build.tar',
|
|
77
42
|
babelRuntimeVersion: '7.0.0-beta.0',
|
|
78
|
-
|
|
43
|
+
// server compilation configs
|
|
44
|
+
serverEntry: path_1.default.resolve(absoluteSrcPath, 'server/index'),
|
|
45
|
+
serverOutput: 'server.js',
|
|
46
|
+
// client compilation configs
|
|
47
|
+
clientPolyfillsEntry: null,
|
|
48
|
+
clientEntry: path_1.default.resolve(absoluteSrcPath, 'index'),
|
|
49
|
+
keepPropTypes: false,
|
|
79
50
|
// compilation configs locations
|
|
80
51
|
tsconfig: fs_1.default.existsSync(projectTsConfigPath) ? projectTsConfigPath : null,
|
|
81
52
|
localNginxConf: fs_1.default.existsSync(nginxConfFilePath) ? nginxConfFilePath : null,
|
|
82
53
|
localDockerfile: fs_1.default.existsSync(dockerfileFilePath) ? dockerfileFilePath : null,
|
|
83
54
|
localStartScript: fs_1.default.existsSync(startScriptFilePath) ? startScriptFilePath : null,
|
|
55
|
+
devSourceMaps: 'eval',
|
|
56
|
+
useTscLoader: false,
|
|
57
|
+
useServerHMR: false,
|
|
58
|
+
webpack4Compatibility: false,
|
|
59
|
+
useYarn: fs_1.default.existsSync(yarnLockFilePath),
|
|
60
|
+
clientServerPort: 8080,
|
|
61
|
+
serverPort: 3000,
|
|
62
|
+
installServerSourceMaps: false,
|
|
63
|
+
debug: false,
|
|
64
|
+
overridesPath: overridesPath ? [overridesPath] : [],
|
|
65
|
+
statsOutputFilename: 'stats.json',
|
|
66
|
+
removeDevDependenciesDuringDockerBuild: true,
|
|
67
|
+
componentsTheme: undefined,
|
|
68
|
+
keepCssVars: false,
|
|
84
69
|
// Эти пути зависят от других настроек, которые могут быть переопределены пользователем
|
|
85
70
|
publicPath: '',
|
|
86
71
|
serverOutputPath: '',
|
|
@@ -95,4 +80,4 @@ function getDefaultAppContext() {
|
|
|
95
80
|
changelogBreakingChangesPath: path_1.default.resolve(CWD, './changelog_breaking_changes.tmp'),
|
|
96
81
|
};
|
|
97
82
|
}
|
|
98
|
-
exports.
|
|
83
|
+
exports.getDefaults = getDefaults;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import '../util/register-ts-node';
|
|
2
|
-
import { AppConfigs
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export declare const configs: AppContextWithConfigs;
|
|
6
|
-
export default configs;
|
|
2
|
+
import { AppConfigs } from './types';
|
|
3
|
+
declare let config: AppConfigs;
|
|
4
|
+
export default config;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configs = exports.appConfigs = exports.appContext = void 0;
|
|
4
3
|
require("../util/register-ts-node");
|
|
5
4
|
const get_defaults_1 = require("./get-defaults");
|
|
6
5
|
const update_with_env_1 = require("./update-with-env");
|
|
@@ -8,15 +7,10 @@ const update_with_package_1 = require("./update-with-package");
|
|
|
8
7
|
const update_with_presets_1 = require("./update-with-presets");
|
|
9
8
|
const calculate_dependent_config_1 = require("./calculate-dependent-config");
|
|
10
9
|
const update_with_config_file_1 = require("./update-with-config-file");
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
tmpContext = (0, calculate_dependent_config_1.calculateDependentContext)(tmpConfig, tmpContext);
|
|
19
|
-
exports.appContext = tmpContext;
|
|
20
|
-
exports.appConfigs = tmpConfig;
|
|
21
|
-
exports.configs = Object.assign(Object.assign({}, exports.appConfigs), exports.appContext);
|
|
22
|
-
exports.default = exports.configs;
|
|
10
|
+
let config = (0, get_defaults_1.getDefaults)();
|
|
11
|
+
config = (0, update_with_presets_1.updateWithPresets)(config);
|
|
12
|
+
config = (0, update_with_package_1.updateWithPackage)(config);
|
|
13
|
+
config = (0, update_with_config_file_1.updateWithConfigFile)(config);
|
|
14
|
+
config = (0, update_with_env_1.updateWithEnv)(config);
|
|
15
|
+
config = (0, calculate_dependent_config_1.calculateDependentConfig)(config);
|
|
16
|
+
exports.default = config;
|
|
@@ -1,74 +1,43 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Конфигурация arui-scripts, которая может быть переопределена приложением
|
|
3
|
-
*/
|
|
4
1
|
export type AppConfigs = {
|
|
5
|
-
clientServerPort: number;
|
|
6
|
-
serverPort: number;
|
|
7
|
-
debug: boolean;
|
|
8
|
-
devSourceMaps: string;
|
|
9
|
-
useServerHMR: boolean;
|
|
10
|
-
presets: string | null;
|
|
11
|
-
buildPath: string;
|
|
12
|
-
assetsPath: string;
|
|
13
|
-
additionalBuildPath: string[];
|
|
14
|
-
statsOutputFilename: string;
|
|
15
|
-
serverEntry: string | string[] | Record<string, string | string[]>;
|
|
16
|
-
serverOutput: string;
|
|
17
|
-
clientPolyfillsEntry: null | string | string[];
|
|
18
|
-
clientEntry: string;
|
|
19
|
-
dockerRegistry: string;
|
|
20
|
-
baseDockerImage: string;
|
|
21
|
-
nginxRootPath: string;
|
|
22
|
-
runFromNonRootUser: boolean;
|
|
23
|
-
removeDevDependenciesDuringDockerBuild: boolean;
|
|
24
|
-
archiveName: string;
|
|
25
|
-
keepPropTypes: boolean;
|
|
26
|
-
useTscLoader: boolean;
|
|
27
|
-
webpack4Compatibility: boolean;
|
|
28
|
-
installServerSourceMaps: boolean;
|
|
29
|
-
componentsTheme: string | undefined;
|
|
30
|
-
keepCssVars: boolean;
|
|
31
|
-
embeddedModules: {
|
|
32
|
-
shared?: {
|
|
33
|
-
[libraryName: string]: string;
|
|
34
|
-
};
|
|
35
|
-
exposes?: {
|
|
36
|
-
[moduleId: string]: EmbeddedModuleConfigBase;
|
|
37
|
-
};
|
|
38
|
-
} | null;
|
|
39
|
-
mfModules: {
|
|
40
|
-
name?: string;
|
|
41
|
-
shared: any;
|
|
42
|
-
exposes?: Record<string, string>;
|
|
43
|
-
} | null;
|
|
44
|
-
};
|
|
45
|
-
type EmbeddedModuleConfigBase = {
|
|
46
|
-
entry: string;
|
|
47
|
-
embeddedConfig?: Record<string, string>;
|
|
48
|
-
cssPrefix?: false | string;
|
|
49
|
-
};
|
|
50
|
-
export type EmbeddedModuleConfig = EmbeddedModuleConfigBase & {
|
|
51
|
-
name: string;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Внутренний контекст arui-scripts
|
|
55
|
-
*/
|
|
56
|
-
export type AppContext = {
|
|
57
2
|
appPackage: any;
|
|
58
3
|
name: string;
|
|
59
|
-
normalizedName: string;
|
|
60
4
|
version: string;
|
|
5
|
+
dockerRegistry: string;
|
|
6
|
+
baseDockerImage: string;
|
|
61
7
|
cwd: string;
|
|
62
8
|
appSrc: string;
|
|
63
9
|
appNodeModules: string;
|
|
64
10
|
appNodeModulesBin: string;
|
|
11
|
+
buildPath: string;
|
|
12
|
+
assetsPath: string;
|
|
13
|
+
additionalBuildPath: string[];
|
|
14
|
+
nginxRootPath: string;
|
|
15
|
+
runFromNonRootUser: boolean;
|
|
16
|
+
archiveName: string;
|
|
65
17
|
babelRuntimeVersion: string;
|
|
66
|
-
|
|
18
|
+
serverEntry: string | string[] | Record<string, string | string[]>;
|
|
19
|
+
serverOutput: string;
|
|
20
|
+
clientPolyfillsEntry: null | string | string[];
|
|
21
|
+
clientEntry: string;
|
|
22
|
+
keepPropTypes: boolean;
|
|
67
23
|
tsconfig: string | null;
|
|
68
24
|
localNginxConf: string | null;
|
|
69
25
|
localDockerfile: string | null;
|
|
70
26
|
localStartScript: string | null;
|
|
27
|
+
devSourceMaps: string;
|
|
28
|
+
useTscLoader: boolean;
|
|
29
|
+
useServerHMR: boolean;
|
|
30
|
+
webpack4Compatibility: boolean;
|
|
31
|
+
useYarn: boolean;
|
|
32
|
+
clientServerPort: number;
|
|
33
|
+
serverPort: number;
|
|
34
|
+
installServerSourceMaps: boolean;
|
|
35
|
+
debug: boolean;
|
|
71
36
|
overridesPath: string[];
|
|
37
|
+
statsOutputFilename: string;
|
|
38
|
+
removeDevDependenciesDuringDockerBuild: boolean;
|
|
39
|
+
componentsTheme: string | undefined;
|
|
40
|
+
keepCssVars: boolean;
|
|
72
41
|
publicPath: string;
|
|
73
42
|
serverOutputPath: string;
|
|
74
43
|
clientOutputPath: string;
|
|
@@ -80,6 +49,3 @@ export type AppContext = {
|
|
|
80
49
|
changelogBugfixesPath: string;
|
|
81
50
|
changelogBreakingChangesPath: string;
|
|
82
51
|
};
|
|
83
|
-
export type AppContextWithConfigs = AppContext & AppConfigs;
|
|
84
|
-
export type PackageSettings = Partial<AppConfigs>;
|
|
85
|
-
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppConfigs
|
|
2
|
-
export declare function updateWithConfigFile(config: AppConfigs
|
|
1
|
+
import { AppConfigs } from './types';
|
|
2
|
+
export declare function updateWithConfigFile(config: AppConfigs): AppConfigs;
|
|
@@ -5,18 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.updateWithConfigFile = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
9
|
const resolve_1 = require("../util/resolve");
|
|
9
|
-
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const validate_settings_keys_1 = __importDefault(require("./validate-settings-keys"));
|
|
11
|
+
const available_package_settings_1 = require("./available-package-settings");
|
|
12
|
+
function updateWithConfigFile(config) {
|
|
13
|
+
const appConfigPath = (0, resolve_1.tryResolve)(path_1.default.join(config.cwd, '/arui-scripts.config'));
|
|
12
14
|
if (appConfigPath) {
|
|
13
15
|
let appSettings = require(appConfigPath);
|
|
14
16
|
if (appSettings.__esModule) {
|
|
15
17
|
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
16
18
|
appSettings = appSettings.default;
|
|
17
19
|
}
|
|
18
|
-
(0, validate_settings_keys_1.
|
|
19
|
-
|
|
20
|
+
(0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, appSettings);
|
|
21
|
+
config = (0, lodash_merge_1.default)(config, appSettings);
|
|
20
22
|
}
|
|
21
23
|
return config;
|
|
22
24
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.updateWithEnv = void 0;
|
|
4
|
-
const
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
+
const validate_settings_keys_1 = __importDefault(require("./validate-settings-keys"));
|
|
9
|
+
const available_package_settings_1 = require("./available-package-settings");
|
|
5
10
|
function updateWithEnv(config) {
|
|
6
11
|
if (!process.env.ARUI_SCRIPTS_CONFIG) {
|
|
7
12
|
return config;
|
|
@@ -9,8 +14,8 @@ function updateWithEnv(config) {
|
|
|
9
14
|
try {
|
|
10
15
|
console.warn('Используйте ARUI_SCRIPTS_CONFIG только для отладки');
|
|
11
16
|
const envSettings = JSON.parse(process.env.ARUI_SCRIPTS_CONFIG);
|
|
12
|
-
(0, validate_settings_keys_1.
|
|
13
|
-
return
|
|
17
|
+
(0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, envSettings);
|
|
18
|
+
return (0, lodash_merge_1.default)(config, envSettings);
|
|
14
19
|
}
|
|
15
20
|
catch (e) {
|
|
16
21
|
console.error(e);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppConfigs
|
|
2
|
-
export declare function updateWithPackage(config: AppConfigs
|
|
1
|
+
import { AppConfigs } from './types';
|
|
2
|
+
export declare function updateWithPackage(config: AppConfigs): any;
|