chore(app): Доработка сборки модулей
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test2-client.dmz.gazprombank.ru"
|
||||
OMNI_FEATURE_ADAPTER_ENDPOINT="https://omni.psi.dmz.gazprombank.ru"
|
||||
AB_PAYMENTS_ENDPOINT="https://app.stage.p.ab-payments.ru"
|
||||
YM_ID=103994161
|
||||
CLIENT_ID=13c910a3-cda5-4dee-978d-08062604ef75
|
||||
@@ -0,0 +1,6 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://gbo.gazprombank.ru"
|
||||
OMNI_FEATURE_ADAPTER_ENDPOINT="https://omni.online.gpb.ru"
|
||||
AB_PAYMENTS_ENDPOINT="https://app.ab-payments.ru"
|
||||
YM_ID=103994334
|
||||
CLIENT_ID=13c910a3-cda5-4dee-978d-08062604ef75
|
||||
Generated
+23562
-5354
File diff suppressed because it is too large
Load Diff
+10
-27
@@ -11,7 +11,8 @@
|
||||
"msb-accounts",
|
||||
"msb-business-cards",
|
||||
"msb-fea",
|
||||
"msb-partner-check"
|
||||
"msb-partner-check",
|
||||
"msb-treasury-deals"
|
||||
],
|
||||
"workspaces": [
|
||||
"packages/*",
|
||||
@@ -19,35 +20,16 @@
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"start": "lerna run start --stream",
|
||||
"start:statements": "lerna run start --scope=msb-host --scope=msb-statements-and-inquiries --stream",
|
||||
"start:stage:statements": "lerna run start:stage --scope=msb-host --stream & lerna run start --scope=msb-statements-and-inquiries --stream",
|
||||
"start:main-page": "lerna run start --scope=msb-host --scope=msb-main-page --scope=msb-operations-history --stream",
|
||||
"start:stage:main-page": "lerna run start:stage --scope=msb-host --stream & lerna run start --scope=msb-main-page --scope=msb-operations-history --stream",
|
||||
"start:operations-history": "lerna run start --scope=msb-host --scope=msb-operations-history --stream",
|
||||
"start:stage:operations-history": "lerna run start:stage --scope=msb-host --stream & lerna run start --scope=msb-operations-history --stream",
|
||||
"start:deposits": "lerna run start --scope=msb-host --scope=msb-deposits --stream",
|
||||
"start:stage:deposits": "lerna run start:stage --scope=msb-host --stream & lerna run start --scope=msb-deposits --stream",
|
||||
"start:payments": "lerna run start --scope=msb-host --scope=msb-payments --stream",
|
||||
"start:stage:payments": "lerna run start:stage --scope=msb-host --stream & lerna run start --scope=msb-payments --stream",
|
||||
"start:accounts": "lerna run start --scope=msb-host --scope=msb-accounts --stream",
|
||||
"start:business-cards": "lerna run start --scope=msb-host --scope=msb-business-cards --stream",
|
||||
"start:stage:accounts": "lerna run start:stage --stream & lerna run start --scope=msb-host --scope=msb-accounts --stream",
|
||||
"start:stage:business-cards": "lerna run start:stage --stream & lerna run start --scope=msb-host --scope=msb-business-cards --stream",
|
||||
"start:stage:treasury-deals": "lerna run start:stage --scope=msb-host --stream & lerna run start --scope=msb-treasury-deals --stream",
|
||||
"start:stage:treasury-deals:win": "npx concurrently \"lerna run start:stage --scope=msb-host --stream\" \"lerna run start --scope=msb-treasury-deals --stream\"",
|
||||
"start:host": "lerna run start --scope=msb-host --stream",
|
||||
"start:stage:host": "lerna run start:stage --scope=msb-host --stream",
|
||||
"start:fea": "lerna run start --scope=msb-host --scope=msb-fea --stream",
|
||||
"start:stage:fea": "lerna run start:stage --scope=msb-host --stream & lerna run start --scope=msb-fea --stream",
|
||||
"start:partner-check": "lerna run start --scope=msb-host --scope=msb-partner-check --stream",
|
||||
"start:stage:partner-check": "lerna run start:stage --scope=msb-host --stream & lerna run start --scope=msb-partner-check --stream",
|
||||
"build": "cross-env IB_MODULE_VERSION=$npm_package_version lerna run build --scope=msb-* --stream --concurrency=2",
|
||||
"start": "cross-env NODE_ENV=development node scripts/build-modules.js",
|
||||
"start:stage": "cross-env NODE_ENV=development SECURE=true node scripts/build-modules.js --envPath ../../.env.stage",
|
||||
"build": "cross-env IB_MODULE_VERSION=$npm_package_version ENV_PATH=../../.env.production lerna run build --scope=msb-* --stream --concurrency=2",
|
||||
"build:t3": "cross-env ENV_PATH=../../.env.t3 lerna run build --scope=msb-* --stream --concurrency=2",
|
||||
"build:ift": "cross-env ENV_PATH=../../.env.ift lerna run build --scope=msb-* --stream --concurrency=2",
|
||||
"build:webpack-config": "lerna run build --scope=@msb/mf-builder --stream",
|
||||
"start:prod": "npm run build && docker-compose up",
|
||||
"lint": "lerna run lint --scope=msb-* --stream",
|
||||
"bump:version": "bash ./update-packages-version.sh",
|
||||
"build:diff": "bash ./build-changed-modules.sh",
|
||||
"bump:version": "bash scripts/update-packages-version.sh",
|
||||
"build:diff": "bash scripts/build-changed-modules.sh",
|
||||
"lint-fix": "lerna run lint-fix --scope=msb-* --stream",
|
||||
"check-types": "lerna run check-types --scope=msb-* --stream",
|
||||
"prepare": "husky || true",
|
||||
@@ -82,6 +64,7 @@
|
||||
"eslint": "^8.9.0",
|
||||
"husky": "^7.0.4",
|
||||
"jest": "27.5.1",
|
||||
"cross-env": "7.0.3",
|
||||
"jest-environment-jsdom": "29.4.0",
|
||||
"jest-serializer": "^27.5.1",
|
||||
"jest-sonar": "0.2.12",
|
||||
|
||||
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const config_1 = require("../../config");
|
||||
const utils_1 = require("../../utils");
|
||||
const webpack_1 = __importDefault(require("webpack"));
|
||||
function build({ configPath, mode, envFilePath }) {
|
||||
function build({ configPath, mode }) {
|
||||
var _a;
|
||||
const appConfig = ((_a = (0, utils_1.readConfigFile)(configPath)) !== null && _a !== void 0 ? _a : {});
|
||||
const config = (0, config_1.createWebpackConfig)(appConfig, mode, envFilePath);
|
||||
const config = (0, config_1.createWebpackConfig)(appConfig, mode);
|
||||
const compiler = (0, webpack_1.default)(config);
|
||||
return new Promise((resolve, reject) => {
|
||||
compiler.run((error, stats) => {
|
||||
|
||||
@@ -14,21 +14,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
const config_1 = require("../../config");
|
||||
const utils_1 = require("../../utils");
|
||||
const webpack_1 = __importDefault(require("webpack"));
|
||||
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
||||
function start({ configPath, envFilePath, secure }) {
|
||||
function start({ configPath }) {
|
||||
var _a;
|
||||
const appConfig = ((_a = (0, utils_1.readConfigFile)(configPath)) !== null && _a !== void 0 ? _a : {});
|
||||
const _b = (0, config_1.createWebpackConfig)(appConfig, 'development', envFilePath, secure), { devServer } = _b, config = __rest(_b, ["devServer"]);
|
||||
const _b = (0, config_1.createWebpackConfig)(appConfig, 'development'), { devServer } = _b, config = __rest(_b, ["devServer"]);
|
||||
const compiler = (0, webpack_1.default)(config);
|
||||
const developmentServer = new webpack_dev_server_1.default(Object.assign(Object.assign({}, devServer), { server: secure ? 'https' : 'http' }), compiler);
|
||||
const developmentServer = new webpack_dev_server_1.default(Object.assign({}, devServer), compiler);
|
||||
developmentServer.startCallback(() => {
|
||||
process.stdin.on('end', () => {
|
||||
// @ts-ignore
|
||||
developmentServer.close();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
@@ -19,13 +19,8 @@ yargs_1.default
|
||||
type: 'string',
|
||||
description: 'Путь до конфигурационного файла webpack.config.ts',
|
||||
});
|
||||
command.option('env', {
|
||||
default: '.env.production',
|
||||
type: 'string',
|
||||
description: 'Путь до .env',
|
||||
});
|
||||
}, argv => {
|
||||
(0, commands_1.build)({ configPath: argv.config, mode: 'production', envFilePath: argv.env });
|
||||
(0, commands_1.build)({ configPath: argv.config, mode: 'production' });
|
||||
})
|
||||
.command(['build:dev'], 'Собрать приложение в development режиме', command => {
|
||||
command.option('config', {
|
||||
@@ -44,17 +39,7 @@ yargs_1.default
|
||||
type: 'string',
|
||||
description: 'Путь до конфигурационного файла webpack.config.ts',
|
||||
});
|
||||
command.option('env', {
|
||||
default: '.env.development',
|
||||
type: 'string',
|
||||
description: 'Путь до .env',
|
||||
});
|
||||
command.option('secure', {
|
||||
default: false,
|
||||
type: 'boolean',
|
||||
description: 'Запстить dev server на https?',
|
||||
});
|
||||
}, argv => {
|
||||
(0, commands_1.start)({ configPath: argv.config, envFilePath: argv.env, secure: argv.secure });
|
||||
(0, commands_1.start)({ configPath: argv.config });
|
||||
})
|
||||
.help().argv;
|
||||
|
||||
@@ -32,14 +32,13 @@ class WebpackConfigBuilder {
|
||||
get configuration() {
|
||||
return this.config;
|
||||
}
|
||||
applyOutput(secure) {
|
||||
var _a, _b, _c;
|
||||
const port = (_a = this.appConfig.devServerOptions) === null || _a === void 0 ? void 0 : _a.port;
|
||||
applyOutput() {
|
||||
var _a, _b;
|
||||
this.config.output = {
|
||||
path: ((_b = this.appConfig.paths) === null || _b === void 0 ? void 0 : _b.outputPath) || node_path_1.default.resolve(this.cwd, 'dist'),
|
||||
path: ((_a = this.appConfig.paths) === null || _a === void 0 ? void 0 : _a.outputPath) || node_path_1.default.resolve(this.cwd, 'dist'),
|
||||
filename: '[name].[contenthash:8].js',
|
||||
chunkFilename: '[name].[contenthash:8].js',
|
||||
publicPath: this.isDevelopmentMode && port ? `${secure ? 'https' : 'http'}://localhost:${port}/` : ((_c = this.appConfig.paths) === null || _c === void 0 ? void 0 : _c.publicUrl) || '/',
|
||||
publicPath: ((_b = this.appConfig.paths) === null || _b === void 0 ? void 0 : _b.publicUrl) || '/',
|
||||
clean: true,
|
||||
};
|
||||
}
|
||||
@@ -82,7 +81,7 @@ class WebpackConfigBuilder {
|
||||
isProductionMode: this.isProductionMode,
|
||||
});
|
||||
}
|
||||
applyPlugins(envFilePath) {
|
||||
applyPlugins() {
|
||||
var _a;
|
||||
const publicPath = ((_a = this.appConfig.paths) === null || _a === void 0 ? void 0 : _a.publicPath) || 'public';
|
||||
this.config.plugins =
|
||||
@@ -92,7 +91,6 @@ class WebpackConfigBuilder {
|
||||
publicPath,
|
||||
moduleName: this.appConfig.moduleName,
|
||||
moduleFederationOptions: this.appConfig.moduleFederationOptions,
|
||||
envFilePath,
|
||||
}) || [];
|
||||
const otherPlugins = this.appConfig.plugins;
|
||||
if (Array.isArray(otherPlugins) && Array.isArray(this.config.plugins)) {
|
||||
|
||||
@@ -5,15 +5,15 @@ const WebpackConfigBuilder_1 = require("./WebpackConfigBuilder");
|
||||
/**
|
||||
* Создание конфига для сборки.
|
||||
*/
|
||||
const createWebpackConfig = (environmentConfig, mode = 'development', envFilePath, secure) => {
|
||||
const createWebpackConfig = (environmentConfig, mode = 'development') => {
|
||||
const builder = new WebpackConfigBuilder_1.WebpackConfigBuilder(environmentConfig, mode);
|
||||
builder.applyOutput(secure);
|
||||
builder.applyOutput();
|
||||
builder.applyDevServer();
|
||||
builder.applyModuleOptions();
|
||||
builder.applyOptimizationRules();
|
||||
builder.applyPerfomance();
|
||||
builder.applyResolve();
|
||||
builder.applyPlugins(envFilePath);
|
||||
builder.applyPlugins();
|
||||
return builder.configuration;
|
||||
};
|
||||
exports.createWebpackConfig = createWebpackConfig;
|
||||
|
||||
@@ -9,13 +9,11 @@ const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin")
|
||||
* Установка правил оптимизации сборки.
|
||||
*/
|
||||
const setOptimizationRules = (options) => (Object.assign({ minimize: true, minimizer: [new terser_webpack_plugin_1.default()], runtimeChunk: false, splitChunks: {
|
||||
minSize: 17000,
|
||||
minRemainingSize: 0,
|
||||
minChunks: 1,
|
||||
maxAsyncRequests: 30,
|
||||
minChunks: 2,
|
||||
maxAsyncRequests: 7,
|
||||
automaticNameDelimiter: '_',
|
||||
maxInitialRequests: 30,
|
||||
enforceSizeThreshold: 30000,
|
||||
maxInitialRequests: 5,
|
||||
cacheGroups: {
|
||||
vendors: {
|
||||
test: /[/\\]node_modules[/\\]/,
|
||||
|
||||
@@ -13,8 +13,8 @@ const setModuleFederationPlugin_1 = require("./setModuleFederationPlugin");
|
||||
/**
|
||||
* Установка плагинов.
|
||||
*/
|
||||
const setPlugins = ({ isDevelopmentMode, isProductionMode, moduleName, moduleFederationOptions, envFilePath, }) => {
|
||||
const dotenvFilename = envFilePath !== null && envFilePath !== void 0 ? envFilePath : (isProductionMode ? '.env.production' : '.env.development');
|
||||
const setPlugins = ({ isDevelopmentMode, isProductionMode, moduleName, moduleFederationOptions, }) => {
|
||||
const dotenvFilename = process.env.ENV_PATH;
|
||||
const plugins = [
|
||||
new dotenv_webpack_1.default({
|
||||
path: dotenvFilename,
|
||||
|
||||
@@ -7,13 +7,12 @@ import type { Stats } from 'webpack';
|
||||
interface IBuildOptions {
|
||||
configPath?: string;
|
||||
mode: Mode;
|
||||
envFilePath?: string;
|
||||
}
|
||||
|
||||
function build({ configPath, mode, envFilePath }: IBuildOptions): Promise<Stats | undefined> {
|
||||
function build({ configPath, mode }: IBuildOptions): Promise<Stats | undefined> {
|
||||
const appConfig = (readConfigFile(configPath) ?? {}) as IWebpackAppConfig;
|
||||
|
||||
const config = createWebpackConfig(appConfig, mode, envFilePath);
|
||||
const config = createWebpackConfig(appConfig, mode);
|
||||
|
||||
const compiler = webpack(config);
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { createWebpackConfig } from 'config';
|
||||
import type { IWebpackAppConfig } from 'types';
|
||||
import { readConfigFile } from 'utils';
|
||||
@@ -8,22 +6,19 @@ import WebpackDevServer from 'webpack-dev-server';
|
||||
|
||||
interface IStartOptions {
|
||||
configPath?: string;
|
||||
envFilePath?: string;
|
||||
secure: boolean;
|
||||
}
|
||||
|
||||
function start({ configPath, envFilePath, secure }: IStartOptions) {
|
||||
function start({ configPath }: IStartOptions) {
|
||||
const appConfig = (readConfigFile(configPath) ?? {}) as IWebpackAppConfig;
|
||||
|
||||
const { devServer, ...config } = createWebpackConfig(appConfig, 'development', envFilePath, secure);
|
||||
const { devServer, ...config } = createWebpackConfig(appConfig, 'development');
|
||||
|
||||
const compiler = webpack(config);
|
||||
|
||||
const developmentServer = new WebpackDevServer({ ...devServer, server: secure ? 'https' : 'http' }, compiler);
|
||||
const developmentServer = new WebpackDevServer({ ...devServer }, compiler);
|
||||
|
||||
developmentServer.startCallback(() => {
|
||||
process.stdin.on('end', () => {
|
||||
// @ts-ignore
|
||||
developmentServer.close();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
@@ -21,14 +21,9 @@ yargs
|
||||
type: 'string',
|
||||
description: 'Путь до конфигурационного файла webpack.config.ts',
|
||||
});
|
||||
command.option('env', {
|
||||
default: '.env.production',
|
||||
type: 'string',
|
||||
description: 'Путь до .env',
|
||||
});
|
||||
},
|
||||
argv => {
|
||||
build({ configPath: argv.config as string, mode: 'production', envFilePath: argv.env as string });
|
||||
build({ configPath: argv.config as string, mode: 'production' });
|
||||
}
|
||||
)
|
||||
.command(
|
||||
@@ -56,19 +51,9 @@ yargs
|
||||
type: 'string',
|
||||
description: 'Путь до конфигурационного файла webpack.config.ts',
|
||||
});
|
||||
command.option('env', {
|
||||
default: '.env.development',
|
||||
type: 'string',
|
||||
description: 'Путь до .env',
|
||||
});
|
||||
command.option('secure', {
|
||||
default: false,
|
||||
type: 'boolean',
|
||||
description: 'Запстить dev server на https?',
|
||||
});
|
||||
},
|
||||
argv => {
|
||||
start({ configPath: argv.config as string, envFilePath: argv.env as string, secure: argv.secure as boolean });
|
||||
start({ configPath: argv.config as string });
|
||||
}
|
||||
)
|
||||
.help().argv;
|
||||
|
||||
@@ -38,15 +38,12 @@ export class WebpackConfigBuilder {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
public applyOutput(secure?: boolean) {
|
||||
const port = this.appConfig.devServerOptions?.port;
|
||||
|
||||
public applyOutput() {
|
||||
this.config.output = {
|
||||
path: this.appConfig.paths?.outputPath || path.resolve(this.cwd, 'dist'),
|
||||
filename: '[name].[contenthash:8].js',
|
||||
chunkFilename: '[name].[contenthash:8].js',
|
||||
publicPath:
|
||||
this.isDevelopmentMode && port ? `${secure ? 'https' : 'http'}://localhost:${port}/` : this.appConfig.paths?.publicUrl || '/',
|
||||
publicPath: this.appConfig.paths?.publicUrl || '/',
|
||||
clean: true,
|
||||
};
|
||||
}
|
||||
@@ -110,7 +107,7 @@ export class WebpackConfigBuilder {
|
||||
});
|
||||
}
|
||||
|
||||
public applyPlugins(envFilePath?: string) {
|
||||
public applyPlugins() {
|
||||
const publicPath = this.appConfig.paths?.publicPath || 'public';
|
||||
|
||||
this.config.plugins =
|
||||
@@ -120,7 +117,6 @@ export class WebpackConfigBuilder {
|
||||
publicPath,
|
||||
moduleName: this.appConfig.moduleName,
|
||||
moduleFederationOptions: this.appConfig.moduleFederationOptions,
|
||||
envFilePath,
|
||||
}) || [];
|
||||
|
||||
const otherPlugins = this.appConfig.plugins;
|
||||
|
||||
@@ -5,21 +5,16 @@ import { WebpackConfigBuilder } from './WebpackConfigBuilder';
|
||||
/**
|
||||
* Создание конфига для сборки.
|
||||
*/
|
||||
export const createWebpackConfig = (
|
||||
environmentConfig: IWebpackAppConfig,
|
||||
mode: Mode = 'development',
|
||||
envFilePath?: string,
|
||||
secure?: boolean
|
||||
): Configuration => {
|
||||
export const createWebpackConfig = (environmentConfig: IWebpackAppConfig, mode: Mode = 'development'): Configuration => {
|
||||
const builder = new WebpackConfigBuilder(environmentConfig, mode);
|
||||
|
||||
builder.applyOutput(secure);
|
||||
builder.applyOutput();
|
||||
builder.applyDevServer();
|
||||
builder.applyModuleOptions();
|
||||
builder.applyOptimizationRules();
|
||||
builder.applyPerfomance();
|
||||
builder.applyResolve();
|
||||
builder.applyPlugins(envFilePath);
|
||||
builder.applyPlugins();
|
||||
|
||||
return builder.configuration;
|
||||
};
|
||||
|
||||
@@ -14,13 +14,11 @@ export const setOptimizationRules = (options?: Configuration['optimization']): C
|
||||
minimizer: [new TerserPlugin()],
|
||||
runtimeChunk: false,
|
||||
splitChunks: {
|
||||
minSize: 17_000,
|
||||
minRemainingSize: 0,
|
||||
minChunks: 1,
|
||||
maxAsyncRequests: 30,
|
||||
minChunks: 2,
|
||||
maxAsyncRequests: 7,
|
||||
automaticNameDelimiter: '_',
|
||||
maxInitialRequests: 30,
|
||||
enforceSizeThreshold: 30_000,
|
||||
maxInitialRequests: 5,
|
||||
cacheGroups: {
|
||||
vendors: {
|
||||
test: /[/\\]node_modules[/\\]/,
|
||||
|
||||
@@ -15,9 +15,8 @@ export const setPlugins = ({
|
||||
isProductionMode,
|
||||
moduleName,
|
||||
moduleFederationOptions,
|
||||
envFilePath,
|
||||
}: IPluginOptions): Configuration['plugins'] => {
|
||||
const dotenvFilename = envFilePath ?? (isProductionMode ? '.env.production' : '.env.development');
|
||||
const dotenvFilename = process.env.ENV_PATH;
|
||||
|
||||
const plugins = [
|
||||
new Dotenv({
|
||||
|
||||
@@ -30,8 +30,6 @@ export interface IPluginOptions extends IModeOptions {
|
||||
publicPath: string;
|
||||
/** Конфигурация для ModuleFedrationPlugin. */
|
||||
moduleFederationOptions?: IModuleFederationPluginOptions;
|
||||
/** Путь до файла .env */
|
||||
envFilePath?: string;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
|
||||
@@ -3,7 +3,6 @@ import type { Stats } from 'webpack';
|
||||
interface IBuildOptions {
|
||||
configPath?: string;
|
||||
mode: Mode;
|
||||
envFilePath?: string;
|
||||
}
|
||||
declare function build({ configPath, mode, envFilePath }: IBuildOptions): Promise<Stats | undefined>;
|
||||
declare function build({ configPath, mode }: IBuildOptions): Promise<Stats | undefined>;
|
||||
export default build;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
interface IStartOptions {
|
||||
configPath?: string;
|
||||
envFilePath?: string;
|
||||
secure: boolean;
|
||||
}
|
||||
declare function start({ configPath, envFilePath, secure }: IStartOptions): void;
|
||||
declare function start({ configPath }: IStartOptions): void;
|
||||
export default start;
|
||||
|
||||
@@ -9,12 +9,12 @@ export declare class WebpackConfigBuilder {
|
||||
private srcPath;
|
||||
constructor(appConfig: IWebpackAppConfig, mode: Mode);
|
||||
get configuration(): Configuration;
|
||||
applyOutput(secure?: boolean): void;
|
||||
applyOutput(): void;
|
||||
applyResolve(): void;
|
||||
applyDevServer(): void;
|
||||
applyPerfomance(): void;
|
||||
applyOptimizationRules(): void;
|
||||
applyModuleOptions(): void;
|
||||
applyPlugins(envFilePath?: string): void;
|
||||
applyPlugins(): void;
|
||||
merge(newConfig: Configuration): void;
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ import type { Configuration } from 'webpack';
|
||||
/**
|
||||
* Создание конфига для сборки.
|
||||
*/
|
||||
export declare const createWebpackConfig: (environmentConfig: IWebpackAppConfig, mode?: Mode, envFilePath?: string, secure?: boolean) => Configuration;
|
||||
export declare const createWebpackConfig: (environmentConfig: IWebpackAppConfig, mode?: Mode) => Configuration;
|
||||
export default createWebpackConfig;
|
||||
|
||||
@@ -3,4 +3,4 @@ import type { Configuration } from 'webpack';
|
||||
/**
|
||||
* Установка плагинов.
|
||||
*/
|
||||
export declare const setPlugins: ({ isDevelopmentMode, isProductionMode, moduleName, moduleFederationOptions, envFilePath, }: IPluginOptions) => Configuration['plugins'];
|
||||
export declare const setPlugins: ({ isDevelopmentMode, isProductionMode, moduleName, moduleFederationOptions, }: IPluginOptions) => Configuration['plugins'];
|
||||
|
||||
@@ -25,8 +25,6 @@ export interface IPluginOptions extends IModeOptions {
|
||||
publicPath: string;
|
||||
/** Конфигурация для ModuleFedrationPlugin. */
|
||||
moduleFederationOptions?: IModuleFederationPluginOptions;
|
||||
/** Путь до файла .env */
|
||||
envFilePath?: string;
|
||||
}
|
||||
/** @public */
|
||||
export interface IWebpackAppConfig {
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import inquirer from 'inquirer';
|
||||
import { spawn } from 'child_process';
|
||||
|
||||
const modules = [
|
||||
'msb-main-page',
|
||||
'msb-operations-history',
|
||||
'msb-deposits',
|
||||
'msb-payments',
|
||||
'msb-statements-and-inquiries',
|
||||
'msb-accounts',
|
||||
'msb-fea',
|
||||
'msb-partner-check',
|
||||
'msb-treasury-deals',
|
||||
];
|
||||
|
||||
async function build() {
|
||||
const questions = [
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'selectedModules',
|
||||
message: 'Выберите модули для сборки:',
|
||||
choices: modules,
|
||||
},
|
||||
];
|
||||
|
||||
const answers = await inquirer.prompt(questions);
|
||||
const { selectedModules } = answers;
|
||||
|
||||
if (selectedModules.length === 0) {
|
||||
console.log('Не выбрано ни одного модуля.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const scopeArguments = selectedModules.map(module => `--scope=${module}`);
|
||||
|
||||
const envPathIndex = process.argv.indexOf('--envPath');
|
||||
const envPath = envPathIndex !== -1 && process.argv[envPathIndex + 1] ? process.argv[envPathIndex + 1] : '../../.env.development';
|
||||
|
||||
const lernaProcess = spawn(
|
||||
'npx',
|
||||
['cross-env', `ENV_PATH=${envPath}`, 'lerna', 'run', 'start', '--scope=msb-host', ...scopeArguments, '--stream'],
|
||||
{ shell: true, stdio: 'inherit' }
|
||||
);
|
||||
|
||||
lernaProcess.stdout.on('data', data => {
|
||||
console.log(`${data}`);
|
||||
});
|
||||
|
||||
lernaProcess.stderr.on('data', data => {
|
||||
console.error(`${data}`);
|
||||
});
|
||||
|
||||
lernaProcess.on('error', err => {
|
||||
console.error(`Ошибка запуска процесса: ${err.message}`);
|
||||
});
|
||||
}
|
||||
|
||||
build().catch(error => {
|
||||
console.error(`Произошла ошибка: ${error}`);
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
ECO_CLIENT_ENDPOINT=""
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
@@ -1 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
ECO_CLIENT_ENDPOINT=""
|
||||
@@ -5,7 +5,6 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "build-app start",
|
||||
"start:stage": "build-app start --secure=true --env='.env.stage'",
|
||||
"build:dev": "build-app build:dev",
|
||||
"build": "build-app build",
|
||||
"lint-fix": "eslint --fix --ext .js,.jsx,.ts,.tsx ./src",
|
||||
@@ -22,9 +21,9 @@
|
||||
"author": "Onufriychuk Egor",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@eco/tracker": "^1.7.0",
|
||||
"@emotion/react": "11.8.1",
|
||||
"@emotion/styled": "11.8.1",
|
||||
"@msb/fractal-ui-composites": "30.15.1",
|
||||
"@fractal-ui/core": "30.15.0",
|
||||
"@fractal-ui/extended": "30.15.0",
|
||||
"@fractal-ui/library": "31.4.0",
|
||||
@@ -32,35 +31,35 @@
|
||||
"@fractal-ui/styling": "30.14.2",
|
||||
"@msb/sentry": "1.0.0",
|
||||
"@msb/crypto": "1.1.0",
|
||||
"@msb/fractal-ui-composites": "30.15.1",
|
||||
"@msb/http": "^1.0.0",
|
||||
"@msb/localization": "1.0.0",
|
||||
"@msb/mf-utils": "^1.0.0",
|
||||
"@eco/tracker": "^1.7.0",
|
||||
"@msb/shared": "1.0.0",
|
||||
"@styled-system/css": "^5.1.5",
|
||||
"dayjs": "1.11.3",
|
||||
"i18next": "22.5.1",
|
||||
"@msb/localization": "1.0.0",
|
||||
"react": "17.0.2",
|
||||
"react-animate-height": "2.0.23",
|
||||
"react-dnd": "11.1.3",
|
||||
"react-dnd-html5-backend": "11.1.3",
|
||||
"react-dom": "17.0.2",
|
||||
"react-final-form": "6.5.3",
|
||||
"react-i18next": "11.2.7",
|
||||
"react-router-dom": "5.2.0",
|
||||
"react-test-renderer": "17.0.2",
|
||||
"react-final-form": "6.5.3",
|
||||
"styled-system": "5.1.5",
|
||||
"virtua": "0.31.0"
|
||||
"virtua": "0.31.0",
|
||||
"i18next": "22.5.1",
|
||||
"react-i18next": "11.2.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eco/lint-staged-config": "21.10.0",
|
||||
"@msb/mf-builder": "1.0.0",
|
||||
"@msb/mocks": "1.0.0",
|
||||
"@testing-library/jest-dom": "5.16.2",
|
||||
"@testing-library/react": "12.1.3",
|
||||
"@testing-library/react-hooks": "7.0.2",
|
||||
"@testing-library/user-event": "13.5.0",
|
||||
"@types/jest": "^27.4.0",
|
||||
"@msb/mocks": "1.0.0",
|
||||
"@types/react": "17.0.36",
|
||||
"@types/react-dom": "17.0.2",
|
||||
"@types/react-router-dom": "5.1.7",
|
||||
@@ -77,11 +76,7 @@
|
||||
"react-router-dom": "5.2.0",
|
||||
"react-test-renderer": "17.0.2"
|
||||
},
|
||||
"browserslist": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"browserslist": [">0.2%", "not dead", "not op_mini all"],
|
||||
"msw": {
|
||||
"workerDirectory": "public"
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
<title>ГАЗПРОМБАНК | МСБ</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<div><img src="https://mc.yandex.ru/watch/103631136" style="position:absolute; left:-9999px;" alt="" /></div>
|
||||
</noscript>
|
||||
<%= htmlWebpackPlugin.options.templateParameters.yandexMetrikaNoScript %>
|
||||
<div id="root">
|
||||
<div class="loader-container">
|
||||
<div class="logo-container">
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
import type { IWebpackAppConfig } from '@msb/mf-builder';
|
||||
import CopyPlugin from 'copy-webpack-plugin';
|
||||
import dotenv from 'dotenv';
|
||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||
import webpack from 'webpack';
|
||||
import path from 'node:path';
|
||||
|
||||
import packageJson from './package.json';
|
||||
|
||||
const outputPath = path.resolve(__dirname, '../../msb-host');
|
||||
const publicPath = path.resolve(__dirname, 'public');
|
||||
const envFile = dotenv.config({ path: process.env.ENV_PATH }).parsed;
|
||||
|
||||
const config: IWebpackAppConfig = {
|
||||
moduleName: packageJson.name,
|
||||
paths: {
|
||||
outputPath,
|
||||
publicUrl: '/msb-host/',
|
||||
publicUrl: process.env.NODE_ENV === 'development' ? '/' : '/msb-host/',
|
||||
},
|
||||
devServerOptions: {
|
||||
port: 8000,
|
||||
server: process.env.SECURE ? 'https' : 'http',
|
||||
proxy: [
|
||||
{
|
||||
context: ['/msb-host'],
|
||||
@@ -25,54 +29,46 @@ const config: IWebpackAppConfig = {
|
||||
},
|
||||
{
|
||||
context: ['/msb-main-page'],
|
||||
target: 'http://localhost:3002 ',
|
||||
target: 'http://localhost:3002',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '/msb-main-page': '' },
|
||||
},
|
||||
{
|
||||
context: ['/msb-operations-history'],
|
||||
target: 'http://localhost:3003',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '/msb-operations-history': '' },
|
||||
},
|
||||
{
|
||||
context: ['/msb-deposits'],
|
||||
target: 'http://localhost:3007',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '/msb-deposits': '' },
|
||||
},
|
||||
{
|
||||
context: ['/msb-payments'],
|
||||
target: 'http://localhost:3004',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '/msb-payments': '' },
|
||||
},
|
||||
{
|
||||
context: ['/msb-statements-and-inquiries'],
|
||||
target: 'http://localhost:3005',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '/msb-statements-and-inquiries': '' },
|
||||
},
|
||||
{
|
||||
context: ['/msb-fea'],
|
||||
target: 'http://localhost:3008',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '/msb-fea': '' },
|
||||
},
|
||||
{
|
||||
context: ['/msb-partner-check'],
|
||||
target: 'http://localhost:3009',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '/msb-partner-check': '' },
|
||||
},
|
||||
{ context: ['/msb-accounts'], target: 'http://localhost:3006', changeOrigin: true, pathRewrite: { '/msb-accounts': '' } },
|
||||
{ context: ['/msb-business-cards'], target: 'http://localhost:3011', changeOrigin: true, pathRewrite: { '/msb-business-cards': '' } },
|
||||
{ context: ['/msb-treasury-deals'], target: 'http://localhost:3010', changeOrigin: true, pathRewrite: { '/msb-treasury-deals': '' } },
|
||||
{ context: ['/msb-business-cards'], target: 'http://localhost:3011', changeOrigin: true },
|
||||
{ context: ['/msb-accounts'], target: 'http://localhost:3006', changeOrigin: true },
|
||||
{ context: ['/msb-treasury-deals'], target: 'http://localhost:3010', changeOrigin: true },
|
||||
{
|
||||
context: ['/api', '/.well-known'],
|
||||
target: 'https://client.stage.gboteam.ru',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { 'https://client.stage.gboteam.ru': '' },
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -84,6 +80,12 @@ const config: IWebpackAppConfig = {
|
||||
favicon: path.resolve(publicPath, 'favicon.ico'),
|
||||
hash: true,
|
||||
cache: true,
|
||||
inject: 'body',
|
||||
templateParameters: {
|
||||
yandexMetrikaNoScript: envFile?.YM_ID
|
||||
? `<noscript><div><img src="https://mc.yandex.ru/watch/${envFile.YM_ID}" style="position:absolute; left:-9999px;" alt="" /></div></noscript>`
|
||||
: undefined,
|
||||
},
|
||||
}),
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
@@ -1 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
@@ -1 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
@@ -1 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
@@ -1 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="development"
|
||||
ECO_CLIENT_ENDPOINT=""
|
||||
@@ -1,2 +0,0 @@
|
||||
NODE_ENV="production"
|
||||
ECO_CLIENT_ENDPOINT="https://eco-test3-client.dmz.gazprombank.ru"
|
||||
+1
-1
@@ -16,5 +16,5 @@
|
||||
"jsx": "react-jsx",
|
||||
"keyofStringsOnly": true // Без этой опции ломаются типы styled-system
|
||||
},
|
||||
"exclude": ["node_modules", "__tests__"]
|
||||
"exclude": ["node_modules", "__tests__", "scripts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user