@infomaximum/package-cli 2.24.0-2 → 2.25.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 +8 -8
- package/dist/application/applicationPaths.d.ts +15 -0
- package/dist/application/applicationPaths.js +9 -0
- package/dist/application/commands/build.d.ts +21 -0
- package/dist/application/commands/build.js +18 -0
- package/dist/application/commands/common.d.ts +16 -0
- package/dist/application/commands/common.js +28 -0
- package/dist/application/commands/init.d.ts +2 -0
- package/dist/application/commands/init.js +15 -0
- package/dist/application/commands/start.d.ts +18 -0
- package/dist/application/commands/start.js +23 -0
- package/dist/application/commands.d.ts +2 -0
- package/dist/application/commands.js +9 -0
- package/dist/application/configs/file.d.ts +10 -0
- package/dist/application/configs/file.js +11 -0
- package/dist/application/configs/webpack/common.d.ts +4 -0
- package/dist/application/configs/webpack/common.js +139 -0
- package/dist/application/configs/webpack/sections/devServer.d.ts +21 -0
- package/dist/application/configs/webpack/sections/devServer.js +19 -0
- package/dist/application/configs/webpack/sections/devtool.d.ts +3 -0
- package/dist/application/configs/webpack/sections/devtool.js +3 -0
- package/dist/application/configs/webpack/sections/loaders/cssLoaders.d.ts +8 -0
- package/dist/application/configs/webpack/sections/loaders/cssLoaders.js +16 -0
- package/dist/application/configs/webpack/sections/plugins/minimizer.d.ts +9 -0
- package/dist/application/configs/webpack/sections/plugins/minimizer.js +23 -0
- package/dist/application/configs/webpack/sections/plugins/modifyManifestApplication.d.ts +10 -0
- package/dist/application/configs/webpack/sections/plugins/modifyManifestApplication.js +35 -0
- package/dist/application/configs/webpack/sections/plugins/reactRefresh.d.ts +2 -0
- package/dist/application/configs/webpack/sections/plugins/reactRefresh.js +4 -0
- package/dist/application/configs/webpack/sections/plugins/zipApplication.d.ts +6 -0
- package/dist/application/configs/webpack/sections/plugins/zipApplication.js +11 -0
- package/dist/application/const.d.ts +10 -0
- package/dist/application/const.js +11 -0
- package/dist/application/index.d.ts +1 -0
- package/dist/application/index.js +1 -0
- package/dist/application/scripts/build.d.ts +2 -0
- package/dist/application/scripts/build.js +63 -0
- package/dist/application/scripts/init.d.ts +23 -0
- package/dist/application/scripts/init.js +60 -0
- package/dist/application/scripts/start.d.ts +2 -0
- package/dist/application/scripts/start.js +61 -0
- package/dist/application/templates/applicationConfigs.d.ts +3 -0
- package/dist/application/templates/applicationConfigs.js +60 -0
- package/dist/application/templates/applicationManifest.d.ts +1 -0
- package/dist/application/templates/applicationManifest.js +11 -0
- package/dist/application/templates/applicationPackageJson.d.ts +1 -0
- package/dist/application/templates/applicationPackageJson.js +29 -0
- package/dist/application/templates/applicationRCConfig.d.ts +1 -0
- package/dist/application/templates/applicationRCConfig.js +14 -0
- package/dist/application/templates/src/applicationContent.d.ts +1 -0
- package/dist/application/templates/src/applicationContent.js +11 -0
- package/dist/application/templates/src/applicationIndex.d.ts +1 -0
- package/dist/application/templates/src/applicationIndex.js +34 -0
- package/dist/arguments.js +2 -0
- package/dist/index.d.ts +0 -1
- package/dist/integration/scripts/init.d.ts +0 -5
- package/dist/integration/scripts/init.js +10 -5
- package/dist/integration/templates/integrationConfigs.d.ts +3 -2
- package/dist/integration/templates/integrationConfigs.js +134 -19
- package/dist/integration/templates/integrationIndex.d.ts +1 -1
- package/dist/integration/templates/integrationIndex.js +2 -2
- package/dist/integration/templates/integrationPackageJson.d.ts +1 -1
- package/dist/integration/templates/integrationPackageJson.js +7 -1
- package/dist/types.d.ts +1 -1
- package/dist/widget/commands.js +0 -2
- package/dist/widget/configs/file.d.ts +0 -2
- package/dist/widget/configs/webpack/common.d.ts +1 -1
- package/dist/widget/configs/webpack/common.js +6 -4
- package/dist/widget/configs/webpack/sections/plugins/minimizer.d.ts +1 -1
- package/dist/widget/scripts/init/actions.js +1 -1
- package/dist/widget/templates/src/widgetIndex.d.ts +1 -1
- package/dist/widget/templates/src/widgetIndex.js +1 -3
- package/dist/widget/templates/widgetPackageJson.d.ts +1 -1
- package/dist/widget/templates/widgetPackageJson.js +5 -10
- package/dist/widget/templates/widgetRCConfig.js +11 -15
- package/dist/widget/widgetPaths.d.ts +1 -2
- package/package.json +3 -6
- package/schemas/applicationConfigSchema.json +48 -0
- package/schemas/applicationManifestSchema.json +29 -0
- package/schemas/widgetConfigSchema.json +0 -5
- package/dist/widget/commands/build_script.d.ts +0 -7
- package/dist/widget/commands/build_script.js +0 -12
- package/dist/widget/scripts/build_script.d.ts +0 -3
- package/dist/widget/scripts/build_script.js +0 -39
package/CHANGELOG.md
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
## [2.
|
|
5
|
+
## [2.25.0](https://github.com/Infomaximum/package-cli/compare/v2.24.0...v2.25.0) (2025-12-03)
|
|
6
6
|
|
|
7
|
-
## [2.24.0-1](https://github.com/Infomaximum/package-cli/compare/v2.24.0-0...v2.24.0-1) (2025-06-20)
|
|
8
7
|
|
|
8
|
+
### Features
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
10
|
+
* добавлен запуск приложения для разработки ([77822ce](https://github.com/Infomaximum/package-cli/commit/77822cec943be8739838dd90c35fa0e9ae1c7132))
|
|
11
|
+
* добавлена сборка приложений ([3d3a04d](https://github.com/Infomaximum/package-cli/commit/3d3a04d0f112c53a1faafb0fb8f077894bab5652))
|
|
12
|
+
* добавлен манифест ([9afec05](https://github.com/Infomaximum/package-cli/commit/9afec056ee319319c006ab8d1c7e64a492633b15))
|
|
13
|
+
* добавлена возможность инициализировать проект приложения ([2d76102](https://github.com/Infomaximum/package-cli/commit/2d7610224e86f031d488aecb312b7587c63ec828))
|
|
13
14
|
|
|
14
|
-
## [2.24.0
|
|
15
|
+
## [2.24.0](https://github.com/Infomaximum/package-cli/compare/v2.23.1...v2.24.0) (2025-09-23)
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
### Features
|
|
18
19
|
|
|
19
|
-
*
|
|
20
|
-
* добавлена поддержка externals ([897eb0c](https://github.com/Infomaximum/package-cli/commit/897eb0cba2b3921f47c6d10d02de860b50d4c151))
|
|
20
|
+
* updated eslint config and add commitlint rules ([c3b94d8](https://github.com/Infomaximum/package-cli/commit/c3b94d8ed29a27b3146e758a212ef44d4f9ef9d1))
|
|
21
21
|
|
|
22
22
|
### [2.23.1](https://github.com/Infomaximum/package-cli/compare/v2.23.0...v2.23.1) (2025-06-02)
|
|
23
23
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MergedApplicationBuildOptions } from "./commands/build.js";
|
|
2
|
+
import type { MergedApplicationStartOptions } from "./commands/start.js";
|
|
3
|
+
export type ApplicationPaths = ReturnType<typeof generateApplicationPaths>;
|
|
4
|
+
type Options = MergedApplicationBuildOptions | MergedApplicationStartOptions;
|
|
5
|
+
export declare function generateApplicationPaths({ entry, applicationManifest, buildDir, }: Options): {
|
|
6
|
+
moduleIndex: string;
|
|
7
|
+
applicationManifestJsonPath: string;
|
|
8
|
+
applicationBuildDirPath: string;
|
|
9
|
+
appPath: string;
|
|
10
|
+
appBuildPath: string;
|
|
11
|
+
appPackageJson: string;
|
|
12
|
+
appTsConfig: string;
|
|
13
|
+
appNodeModules: string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { _resolveApp, generateGlobalPaths, generateIndexPath, } from "../paths.js";
|
|
3
|
+
const resolveApp = _resolveApp();
|
|
4
|
+
export function generateApplicationPaths({ entry, applicationManifest, buildDir, }) {
|
|
5
|
+
const globalPaths = generateGlobalPaths({ buildDir });
|
|
6
|
+
return Object.assign(Object.assign({}, globalPaths), { get moduleIndex() {
|
|
7
|
+
return generateIndexPath(entry);
|
|
8
|
+
}, applicationManifestJsonPath: resolveApp(applicationManifest), applicationBuildDirPath: resolveApp(buildDir) });
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type InputApplicationCommonOptions } from "./common.js";
|
|
3
|
+
export type InputBuildOptions = {
|
|
4
|
+
dev: boolean;
|
|
5
|
+
port?: string | number;
|
|
6
|
+
host?: string;
|
|
7
|
+
buildDir?: string;
|
|
8
|
+
} & InputApplicationCommonOptions;
|
|
9
|
+
export type MergedApplicationBuildOptions = ReturnType<typeof mergeApplicationWithOptionsBuild>;
|
|
10
|
+
declare function mergeApplicationWithOptionsBuild(options: InputBuildOptions): {
|
|
11
|
+
entry: string;
|
|
12
|
+
packageDir: string;
|
|
13
|
+
packageManifest: string;
|
|
14
|
+
applicationManifest: string;
|
|
15
|
+
buildDir: string;
|
|
16
|
+
host: string | undefined;
|
|
17
|
+
port: string | number | undefined;
|
|
18
|
+
dev: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const registerApplicationBuildCommand: (applicationCommand: Command) => void;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getApplicationConfigFromFile } from "../configs/file.js";
|
|
2
|
+
import { mergeApplicationConfigWithOptionsCommon, registerApplicationCommonOption, } from "./common.js";
|
|
3
|
+
import { runApplicationBuild } from "../scripts/build.js";
|
|
4
|
+
function mergeApplicationWithOptionsBuild(options) {
|
|
5
|
+
const config = getApplicationConfigFromFile();
|
|
6
|
+
return Object.assign({ host: options.host || (config === null || config === void 0 ? void 0 : config.host), port: options.port || (config === null || config === void 0 ? void 0 : config.port), dev: options.dev }, mergeApplicationConfigWithOptionsCommon(config, options));
|
|
7
|
+
}
|
|
8
|
+
export const registerApplicationBuildCommand = (applicationCommand) => {
|
|
9
|
+
const applicationBuildCommand = applicationCommand.command("build");
|
|
10
|
+
registerApplicationCommonOption(applicationBuildCommand);
|
|
11
|
+
applicationBuildCommand
|
|
12
|
+
.description("Выполняет сборку пакета")
|
|
13
|
+
.option("--build-dir <buildDirPath>", "путь до директории в которую будет собран пакет")
|
|
14
|
+
.option("--dev", "собрать пакет для разработки", false)
|
|
15
|
+
.option("--host <host>", "хост который будет указан в манифесте приложения")
|
|
16
|
+
.option("--port <port>", "порт который будет указан в манифесте приложения")
|
|
17
|
+
.action((options) => runApplicationBuild(mergeApplicationWithOptionsBuild(options)));
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApplicationRCConfig } from "../configs/file.js";
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
import { type InputPackageOptions } from "../../package/commands.js";
|
|
4
|
+
export type InputApplicationCommonOptions = {
|
|
5
|
+
entry: string;
|
|
6
|
+
applicationManifest?: string;
|
|
7
|
+
} & InputPackageOptions;
|
|
8
|
+
export type MergedApplicationCommonOptions = ReturnType<typeof mergeApplicationConfigWithOptionsCommon>;
|
|
9
|
+
export declare function registerApplicationCommonOption(command: Command): void;
|
|
10
|
+
export declare function mergeApplicationConfigWithOptionsCommon(config: ApplicationRCConfig | undefined, options: InputApplicationCommonOptions): {
|
|
11
|
+
entry: string;
|
|
12
|
+
packageDir: string;
|
|
13
|
+
packageManifest: string;
|
|
14
|
+
applicationManifest: string;
|
|
15
|
+
buildDir: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { assertSimple } from "@infomaximum/assert";
|
|
3
|
+
import { DEFAULT_BUILD_DIR_NAME } from "../../const.js";
|
|
4
|
+
import { registerPackageOptions, } from "../../package/commands.js";
|
|
5
|
+
export function registerApplicationCommonOption(command) {
|
|
6
|
+
registerPackageOptions(command);
|
|
7
|
+
command
|
|
8
|
+
.option("--entry <path>", "путь до entrypoint")
|
|
9
|
+
.option("--application-manifest <manifestPath>", "путь до файла манифеста приложения");
|
|
10
|
+
}
|
|
11
|
+
export function mergeApplicationConfigWithOptionsCommon(config, options) {
|
|
12
|
+
const entry = options.entry || (config === null || config === void 0 ? void 0 : config.entry);
|
|
13
|
+
const packageDir = (options === null || options === void 0 ? void 0 : options.packageDir) || (config === null || config === void 0 ? void 0 : config.packageDir);
|
|
14
|
+
const buildDir = (config === null || config === void 0 ? void 0 : config.buildDir) || DEFAULT_BUILD_DIR_NAME;
|
|
15
|
+
const packageManifest = (options === null || options === void 0 ? void 0 : options.packageManifest) || (config === null || config === void 0 ? void 0 : config.packageManifest);
|
|
16
|
+
const applicationManifest = (options === null || options === void 0 ? void 0 : options.applicationManifest) || (config === null || config === void 0 ? void 0 : config.applicationManifest);
|
|
17
|
+
assertSimple(!!entry, chalk.red("В конфигурации не задан entry"));
|
|
18
|
+
assertSimple(!!packageDir, chalk.red("В конфигурации не задан packageDir"));
|
|
19
|
+
assertSimple(!!packageManifest, chalk.red("В конфигурации не задан packageManifest"));
|
|
20
|
+
assertSimple(!!applicationManifest, chalk.red("В конфигурации не задан applicationManifest"));
|
|
21
|
+
return {
|
|
22
|
+
entry,
|
|
23
|
+
packageDir,
|
|
24
|
+
packageManifest,
|
|
25
|
+
applicationManifest,
|
|
26
|
+
buildDir,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { runInitEntityScript } from "../../plopHelpers.js";
|
|
3
|
+
import { getInitApplicationActions } from "../scripts/init.js";
|
|
4
|
+
export const registerApplicationInitCommand = (applicationCommand) => {
|
|
5
|
+
const applicationInitCommand = applicationCommand.command("init <project-directory>");
|
|
6
|
+
applicationInitCommand
|
|
7
|
+
.description("Инициализация проекта приложения")
|
|
8
|
+
.action((dirName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
runInitEntityScript({
|
|
10
|
+
dirName,
|
|
11
|
+
entity: "application",
|
|
12
|
+
actions: yield getInitApplicationActions(),
|
|
13
|
+
});
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type InputApplicationCommonOptions } from "./common.js";
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
export type InputApplicationStartOptions = {
|
|
4
|
+
port: string | number;
|
|
5
|
+
host: string;
|
|
6
|
+
} & InputApplicationCommonOptions;
|
|
7
|
+
export type MergedApplicationStartOptions = ReturnType<typeof configMergeWithOptionsStart>;
|
|
8
|
+
declare function configMergeWithOptionsStart(options: InputApplicationStartOptions): {
|
|
9
|
+
entry: string;
|
|
10
|
+
packageDir: string;
|
|
11
|
+
packageManifest: string;
|
|
12
|
+
applicationManifest: string;
|
|
13
|
+
buildDir: string;
|
|
14
|
+
host: string;
|
|
15
|
+
port: string | number;
|
|
16
|
+
};
|
|
17
|
+
export declare const registerApplicationStartCommand: (applicationCommand: Command) => void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { assertSilent } from "@infomaximum/assert";
|
|
3
|
+
import { getApplicationConfigFromFile } from "../configs/file.js";
|
|
4
|
+
import { mergeApplicationConfigWithOptionsCommon, registerApplicationCommonOption, } from "./common.js";
|
|
5
|
+
import { APPLICATION_DEFAULT_HOST, APPLICATION_DEFAULT_PORT, } from "../const.js";
|
|
6
|
+
import { runApplicationDevServer } from "../scripts/start.js";
|
|
7
|
+
function configMergeWithOptionsStart(options) {
|
|
8
|
+
const config = getApplicationConfigFromFile();
|
|
9
|
+
const host = options.host || (config === null || config === void 0 ? void 0 : config.host);
|
|
10
|
+
const port = options.port || (config === null || config === void 0 ? void 0 : config.port);
|
|
11
|
+
assertSilent(!!host, chalk.yellow(`В конфигурациях не найден host, используется host по умолчанию "${APPLICATION_DEFAULT_HOST}"`));
|
|
12
|
+
assertSilent(!!port, chalk.yellow(`В конфигурациях не найден port, используется port по умолчанию "${APPLICATION_DEFAULT_PORT}"`));
|
|
13
|
+
return Object.assign({ host: host || APPLICATION_DEFAULT_HOST, port: port || APPLICATION_DEFAULT_PORT }, mergeApplicationConfigWithOptionsCommon(config, options));
|
|
14
|
+
}
|
|
15
|
+
export const registerApplicationStartCommand = (applicationCommand) => {
|
|
16
|
+
const applicationStartCommand = applicationCommand.command("start");
|
|
17
|
+
registerApplicationCommonOption(applicationStartCommand);
|
|
18
|
+
applicationStartCommand
|
|
19
|
+
.description("Выполняет запуск проекта для разработки")
|
|
20
|
+
.option("--port <port>", "порт на котором будет доступно приложение")
|
|
21
|
+
.option("--host <host>", "host на котором будет доступно приложение")
|
|
22
|
+
.action((options) => runApplicationDevServer(configMergeWithOptionsStart(options)));
|
|
23
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { registerApplicationInitCommand } from "./commands/init.js";
|
|
2
|
+
import { registerApplicationBuildCommand } from "./commands/build.js";
|
|
3
|
+
import { registerApplicationStartCommand } from "./commands/start.js";
|
|
4
|
+
export const registerApplicationCommands = (cli) => {
|
|
5
|
+
const applicationCommand = cli.command("application");
|
|
6
|
+
registerApplicationInitCommand(applicationCommand);
|
|
7
|
+
registerApplicationBuildCommand(applicationCommand);
|
|
8
|
+
registerApplicationStartCommand(applicationCommand);
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ApplicationRCConfig = {
|
|
2
|
+
entry: string;
|
|
3
|
+
applicationManifest: string;
|
|
4
|
+
packageManifest: string;
|
|
5
|
+
packageDir: string;
|
|
6
|
+
buildDir: string;
|
|
7
|
+
port: number;
|
|
8
|
+
host: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const getApplicationConfigFromFile: () => ApplicationRCConfig | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { rcFile } from "rc-config-loader";
|
|
2
|
+
import { APPLICATION_CONFIG_FIELD_NAME, APPLICATION_CONFIG_FILE_NAME, } from "../const.js";
|
|
3
|
+
export const getApplicationConfigFromFile = () => {
|
|
4
|
+
var _a;
|
|
5
|
+
const config = (_a = rcFile(APPLICATION_CONFIG_FILE_NAME, {
|
|
6
|
+
cwd: process.cwd(),
|
|
7
|
+
packageJSON: { fieldName: APPLICATION_CONFIG_FIELD_NAME },
|
|
8
|
+
configFileName: APPLICATION_CONFIG_FILE_NAME,
|
|
9
|
+
})) === null || _a === void 0 ? void 0 : _a.config;
|
|
10
|
+
return config;
|
|
11
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Configuration } from "webpack";
|
|
2
|
+
import type { Mode } from "../../../paths.js";
|
|
3
|
+
import type { ApplicationPaths } from "../../applicationPaths.js";
|
|
4
|
+
export declare const getCommonApplicationWebpackConfig: (mode: Mode, PATHS: ApplicationPaths) => Configuration;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
|
2
|
+
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
3
|
+
import webpack, {} from "webpack";
|
|
4
|
+
import { applicationCssLoaders } from "./sections/loaders/cssLoaders.js";
|
|
5
|
+
import { compact, systemRequire } from "../../../utils.js";
|
|
6
|
+
import { MANIFEST_REG_EXP } from "../../../const.js";
|
|
7
|
+
import { APPLICATION_OUTPUT_FILE_NAME, APPLICATION_OUTPUT_FULL_FILE_NAME, } from "../../const.js";
|
|
8
|
+
const { ProgressPlugin } = webpack;
|
|
9
|
+
const isProduction = (mode) => mode === "production";
|
|
10
|
+
const isDevelopment = (mode) => mode === "development";
|
|
11
|
+
export const getCommonApplicationWebpackConfig = (mode, PATHS) => {
|
|
12
|
+
const manifestEntry = systemRequire(PATHS.applicationManifestJsonPath).entry;
|
|
13
|
+
const filename = isProduction(mode)
|
|
14
|
+
? `${APPLICATION_OUTPUT_FILE_NAME}.[contenthash].js`
|
|
15
|
+
: APPLICATION_OUTPUT_FULL_FILE_NAME;
|
|
16
|
+
return {
|
|
17
|
+
mode,
|
|
18
|
+
entry: [PATHS.moduleIndex, PATHS.applicationManifestJsonPath],
|
|
19
|
+
output: {
|
|
20
|
+
path: PATHS.appBuildPath,
|
|
21
|
+
filename: manifestEntry !== null && manifestEntry !== void 0 ? manifestEntry : filename,
|
|
22
|
+
asyncChunks: false,
|
|
23
|
+
clean: true,
|
|
24
|
+
},
|
|
25
|
+
plugins: compact([
|
|
26
|
+
new ProgressPlugin(),
|
|
27
|
+
new ForkTsCheckerWebpackPlugin({
|
|
28
|
+
typescript: {
|
|
29
|
+
mode: "write-references",
|
|
30
|
+
diagnosticOptions: {
|
|
31
|
+
semantic: true,
|
|
32
|
+
syntactic: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
]),
|
|
37
|
+
module: {
|
|
38
|
+
rules: [
|
|
39
|
+
{
|
|
40
|
+
test: /\.(js|ts|jsx|tsx)$/i,
|
|
41
|
+
exclude: ["/node_modules/"],
|
|
42
|
+
loader: systemRequire.resolve("babel-loader"),
|
|
43
|
+
options: {
|
|
44
|
+
plugins: [
|
|
45
|
+
systemRequire.resolve("babel-plugin-inline-json-import"),
|
|
46
|
+
systemRequire.resolve("@babel/plugin-transform-runtime"),
|
|
47
|
+
!isProduction(mode) &&
|
|
48
|
+
systemRequire.resolve("react-refresh/babel"),
|
|
49
|
+
].filter(Boolean),
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
test: /\.css$/i,
|
|
54
|
+
use: applicationCssLoaders,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
test: /\.s[ac]ss$/i,
|
|
58
|
+
use: [
|
|
59
|
+
...applicationCssLoaders,
|
|
60
|
+
{
|
|
61
|
+
loader: systemRequire.resolve("sass-loader"),
|
|
62
|
+
options: {
|
|
63
|
+
implementation: systemRequire("sass"),
|
|
64
|
+
sassOptions: {
|
|
65
|
+
fiber: false,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
test: /\.less$/i,
|
|
73
|
+
use: [
|
|
74
|
+
...applicationCssLoaders,
|
|
75
|
+
{
|
|
76
|
+
loader: systemRequire.resolve("less-loader"),
|
|
77
|
+
options: {
|
|
78
|
+
sourceMap: isDevelopment(mode),
|
|
79
|
+
lessOptions: {
|
|
80
|
+
javascriptEnabled: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
test: /\.(eot|ttf|woff|woff2|png|jpg|jpeg|webp|gif)$/i,
|
|
88
|
+
type: "asset/inline",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
test: MANIFEST_REG_EXP,
|
|
92
|
+
type: "asset/resource",
|
|
93
|
+
generator: {
|
|
94
|
+
filename: "[name][ext]",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
test: /\.svg$/i,
|
|
99
|
+
oneOf: [
|
|
100
|
+
{
|
|
101
|
+
type: "asset",
|
|
102
|
+
resourceQuery: /url/,
|
|
103
|
+
parser: {
|
|
104
|
+
dataUrlCondition: {
|
|
105
|
+
maxSize: 64 * 1024,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
generator: {
|
|
109
|
+
filename: "build/static/[hash][ext][query]",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: "asset/source",
|
|
114
|
+
resourceQuery: /src/,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
issuer: /\.[jt]sx?$/,
|
|
118
|
+
loader: systemRequire.resolve("@svgr/webpack"),
|
|
119
|
+
options: {
|
|
120
|
+
svgoConfig: {
|
|
121
|
+
plugins: [
|
|
122
|
+
{
|
|
123
|
+
name: "removeViewBox",
|
|
124
|
+
active: false,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
resolve: {
|
|
135
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
136
|
+
plugins: [new TsconfigPathsPlugin()],
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type DevServerParams = {
|
|
2
|
+
port: string;
|
|
3
|
+
host: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const getDevServerConfig: ({ host, port }: DevServerParams) => {
|
|
6
|
+
open: false;
|
|
7
|
+
hot: true;
|
|
8
|
+
port: string;
|
|
9
|
+
host: string;
|
|
10
|
+
headers: {
|
|
11
|
+
"Access-Control-Allow-Origin": string;
|
|
12
|
+
};
|
|
13
|
+
devMiddleware: {
|
|
14
|
+
writeToDisk: false;
|
|
15
|
+
};
|
|
16
|
+
allowedHosts: string;
|
|
17
|
+
client: {
|
|
18
|
+
logging: "error";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {} from "webpack-dev-server";
|
|
2
|
+
export const getDevServerConfig = ({ host, port }) => {
|
|
3
|
+
return {
|
|
4
|
+
open: false,
|
|
5
|
+
hot: true,
|
|
6
|
+
port,
|
|
7
|
+
host,
|
|
8
|
+
headers: {
|
|
9
|
+
"Access-Control-Allow-Origin": "*",
|
|
10
|
+
},
|
|
11
|
+
devMiddleware: {
|
|
12
|
+
writeToDisk: false,
|
|
13
|
+
},
|
|
14
|
+
allowedHosts: "all",
|
|
15
|
+
client: {
|
|
16
|
+
logging: "error",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { systemRequire } from "../../../../../utils.js";
|
|
2
|
+
export const applicationCssLoaders = [
|
|
3
|
+
systemRequire.resolve("style-loader"),
|
|
4
|
+
systemRequire.resolve("css-loader"),
|
|
5
|
+
{
|
|
6
|
+
loader: systemRequire.resolve("postcss-loader"),
|
|
7
|
+
options: {
|
|
8
|
+
postcssOptions: {
|
|
9
|
+
plugins: [
|
|
10
|
+
systemRequire.resolve("postcss-preset-env"),
|
|
11
|
+
systemRequire.resolve("autoprefixer"),
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
2
|
+
import TerserWebpackPlugin from "terser-webpack-plugin";
|
|
3
|
+
export declare const getApplicationMinimizer: () => {
|
|
4
|
+
optimization: {
|
|
5
|
+
minimize: boolean;
|
|
6
|
+
splitChunks: boolean;
|
|
7
|
+
minimizer: (TerserWebpackPlugin<import("terser").MinifyOptions> | CssMinimizerPlugin<CssMinimizerPlugin.CssNanoOptionsExtended>)[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
2
|
+
import TerserWebpackPlugin from "terser-webpack-plugin";
|
|
3
|
+
export const getApplicationMinimizer = () => {
|
|
4
|
+
return {
|
|
5
|
+
optimization: {
|
|
6
|
+
minimize: true,
|
|
7
|
+
splitChunks: false,
|
|
8
|
+
minimizer: [
|
|
9
|
+
new TerserWebpackPlugin({
|
|
10
|
+
minify: TerserWebpackPlugin.terserMinify,
|
|
11
|
+
parallel: true,
|
|
12
|
+
extractComments: false,
|
|
13
|
+
terserOptions: {
|
|
14
|
+
format: {
|
|
15
|
+
comments: false,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
new CssMinimizerPlugin(),
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
|
|
2
|
+
import type { ApplicationPaths } from "../../../../applicationPaths.js";
|
|
3
|
+
type Params = {
|
|
4
|
+
port?: string | number;
|
|
5
|
+
host?: string;
|
|
6
|
+
isBuildDevMode: boolean;
|
|
7
|
+
APPLICATION_PATHS: ApplicationPaths;
|
|
8
|
+
};
|
|
9
|
+
export declare const getModifyManifestApplicationPlugin: ({ host, port, isBuildDevMode, APPLICATION_PATHS, }: Params) => JsonModifyWebpackPlugin;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
|
|
2
|
+
import { DEV_POSTFIX } from "../../../../../const.js";
|
|
3
|
+
import { removeServiceFieldsForDevelopment } from "../../../../../utils.js";
|
|
4
|
+
import { APPLICATION_OUTPUT_FILE_NAME, APPLICATION_OUTPUT_FULL_FILE_NAME, } from "../../../../const.js";
|
|
5
|
+
export const getModifyManifestApplicationPlugin = ({ host, port, isBuildDevMode, APPLICATION_PATHS, }) => {
|
|
6
|
+
return new JsonModifyWebpackPlugin({
|
|
7
|
+
matchers: [
|
|
8
|
+
{
|
|
9
|
+
matcher: /^manifest.json$/,
|
|
10
|
+
action: (currentJsonContent, assetNames) => {
|
|
11
|
+
const manifestEntry = currentJsonContent.entry;
|
|
12
|
+
if (isBuildDevMode && host && port) {
|
|
13
|
+
currentJsonContent.entry = `http://${host}:${port}/${manifestEntry !== null && manifestEntry !== void 0 ? manifestEntry : APPLICATION_OUTPUT_FULL_FILE_NAME}`;
|
|
14
|
+
if ((currentJsonContent === null || currentJsonContent === void 0 ? void 0 : currentJsonContent.name) &&
|
|
15
|
+
typeof currentJsonContent.name === "object") {
|
|
16
|
+
Object.keys(currentJsonContent.name).forEach((lang) => {
|
|
17
|
+
Object.assign(currentJsonContent.name, {
|
|
18
|
+
[lang]: currentJsonContent.name[lang] + DEV_POSTFIX,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (!manifestEntry) {
|
|
24
|
+
const entryName = assetNames.find((asset) => asset.startsWith(`${APPLICATION_OUTPUT_FILE_NAME}.`));
|
|
25
|
+
if (entryName) {
|
|
26
|
+
currentJsonContent.entry = entryName;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
removeServiceFieldsForDevelopment(currentJsonContent);
|
|
30
|
+
return currentJsonContent;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ZipPlugin from "zip-webpack-plugin";
|
|
2
|
+
import { APPLICATION_ARCHIVE_FULL_NAME } from "../../../../const.js";
|
|
3
|
+
import { BUILD_ARCHIVE_EXT, MANIFEST_JSON_FILE_NAME, } from "../../../../../const.js";
|
|
4
|
+
import { compact } from "../../../../../utils.js";
|
|
5
|
+
export const getZipApplicationPlugin = ({ isOnlyManifest }) => {
|
|
6
|
+
return new ZipPlugin({
|
|
7
|
+
filename: APPLICATION_ARCHIVE_FULL_NAME,
|
|
8
|
+
extension: BUILD_ARCHIVE_EXT,
|
|
9
|
+
include: isOnlyManifest ? compact([MANIFEST_JSON_FILE_NAME]) : undefined,
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const APPLICATION_SDK_LIB_NAME = "@infomaximum/application-types";
|
|
2
|
+
export declare const APPLICATION_OUTPUT_FILE_NAME = "application";
|
|
3
|
+
export declare const APPLICATION_OUTPUT_FULL_FILE_NAME = "application.js";
|
|
4
|
+
export declare const APPLICATION_SDK_LIB_VERSION = "1.1.1";
|
|
5
|
+
export declare const APPLICATION_CONFIG_FIELD_NAME = "application";
|
|
6
|
+
export declare const APPLICATION_CONFIG_FILE_NAME = "applicationrc";
|
|
7
|
+
export declare const APPLICATION_DEFAULT_HOST = "localhost";
|
|
8
|
+
export declare const APPLICATION_DEFAULT_PORT = "5566";
|
|
9
|
+
export declare const APPLICATION_ARCHIVE_NAME = "application";
|
|
10
|
+
export declare const APPLICATION_ARCHIVE_FULL_NAME = "application.zip";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BUILD_ARCHIVE_EXT } from "../const.js";
|
|
2
|
+
export const APPLICATION_SDK_LIB_NAME = "@infomaximum/application-types";
|
|
3
|
+
export const APPLICATION_OUTPUT_FILE_NAME = "application";
|
|
4
|
+
export const APPLICATION_OUTPUT_FULL_FILE_NAME = `${APPLICATION_OUTPUT_FILE_NAME}.js`;
|
|
5
|
+
export const APPLICATION_SDK_LIB_VERSION = "1.1.1";
|
|
6
|
+
export const APPLICATION_CONFIG_FIELD_NAME = "application";
|
|
7
|
+
export const APPLICATION_CONFIG_FILE_NAME = `${APPLICATION_CONFIG_FIELD_NAME}rc`;
|
|
8
|
+
export const APPLICATION_DEFAULT_HOST = "localhost";
|
|
9
|
+
export const APPLICATION_DEFAULT_PORT = "5566";
|
|
10
|
+
export const APPLICATION_ARCHIVE_NAME = "application";
|
|
11
|
+
export const APPLICATION_ARCHIVE_FULL_NAME = `${APPLICATION_ARCHIVE_NAME}.${BUILD_ARCHIVE_EXT}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerApplicationCommands } from "./commands.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerApplicationCommands } from "./commands.js";
|