arui-scripts 0.0.0-next-20230725145300
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/.turbo/turbo-build.log +0 -0
- package/.turbo/turbo-test.log +91 -0
- package/CHANGELOG.md +1032 -0
- package/README.md +716 -0
- package/bin/build.sh +2 -0
- package/build/bin/index.d.ts +3 -0
- package/build/bin/index.js +21 -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 +41 -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 +10 -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 +36 -0
- package/build/commands/changelog/index.d.ts +5 -0
- package/build/commands/changelog/index.js +116 -0
- package/build/commands/docker-build/index.d.ts +1 -0
- package/build/commands/docker-build/index.js +70 -0
- package/build/commands/docker-build-compiled/index.d.ts +1 -0
- package/build/commands/docker-build-compiled/index.js +52 -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 +8 -0
- package/build/commands/start/print-compiler-output.d.ts +1 -0
- package/build/commands/start/print-compiler-output.js +15 -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 +8 -0
- package/build/commands/start-prod/server.d.ts +1 -0
- package/build/commands/start-prod/server.js +8 -0
- package/build/commands/test/index.d.ts +3 -0
- package/build/commands/test/index.js +17 -0
- package/build/commands/util/check-required-files.d.ts +2 -0
- package/build/commands/util/check-required-files.js +67 -0
- package/build/commands/util/client-assets-sizes.d.ts +26 -0
- package/build/commands/util/client-assets-sizes.js +88 -0
- package/build/commands/util/docker-build.d.ts +21 -0
- package/build/commands/util/docker-build.js +89 -0
- package/build/commands/util/exec.d.ts +2 -0
- package/build/commands/util/exec.js +18 -0
- package/build/commands/util/format-webpack-messages.d.ts +11 -0
- package/build/commands/util/format-webpack-messages.js +93 -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 +47 -0
- package/build/commands/util/run-compilers.d.ts +1 -0
- package/build/commands/util/run-compilers.js +31 -0
- package/build/commands/util/run-server-watch-compiler.d.ts +2 -0
- package/build/commands/util/run-server-watch-compiler.js +21 -0
- package/build/commands/util/yarn.d.ts +5 -0
- package/build/commands/util/yarn.js +53 -0
- package/build/configs/app-configs/calculate-dependent-config.d.ts +76 -0
- package/build/configs/app-configs/calculate-dependent-config.js +37 -0
- package/build/configs/app-configs/get-defaults.d.ts +3 -0
- package/build/configs/app-configs/get-defaults.js +127 -0
- package/build/configs/app-configs/index.d.ts +6 -0
- package/build/configs/app-configs/index.js +22 -0
- package/build/configs/app-configs/types.d.ts +108 -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 +23 -0
- package/build/configs/app-configs/update-with-env.d.ts +2 -0
- package/build/configs/app-configs/update-with-env.js +20 -0
- package/build/configs/app-configs/update-with-package.d.ts +2 -0
- package/build/configs/app-configs/update-with-package.js +10 -0
- package/build/configs/app-configs/update-with-presets.d.ts +2 -0
- package/build/configs/app-configs/update-with-presets.js +26 -0
- package/build/configs/app-configs/validate-settings-keys.d.ts +4 -0
- package/build/configs/app-configs/validate-settings-keys.js +14 -0
- package/build/configs/babel-client.d.ts +34 -0
- package/build/configs/babel-client.js +65 -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 +47 -0
- package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +2 -0
- package/build/configs/config-extras/minimizers/imagemin/imagemin.js +42 -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 +48 -0
- package/build/configs/jest/babel-transform.d.ts +2 -0
- package/build/configs/jest/babel-transform.js +4 -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 +9 -0
- package/build/configs/jest/index.d.ts +50 -0
- package/build/configs/jest/index.js +47 -0
- package/build/configs/modules.d.ts +16 -0
- package/build/configs/modules.js +101 -0
- package/build/configs/mq.css +22 -0
- package/build/configs/postcss.config.d.ts +25 -0
- package/build/configs/postcss.config.js +62 -0
- package/build/configs/postcss.d.ts +2 -0
- package/build/configs/postcss.js +9 -0
- package/build/configs/process-assets-plugin-output.d.ts +2 -0
- package/build/configs/process-assets-plugin-output.js +46 -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 +13 -0
- package/build/configs/util/apply-overrides.d.ts +56 -0
- package/build/configs/util/apply-overrides.js +47 -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 +23 -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 +3 -0
- package/build/configs/util/get-polyfills.js +27 -0
- package/build/configs/util/install-sourcemap-support.d.ts +1 -0
- package/build/configs/util/install-sourcemap-support.js +7 -0
- package/build/configs/util/node-assets-ignore.d.ts +0 -0
- package/build/configs/util/node-assets-ignore.js +31 -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 +17 -0
- package/build/configs/util/resolve.d.ts +12 -0
- package/build/configs/util/resolve.js +30 -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 +9 -0
- package/build/configs/webpack.client.js +402 -0
- package/build/configs/webpack.client.prod.d.ts +2 -0
- package/build/configs/webpack.client.prod.js +9 -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 +9 -0
- package/build/configs/webpack.server.js +229 -0
- package/build/configs/webpack.server.prod.d.ts +2 -0
- package/build/configs/webpack.server.prod.js +9 -0
- package/build/index.d.ts +5 -0
- package/build/index.js +9 -0
- package/build/plugins/reload-server-webpack-plugin.d.ts +9 -0
- package/build/plugins/reload-server-webpack-plugin.js +42 -0
- package/build/templates/dockerfile-compiled.template.d.ts +2 -0
- package/build/templates/dockerfile-compiled.template.js +47 -0
- package/build/templates/dockerfile.template.d.ts +2 -0
- package/build/templates/dockerfile.template.js +32 -0
- package/build/templates/nginx.conf.template.d.ts +2 -0
- package/build/templates/nginx.conf.template.js +34 -0
- package/build/templates/start.template.d.ts +2 -0
- package/build/templates/start.template.js +37 -0
- package/build/tsconfig-local.tsbuildinfo +1 -0
- package/docs/modules.md +572 -0
- package/jest-preset.js +22 -0
- package/package.json +172 -0
- package/release.config.js +21 -0
- package/tsconfig-local.json +16 -0
- package/tsconfig.json +71 -0
|
@@ -0,0 +1,53 @@
|
|
|
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.getInstallProductionCommand = exports.getPruningCommand = exports.getYarnVersion = void 0;
|
|
7
|
+
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
8
|
+
const shelljs_1 = __importDefault(require("shelljs"));
|
|
9
|
+
function getYarnVersion() {
|
|
10
|
+
if (app_configs_1.default.useYarn && shelljs_1.default.which('yarn')) {
|
|
11
|
+
const yarnVersion = shelljs_1.default.exec('yarn -v', { silent: true });
|
|
12
|
+
const yarnMajorVersion = Number(yarnVersion.split('.')[0]);
|
|
13
|
+
return yarnMajorVersion > 1 ? '2+' : '1';
|
|
14
|
+
}
|
|
15
|
+
return 'unavailable';
|
|
16
|
+
}
|
|
17
|
+
exports.getYarnVersion = getYarnVersion;
|
|
18
|
+
function getPruningCommand() {
|
|
19
|
+
const yarnVersion = getYarnVersion();
|
|
20
|
+
switch (yarnVersion) {
|
|
21
|
+
case '1': {
|
|
22
|
+
return 'yarn install --production --ignore-optional --frozen-lockfile --ignore-scripts --prefer-offline';
|
|
23
|
+
}
|
|
24
|
+
case '2+': {
|
|
25
|
+
return 'yarn workspaces focus --production --all';
|
|
26
|
+
}
|
|
27
|
+
case 'unavailable': {
|
|
28
|
+
return 'npm prune --production';
|
|
29
|
+
}
|
|
30
|
+
default: {
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.getPruningCommand = getPruningCommand;
|
|
36
|
+
function getInstallProductionCommand() {
|
|
37
|
+
const yarnVersion = getYarnVersion();
|
|
38
|
+
switch (yarnVersion) {
|
|
39
|
+
case '1': {
|
|
40
|
+
return 'yarn install --production --ignore-optional --frozen-lockfile --ignore-scripts --prefer-offline';
|
|
41
|
+
}
|
|
42
|
+
case '2+': {
|
|
43
|
+
return 'yarn workspaces focus --production --all';
|
|
44
|
+
}
|
|
45
|
+
case 'unavailable': {
|
|
46
|
+
return 'npm install --production';
|
|
47
|
+
}
|
|
48
|
+
default: {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.getInstallProductionCommand = getInstallProductionCommand;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { AppConfigs, AppContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
4
|
+
*/
|
|
5
|
+
export declare function calculateDependentConfig(config: AppConfigs): {
|
|
6
|
+
clientPolyfillsEntry: string[];
|
|
7
|
+
clientServerPort: number;
|
|
8
|
+
serverPort: number;
|
|
9
|
+
debug: boolean;
|
|
10
|
+
devSourceMaps: string;
|
|
11
|
+
devServerCors: boolean;
|
|
12
|
+
useServerHMR: boolean;
|
|
13
|
+
presets: string | null;
|
|
14
|
+
buildPath: string;
|
|
15
|
+
assetsPath: string;
|
|
16
|
+
additionalBuildPath: string[];
|
|
17
|
+
statsOutputFilename: string;
|
|
18
|
+
serverEntry: string | string[] | Record<string, string | string[]>;
|
|
19
|
+
serverOutput: string;
|
|
20
|
+
clientEntry: string | string[] | Record<string, string | string[]>;
|
|
21
|
+
dockerRegistry: string;
|
|
22
|
+
baseDockerImage: string;
|
|
23
|
+
nginxRootPath: string;
|
|
24
|
+
runFromNonRootUser: boolean;
|
|
25
|
+
removeDevDependenciesDuringDockerBuild: boolean;
|
|
26
|
+
archiveName: string;
|
|
27
|
+
keepPropTypes: boolean;
|
|
28
|
+
useTscLoader: boolean;
|
|
29
|
+
webpack4Compatibility: boolean;
|
|
30
|
+
installServerSourceMaps: boolean;
|
|
31
|
+
dataUrlMaxSize?: number | undefined;
|
|
32
|
+
imageMinimizer?: {
|
|
33
|
+
svg?: {
|
|
34
|
+
enabled?: boolean | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
gif?: {
|
|
37
|
+
enabled?: boolean | undefined;
|
|
38
|
+
optimizationLevel?: number | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
jpg?: {
|
|
41
|
+
enabled?: boolean | undefined;
|
|
42
|
+
quality: number;
|
|
43
|
+
} | undefined;
|
|
44
|
+
png?: {
|
|
45
|
+
enabled?: boolean | undefined;
|
|
46
|
+
optimizationLevel?: number | undefined;
|
|
47
|
+
bitDepthReduction?: boolean | undefined;
|
|
48
|
+
colorTypeReduction?: boolean | undefined;
|
|
49
|
+
paletteReduction?: boolean | undefined;
|
|
50
|
+
interlaced?: boolean | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
componentsTheme: string | null;
|
|
54
|
+
keepCssVars: boolean;
|
|
55
|
+
embeddedModules: {
|
|
56
|
+
shared?: {
|
|
57
|
+
[libraryName: string]: string;
|
|
58
|
+
} | undefined;
|
|
59
|
+
exposes?: {
|
|
60
|
+
[moduleId: string]: {
|
|
61
|
+
entry: string;
|
|
62
|
+
embeddedConfig?: Record<string, string> | undefined;
|
|
63
|
+
cssPrefix?: string | false | undefined;
|
|
64
|
+
};
|
|
65
|
+
} | undefined;
|
|
66
|
+
} | null;
|
|
67
|
+
mfModules: {
|
|
68
|
+
name?: string | undefined;
|
|
69
|
+
shared: any;
|
|
70
|
+
exposes?: Record<string, string> | undefined;
|
|
71
|
+
} | null;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Обновление контекста в зависимости от ключей конфига
|
|
75
|
+
*/
|
|
76
|
+
export declare function calculateDependentContext(config: AppConfigs, context: AppContext): AppContext;
|
|
@@ -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.calculateDependentContext = exports.calculateDependentConfig = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const get_polyfills_1 = require("../util/get-polyfills");
|
|
10
|
+
const resolve_1 = require("../util/resolve");
|
|
11
|
+
/**
|
|
12
|
+
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
13
|
+
*/
|
|
14
|
+
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
|
+
let babelRuntimeVersion;
|
|
23
|
+
try {
|
|
24
|
+
// В проекте может стоять babel/runtime отличный от того, что установлен как зависимость arui-scripts.
|
|
25
|
+
// При этом webpack будет резолвить babel/runtime относительно проекта, а не относительно arui-scripts.
|
|
26
|
+
// Поэтому мы читаем версию того babel/runtime, который установлен в проекте.
|
|
27
|
+
// Так же мы не можем использовать require для получения контента из babel/runtime/package.json,
|
|
28
|
+
// потому что webpack.cache будет ругаться на то, что мы пытаемся импортировать файлы НЕ из своего node_modules.
|
|
29
|
+
const pathToProjectBabelRuntime = (0, resolve_1.resolveNodeModuleRelativeTo)(context.cwd, '@babel/runtime/package.json');
|
|
30
|
+
babelRuntimeVersion = JSON.parse(fs_1.default.readFileSync(pathToProjectBabelRuntime, 'utf8')).version;
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
babelRuntimeVersion = require('@babel/runtime/package.json').version;
|
|
34
|
+
}
|
|
35
|
+
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 });
|
|
36
|
+
}
|
|
37
|
+
exports.calculateDependentContext = calculateDependentContext;
|
|
@@ -0,0 +1,127 @@
|
|
|
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.getDefaultAppContext = exports.getDefaultAppConfig = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const resolve_1 = require("../util/resolve");
|
|
10
|
+
const CWD = process.cwd();
|
|
11
|
+
const absoluteSrcPath = path_1.default.resolve(CWD, 'src');
|
|
12
|
+
function getDefaultAppConfig() {
|
|
13
|
+
var _a;
|
|
14
|
+
const appPackage = getPackageJson();
|
|
15
|
+
return {
|
|
16
|
+
/// general settings
|
|
17
|
+
clientServerPort: 8080,
|
|
18
|
+
serverPort: 3000,
|
|
19
|
+
debug: false,
|
|
20
|
+
devSourceMaps: 'eval',
|
|
21
|
+
devServerCors: false,
|
|
22
|
+
useServerHMR: false,
|
|
23
|
+
presets: ((_a = appPackage.aruiScripts) === null || _a === void 0 ? void 0 : _a.presets) || null,
|
|
24
|
+
// paths
|
|
25
|
+
buildPath: '.build',
|
|
26
|
+
assetsPath: 'assets',
|
|
27
|
+
additionalBuildPath: ['config'],
|
|
28
|
+
statsOutputFilename: 'stats.json',
|
|
29
|
+
serverEntry: path_1.default.resolve(absoluteSrcPath, 'server/index'),
|
|
30
|
+
serverOutput: 'server.js',
|
|
31
|
+
clientPolyfillsEntry: null,
|
|
32
|
+
clientEntry: path_1.default.resolve(absoluteSrcPath, 'index'),
|
|
33
|
+
// docker compilation configs
|
|
34
|
+
dockerRegistry: '',
|
|
35
|
+
baseDockerImage: 'alfabankui/arui-scripts:latest',
|
|
36
|
+
nginxRootPath: '/src',
|
|
37
|
+
runFromNonRootUser: true,
|
|
38
|
+
removeDevDependenciesDuringDockerBuild: true,
|
|
39
|
+
// archive compilation configs
|
|
40
|
+
archiveName: 'build.tar',
|
|
41
|
+
// build tuning
|
|
42
|
+
keepPropTypes: false,
|
|
43
|
+
useTscLoader: false,
|
|
44
|
+
webpack4Compatibility: false,
|
|
45
|
+
installServerSourceMaps: false,
|
|
46
|
+
// image processing
|
|
47
|
+
dataUrlMaxSize: 1536,
|
|
48
|
+
imageMinimizer: {
|
|
49
|
+
svg: {
|
|
50
|
+
enabled: true,
|
|
51
|
+
},
|
|
52
|
+
gif: {
|
|
53
|
+
enabled: false,
|
|
54
|
+
optimizationLevel: 1,
|
|
55
|
+
},
|
|
56
|
+
jpg: {
|
|
57
|
+
enabled: false,
|
|
58
|
+
quality: 75,
|
|
59
|
+
},
|
|
60
|
+
png: {
|
|
61
|
+
enabled: false,
|
|
62
|
+
optimizationLevel: 3,
|
|
63
|
+
bitDepthReduction: false,
|
|
64
|
+
colorTypeReduction: false,
|
|
65
|
+
paletteReduction: false,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
// CSS
|
|
69
|
+
componentsTheme: null,
|
|
70
|
+
keepCssVars: false,
|
|
71
|
+
// Modules
|
|
72
|
+
embeddedModules: null,
|
|
73
|
+
mfModules: null,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
exports.getDefaultAppConfig = getDefaultAppConfig;
|
|
77
|
+
function getPackageJson() {
|
|
78
|
+
const appPackage = JSON.parse(fs_1.default.readFileSync(path_1.default.join(CWD, 'package.json'), 'utf8'));
|
|
79
|
+
if (appPackage['arui-scripts']) {
|
|
80
|
+
throw Error('arui-scripts in package.json is not supported. Use aruiScripts instead.');
|
|
81
|
+
}
|
|
82
|
+
return appPackage;
|
|
83
|
+
}
|
|
84
|
+
function getDefaultAppContext() {
|
|
85
|
+
const appPackage = getPackageJson();
|
|
86
|
+
const absoluteNodeModulesPath = path_1.default.resolve(CWD, 'node_modules');
|
|
87
|
+
const absoluteNodeModulesBinPath = path_1.default.resolve(absoluteNodeModulesPath, '.bin');
|
|
88
|
+
const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
|
|
89
|
+
const yarnLockFilePath = path_1.default.join(CWD, 'yarn.lock');
|
|
90
|
+
const overridesPath = (0, resolve_1.tryResolve)(path_1.default.join(CWD, 'arui-scripts.overrides'));
|
|
91
|
+
const nginxConfFilePath = path_1.default.join(CWD, 'nginx.conf');
|
|
92
|
+
const dockerfileFilePath = path_1.default.join(CWD, 'Dockerfile');
|
|
93
|
+
const startScriptFilePath = path_1.default.join(CWD, 'start.sh');
|
|
94
|
+
return {
|
|
95
|
+
appPackage,
|
|
96
|
+
name: appPackage.name,
|
|
97
|
+
normalizedName: appPackage.name.replace(/-/g, '_'),
|
|
98
|
+
version: appPackage.version,
|
|
99
|
+
// general paths
|
|
100
|
+
cwd: CWD,
|
|
101
|
+
appSrc: absoluteSrcPath,
|
|
102
|
+
appNodeModules: absoluteNodeModulesPath,
|
|
103
|
+
appNodeModulesBin: absoluteNodeModulesBinPath,
|
|
104
|
+
overridesPath: overridesPath ? [overridesPath] : [],
|
|
105
|
+
// tools availability
|
|
106
|
+
babelRuntimeVersion: '7.0.0-beta.0',
|
|
107
|
+
useYarn: fs_1.default.existsSync(yarnLockFilePath),
|
|
108
|
+
// compilation configs locations
|
|
109
|
+
tsconfig: fs_1.default.existsSync(projectTsConfigPath) ? projectTsConfigPath : null,
|
|
110
|
+
localNginxConf: fs_1.default.existsSync(nginxConfFilePath) ? nginxConfFilePath : null,
|
|
111
|
+
localDockerfile: fs_1.default.existsSync(dockerfileFilePath) ? dockerfileFilePath : null,
|
|
112
|
+
localStartScript: fs_1.default.existsSync(startScriptFilePath) ? startScriptFilePath : null,
|
|
113
|
+
// Эти пути зависят от других настроек, которые могут быть переопределены пользователем
|
|
114
|
+
publicPath: '',
|
|
115
|
+
serverOutputPath: '',
|
|
116
|
+
clientOutputPath: '',
|
|
117
|
+
statsOutputPath: '',
|
|
118
|
+
watchIgnorePath: [],
|
|
119
|
+
// changelog paths
|
|
120
|
+
changelogPath: path_1.default.resolve(CWD, './CHANGELOG.md'),
|
|
121
|
+
changelogTmpPath: path_1.default.resolve(CWD, './CHANGELOG_TMP.md'),
|
|
122
|
+
changelogFeaturesPath: path_1.default.resolve(CWD, './changelog_features.tmp'),
|
|
123
|
+
changelogBugfixesPath: path_1.default.resolve(CWD, './changelog_bugfixes.tmp'),
|
|
124
|
+
changelogBreakingChangesPath: path_1.default.resolve(CWD, './changelog_breaking_changes.tmp'),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
exports.getDefaultAppContext = getDefaultAppContext;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import '../util/register-ts-node';
|
|
2
|
+
import { AppConfigs, AppContext, AppContextWithConfigs } from './types';
|
|
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,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configs = exports.appConfigs = exports.appContext = void 0;
|
|
4
|
+
require("../util/register-ts-node");
|
|
5
|
+
const get_defaults_1 = require("./get-defaults");
|
|
6
|
+
const update_with_env_1 = require("./update-with-env");
|
|
7
|
+
const update_with_package_1 = require("./update-with-package");
|
|
8
|
+
const update_with_presets_1 = require("./update-with-presets");
|
|
9
|
+
const calculate_dependent_config_1 = require("./calculate-dependent-config");
|
|
10
|
+
const update_with_config_file_1 = require("./update-with-config-file");
|
|
11
|
+
let tmpConfig = (0, get_defaults_1.getDefaultAppConfig)();
|
|
12
|
+
let tmpContext = (0, get_defaults_1.getDefaultAppContext)();
|
|
13
|
+
tmpConfig = (0, update_with_presets_1.updateWithPresets)(tmpConfig, tmpContext);
|
|
14
|
+
tmpConfig = (0, update_with_package_1.updateWithPackage)(tmpConfig, tmpContext);
|
|
15
|
+
tmpConfig = (0, update_with_config_file_1.updateWithConfigFile)(tmpConfig, tmpContext);
|
|
16
|
+
tmpConfig = (0, update_with_env_1.updateWithEnv)(tmpConfig);
|
|
17
|
+
tmpConfig = (0, calculate_dependent_config_1.calculateDependentConfig)(tmpConfig);
|
|
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;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Конфигурация arui-scripts, которая может быть переопределена приложением
|
|
3
|
+
*/
|
|
4
|
+
export type AppConfigs = {
|
|
5
|
+
clientServerPort: number;
|
|
6
|
+
serverPort: number;
|
|
7
|
+
debug: boolean;
|
|
8
|
+
devSourceMaps: string;
|
|
9
|
+
devServerCors: boolean;
|
|
10
|
+
useServerHMR: boolean;
|
|
11
|
+
presets: string | null;
|
|
12
|
+
buildPath: string;
|
|
13
|
+
assetsPath: string;
|
|
14
|
+
additionalBuildPath: string[];
|
|
15
|
+
statsOutputFilename: string;
|
|
16
|
+
serverEntry: string | string[] | Record<string, string | string[]>;
|
|
17
|
+
serverOutput: string;
|
|
18
|
+
clientPolyfillsEntry: null | string | string[];
|
|
19
|
+
clientEntry: string | string[] | Record<string, string | 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
|
+
dataUrlMaxSize?: number;
|
|
31
|
+
imageMinimizer?: {
|
|
32
|
+
svg?: {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
};
|
|
35
|
+
gif?: {
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
optimizationLevel?: number;
|
|
38
|
+
};
|
|
39
|
+
jpg?: {
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
quality: number;
|
|
42
|
+
};
|
|
43
|
+
png?: {
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
optimizationLevel?: number;
|
|
46
|
+
bitDepthReduction?: boolean;
|
|
47
|
+
colorTypeReduction?: boolean;
|
|
48
|
+
paletteReduction?: boolean;
|
|
49
|
+
interlaced?: boolean;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
componentsTheme: string | null;
|
|
53
|
+
keepCssVars: boolean;
|
|
54
|
+
embeddedModules: {
|
|
55
|
+
shared?: {
|
|
56
|
+
[libraryName: string]: string;
|
|
57
|
+
};
|
|
58
|
+
exposes?: {
|
|
59
|
+
[moduleId: string]: EmbeddedModuleConfigBase;
|
|
60
|
+
};
|
|
61
|
+
} | null;
|
|
62
|
+
mfModules: {
|
|
63
|
+
name?: string;
|
|
64
|
+
shared: any;
|
|
65
|
+
exposes?: Record<string, string>;
|
|
66
|
+
} | null;
|
|
67
|
+
};
|
|
68
|
+
type EmbeddedModuleConfigBase = {
|
|
69
|
+
entry: string;
|
|
70
|
+
embeddedConfig?: Record<string, string>;
|
|
71
|
+
cssPrefix?: false | string;
|
|
72
|
+
};
|
|
73
|
+
export type EmbeddedModuleConfig = EmbeddedModuleConfigBase & {
|
|
74
|
+
name: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Внутренний контекст arui-scripts
|
|
78
|
+
*/
|
|
79
|
+
export type AppContext = {
|
|
80
|
+
appPackage: any;
|
|
81
|
+
name: string;
|
|
82
|
+
normalizedName: string;
|
|
83
|
+
version: string;
|
|
84
|
+
cwd: string;
|
|
85
|
+
appSrc: string;
|
|
86
|
+
appNodeModules: string;
|
|
87
|
+
appNodeModulesBin: string;
|
|
88
|
+
babelRuntimeVersion: string;
|
|
89
|
+
useYarn: boolean;
|
|
90
|
+
tsconfig: string | null;
|
|
91
|
+
localNginxConf: string | null;
|
|
92
|
+
localDockerfile: string | null;
|
|
93
|
+
localStartScript: string | null;
|
|
94
|
+
overridesPath: string[];
|
|
95
|
+
publicPath: string;
|
|
96
|
+
serverOutputPath: string;
|
|
97
|
+
clientOutputPath: string;
|
|
98
|
+
statsOutputPath: string;
|
|
99
|
+
watchIgnorePath: string[];
|
|
100
|
+
changelogPath: string;
|
|
101
|
+
changelogTmpPath: string;
|
|
102
|
+
changelogFeaturesPath: string;
|
|
103
|
+
changelogBugfixesPath: string;
|
|
104
|
+
changelogBreakingChangesPath: string;
|
|
105
|
+
};
|
|
106
|
+
export type AppContextWithConfigs = AppContext & AppConfigs;
|
|
107
|
+
export type PackageSettings = Partial<AppConfigs>;
|
|
108
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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.updateWithConfigFile = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const resolve_1 = require("../util/resolve");
|
|
9
|
+
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
10
|
+
function updateWithConfigFile(config, context) {
|
|
11
|
+
const appConfigPath = (0, resolve_1.tryResolve)(path_1.default.join(context.cwd, '/arui-scripts.config'));
|
|
12
|
+
if (appConfigPath) {
|
|
13
|
+
let appSettings = require(appConfigPath);
|
|
14
|
+
if (appSettings.__esModule) {
|
|
15
|
+
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
16
|
+
appSettings = appSettings.default;
|
|
17
|
+
}
|
|
18
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, appSettings, appConfigPath);
|
|
19
|
+
return Object.assign(Object.assign({}, config), appSettings);
|
|
20
|
+
}
|
|
21
|
+
return config;
|
|
22
|
+
}
|
|
23
|
+
exports.updateWithConfigFile = updateWithConfigFile;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateWithEnv = void 0;
|
|
4
|
+
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
5
|
+
function updateWithEnv(config) {
|
|
6
|
+
if (!process.env.ARUI_SCRIPTS_CONFIG) {
|
|
7
|
+
return config;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
console.warn('Используйте ARUI_SCRIPTS_CONFIG только для отладки');
|
|
11
|
+
const envSettings = JSON.parse(process.env.ARUI_SCRIPTS_CONFIG);
|
|
12
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, envSettings, 'ENV');
|
|
13
|
+
return Object.assign(Object.assign({}, config), envSettings);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
console.error(e);
|
|
17
|
+
throw Error('Not valid JSON passed. Correct it. For example: ARUI_SCRIPTS_CONFIG="{\"serverPort\":3333}"');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.updateWithEnv = updateWithEnv;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateWithPackage = void 0;
|
|
4
|
+
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
5
|
+
function updateWithPackage(config, context) {
|
|
6
|
+
const packageSettings = context.appPackage.aruiScripts || {};
|
|
7
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, packageSettings, 'package.json');
|
|
8
|
+
return Object.assign(Object.assign({}, config), packageSettings);
|
|
9
|
+
}
|
|
10
|
+
exports.updateWithPackage = updateWithPackage;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateWithPresets = void 0;
|
|
4
|
+
const resolve_1 = require("../util/resolve");
|
|
5
|
+
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
6
|
+
function updateWithPresets(config, context) {
|
|
7
|
+
if (!config.presets) {
|
|
8
|
+
return config;
|
|
9
|
+
}
|
|
10
|
+
const presetsConfigPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.config`, { paths: [context.cwd] });
|
|
11
|
+
const presetsOverridesPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.overrides`, { paths: [context.cwd] });
|
|
12
|
+
if (presetsConfigPath) {
|
|
13
|
+
let presetsSettings = require(presetsConfigPath);
|
|
14
|
+
if (presetsSettings.__esModule) {
|
|
15
|
+
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
16
|
+
presetsSettings = presetsSettings.default;
|
|
17
|
+
}
|
|
18
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, presetsSettings, presetsConfigPath);
|
|
19
|
+
config = Object.assign(Object.assign({}, config), presetsSettings);
|
|
20
|
+
}
|
|
21
|
+
if (presetsOverridesPath) {
|
|
22
|
+
context.overridesPath.unshift(presetsOverridesPath);
|
|
23
|
+
}
|
|
24
|
+
return config;
|
|
25
|
+
}
|
|
26
|
+
exports.updateWithPresets = updateWithPresets;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateSettingsKeys = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Функция проверяет что все ключи объекта settingsObject есть в уже существующей конфигурации
|
|
6
|
+
*/
|
|
7
|
+
function validateSettingsKeys(existingConfig, settingsObject, source) {
|
|
8
|
+
Object.keys(settingsObject).forEach((setting) => {
|
|
9
|
+
if (typeof existingConfig[setting] === 'undefined') {
|
|
10
|
+
console.warn(`Неизвестная настройка "${setting}" в ${source || 'конфигурации'}`);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
exports.validateSettingsKeys = validateSettingsKeys;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const babelClientConfig: {
|
|
2
|
+
presets: (string | false | (string | {
|
|
3
|
+
targets: {
|
|
4
|
+
browsers: string[];
|
|
5
|
+
};
|
|
6
|
+
loose: boolean;
|
|
7
|
+
useBuiltIns: string;
|
|
8
|
+
corejs: number;
|
|
9
|
+
exclude: string[];
|
|
10
|
+
})[])[];
|
|
11
|
+
plugins: (string | (string | {
|
|
12
|
+
legacy: boolean;
|
|
13
|
+
})[] | (string | {
|
|
14
|
+
loose: boolean;
|
|
15
|
+
})[] | (string | {
|
|
16
|
+
useBuiltIns: boolean;
|
|
17
|
+
})[] | (string | {
|
|
18
|
+
corejs: boolean;
|
|
19
|
+
helpers: boolean;
|
|
20
|
+
version: string;
|
|
21
|
+
regenerator: boolean;
|
|
22
|
+
})[])[];
|
|
23
|
+
env: {
|
|
24
|
+
production: {
|
|
25
|
+
plugins: (string | (string | {
|
|
26
|
+
removeImport: boolean;
|
|
27
|
+
})[])[];
|
|
28
|
+
};
|
|
29
|
+
test: {
|
|
30
|
+
plugins: string[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export default babelClientConfig;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 supporting_browsers_1 = __importDefault(require("./supporting-browsers"));
|
|
7
|
+
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
8
|
+
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
9
|
+
const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'], {
|
|
10
|
+
presets: [
|
|
11
|
+
[
|
|
12
|
+
require.resolve('@babel/preset-env'),
|
|
13
|
+
{
|
|
14
|
+
targets: { browsers: supporting_browsers_1.default },
|
|
15
|
+
loose: true,
|
|
16
|
+
// Allow importing core-js in entrypoint and use browserlist to select polyfills
|
|
17
|
+
useBuiltIns: 'entry',
|
|
18
|
+
// Set the corejs version we are using to avoid warnings in console
|
|
19
|
+
corejs: 3,
|
|
20
|
+
// Exclude transforms that make all code slower
|
|
21
|
+
exclude: ['transform-typeof-symbol'],
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
(app_configs_1.default.tsconfig !== null && !app_configs_1.default.useTscLoader) && require.resolve('@babel/preset-typescript'),
|
|
25
|
+
require.resolve('@babel/preset-react')
|
|
26
|
+
].filter(Boolean),
|
|
27
|
+
plugins: [
|
|
28
|
+
require.resolve('@babel/plugin-syntax-dynamic-import'),
|
|
29
|
+
require.resolve('@babel/plugin-transform-proto-to-assign'),
|
|
30
|
+
[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
|
|
31
|
+
[require.resolve('@babel/plugin-proposal-class-properties'), { loose: true }],
|
|
32
|
+
[require.resolve('@babel/plugin-proposal-private-methods'), { loose: true }],
|
|
33
|
+
[require.resolve('@babel/plugin-proposal-private-property-in-object'), { loose: true }],
|
|
34
|
+
require.resolve('@babel/plugin-proposal-numeric-separator'),
|
|
35
|
+
require.resolve('@babel/plugin-proposal-export-default-from'),
|
|
36
|
+
require.resolve('@babel/plugin-proposal-export-namespace-from'),
|
|
37
|
+
[require.resolve('@babel/plugin-proposal-object-rest-spread'), { useBuiltIns: true }],
|
|
38
|
+
[require.resolve('@babel/plugin-transform-runtime'), {
|
|
39
|
+
corejs: false,
|
|
40
|
+
helpers: true,
|
|
41
|
+
// By default, babel assumes babel/runtime version 7.0.0-beta.0,
|
|
42
|
+
// explicitly resolving to match the provided helper functions.
|
|
43
|
+
// https://github.com/babel/babel/issues/10261
|
|
44
|
+
version: app_configs_1.default.babelRuntimeVersion,
|
|
45
|
+
regenerator: true,
|
|
46
|
+
}],
|
|
47
|
+
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
|
|
48
|
+
require.resolve('@babel/plugin-proposal-optional-chaining')
|
|
49
|
+
],
|
|
50
|
+
env: {
|
|
51
|
+
production: {
|
|
52
|
+
plugins: [
|
|
53
|
+
require.resolve('@babel/plugin-transform-react-constant-elements'),
|
|
54
|
+
require.resolve('@babel/plugin-transform-react-inline-elements'),
|
|
55
|
+
[require.resolve('babel-plugin-transform-react-remove-prop-types'), { removeImport: true }]
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
test: {
|
|
59
|
+
plugins: [
|
|
60
|
+
require.resolve('@babel/plugin-transform-modules-commonjs')
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
exports.default = babelClientConfig;
|