arui-scripts 12.0.1-beta.0 → 12.2.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 +6 -0
- package/README.md +11 -1
- package/build/commands/bundle-analyze/index.js +6 -1
- package/build/configs/app-configs/available-package-settings.js +1 -0
- package/build/configs/app-configs/calculate-dependent-config.js +1 -0
- package/build/configs/app-configs/get-defaults.js +2 -0
- package/build/configs/webpack.client.dev.js +2 -0
- package/build/configs/webpack.server.dev.js +3 -0
- package/build/configs/webpack.server.prod.js +0 -3
- package/build/tsconfig-local.tsbuildinfo +180 -179
- package/package.json +1 -1
- package/build/configs/app-configs.js +0 -119
- package/build/configs/util/validate-settings-keys.js +0 -15
package/package.json
CHANGED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
9
|
-
const validate_settings_keys_1 = __importDefault(require("./util/validate-settings-keys"));
|
|
10
|
-
const CWD = process.cwd();
|
|
11
|
-
const appPackage = JSON.parse(fs_1.default.readFileSync(path_1.default.join(CWD, 'package.json'), 'utf8'));
|
|
12
|
-
if (appPackage['arui-scripts']) {
|
|
13
|
-
throw Error('arui-scripts in package.json is not supported. Use aruiScripts instead.');
|
|
14
|
-
}
|
|
15
|
-
const absoluteSrcPath = path_1.default.resolve(CWD, 'src');
|
|
16
|
-
const absoluteNodeModulesPath = path_1.default.resolve(CWD, 'node_modules');
|
|
17
|
-
const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
|
|
18
|
-
const yarnLockFilePath = path_1.default.join(CWD, 'yarn.lock');
|
|
19
|
-
const overridesPath = path_1.default.join(CWD, 'arui-scripts.overrides.js');
|
|
20
|
-
const nginxConfFilePath = path_1.default.join(CWD, 'nginx.conf');
|
|
21
|
-
const dockerfileFilePath = path_1.default.join(CWD, 'Dockerfile');
|
|
22
|
-
let aruiPolyfills = null;
|
|
23
|
-
try {
|
|
24
|
-
aruiPolyfills = require.resolve('arui-feather/polyfills');
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
// just ignore it
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Базовые настройки. Часть из них может быть переопределена через env либо через package.json
|
|
31
|
-
*/
|
|
32
|
-
let config = {
|
|
33
|
-
appPackage,
|
|
34
|
-
name: appPackage.name,
|
|
35
|
-
version: appPackage.version,
|
|
36
|
-
dockerRegistry: '',
|
|
37
|
-
baseDockerImage: 'alfabankui/arui-scripts:latest',
|
|
38
|
-
// general paths
|
|
39
|
-
cwd: CWD,
|
|
40
|
-
appSrc: absoluteSrcPath,
|
|
41
|
-
appNodeModules: absoluteNodeModulesPath,
|
|
42
|
-
buildPath: '.build',
|
|
43
|
-
assetsPath: 'assets',
|
|
44
|
-
additionalBuildPath: ['config'],
|
|
45
|
-
nginxRootPath: '/src',
|
|
46
|
-
runFromNonRootUser: false,
|
|
47
|
-
archiveName: 'build.tar',
|
|
48
|
-
// server compilation configs
|
|
49
|
-
serverEntry: path_1.default.resolve(absoluteSrcPath, 'server/index'),
|
|
50
|
-
serverOutput: 'server.js',
|
|
51
|
-
// client compilation configs
|
|
52
|
-
clientPolyfillsEntry: aruiPolyfills,
|
|
53
|
-
clientEntry: path_1.default.resolve(absoluteSrcPath, 'index'),
|
|
54
|
-
keepPropTypes: false,
|
|
55
|
-
// compilation configs locations
|
|
56
|
-
tsconfig: fs_1.default.existsSync(projectTsConfigPath) ? projectTsConfigPath : null,
|
|
57
|
-
localNginxConf: fs_1.default.existsSync(nginxConfFilePath) ? nginxConfFilePath : null,
|
|
58
|
-
localDockerfile: fs_1.default.existsSync(dockerfileFilePath) ? dockerfileFilePath : null,
|
|
59
|
-
useTscLoader: false,
|
|
60
|
-
useServerHMR: false,
|
|
61
|
-
useYarn: fs_1.default.existsSync(yarnLockFilePath),
|
|
62
|
-
clientServerPort: 8080,
|
|
63
|
-
serverPort: 3000,
|
|
64
|
-
debug: false,
|
|
65
|
-
hasOverrides: fs_1.default.existsSync(overridesPath),
|
|
66
|
-
overridesPath: overridesPath,
|
|
67
|
-
componentsTheme: undefined,
|
|
68
|
-
keepCssVars: true,
|
|
69
|
-
// Эти пути зависят от других настроек, которые могут быть переопределены пользователем
|
|
70
|
-
publicPath: '',
|
|
71
|
-
serverOutputPath: '',
|
|
72
|
-
clientOutputPath: '',
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Эти ключи из конфига будут обновляться из package.json при их наличии
|
|
76
|
-
*/
|
|
77
|
-
const availablePackageSettings = [
|
|
78
|
-
'dockerRegistry',
|
|
79
|
-
'baseDockerImage',
|
|
80
|
-
'serverEntry',
|
|
81
|
-
'buildPath',
|
|
82
|
-
'assetsPath',
|
|
83
|
-
'additionalBuildPath',
|
|
84
|
-
'nginxRootPath',
|
|
85
|
-
'runFromNonRootUser',
|
|
86
|
-
'archiveName',
|
|
87
|
-
'serverOutput',
|
|
88
|
-
'clientPolyfillsEntry',
|
|
89
|
-
'clientEntry',
|
|
90
|
-
'keepPropTypes',
|
|
91
|
-
'useTscLoader',
|
|
92
|
-
'useServerHMR',
|
|
93
|
-
'clientServerPort',
|
|
94
|
-
'serverPort',
|
|
95
|
-
'debug',
|
|
96
|
-
'componentsTheme',
|
|
97
|
-
'keepCssVars',
|
|
98
|
-
];
|
|
99
|
-
const packageSettings = appPackage.aruiScripts || {};
|
|
100
|
-
validate_settings_keys_1.default(availablePackageSettings, packageSettings);
|
|
101
|
-
config = lodash_merge_1.default(config, packageSettings);
|
|
102
|
-
if (process.env.ARUI_SCRIPTS_CONFIG) {
|
|
103
|
-
try {
|
|
104
|
-
console.warn('Используйте ARUI_SCRIPTS_CONFIG только для отладки');
|
|
105
|
-
const envSettings = JSON.parse(process.env.ARUI_SCRIPTS_CONFIG);
|
|
106
|
-
validate_settings_keys_1.default(availablePackageSettings, envSettings);
|
|
107
|
-
config = lodash_merge_1.default(config, envSettings);
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
console.error(e);
|
|
111
|
-
throw Error('Not valid JSON passed. Correct it. For example: ARUI_SCRIPTS_CONFIG="{\"serverPort\":3333}"');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
//
|
|
115
|
-
// Обновляем их в последнюю очередь
|
|
116
|
-
config.publicPath = `${config.assetsPath}/`;
|
|
117
|
-
config.serverOutputPath = path_1.default.resolve(CWD, config.buildPath);
|
|
118
|
-
config.clientOutputPath = path_1.default.resolve(CWD, config.buildPath, config.assetsPath);
|
|
119
|
-
exports.default = config;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Функция проверяет что все ключи объекта settingsObject есть в массиве availableKeys
|
|
5
|
-
* @param {string[]} availableKeys Массив допустимых настроек
|
|
6
|
-
* @param settingsObject Объект с настройками
|
|
7
|
-
*/
|
|
8
|
-
function validateSettingsKeys(availableKeys, settingsObject) {
|
|
9
|
-
Object.keys(settingsObject).forEach((setting) => {
|
|
10
|
-
if (!availableKeys.includes(setting)) {
|
|
11
|
-
console.warn('\x1b[33m', `Setting`, '\x1b[31m', setting, '\x1b[33m', 'is not supported!');
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
exports.default = validateSettingsKeys;
|