Files
Ildar Kamalov 336e9c9df4 Pull request 2723: AGDNS-4277 generate client api using openapi specs
Squashed commit of the following:

commit 889c9051c7825c36961a92a36d20054bb4a77e46
Merge: d38b8a984 5c44c4b26
Author: Ildar Kamalov <[email protected]>
Date:   Mon Jul 27 12:59:55 2026 +0300

    Merge branch 'master' into AGDNS-4277

commit d38b8a984458f15b17a7b096e298f3a4652d7a7b
Author: Ildar Kamalov <[email protected]>
Date:   Mon Jul 27 12:03:14 2026 +0300

    fix md lint

commit 5bfc44e55269b44fbadaffa42844c7cbcfa751ec
Author: Ildar Kamalov <[email protected]>
Date:   Mon Jul 27 11:55:57 2026 +0300

    update changelog

commit a1cdc0014ac5a69e56dce5a6bb80ad6a62b32bab
Author: Ildar Kamalov <[email protected]>
Date:   Fri Jul 24 18:35:55 2026 +0300

    fix protection_disabled_until

commit b5bba05877dc887f07edfb20c640ea751beafb99
Author: Ildar Kamalov <[email protected]>
Date:   Fri Jul 24 17:01:46 2026 +0300

    review fix

commit fa365d0f4d203dd5a6d4607a766aed5bf779c045
Author: Ildar Kamalov <[email protected]>
Date:   Fri Jul 24 08:47:18 2026 +0000

    Pull request 2730: AGDNS-4225 fix language change, add language selector to install
    
    Squashed commit of the following:
    
    commit 9b4db74d65
    Merge: 8371be2f0 145a20744
    Author: Ildar Kamalov <[email protected]>
    Date:   Fri Jul 24 11:39:45 2026 +0300
    
        Merge branch 'AGDNS-4277' into AGDNS-4225
    
    commit 8371be2f08
    Author: Ildar Kamalov <[email protected]>
    Date:   Thu Jul 23 16:58:47 2026 +0300
    
        fix tests
    
    commit 40cc9ccf42
    Author: Ildar Kamalov <[email protected]>
    Date:   Thu Jul 23 16:22:13 2026 +0300
    
        add some respect for login page
    
    commit 6fa78d1946
    Author: Ildar Kamalov <[email protected]>
    Date:   Thu Jul 23 15:58:28 2026 +0300
    
        fix lang change on public pages
    
    commit e8158d8a61
    Merge: a7c10ff29 7d88eb525
    Author: Ildar Kamalov <[email protected]>
    Date:   Thu Jul 23 15:25:03 2026 +0300
    
        Merge branch 'AGDNS-4277' into AGDNS-4225
    
    commit a7c10ff294
    Author: Ildar Kamalov <[email protected]>
    Date:   Thu Jul 23 14:12:03 2026 +0300
    
        fix lang labels
    
    commit 9b59e83e39
    Author: Ildar Kamalov <[email protected]>
    Date:   Thu Jul 23 14:05:01 2026 +0300
    
        add fully translated zh cn
    
    commit 817337ad81
    Author: Ildar Kamalov <[email protected]>
    Date:   Thu Jul 23 13:53:27 2026 +0300
    
        AGDNS-4225 fix lang import
    
    commit d3559e354b
    Author: Ildar Kamalov <[email protected]>
    Date:   Thu Jul 23 12:21:24 2026 +0300
    
        AGDNS-4225 fix language change, add language selector to install

commit 145a207442
Author: Ildar Kamalov <[email protected]>
Date:   Fri Jul 24 11:36:33 2026 +0300

    AGDNS-4277 review fix

commit 81a41ee4dc
Author: Ildar Kamalov <[email protected]>
Date:   Fri Jul 24 10:12:06 2026 +0300

    AGDNS-4277 review fix

commit 119f426bbe
Author: Ildar Kamalov <[email protected]>
Date:   Thu Jul 23 18:00:56 2026 +0300

    AGDNS-4277 fix get address entity

commit 31ae762860
Merge: 7d88eb525 e8e328709
Author: Ildar Kamalov <[email protected]>
Date:   Thu Jul 23 17:33:20 2026 +0300

    Merge branch 'master' into AGDNS-4277

commit 7d88eb5253
Author: Ildar Kamalov <[email protected]>
Date:   Thu Jul 23 15:24:03 2026 +0300

    missing translations

commit 3cc6179392
Author: Ildar Kamalov <[email protected]>
Date:   Thu Jul 23 14:14:46 2026 +0300

    fix

commit 7bd53b58e8
Author: Ildar Kamalov <[email protected]>
Date:   Wed Jul 22 17:42:30 2026 +0300

    safe search types

commit 77468b0b40
Author: Ildar Kamalov <[email protected]>
Date:   Wed Jul 22 17:12:30 2026 +0300

    revert

commit e73d826e7d
Merge: bac2eaae8 f078919e2
Author: Ildar Kamalov <[email protected]>
Date:   Wed Jul 22 17:09:56 2026 +0300

    Merge branch 'master' into AGDNS-4277

commit bac2eaae8b
Author: Ildar Kamalov <[email protected]>
Date:   Wed Jul 22 17:09:14 2026 +0300

    AGDNS-4277

commit 1aee4f3025
Merge: c79ff5454 758376ee1
Author: Ildar Kamalov <[email protected]>
Date:   Mon Jul 20 17:34:02 2026 +0300

    Merge branch 'master' into AGDNS-4277

commit c79ff5454e
Author: Ildar Kamalov <[email protected]>
Date:   Fri Jul 17 16:22:40 2026 +0300

    AGDNS-4277 generate client api using openapi specs
2026-07-27 11:17:46 +00:00

186 lines
6.1 KiB
JavaScript

import path from 'path';
import fs from 'fs';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import { BUILD_ENVS } from './constants.js';
const __dirname = path.dirname(new URL(import.meta.url).pathname);
const RESOURCES_PATH = __dirname;
const ENTRY_MAIN = path.resolve(RESOURCES_PATH, 'src/index.tsx');
const ENTRY_INSTALL = path.resolve(RESOURCES_PATH, 'src/install/index.tsx');
const ENTRY_LOGIN = path.resolve(RESOURCES_PATH, 'src/login/index.tsx');
const ENTRY_FORGOT_PASSWORD = path.resolve(RESOURCES_PATH, 'src/forgot_password/index.tsx');
const HTML_PATH = path.resolve(RESOURCES_PATH, 'public/index.html');
const HTML_INSTALL_PATH = path.resolve(RESOURCES_PATH, 'public/install.html');
const HTML_LOGIN_PATH = path.resolve(RESOURCES_PATH, 'public/login.html');
const HTML_FORGOT_PASSWORD_PATH = path.resolve(RESOURCES_PATH, 'public/forgot_password.html');
const ASSETS_PATH = path.resolve(RESOURCES_PATH, 'public/assets');
const PUBLIC_PATH = path.resolve(RESOURCES_PATH, '../build/static');
const PUBLIC_ASSETS_PATH = path.resolve(PUBLIC_PATH, 'assets');
const BUILD_ENV = BUILD_ENVS[process.env.BUILD_ENV];
const isDev = BUILD_ENV === BUILD_ENVS.dev;
function getAliasesFromTsconfig(tsconfigPath, resourcesPath) {
const tsConfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
const aliases = {};
if (tsConfig.compilerOptions && tsConfig.compilerOptions.paths) {
Object.entries(tsConfig.compilerOptions.paths).forEach(([alias, targetArr]) => {
if (alias.endsWith('/*')) {
const aliasName = alias.replace('/*', '');
const target = targetArr[0].replace('/*', '');
aliases[aliasName] = path.resolve(resourcesPath, target);
} else {
aliases[alias] = path.resolve(resourcesPath, targetArr[0]);
}
});
}
return aliases;
}
const tsConfigPath = path.resolve(__dirname, './tsconfig.json');
const aliasesFromTsconfig = getAliasesFromTsconfig(tsConfigPath, RESOURCES_PATH);
const config = {
mode: BUILD_ENV,
target: 'web',
context: RESOURCES_PATH,
entry: {
main: ENTRY_MAIN,
install: ENTRY_INSTALL,
login: ENTRY_LOGIN,
forgot_password: ENTRY_FORGOT_PASSWORD,
},
output: {
path: PUBLIC_PATH,
filename: '[name].[chunkhash].js',
chunkFilename: 'assets/[name].[chunkhash].js',
},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
alias: {
...aliasesFromTsconfig,
},
},
module: {
rules: [
{
test: /\.ya?ml$/,
type: 'json',
use: 'yaml-loader',
},
{
test: /\.(svg|png|jpe?g|gif|webp|ico|woff2?)$/i,
type: 'asset/resource',
generator: {
filename: 'assets/[name].[contenthash][ext]',
},
},
{
test: /\.module\.pcss$/i,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: 'css-loader',
options: {
importLoaders: 1,
modules: {
localIdentName: isDev
? '[name]__[local]--[hash:base64:5]'
: '[hash:base64]',
namedExport: false,
exportLocalsConvention: 'asIs',
},
esModule: true,
},
},
{
loader: 'postcss-loader',
},
],
},
{
test: /\.p?css$/i,
exclude: /\.module\.pcss$/i,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: 'css-loader',
options: {
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
},
],
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
],
},
plugins: [
new CleanWebpackPlugin({
root: PUBLIC_PATH,
verbose: false,
dry: false,
}),
new HtmlWebpackPlugin({
inject: true,
cache: false,
chunks: ['main'],
template: HTML_PATH,
}),
new HtmlWebpackPlugin({
inject: true,
cache: false,
chunks: ['install'],
filename: 'install.html',
template: HTML_INSTALL_PATH,
}),
new HtmlWebpackPlugin({
inject: true,
cache: false,
chunks: ['login'],
filename: 'login.html',
template: HTML_LOGIN_PATH,
}),
new HtmlWebpackPlugin({
inject: true,
cache: false,
chunks: ['forgot_password'],
filename: 'forgot_password.html',
template: HTML_FORGOT_PASSWORD_PATH,
}),
new MiniCssExtractPlugin({
filename: isDev ? '[name].css' : '[name].[hash].css',
chunkFilename: isDev ? 'assets/[id].css' : 'assets/[id].[hash].css',
}),
new CopyPlugin({
patterns: [
{
from: ASSETS_PATH,
to: PUBLIC_ASSETS_PATH,
},
],
}),
],
};
export default config;