arui-scripts 13.5.0 → 14.0.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 +16 -0
- package/build/commands/archive-build/index.js +3 -3
- package/build/commands/build/build-wrapper.d.ts +1 -1
- package/build/commands/build/build-wrapper.js +2 -2
- package/build/commands/build/client.js +4 -4
- package/build/commands/build/index.js +3 -3
- package/build/commands/build/server.js +2 -2
- package/build/commands/bundle-analyze/index.js +2 -2
- package/build/commands/changelog/index.js +35 -28
- package/build/commands/docker-build/index.js +7 -7
- package/build/commands/docker-build-compiled/index.js +5 -5
- package/build/commands/start/client.js +3 -3
- package/build/commands/start/index.js +3 -3
- package/build/commands/start/server.js +2 -2
- package/build/commands/util/client-assets-sizes.d.ts +3 -3
- package/build/commands/util/client-assets-sizes.js +9 -9
- package/build/commands/util/docker-build.d.ts +1 -1
- package/build/commands/util/yarn.d.ts +1 -1
- package/build/configs/app-configs/available-package-settings.d.ts +2 -2
- package/build/configs/app-configs/calculate-dependent-config.js +3 -3
- package/build/configs/app-configs/get-defaults.js +1 -1
- package/build/configs/app-configs/index.js +6 -6
- package/build/configs/app-configs/types.d.ts +1 -1
- package/build/configs/app-configs/update-with-config-file.js +3 -3
- package/build/configs/app-configs/update-with-env.js +2 -2
- package/build/configs/app-configs/update-with-package.js +2 -2
- package/build/configs/app-configs/update-with-presets.js +4 -4
- package/build/configs/babel-client.js +1 -1
- package/build/configs/babel-dependencies.js +1 -1
- package/build/configs/babel-server.js +1 -1
- package/build/configs/dev-server.js +1 -1
- package/build/configs/jest/babel-transform.d.ts +1 -6
- package/build/configs/jest/file-transform.d.ts +3 -2
- package/build/configs/jest/file-transform.js +1 -1
- package/build/configs/jest/index.d.ts +8 -8
- package/build/configs/jest/index.js +1 -1
- package/build/configs/postcss.config.d.ts +1 -1
- package/build/configs/postcss.js +1 -1
- package/build/configs/server-externals-exemptions.js +1 -1
- package/build/configs/stats-options.js +1 -1
- package/build/configs/supporting-browsers.js +1 -1
- package/build/configs/util/apply-overrides.d.ts +3 -3
- package/build/configs/webpack.client.dev.js +7 -2
- package/build/configs/webpack.client.prod.js +5 -3
- package/build/configs/webpack.server.dev.js +3 -3
- package/build/configs/webpack.server.prod.js +3 -3
- package/build/index.js +1 -0
- package/build/templates/dockerfile-compiled.template.js +3 -3
- package/build/templates/dockerfile.template.js +1 -1
- package/build/templates/nginx.conf.template.js +1 -1
- package/build/templates/start.template.js +1 -1
- package/build/tsconfig-local.tsbuildinfo +1 -8848
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# [14.0.0](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.5.0...v14.0.0) (2023-03-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* update jest to 28 ([14d1af7](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/14d1af7c4502e20adaf200716f6ed941784643ef))
|
|
7
|
+
* update minimal ts version to 4.3 ([ce4910a](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/ce4910afb2efc0cc351e73a07a286afe58f621fd))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* minimal supported version of ts it now 4.3
|
|
13
|
+
* now we use jest@28
|
|
14
|
+
|
|
15
|
+
For complete list of breaking changes see https://jestjs.io/docs/28.x/upgrading-to-jest28
|
|
16
|
+
|
|
1
17
|
# [13.5.0](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.4.0...v13.5.0) (2023-03-02)
|
|
2
18
|
|
|
3
19
|
|
|
@@ -46,11 +46,11 @@ const packageJsonPath = path_1.default.join(app_configs_1.default.cwd, packageJs
|
|
|
46
46
|
console.timeEnd('Setting up time');
|
|
47
47
|
console.time('Build application time');
|
|
48
48
|
// run build script
|
|
49
|
-
yield exec_1.default('npm run build');
|
|
49
|
+
yield (0, exec_1.default)('npm run build');
|
|
50
50
|
console.timeEnd('Build application time');
|
|
51
51
|
console.time('Remove build dependencies time');
|
|
52
|
-
const pruneCommand = yarn_1.getPruningCommand();
|
|
53
|
-
yield exec_1.default(pruneCommand);
|
|
52
|
+
const pruneCommand = (0, yarn_1.getPruningCommand)();
|
|
53
|
+
yield (0, exec_1.default)(pruneCommand);
|
|
54
54
|
console.timeEnd('Remove build dependencies time');
|
|
55
55
|
console.time('Archive build time');
|
|
56
56
|
yield Promise.all([
|
|
@@ -9,13 +9,13 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
const webpack_1 = __importDefault(require("webpack"));
|
|
10
10
|
const format_webpack_messages_1 = __importDefault(require("../util/format-webpack-messages"));
|
|
11
11
|
function build(config, previousFileSizes) {
|
|
12
|
-
let compiler = webpack_1.default(config);
|
|
12
|
+
let compiler = (0, webpack_1.default)(config);
|
|
13
13
|
return new Promise((resolve, reject) => {
|
|
14
14
|
compiler.run((err, stats) => {
|
|
15
15
|
if (err) {
|
|
16
16
|
return reject(err);
|
|
17
17
|
}
|
|
18
|
-
const messages = format_webpack_messages_1.default(stats === null || stats === void 0 ? void 0 : stats.toJson({}));
|
|
18
|
+
const messages = (0, format_webpack_messages_1.default)(stats === null || stats === void 0 ? void 0 : stats.toJson({}));
|
|
19
19
|
if (messages.errors.length) {
|
|
20
20
|
// Only keep the first error. Others are often indicative
|
|
21
21
|
// of the same problem, but confuse the reader with noise.
|
|
@@ -11,7 +11,7 @@ const build_wrapper_1 = __importDefault(require("./build-wrapper"));
|
|
|
11
11
|
const client_assets_sizes_1 = require("../util/client-assets-sizes");
|
|
12
12
|
const webpack_client_prod_1 = __importDefault(require("../../configs/webpack.client.prod"));
|
|
13
13
|
console.log(chalk_1.default.magenta('Building client...'));
|
|
14
|
-
build_wrapper_1.default(webpack_client_prod_1.default)
|
|
14
|
+
(0, build_wrapper_1.default)(webpack_client_prod_1.default)
|
|
15
15
|
.then(({ stats, warnings }) => {
|
|
16
16
|
if (warnings.length) {
|
|
17
17
|
console.log(chalk_1.default.yellow('Client compiled with warnings.\n'));
|
|
@@ -24,8 +24,8 @@ build_wrapper_1.default(webpack_client_prod_1.default)
|
|
|
24
24
|
}
|
|
25
25
|
function printOutputSizes(webpackConfig) {
|
|
26
26
|
var _a;
|
|
27
|
-
const sizes = 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
|
-
client_assets_sizes_1.printAssetsSizes(sizes);
|
|
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
|
+
(0, client_assets_sizes_1.printAssetsSizes)(sizes);
|
|
29
29
|
}
|
|
30
30
|
if (Array.isArray(webpack_client_prod_1.default)) {
|
|
31
31
|
webpack_client_prod_1.default.forEach(printOutputSizes);
|
|
@@ -36,6 +36,6 @@ build_wrapper_1.default(webpack_client_prod_1.default)
|
|
|
36
36
|
})
|
|
37
37
|
.catch((err) => {
|
|
38
38
|
console.log(chalk_1.default.red('Failed to compile client.\n'));
|
|
39
|
-
printBuildError_1.default(err);
|
|
39
|
+
(0, printBuildError_1.default)(err);
|
|
40
40
|
process.exit(1);
|
|
41
41
|
});
|
|
@@ -14,14 +14,14 @@ const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
|
14
14
|
process.env.BABEL_ENV = 'production';
|
|
15
15
|
process.env.NODE_ENV = 'production';
|
|
16
16
|
process.env.BROWSERSLIST_CONFIG = process.env.BROWSERSLIST_CONFIG || require.resolve('../../../.browserslistrc');
|
|
17
|
-
if (!check_required_files_1.default()) {
|
|
17
|
+
if (!(0, check_required_files_1.default)()) {
|
|
18
18
|
process.exit(1);
|
|
19
19
|
}
|
|
20
20
|
if (fs_extra_1.default.pathExistsSync(app_configs_1.default.serverOutputPath)) {
|
|
21
21
|
fs_extra_1.default.removeSync(app_configs_1.default.serverOutputPath);
|
|
22
22
|
}
|
|
23
|
-
const compileServer = child_process_1.spawn('node', [path_1.default.join(__dirname, './server')], { stdio: 'inherit' });
|
|
24
|
-
const compileClient = child_process_1.spawn('node', [path_1.default.join(__dirname, './client')], { stdio: 'inherit' });
|
|
23
|
+
const compileServer = (0, child_process_1.spawn)('node', [path_1.default.join(__dirname, './server')], { stdio: 'inherit' });
|
|
24
|
+
const compileClient = (0, child_process_1.spawn)('node', [path_1.default.join(__dirname, './client')], { stdio: 'inherit' });
|
|
25
25
|
const onProcessExit = (code) => {
|
|
26
26
|
if (code !== 0) {
|
|
27
27
|
compileServer.kill();
|
|
@@ -10,7 +10,7 @@ const printBuildError_1 = __importDefault(require("react-dev-utils/printBuildErr
|
|
|
10
10
|
const build_wrapper_1 = __importDefault(require("./build-wrapper"));
|
|
11
11
|
const webpack_server_prod_1 = __importDefault(require("../../configs/webpack.server.prod"));
|
|
12
12
|
console.log(chalk_1.default.magenta('Building server...'));
|
|
13
|
-
build_wrapper_1.default(webpack_server_prod_1.default)
|
|
13
|
+
(0, build_wrapper_1.default)(webpack_server_prod_1.default)
|
|
14
14
|
.then(({ warnings }) => {
|
|
15
15
|
if (warnings.length) {
|
|
16
16
|
console.log(chalk_1.default.yellow('Server compiled with warnings.\n'));
|
|
@@ -24,6 +24,6 @@ build_wrapper_1.default(webpack_server_prod_1.default)
|
|
|
24
24
|
})
|
|
25
25
|
.catch((err) => {
|
|
26
26
|
console.log(chalk_1.default.red('Failed to compile server.\n'));
|
|
27
|
-
printBuildError_1.default(err);
|
|
27
|
+
(0, printBuildError_1.default)(err);
|
|
28
28
|
process.exit(1);
|
|
29
29
|
});
|
|
@@ -19,7 +19,7 @@ const webpack_client_prod_1 = __importDefault(require("../../configs/webpack.cli
|
|
|
19
19
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
20
20
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
21
|
var _a;
|
|
22
|
-
const tmpDir = yield make_tmp_dir_1.default();
|
|
22
|
+
const tmpDir = yield (0, make_tmp_dir_1.default)();
|
|
23
23
|
const plugin = new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
|
|
24
24
|
generateStatsFile: true,
|
|
25
25
|
statsFilename: app_configs_1.default.statsOutputPath,
|
|
@@ -31,5 +31,5 @@ const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
|
31
31
|
}
|
|
32
32
|
(_a = clientWebpackConfig.plugins) === null || _a === void 0 ? void 0 : _a.push(plugin);
|
|
33
33
|
clientWebpackConfig.output.path = tmpDir;
|
|
34
|
-
webpack_1.default(clientWebpackConfig).run(() => { });
|
|
34
|
+
(0, webpack_1.default)(clientWebpackConfig).run(() => { });
|
|
35
35
|
}))();
|
|
@@ -33,15 +33,15 @@ const { readFile, rename, unlink } = fs_1.promises;
|
|
|
33
33
|
* переменные окружения, т.к. `standard-version` запускает хуки через `child_process.exec`, не передавая туда
|
|
34
34
|
* ни аргументы ни переменные окружения.
|
|
35
35
|
*/
|
|
36
|
-
const { appNodeModulesBin, changelogPath, changelogTmpPath, changelogFeaturesPath, changelogBugfixesPath, changelogBreakingChangesPath } = get_defaults_1.getDefaults();
|
|
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* () {
|
|
40
|
-
var e_1,
|
|
40
|
+
var _a, e_1, _b, _c;
|
|
41
41
|
const rl = readline_1.default.createInterface({
|
|
42
|
-
input: fs_1.createReadStream(changelogPath),
|
|
42
|
+
input: (0, fs_1.createReadStream)(changelogPath),
|
|
43
43
|
});
|
|
44
|
-
const ws = fs_1.createWriteStream(changelogTmpPath);
|
|
44
|
+
const ws = (0, fs_1.createWriteStream)(changelogTmpPath);
|
|
45
45
|
let modifyingStatus = 'PENDING';
|
|
46
46
|
const addVersionDescription = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
47
|
const [features, bugFixes, breakingChanges] = yield Promise.all([
|
|
@@ -52,36 +52,43 @@ const changelogHeaderRegExp = /^###? \[\d+\.\d+\.\d+]\([^)]+\) \(\d{4}-\d{2}-\d{
|
|
|
52
52
|
ws.write(getVersionDescription({ features, bugFixes, breakingChanges }));
|
|
53
53
|
});
|
|
54
54
|
try {
|
|
55
|
-
for (var rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// до второго заголовка. См. описание задачи http://jira.moscow.alfaintra.net/browse/NEWCLICKUI-1048
|
|
67
|
-
case 'MODIFYING':
|
|
68
|
-
if (changelogHeaderRegExp.test(line)) {
|
|
69
|
-
modifyingStatus = 'MODIFIED';
|
|
70
|
-
yield addVersionDescription();
|
|
55
|
+
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(), _a = rl_1_1.done, !_a;) {
|
|
56
|
+
_c = rl_1_1.value;
|
|
57
|
+
_d = false;
|
|
58
|
+
try {
|
|
59
|
+
const line = _c;
|
|
60
|
+
switch (modifyingStatus) {
|
|
61
|
+
// Копируем всё как есть до первого заголовка.
|
|
62
|
+
case 'PENDING':
|
|
63
|
+
if (changelogHeaderRegExp.test(line)) {
|
|
64
|
+
modifyingStatus = 'MODIFYING';
|
|
65
|
+
}
|
|
71
66
|
ws.write(`${line}\n`);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
break;
|
|
68
|
+
// Игнорируем описание версии, сгенерированное пакетом `standard-version`, пишем своё
|
|
69
|
+
// до второго заголовка. См. описание задачи http://jira.moscow.alfaintra.net/browse/NEWCLICKUI-1048
|
|
70
|
+
case 'MODIFYING':
|
|
71
|
+
if (changelogHeaderRegExp.test(line)) {
|
|
72
|
+
modifyingStatus = 'MODIFIED';
|
|
73
|
+
yield addVersionDescription();
|
|
74
|
+
ws.write(`${line}\n`);
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
// Дальше просто копируем всё как есть.
|
|
78
|
+
case 'MODIFIED':
|
|
79
|
+
ws.write(`${line}\n`);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
_d = true;
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
82
89
|
finally {
|
|
83
90
|
try {
|
|
84
|
-
if (
|
|
91
|
+
if (!_d && !_a && (_b = rl_1.return)) yield _b.call(rl_1);
|
|
85
92
|
}
|
|
86
93
|
finally { if (e_1) throw e_1.error; }
|
|
87
94
|
}
|
|
@@ -91,7 +98,7 @@ const changelogHeaderRegExp = /^###? \[\d+\.\d+\.\d+]\([^)]+\) \(\d{4}-\d{2}-\d{
|
|
|
91
98
|
ws.close();
|
|
92
99
|
yield unlink(changelogPath);
|
|
93
100
|
yield rename(changelogTmpPath, changelogPath);
|
|
94
|
-
child_process_1.execSync(`${appNodeModulesBin}/prettier -w "${changelogPath}"`);
|
|
101
|
+
(0, child_process_1.execSync)(`${appNodeModulesBin}/prettier -w "${changelogPath}"`);
|
|
95
102
|
process.exit(0);
|
|
96
103
|
}))();
|
|
97
104
|
function getVersionDescription({ features, bugFixes, breakingChanges }) {
|
|
@@ -21,12 +21,12 @@ const exec_1 = __importDefault(require("../util/exec"));
|
|
|
21
21
|
const docker_build_1 = require("../util/docker-build");
|
|
22
22
|
const yarn_1 = require("../util/yarn");
|
|
23
23
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
const { imageFullName, pathToTempDir, tempDirName } = docker_build_1.getBuildParamsFromArgs();
|
|
24
|
+
const { imageFullName, pathToTempDir, tempDirName } = (0, docker_build_1.getBuildParamsFromArgs)();
|
|
25
25
|
try {
|
|
26
26
|
console.log(`Build docker image ${imageFullName}`);
|
|
27
27
|
console.time('Total time');
|
|
28
28
|
console.time('Setting up time');
|
|
29
|
-
yield docker_build_1.prepareFilesForDocker({
|
|
29
|
+
yield (0, docker_build_1.prepareFilesForDocker)({
|
|
30
30
|
pathToTempDir,
|
|
31
31
|
dockerfileTemplate: dockerfile_template_1.default,
|
|
32
32
|
nginxConfTemplate: nginx_conf_template_1.default,
|
|
@@ -37,16 +37,16 @@ const yarn_1 = require("../util/yarn");
|
|
|
37
37
|
console.timeEnd('Setting up time');
|
|
38
38
|
console.time('Build application time');
|
|
39
39
|
// run build script
|
|
40
|
-
yield exec_1.default('npm run build');
|
|
40
|
+
yield (0, exec_1.default)('npm run build');
|
|
41
41
|
console.timeEnd('Build application time');
|
|
42
42
|
if (app_configs_1.default.removeDevDependenciesDuringDockerBuild) {
|
|
43
43
|
console.time('Remove dev dependencies time');
|
|
44
|
-
const pruneCommand = yarn_1.getPruningCommand();
|
|
45
|
-
yield exec_1.default(pruneCommand);
|
|
44
|
+
const pruneCommand = (0, yarn_1.getPruningCommand)();
|
|
45
|
+
yield (0, exec_1.default)(pruneCommand);
|
|
46
46
|
console.timeEnd('Remove dev dependencies time');
|
|
47
47
|
}
|
|
48
48
|
console.time('Build docker image time');
|
|
49
|
-
yield exec_1.default(`docker build -f "./${tempDirName}/Dockerfile" \\
|
|
49
|
+
yield (0, exec_1.default)(`docker build -f "./${tempDirName}/Dockerfile" \\
|
|
50
50
|
--build-arg START_SH_LOCATION="./${tempDirName}/start.sh" \\
|
|
51
51
|
--build-arg NGINX_CONF_LOCATION="./${tempDirName}/nginx.conf" -t ${imageFullName} .`);
|
|
52
52
|
console.timeEnd('Build docker image time');
|
|
@@ -55,7 +55,7 @@ const yarn_1 = require("../util/yarn");
|
|
|
55
55
|
yield fs_extra_1.default.remove(pathToTempDir);
|
|
56
56
|
// guard against pushing the image during tests
|
|
57
57
|
if (!app_configs_1.default.debug) {
|
|
58
|
-
yield exec_1.default(`docker push ${imageFullName}`);
|
|
58
|
+
yield (0, exec_1.default)(`docker push ${imageFullName}`);
|
|
59
59
|
}
|
|
60
60
|
console.timeEnd('Cleanup time');
|
|
61
61
|
console.timeEnd('Total time');
|
|
@@ -20,25 +20,25 @@ const start_template_1 = __importDefault(require("../../templates/start.template
|
|
|
20
20
|
const exec_1 = __importDefault(require("../util/exec"));
|
|
21
21
|
const docker_build_1 = require("../util/docker-build");
|
|
22
22
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
-
const { imageFullName, pathToTempDir, tempDirName } = docker_build_1.getBuildParamsFromArgs();
|
|
23
|
+
const { imageFullName, pathToTempDir, tempDirName } = (0, docker_build_1.getBuildParamsFromArgs)();
|
|
24
24
|
try {
|
|
25
25
|
console.log(`Build docker image ${imageFullName}`);
|
|
26
26
|
console.time('Total time');
|
|
27
|
-
yield docker_build_1.prepareFilesForDocker({
|
|
27
|
+
yield (0, docker_build_1.prepareFilesForDocker)({
|
|
28
28
|
pathToTempDir,
|
|
29
29
|
dockerfileTemplate: dockerfile_compiled_template_1.default,
|
|
30
30
|
nginxConfTemplate: nginx_conf_template_1.default,
|
|
31
31
|
startScript: start_template_1.default,
|
|
32
32
|
allowLocalDockerfile: false,
|
|
33
33
|
});
|
|
34
|
-
yield exec_1.default('echo "node_modules" >> .dockerignore');
|
|
35
|
-
yield exec_1.default(`docker build -f "./${tempDirName}/Dockerfile" \\
|
|
34
|
+
yield (0, exec_1.default)('echo "node_modules" >> .dockerignore');
|
|
35
|
+
yield (0, exec_1.default)(`docker build -f "./${tempDirName}/Dockerfile" \\
|
|
36
36
|
--build-arg START_SH_LOCATION="./${tempDirName}/start.sh" \\
|
|
37
37
|
--build-arg NGINX_CONF_LOCATION="./${tempDirName}/nginx.conf" -t ${imageFullName} .`);
|
|
38
38
|
yield fs_extra_1.default.remove(pathToTempDir);
|
|
39
39
|
// guard against pushing the image during tests
|
|
40
40
|
if (!app_configs_1.default.debug) {
|
|
41
|
-
yield exec_1.default(`docker push ${imageFullName}`);
|
|
41
|
+
yield (0, exec_1.default)(`docker push ${imageFullName}`);
|
|
42
42
|
}
|
|
43
43
|
console.timeEnd('Total time');
|
|
44
44
|
}
|
|
@@ -9,16 +9,16 @@ const WebpackDevServerUtils_1 = require("react-dev-utils/WebpackDevServerUtils")
|
|
|
9
9
|
const print_compiler_output_1 = __importDefault(require("./print-compiler-output"));
|
|
10
10
|
const webpack_client_dev_1 = __importDefault(require("../../configs/webpack.client.dev"));
|
|
11
11
|
const dev_server_1 = __importDefault(require("../../configs/dev-server"));
|
|
12
|
-
const clientCompiler = webpack_1.default(webpack_client_dev_1.default);
|
|
12
|
+
const clientCompiler = (0, webpack_1.default)(webpack_client_dev_1.default);
|
|
13
13
|
// не резолвиться constructor(config: WebpackDevServer.Configuration, webpack?: webpack.Compiler | webpack.MultiCompiler);
|
|
14
14
|
// clientCompiler: webpack.Compiler
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
const clientDevServer = new webpack_dev_server_1.default(dev_server_1.default, clientCompiler);
|
|
17
17
|
clientCompiler.hooks.invalid.tap('client', () => console.log('Compiling client...'));
|
|
18
|
-
clientCompiler.hooks.done.tap('client', (stats) => print_compiler_output_1.default('Client', stats));
|
|
18
|
+
clientCompiler.hooks.done.tap('client', (stats) => (0, print_compiler_output_1.default)('Client', stats));
|
|
19
19
|
const DEFAULT_PORT = dev_server_1.default.port;
|
|
20
20
|
const HOST = '0.0.0.0';
|
|
21
|
-
WebpackDevServerUtils_1.choosePort(HOST, +(DEFAULT_PORT || 0))
|
|
21
|
+
(0, WebpackDevServerUtils_1.choosePort)(HOST, +(DEFAULT_PORT || 0))
|
|
22
22
|
.then((port) => {
|
|
23
23
|
if (!port) {
|
|
24
24
|
// We have not found a port.
|
|
@@ -9,14 +9,14 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const check_required_files_1 = __importDefault(require("../util/check-required-files"));
|
|
10
10
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
11
11
|
process.env.BROWSERSLIST_CONFIG = process.env.BROWSERSLIST_CONFIG || require.resolve('../../../.browserslistrc');
|
|
12
|
-
if (!check_required_files_1.default()) {
|
|
12
|
+
if (!(0, check_required_files_1.default)()) {
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
15
15
|
if (fs_extra_1.default.pathExistsSync(app_configs_1.default.serverOutputPath)) {
|
|
16
16
|
fs_extra_1.default.removeSync(app_configs_1.default.serverOutputPath);
|
|
17
17
|
}
|
|
18
|
-
const compileServer = child_process_1.spawn('node', [path_1.default.join(__dirname, './server')], { stdio: 'inherit' });
|
|
19
|
-
const compileClient = child_process_1.spawn('node', [path_1.default.join(__dirname, './client')], { stdio: 'inherit' });
|
|
18
|
+
const compileServer = (0, child_process_1.spawn)('node', [path_1.default.join(__dirname, './server')], { stdio: 'inherit' });
|
|
19
|
+
const compileClient = (0, child_process_1.spawn)('node', [path_1.default.join(__dirname, './client')], { stdio: 'inherit' });
|
|
20
20
|
const onProcessExit = (code) => {
|
|
21
21
|
if (code !== 0) {
|
|
22
22
|
compileServer.kill();
|
|
@@ -7,10 +7,10 @@ const webpack_1 = __importDefault(require("webpack"));
|
|
|
7
7
|
const print_compiler_output_1 = __importDefault(require("./print-compiler-output"));
|
|
8
8
|
const webpack_server_dev_1 = __importDefault(require("../../configs/webpack.server.dev"));
|
|
9
9
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
10
|
-
const serverCompiler = webpack_1.default(webpack_server_dev_1.default);
|
|
10
|
+
const serverCompiler = (0, webpack_1.default)(webpack_server_dev_1.default);
|
|
11
11
|
serverCompiler.hooks.compile.tap('server', () => console.log('Compiling server...'));
|
|
12
12
|
serverCompiler.hooks.invalid.tap('server', () => console.log('Compiling server...'));
|
|
13
|
-
serverCompiler.hooks.done.tap('server', (stats) => print_compiler_output_1.default('Server', stats));
|
|
13
|
+
serverCompiler.hooks.done.tap('server', (stats) => (0, print_compiler_output_1.default)('Server', stats));
|
|
14
14
|
serverCompiler.watch({
|
|
15
15
|
aggregateTimeout: 50,
|
|
16
16
|
ignored: new RegExp(app_configs_1.default.watchIgnorePath.join('|')),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Stats } from 'webpack';
|
|
2
|
-
|
|
2
|
+
type AssetSize = {
|
|
3
3
|
name: string;
|
|
4
4
|
fullName: string;
|
|
5
5
|
gzipSize: number;
|
|
@@ -9,7 +9,7 @@ declare type AssetSize = {
|
|
|
9
9
|
gzipLabel: string;
|
|
10
10
|
brotliLabel: string;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type TotalSizes = {
|
|
13
13
|
size: number;
|
|
14
14
|
sizeLabel: string;
|
|
15
15
|
gzipSize: number;
|
|
@@ -17,7 +17,7 @@ declare type TotalSizes = {
|
|
|
17
17
|
brotliSize: number;
|
|
18
18
|
brotliLabel: string;
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
type ClientAssetsSizes = {
|
|
21
21
|
totalSizes: TotalSizes;
|
|
22
22
|
assets: AssetSize[];
|
|
23
23
|
};
|
|
@@ -34,7 +34,7 @@ function calculateAssetsSizes(webpackStats, rootDir = '') {
|
|
|
34
34
|
.filter((asset) => canReadAsset(asset.name))
|
|
35
35
|
.map((asset) => {
|
|
36
36
|
const fileContents = fs_1.default.readFileSync(path_1.default.join(rootDir, asset.name));
|
|
37
|
-
const size = gzip_size_1.sync(fileContents);
|
|
37
|
+
const size = (0, gzip_size_1.sync)(fileContents);
|
|
38
38
|
const brSize = brotliSize(fileContents);
|
|
39
39
|
const filename = path_1.default.basename(asset.name);
|
|
40
40
|
return {
|
|
@@ -43,9 +43,9 @@ function calculateAssetsSizes(webpackStats, rootDir = '') {
|
|
|
43
43
|
gzipSize: size,
|
|
44
44
|
brotliSize: brSize,
|
|
45
45
|
size: asset.size,
|
|
46
|
-
sizeLabel: filesize_1.default(asset.size),
|
|
47
|
-
gzipLabel: filesize_1.default(size),
|
|
48
|
-
brotliLabel: brSize ? filesize_1.default(brSize) : '-'
|
|
46
|
+
sizeLabel: (0, filesize_1.default)(asset.size),
|
|
47
|
+
gzipLabel: (0, filesize_1.default)(size),
|
|
48
|
+
brotliLabel: brSize ? (0, filesize_1.default)(brSize) : '-'
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
const totalSizes = (assets || []).reduce((file, total) => {
|
|
@@ -55,9 +55,9 @@ function calculateAssetsSizes(webpackStats, rootDir = '') {
|
|
|
55
55
|
brotliSize: total.brotliSize + file.brotliSize
|
|
56
56
|
};
|
|
57
57
|
}, { size: 0, gzipSize: 0, brotliSize: 0 });
|
|
58
|
-
totalSizes.sizeLabel = filesize_1.default(totalSizes.size || 0);
|
|
59
|
-
totalSizes.gzipLabel = filesize_1.default(totalSizes.gzipSize || 0);
|
|
60
|
-
totalSizes.brotliLabel = totalSizes.brotliSize ? filesize_1.default(totalSizes.brotliSize) : '-';
|
|
58
|
+
totalSizes.sizeLabel = (0, filesize_1.default)(totalSizes.size || 0);
|
|
59
|
+
totalSizes.gzipLabel = (0, filesize_1.default)(totalSizes.gzipSize || 0);
|
|
60
|
+
totalSizes.brotliLabel = totalSizes.brotliSize ? (0, filesize_1.default)(totalSizes.brotliSize) : '-';
|
|
61
61
|
return {
|
|
62
62
|
totalSizes: totalSizes,
|
|
63
63
|
assets
|
|
@@ -66,13 +66,13 @@ function calculateAssetsSizes(webpackStats, rootDir = '') {
|
|
|
66
66
|
exports.calculateAssetsSizes = calculateAssetsSizes;
|
|
67
67
|
function printAssetsSizes(sizes) {
|
|
68
68
|
const longestSizeLabelLength = Math.max.apply(null, sizes.assets.map(a => {
|
|
69
|
-
const sizeLength = strip_ansi_1.default(a.gzipLabel).length;
|
|
69
|
+
const sizeLength = (0, strip_ansi_1.default)(a.gzipLabel).length;
|
|
70
70
|
return sizeLength + sizeLength + 8;
|
|
71
71
|
}));
|
|
72
72
|
console.log(chalk_1.default.blueBright('Assets sizes:'));
|
|
73
73
|
sizes.assets.forEach(asset => {
|
|
74
74
|
let sizeLabel = `${asset.sizeLabel} (${asset.gzipLabel} gzip, ${asset.brotliLabel} br)`;
|
|
75
|
-
const sizeLength = strip_ansi_1.default(sizeLabel).length;
|
|
75
|
+
const sizeLength = (0, strip_ansi_1.default)(sizeLabel).length;
|
|
76
76
|
if (sizeLength < longestSizeLabelLength) {
|
|
77
77
|
const rightPadding = ' '.repeat(longestSizeLabelLength - sizeLength);
|
|
78
78
|
sizeLabel += rightPadding;
|
|
@@ -3,7 +3,7 @@ export declare function getBuildParamsFromArgs(): {
|
|
|
3
3
|
imageFullName: string;
|
|
4
4
|
tempDirName: string;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type PrepareFilesForDockerParams = {
|
|
7
7
|
dockerfileTemplate: string;
|
|
8
8
|
nginxConfTemplate: string;
|
|
9
9
|
startScript: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type YarnVersion = '1' | '2+' | 'unavailable';
|
|
2
2
|
export declare function getYarnVersion(): YarnVersion;
|
|
3
3
|
export declare function getPruningCommand(): string;
|
|
4
4
|
export declare function getInstallProductionCommand(): string;
|
|
@@ -3,6 +3,6 @@ import { AppConfigs } from './types';
|
|
|
3
3
|
* Эти ключи из конфига будут обновляться из package.json при их наличии
|
|
4
4
|
*/
|
|
5
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
|
-
|
|
7
|
-
export
|
|
6
|
+
type ArrayElementType<ArrayType extends ReadonlyArray<unknown>> = ArrayType[number];
|
|
7
|
+
export type PackageSettings = Partial<Pick<AppConfigs, ArrayElementType<typeof availablePackageSettings>>>;
|
|
8
8
|
export {};
|
|
@@ -20,17 +20,17 @@ function calculateDependentConfig(config) {
|
|
|
20
20
|
// Поэтому мы читаем версию того babel/runtime, который установлен в проекте.
|
|
21
21
|
// Так же мы не можем использовать require для получения контента из babel/runtime/package.json,
|
|
22
22
|
// потому что webpack.cache будет ругаться на то, что мы пытаемся импортировать файлы НЕ из своего node_modules.
|
|
23
|
-
const pathToProjectBabelRuntime = resolve_1.resolveNodeModuleRelativeTo(config.cwd, '@babel/runtime/package.json');
|
|
23
|
+
const pathToProjectBabelRuntime = (0, resolve_1.resolveNodeModuleRelativeTo)(config.cwd, '@babel/runtime/package.json');
|
|
24
24
|
babelRuntimeVersion = JSON.parse(fs_1.default.readFileSync(pathToProjectBabelRuntime, 'utf8')).version;
|
|
25
25
|
}
|
|
26
26
|
catch (e) {
|
|
27
27
|
babelRuntimeVersion = require('@babel/runtime/package.json').version;
|
|
28
28
|
}
|
|
29
|
-
return lodash_merge_1.default(config, {
|
|
29
|
+
return (0, lodash_merge_1.default)(config, {
|
|
30
30
|
publicPath: `${config.assetsPath}/`,
|
|
31
31
|
serverOutputPath: path_1.default.resolve(config.cwd, config.buildPath),
|
|
32
32
|
clientOutputPath: path_1.default.resolve(config.cwd, config.buildPath, config.assetsPath),
|
|
33
|
-
clientPolyfillsEntry: get_polyfills_1.getPolyfills(config),
|
|
33
|
+
clientPolyfillsEntry: (0, get_polyfills_1.getPolyfills)(config),
|
|
34
34
|
statsOutputPath: path_1.default.resolve(config.cwd, config.buildPath, config.statsOutputFilename),
|
|
35
35
|
watchIgnorePath: ['node_modules', config.buildPath],
|
|
36
36
|
babelRuntimeVersion,
|
|
@@ -18,7 +18,7 @@ function getDefaults() {
|
|
|
18
18
|
const absoluteNodeModulesBinPath = path_1.default.resolve(absoluteNodeModulesPath, '.bin');
|
|
19
19
|
const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
|
|
20
20
|
const yarnLockFilePath = path_1.default.join(CWD, 'yarn.lock');
|
|
21
|
-
const overridesPath = resolve_1.tryResolve(path_1.default.join(CWD, 'arui-scripts.overrides'));
|
|
21
|
+
const overridesPath = (0, resolve_1.tryResolve)(path_1.default.join(CWD, 'arui-scripts.overrides'));
|
|
22
22
|
const nginxConfFilePath = path_1.default.join(CWD, 'nginx.conf');
|
|
23
23
|
const dockerfileFilePath = path_1.default.join(CWD, 'Dockerfile');
|
|
24
24
|
return {
|
|
@@ -7,10 +7,10 @@ const update_with_package_1 = require("./update-with-package");
|
|
|
7
7
|
const update_with_presets_1 = require("./update-with-presets");
|
|
8
8
|
const calculate_dependent_config_1 = require("./calculate-dependent-config");
|
|
9
9
|
const update_with_config_file_1 = require("./update-with-config-file");
|
|
10
|
-
let config = get_defaults_1.getDefaults();
|
|
11
|
-
config = update_with_presets_1.updateWithPresets(config);
|
|
12
|
-
config = update_with_package_1.updateWithPackage(config);
|
|
13
|
-
config = update_with_config_file_1.updateWithConfigFile(config);
|
|
14
|
-
config = update_with_env_1.updateWithEnv(config);
|
|
15
|
-
config = calculate_dependent_config_1.calculateDependentConfig(config);
|
|
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
16
|
exports.default = config;
|
|
@@ -10,15 +10,15 @@ const resolve_1 = require("../util/resolve");
|
|
|
10
10
|
const validate_settings_keys_1 = __importDefault(require("./validate-settings-keys"));
|
|
11
11
|
const available_package_settings_1 = require("./available-package-settings");
|
|
12
12
|
function updateWithConfigFile(config) {
|
|
13
|
-
const appConfigPath = resolve_1.tryResolve(path_1.default.join(config.cwd, '/arui-scripts.config'));
|
|
13
|
+
const appConfigPath = (0, resolve_1.tryResolve)(path_1.default.join(config.cwd, '/arui-scripts.config'));
|
|
14
14
|
if (appConfigPath) {
|
|
15
15
|
let appSettings = require(appConfigPath);
|
|
16
16
|
if (appSettings.__esModule) {
|
|
17
17
|
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
18
18
|
appSettings = appSettings.default;
|
|
19
19
|
}
|
|
20
|
-
validate_settings_keys_1.default(available_package_settings_1.availablePackageSettings, appSettings);
|
|
21
|
-
config = lodash_merge_1.default(config, appSettings);
|
|
20
|
+
(0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, appSettings);
|
|
21
|
+
config = (0, lodash_merge_1.default)(config, appSettings);
|
|
22
22
|
}
|
|
23
23
|
return config;
|
|
24
24
|
}
|
|
@@ -14,8 +14,8 @@ function updateWithEnv(config) {
|
|
|
14
14
|
try {
|
|
15
15
|
console.warn('Используйте ARUI_SCRIPTS_CONFIG только для отладки');
|
|
16
16
|
const envSettings = JSON.parse(process.env.ARUI_SCRIPTS_CONFIG);
|
|
17
|
-
validate_settings_keys_1.default(available_package_settings_1.availablePackageSettings, envSettings);
|
|
18
|
-
return lodash_merge_1.default(config, envSettings);
|
|
17
|
+
(0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, envSettings);
|
|
18
|
+
return (0, lodash_merge_1.default)(config, envSettings);
|
|
19
19
|
}
|
|
20
20
|
catch (e) {
|
|
21
21
|
console.error(e);
|
|
@@ -9,7 +9,7 @@ const validate_settings_keys_1 = __importDefault(require("./validate-settings-ke
|
|
|
9
9
|
const available_package_settings_1 = require("./available-package-settings");
|
|
10
10
|
function updateWithPackage(config) {
|
|
11
11
|
const packageSettings = config.appPackage.aruiScripts || {};
|
|
12
|
-
validate_settings_keys_1.default(available_package_settings_1.availablePackageSettings, packageSettings);
|
|
13
|
-
return lodash_merge_1.default(config, packageSettings);
|
|
12
|
+
(0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, packageSettings);
|
|
13
|
+
return (0, lodash_merge_1.default)(config, packageSettings);
|
|
14
14
|
}
|
|
15
15
|
exports.updateWithPackage = updateWithPackage;
|
|
@@ -13,16 +13,16 @@ function updateWithPresets(config) {
|
|
|
13
13
|
if (!packageSettings.presets) {
|
|
14
14
|
return config;
|
|
15
15
|
}
|
|
16
|
-
const presetsConfigPath = resolve_1.tryResolve(`${packageSettings.presets}/arui-scripts.config`, { paths: [config.cwd] });
|
|
17
|
-
const presetsOverridesPath = resolve_1.tryResolve(`${packageSettings.presets}/arui-scripts.overrides`, { paths: [config.cwd] });
|
|
16
|
+
const presetsConfigPath = (0, resolve_1.tryResolve)(`${packageSettings.presets}/arui-scripts.config`, { paths: [config.cwd] });
|
|
17
|
+
const presetsOverridesPath = (0, resolve_1.tryResolve)(`${packageSettings.presets}/arui-scripts.overrides`, { paths: [config.cwd] });
|
|
18
18
|
if (presetsConfigPath) {
|
|
19
19
|
let presetsSettings = require(presetsConfigPath);
|
|
20
20
|
if (presetsSettings.__esModule) {
|
|
21
21
|
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
22
22
|
presetsSettings = presetsSettings.default;
|
|
23
23
|
}
|
|
24
|
-
validate_settings_keys_1.default(available_package_settings_1.availablePackageSettings, presetsSettings);
|
|
25
|
-
config = lodash_merge_1.default(config, presetsSettings);
|
|
24
|
+
(0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, presetsSettings);
|
|
25
|
+
config = (0, lodash_merge_1.default)(config, presetsSettings);
|
|
26
26
|
}
|
|
27
27
|
if (presetsOverridesPath) {
|
|
28
28
|
config.overridesPath.unshift(presetsOverridesPath);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const supporting_browsers_1 = __importDefault(require("./supporting-browsers"));
|
|
7
7
|
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
8
8
|
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
9
|
-
const babelClientConfig = apply_overrides_1.default(['babel', 'babelClient'], {
|
|
9
|
+
const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'], {
|
|
10
10
|
presets: [
|
|
11
11
|
[
|
|
12
12
|
require.resolve('@babel/preset-env'),
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.babelDependencies = void 0;
|
|
7
7
|
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
8
8
|
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
9
|
-
exports.babelDependencies = apply_overrides_1.default('babelDependencies', {
|
|
9
|
+
exports.babelDependencies = (0, apply_overrides_1.default)('babelDependencies', {
|
|
10
10
|
sourceType: 'unambiguous',
|
|
11
11
|
presets: [
|
|
12
12
|
[
|