@infomaximum/package-cli 2.22.6 → 2.23.1
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 +20 -0
- package/dist/integration/commands/build.js +0 -1
- package/dist/integration/commands/debug.js +1 -0
- package/dist/integration/configs/webpack/FetchCodeToServerPlugin.d.ts +1 -0
- package/dist/integration/configs/webpack/FetchCodeToServerPlugin.js +4 -3
- package/dist/integration/configs/webpack/utils.d.ts +10 -0
- package/dist/integration/configs/webpack/utils.js +10 -0
- package/dist/integration/scripts/build.js +1 -4
- package/dist/integration/scripts/debugger.js +2 -1
- package/dist/integration/scripts/init.d.ts +5 -0
- package/dist/integration/scripts/init.js +31 -1
- package/dist/integration/templates/integrationConfigs.d.ts +4 -2
- package/dist/integration/templates/integrationConfigs.js +11 -2
- package/dist/integration/templates/integrationIndex.d.ts +1 -1
- package/dist/integration/templates/integrationIndex.js +6 -8
- package/dist/integration/templates/integrationPackageJson.d.ts +1 -1
- package/dist/integration/templates/integrationPackageJson.js +5 -2
- package/package.json +3 -4
- package/dist/integration/configs/webpack/ASTIntegrationPreamblePlugin.d.ts +0 -10
- package/dist/integration/configs/webpack/ASTIntegrationPreamblePlugin.js +0 -67
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
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.23.1](https://github.com/Infomaximum/package-cli/compare/v2.23.0...v2.23.1) (2025-06-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Изменение структуры ПИ, отключение флага experementa-transform ([1505f16](https://github.com/Infomaximum/package-cli/commit/1505f165cf8cfb1afc284f07543b0104724f014f))
|
|
11
|
+
|
|
12
|
+
## [2.23.0](https://github.com/Infomaximum/package-cli/compare/v2.22.6...v2.23.0) (2025-04-09)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* добавлен флаг для генерации схемы ([576b9a4](https://github.com/Infomaximum/package-cli/commit/576b9a4798f717941520b73084924672d6428715))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* arrows ([32b11ab](https://github.com/Infomaximum/package-cli/commit/32b11abf760c7113df187ef87498616fa6237527))
|
|
23
|
+
* исправлены преобразования кода ([56796ad](https://github.com/Infomaximum/package-cli/commit/56796adc51fed92620b5b6b8f7cfb254e3da2b80))
|
|
24
|
+
|
|
5
25
|
### [2.22.6](https://github.com/Infomaximum/package-cli/compare/v2.22.5...v2.22.6) (2025-04-04)
|
|
6
26
|
|
|
7
27
|
|
|
@@ -16,7 +16,6 @@ export const registerIntegrationBuildCommand = (integrationCommand) => {
|
|
|
16
16
|
.option("--copy", "копирование скрипта интеграции в буфер обмена", false)
|
|
17
17
|
.option("--fetchToServer", `отправка изменений на сервер (должен быть настроен файл ${INTEGRATION_CONFIG_RC_FILE_NAME}${INTEGRATION_CONFIG_RC_EXT})`, false)
|
|
18
18
|
.option("--beautify", `отформатировать код после сборки`, false)
|
|
19
|
-
.option("--experimental-transform", `эксперементальная функция по переносу общего кода в функции executePagination'`, false)
|
|
20
19
|
.action((options) => {
|
|
21
20
|
if (options.fetchToServer && typeof (config === null || config === void 0 ? void 0 : config.fetcher) !== "function") {
|
|
22
21
|
throw new Error("Не настроен конфиг или нет функции fetcher в конфиге");
|
|
@@ -8,6 +8,7 @@ export const registerIntegrationDebugCommand = (integrationCommand) => {
|
|
|
8
8
|
widgetDebugCommand
|
|
9
9
|
.description("Отладка проекта интеграции")
|
|
10
10
|
.option("--entityKey <key>", "Ключ сущности для которой запускается отладка")
|
|
11
|
+
.option("--isGenerateSchema", "Сгенерировать output_variables по output", false)
|
|
11
12
|
.option("--series", "Выполняет серию запусков отладки сущности", false)
|
|
12
13
|
.action((options) => {
|
|
13
14
|
const config = getConfigIntegrationFromFile();
|
|
@@ -3,14 +3,15 @@ import fs from "fs";
|
|
|
3
3
|
import crypto from "crypto";
|
|
4
4
|
export class FetchCodeToServerPlugin {
|
|
5
5
|
constructor({ fetcher }) {
|
|
6
|
+
this.name = "FetchCodeToServerPlugin";
|
|
6
7
|
this.fetcher = fetcher;
|
|
7
8
|
}
|
|
8
9
|
apply(compiler) {
|
|
9
|
-
compiler.hooks.afterEmit.tap(
|
|
10
|
+
compiler.hooks.afterEmit.tap(FetchCodeToServerPlugin.name, () => {
|
|
10
11
|
const outputPath = compiler.options.output.path || "";
|
|
11
12
|
let filename = compiler.options.output.filename;
|
|
12
13
|
if (typeof filename !== "string") {
|
|
13
|
-
console.warn(
|
|
14
|
+
console.warn(`⚠️ [${FetchCodeToServerPlugin.name}] Динамические имена файлов не поддерживаются.`);
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
const filePath = path.resolve(outputPath, filename);
|
|
@@ -39,7 +40,7 @@ export class FetchCodeToServerPlugin {
|
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
|
-
console.warn(`⚠️ [FetchCodeToServerPlugin]
|
|
43
|
+
console.warn(`⚠️ [${FetchCodeToServerPlugin.name}] Файл ${filename} не найден.`);
|
|
43
44
|
}
|
|
44
45
|
});
|
|
45
46
|
}
|
|
@@ -5,10 +5,20 @@ export declare const TERSER_OPTIONS: (isBeautifyCode: boolean) => {
|
|
|
5
5
|
format: {
|
|
6
6
|
comments: false;
|
|
7
7
|
beautify: boolean;
|
|
8
|
+
keep_numbers: true;
|
|
9
|
+
braces: true;
|
|
8
10
|
};
|
|
9
11
|
compress: {
|
|
10
12
|
booleans: false;
|
|
11
13
|
keep_fnames: false;
|
|
12
14
|
toplevel: true;
|
|
15
|
+
join_vars: false;
|
|
16
|
+
sequences: false;
|
|
17
|
+
unsafe_undefined: false;
|
|
18
|
+
hoist_vars: false;
|
|
19
|
+
hoist_funs: false;
|
|
20
|
+
hoist_props: false;
|
|
21
|
+
typeofs: false;
|
|
22
|
+
arrows: true;
|
|
13
23
|
};
|
|
14
24
|
};
|
|
@@ -7,10 +7,20 @@ export const TERSER_OPTIONS = (isBeautifyCode) => ({
|
|
|
7
7
|
format: {
|
|
8
8
|
comments: false,
|
|
9
9
|
beautify: isBeautifyCode,
|
|
10
|
+
keep_numbers: true,
|
|
11
|
+
braces: true,
|
|
10
12
|
},
|
|
11
13
|
compress: {
|
|
12
14
|
booleans: false,
|
|
13
15
|
keep_fnames: false,
|
|
14
16
|
toplevel: true,
|
|
17
|
+
join_vars: false,
|
|
18
|
+
sequences: false,
|
|
19
|
+
unsafe_undefined: false,
|
|
20
|
+
hoist_vars: false,
|
|
21
|
+
hoist_funs: false,
|
|
22
|
+
hoist_props: false,
|
|
23
|
+
typeofs: false,
|
|
24
|
+
arrows: true,
|
|
15
25
|
},
|
|
16
26
|
});
|
|
@@ -9,9 +9,8 @@ import path from "path";
|
|
|
9
9
|
import { merge } from "webpack-merge";
|
|
10
10
|
import { CopyToClipboardPlugin } from "../configs/webpack/CopyToClipboardPlugin.js";
|
|
11
11
|
import { FetchCodeToServerPlugin } from "../configs/webpack/FetchCodeToServerPlugin.js";
|
|
12
|
-
import { ASTIntegrationPreamblePlugin } from "../configs/webpack/ASTIntegrationPreamblePlugin.js";
|
|
13
12
|
export const runBuildIntegration = (options, rcConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
const { entry, buildDir, packageDir, packageManifest, type, watch, copy, beautify: isBeautifyCode,
|
|
13
|
+
const { entry, buildDir, packageDir, packageManifest, type, watch, copy, beautify: isBeautifyCode, } = options;
|
|
15
14
|
const INTEGRATION_PATHS = generateIntegrationPaths({
|
|
16
15
|
entry,
|
|
17
16
|
buildDir,
|
|
@@ -33,8 +32,6 @@ export const runBuildIntegration = (options, rcConfig) => __awaiter(void 0, void
|
|
|
33
32
|
{
|
|
34
33
|
plugins: [
|
|
35
34
|
copy && new CopyToClipboardPlugin(),
|
|
36
|
-
experimentalTransform &&
|
|
37
|
-
new ASTIntegrationPreamblePlugin({ isBeautifyCode }),
|
|
38
35
|
options.fetchToServer &&
|
|
39
36
|
typeof fetcherFromConfig === "function" &&
|
|
40
37
|
new FetchCodeToServerPlugin({
|
|
@@ -5,13 +5,14 @@ import { assertSimple } from "@infomaximum/assert";
|
|
|
5
5
|
import { INTEGRATION_CONFIG_RC_EXT, INTEGRATION_CONFIG_RC_FILE_NAME, } from "../const.js";
|
|
6
6
|
import { systemRequire } from "../../utils.js";
|
|
7
7
|
const runDebug = (options, rcConfig) => {
|
|
8
|
-
const { entityKey, series } = options;
|
|
8
|
+
const { entityKey, series, isGenerateSchema } = options;
|
|
9
9
|
const debuggingConfig = rcConfig === null || rcConfig === void 0 ? void 0 : rcConfig.debugging;
|
|
10
10
|
assertSimple(!!debuggingConfig, `Не задана конфигурация для отладки в файле: ${INTEGRATION_CONFIG_RC_FILE_NAME}${INTEGRATION_CONFIG_RC_EXT}`);
|
|
11
11
|
const executor = new IntegrationExecutor(globalThis.integration, {
|
|
12
12
|
entityKey,
|
|
13
13
|
debuggingConfig,
|
|
14
14
|
series,
|
|
15
|
+
isGenerateSchema,
|
|
15
16
|
});
|
|
16
17
|
try {
|
|
17
18
|
executor === null || executor === void 0 ? void 0 : executor.execute();
|
|
@@ -12,6 +12,11 @@ declare const getInitIntegrationActions: () => Promise<(data: Answers) => ({
|
|
|
12
12
|
path: string;
|
|
13
13
|
template: string;
|
|
14
14
|
data?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
type: "add";
|
|
17
|
+
path: string;
|
|
18
|
+
template: undefined;
|
|
19
|
+
data?: undefined;
|
|
15
20
|
} | {
|
|
16
21
|
type: "add";
|
|
17
22
|
path: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { INTEGRATION_BABEL_CONFIG, INTEGRATION_ENV_EXAMPLE_CONFIG, INTEGRATION_ESLINTRC, INTEGRATION_GITIGNORE, INTEGRATION_RC_CONFIG, INTEGRATION_TSCONFIG_JSON, INTEGRATION_VITEST_CONFIG, INTEGRATION_VSCODE_EXTENSIONS, INTEGRATION_VSCODE_LAUNCH, INTEGRATION_VSCODE_SETTINGS, } from "../templates/integrationConfigs.js";
|
|
2
|
+
import { INTEGRATION_BABEL_CONFIG, INTEGRATION_ENV_EXAMPLE_CONFIG, INTEGRATION_ESLINTRC, INTEGRATION_GITIGNORE, INTEGRATION_HUSKY_COMMITMSG, INTEGRATION_HUSKY_PRECOMMIT, INTEGRATION_RC_CONFIG, INTEGRATION_TSCONFIG_JSON, INTEGRATION_VITEST_CONFIG, INTEGRATION_VSCODE_EXTENSIONS, INTEGRATION_VSCODE_LAUNCH, INTEGRATION_VSCODE_SETTINGS, } from "../templates/integrationConfigs.js";
|
|
3
3
|
import { getPackageActions } from "../../package/scripts/actions.js";
|
|
4
4
|
import { INTEGRATION_INDEX_TEMPLATE } from "../templates/integrationIndex.js";
|
|
5
5
|
import { INTEGRATION_PACKAGE_JSON_TEMPLATE } from "../templates/integrationPackageJson.js";
|
|
@@ -13,6 +13,26 @@ const actions = ({ packageCliVersion, integrationSdkVersion }) => {
|
|
|
13
13
|
path: "src/index.ts",
|
|
14
14
|
template: INTEGRATION_INDEX_TEMPLATE,
|
|
15
15
|
},
|
|
16
|
+
{
|
|
17
|
+
type: "add",
|
|
18
|
+
path: "src/types/common.d.ts",
|
|
19
|
+
template: undefined
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: "add",
|
|
23
|
+
path: "src/utils/index.ts",
|
|
24
|
+
template: ""
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: "add",
|
|
28
|
+
path: "src/modules/template.ts",
|
|
29
|
+
template: ""
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "add",
|
|
33
|
+
path: "src/connections/base.ts",
|
|
34
|
+
template: ""
|
|
35
|
+
},
|
|
16
36
|
{
|
|
17
37
|
type: "add",
|
|
18
38
|
path: "tsconfig.json",
|
|
@@ -69,6 +89,16 @@ const actions = ({ packageCliVersion, integrationSdkVersion }) => {
|
|
|
69
89
|
path: ".vscode/extensions.json",
|
|
70
90
|
template: INTEGRATION_VSCODE_EXTENSIONS,
|
|
71
91
|
},
|
|
92
|
+
{
|
|
93
|
+
type: "add",
|
|
94
|
+
path: ".husky/commit-msg",
|
|
95
|
+
template: INTEGRATION_HUSKY_COMMITMSG,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: "add",
|
|
99
|
+
path: ".husky/pre-commit",
|
|
100
|
+
template: INTEGRATION_HUSKY_PRECOMMIT,
|
|
101
|
+
},
|
|
72
102
|
];
|
|
73
103
|
};
|
|
74
104
|
const getInitIntegrationActions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const INTEGRATION_TSCONFIG_JSON = "{\n \"compilerOptions\": {\n \"target\": \"
|
|
2
|
-
export declare const INTEGRATION_GITIGNORE = "# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/dist\n\n#documentation\n/docs\n\n# misc\n.DS_Store\n.env\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n/build\n.ultra.cache.json\n*.tsbuildinfo\n.node-xmlhttprequest-content-*\n.node-xmlhttprequest-sync-*\n";
|
|
1
|
+
export declare const INTEGRATION_TSCONFIG_JSON = "{\n \"compilerOptions\": {\n \"target\": \"ES2024\",\n \"lib\": [\"ES2024\",\"DOM\"],\n \"types\": [\"@infomaximum/integration-sdk\"],\n \"module\": \"Preserve\",\n \"esModuleInterop\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"skipLibCheck\": true,\n \"isolatedModules\": false\n },\n \"include\": [\"src\"]\n}\n";
|
|
2
|
+
export declare const INTEGRATION_GITIGNORE = "# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/dist\n\n#documentation\n/docs\n\n#package\n/package\n\n# misc\n.DS_Store\n.env\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n/build\n.ultra.cache.json\n*.tsbuildinfo\n.node-xmlhttprequest-content-*\n.node-xmlhttprequest-sync-*\n";
|
|
3
3
|
export declare const INTEGRATION_BABEL_CONFIG = "module.exports = {\n sourceType: \"unambiguous\",\n presets: [],\n plugins: [\"@babel/plugin-transform-block-scoping\"],\n};\n";
|
|
4
4
|
export declare const INTEGRATION_ESLINTRC = "const js = require(\"@eslint/js\");\nconst globals = require(\"globals\");\nconst tseslint = require(\"typescript-eslint\");\n\nmodule.exports = tseslint.config(\n { ignores: [\"dist\", \"build\", \"node_modules\"] },\n {\n extends: [js.configs.recommended, ...tseslint.configs.recommended],\n files: [\"**/*.{ts,tsx}\"],\n languageOptions: {\n ecmaVersion: 2020,\n globals: globals.browser,\n },\n plugins: {},\n rules: {\n \"@typescript-eslint/no-explicit-any\": \"warn\",\n },\n }\n);\n";
|
|
5
5
|
export declare const INTEGRATION_VITEST_CONFIG = "import { defineConfig } from 'vitest/config';\n\nexport default defineConfig({\n test: {\n coverage: {\n provider:'v8',\n exclude: [\n '**/*.config.*',\n 'src/index.ts',\n ],\n },\n },\n});\n";
|
|
@@ -8,3 +8,5 @@ export declare const INTEGRATION_ENV_EXAMPLE_CONFIG = "INTEGRATION_ID=0\nGRAPHQL
|
|
|
8
8
|
export declare const INTEGRATION_VSCODE_LAUNCH: string;
|
|
9
9
|
export declare const INTEGRATION_VSCODE_SETTINGS = "{\n \"typescript.tsdk\": \"node_modules/typescript/lib\",\n \"integration-debugger.isEnabled\": true,\n \"integration-debugger.debugConfigurationName\": \"Debug Integration\",\n \"integration-debugger.functionNames\": {\n \"single\": [\"executePagination\", \"execute\"],\n \"series\": [\"executePagination\"]\n }\n}\n";
|
|
10
10
|
export declare const INTEGRATION_VSCODE_EXTENSIONS = "{\n \"recommendations\": [\"Jokerok.integration-debugger\"]\n}\n";
|
|
11
|
+
export declare const INTEGRATION_HUSKY_PRECOMMIT = "yarn lint\n";
|
|
12
|
+
export declare const INTEGRATION_HUSKY_COMMITMSG = "yarn commitlint --edit $1\n";
|
|
@@ -3,8 +3,8 @@ import { INTEGRATION_SDK_LIB_NAME } from "../const.js";
|
|
|
3
3
|
export const INTEGRATION_TSCONFIG_JSON = `\
|
|
4
4
|
{
|
|
5
5
|
"compilerOptions": {
|
|
6
|
-
"target": "
|
|
7
|
-
"lib": ["
|
|
6
|
+
"target": "ES2024",
|
|
7
|
+
"lib": ["ES2024","DOM"],
|
|
8
8
|
"types": ["${INTEGRATION_SDK_LIB_NAME}"],
|
|
9
9
|
"module": "Preserve",
|
|
10
10
|
"esModuleInterop": true,
|
|
@@ -31,6 +31,9 @@ export const INTEGRATION_GITIGNORE = `\
|
|
|
31
31
|
#documentation
|
|
32
32
|
/docs
|
|
33
33
|
|
|
34
|
+
#package
|
|
35
|
+
/package
|
|
36
|
+
|
|
34
37
|
# misc
|
|
35
38
|
.DS_Store
|
|
36
39
|
.env
|
|
@@ -184,3 +187,9 @@ export const INTEGRATION_VSCODE_EXTENSIONS = `\
|
|
|
184
187
|
"recommendations": ["Jokerok.integration-debugger"]
|
|
185
188
|
}
|
|
186
189
|
`;
|
|
190
|
+
export const INTEGRATION_HUSKY_PRECOMMIT = `\
|
|
191
|
+
yarn lint
|
|
192
|
+
`;
|
|
193
|
+
export const INTEGRATION_HUSKY_COMMITMSG = `\
|
|
194
|
+
yarn commitlint --edit $1
|
|
195
|
+
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const INTEGRATION_INDEX_TEMPLATE = "
|
|
1
|
+
export declare const INTEGRATION_INDEX_TEMPLATE = "const app = {\n schema: 1,\n version:\"0.0.1\",\n label:\"Integration_template\",\n description:\"\",\n blocks: {},\n connections: {},\n};\n";
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export const INTEGRATION_INDEX_TEMPLATE = `\
|
|
2
|
-
|
|
2
|
+
const app = {
|
|
3
3
|
schema: 1,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
blocks: [],
|
|
10
|
-
connections: [],
|
|
4
|
+
version:"0.0.1",
|
|
5
|
+
label:"Integration_template",
|
|
6
|
+
description:"",
|
|
7
|
+
blocks: {},
|
|
8
|
+
connections: {},
|
|
11
9
|
};
|
|
12
10
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const INTEGRATION_PACKAGE_JSON_TEMPLATE = "{\n \"name\": \"template_integration\",\n \"version\": \"1.0.0\",\n \"main\": \"src/index.ts\",\n \"scripts\": {\n \"build\": \"im-package-cli integration build\",\n \"build:script\": \"im-package-cli integration build --type=script --beautify\",\n \"dev\": \"im-package-cli integration build --watch --beautify\",\n \"serve\": \"im-package-cli integration build --watch --fetchToServer --beautify\",\n \"lint\": \"tsc --noEmit && eslint src/ --ext .ts,.tsx --quiet\",\n \"test\": \"vitest --run\",\n \"test:coverage\": \"vitest --run --coverage\",\n \"test:ui\": \"vitest --ui\"\n },\n \"devDependencies\": {\n \"@babel/plugin-transform-block-scoping\": \"^7.25.9\",\n \"@eslint/js\": \"^9.23.0\",\n \"@infomaximum/integration-sdk\": \"^{{integrationSdkVersion}}\",\n \"@infomaximum/package-cli\": \"^{{packageCliVersion}}\",\n \"@types/node\": \"^0\",\n \"dotenv\": \"^16.4.7\",\n \"eslint\": \"^9.23.0\",\n \"globals\": \"^15.14.0\",\n \"tsx\": \"^4.19.3\",\n \"typescript\": \"^5.8.2\",\n \"typescript-eslint\": \"^8.29.0\",\n \"vitest\": \"^3.0.4\",\n \"@vitest/coverage-v8\": \"3.0.7\",\n \"@vitest/ui\": \"3.0.7\"\n }\n}\n";
|
|
1
|
+
export declare const INTEGRATION_PACKAGE_JSON_TEMPLATE = "{\n \"name\": \"template_integration\",\n \"version\": \"1.0.0\",\n \"main\": \"src/index.ts\",\n \"scripts\": {\n \"build\": \"im-package-cli integration build\",\n \"build:script\": \"im-package-cli integration build --type=script --beautify\",\n \"dev\": \"im-package-cli integration build --watch --beautify\",\n \"serve\": \"im-package-cli integration build --watch --fetchToServer --beautify\",\n \"lint\": \"tsc --noEmit && eslint src/ --ext .ts,.tsx --quiet\",\n \"test\": \"vitest --run\",\n \"test:coverage\": \"vitest --run --coverage\",\n \"test:ui\": \"vitest --ui\",\n \"debug\": \"node --import tsx ./node_modules/.bin/im-package-cli integration debug\",\n \"prepare\": \"husky\"\n },\n \"devDependencies\": {\n \"@babel/plugin-transform-block-scoping\": \"^7.25.9\",\n \"@eslint/js\": \"^9.23.0\",\n \"@infomaximum/integration-sdk\": \"^{{integrationSdkVersion}}\",\n \"@infomaximum/package-cli\": \"^{{packageCliVersion}}\",\n \"@types/node\": \"^0\",\n \"dotenv\": \"^16.4.7\",\n \"eslint\": \"^9.23.0\",\n \"globals\": \"^15.14.0\",\n \"tsx\": \"^4.19.3\",\n \"typescript\": \"^5.8.2\",\n \"typescript-eslint\": \"^8.29.0\",\n \"vitest\": \"^3.0.4\",\n \"@vitest/coverage-v8\": \"3.0.7\",\n \"@vitest/ui\": \"3.0.7\",\n \"husky\": \"^9.1.7\"\n }\n}\n";
|
|
@@ -13,7 +13,9 @@ export const INTEGRATION_PACKAGE_JSON_TEMPLATE = `\
|
|
|
13
13
|
"lint": "tsc --noEmit && eslint src/ --ext .ts,.tsx --quiet",
|
|
14
14
|
"test": "vitest --run",
|
|
15
15
|
"test:coverage": "vitest --run --coverage",
|
|
16
|
-
"test:ui": "vitest --ui"
|
|
16
|
+
"test:ui": "vitest --ui",
|
|
17
|
+
"debug": "node --import tsx ./node_modules/.bin/im-package-cli integration debug",
|
|
18
|
+
"prepare": "husky"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
19
21
|
"@babel/plugin-transform-block-scoping": "^7.25.9",
|
|
@@ -29,7 +31,8 @@ export const INTEGRATION_PACKAGE_JSON_TEMPLATE = `\
|
|
|
29
31
|
"typescript-eslint": "^8.29.0",
|
|
30
32
|
"vitest": "^3.0.4",
|
|
31
33
|
"@vitest/coverage-v8": "3.0.7",
|
|
32
|
-
"@vitest/ui": "3.0.7"
|
|
34
|
+
"@vitest/ui": "3.0.7",
|
|
35
|
+
"husky": "^9.1.7"
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infomaximum/package-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.1",
|
|
4
4
|
"exports": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -26,10 +26,9 @@
|
|
|
26
26
|
"@babel/core": "^7.23.6",
|
|
27
27
|
"@babel/plugin-transform-runtime": "^7.23.6",
|
|
28
28
|
"@infomaximum/assert": "^1.1.3",
|
|
29
|
-
"@infomaximum/integration-debugger": "^1.
|
|
29
|
+
"@infomaximum/integration-debugger": "^1.7.0",
|
|
30
30
|
"@infomaximum/json-modify-webpack-plugin": "^1.1.0",
|
|
31
31
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
32
|
-
"@saneksa/babel-plugin-function-transform": "^1.0.0",
|
|
33
32
|
"@svgr/webpack": "^8.1.0",
|
|
34
33
|
"autoprefixer": "^10.4.16",
|
|
35
34
|
"babel-loader": "^9.1.3",
|
|
@@ -71,7 +70,7 @@
|
|
|
71
70
|
"zip-webpack-plugin": "^4.0.1"
|
|
72
71
|
},
|
|
73
72
|
"devDependencies": {
|
|
74
|
-
"@infomaximum/integration-sdk": "^2.
|
|
73
|
+
"@infomaximum/integration-sdk": "^2.3.0",
|
|
75
74
|
"@types/babel__core": "^7.20.5",
|
|
76
75
|
"@types/fs-extra": "^11.0.4",
|
|
77
76
|
"@types/node": "^20.9.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Compiler } from "webpack";
|
|
2
|
-
type ASTIntegrationPreamblePluginParams = {
|
|
3
|
-
isBeautifyCode: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare class ASTIntegrationPreamblePlugin {
|
|
6
|
-
private isBeautifyCode;
|
|
7
|
-
constructor({ isBeautifyCode }: ASTIntegrationPreamblePluginParams);
|
|
8
|
-
apply(compiler: Compiler): void;
|
|
9
|
-
}
|
|
10
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { __asyncValues, __awaiter } from "tslib";
|
|
2
|
-
import { systemRequire } from "../../../utils.js";
|
|
3
|
-
import { transformSync } from "@babel/core";
|
|
4
|
-
import webpack, {} from "webpack";
|
|
5
|
-
import { minify } from "terser";
|
|
6
|
-
import { TERSER_OPTIONS } from "./utils.js";
|
|
7
|
-
const { Compilation } = webpack;
|
|
8
|
-
function minifyCode(code, isBeautifyCode) {
|
|
9
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
10
|
-
const result = yield minify(code, TERSER_OPTIONS(isBeautifyCode));
|
|
11
|
-
if (result.code) {
|
|
12
|
-
return result.code;
|
|
13
|
-
}
|
|
14
|
-
throw new Error("Минификация не удалась");
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
export class ASTIntegrationPreamblePlugin {
|
|
18
|
-
constructor({ isBeautifyCode }) {
|
|
19
|
-
this.isBeautifyCode = isBeautifyCode;
|
|
20
|
-
}
|
|
21
|
-
apply(compiler) {
|
|
22
|
-
compiler.hooks.compilation.tap("ASTIntegrationPreamblePlugin", (compilation) => {
|
|
23
|
-
compilation.hooks.processAssets.tapPromise({
|
|
24
|
-
name: "ASTIntegrationPreamblePlugin",
|
|
25
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_REPORT,
|
|
26
|
-
}, (assets) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
var _a, e_1, _b, _c;
|
|
28
|
-
var _d, _e;
|
|
29
|
-
try {
|
|
30
|
-
for (var _f = true, _g = __asyncValues(Object.entries(assets)), _h; _h = yield _g.next(), _a = _h.done, !_a; _f = true) {
|
|
31
|
-
_c = _h.value;
|
|
32
|
-
_f = false;
|
|
33
|
-
const [filename, source] = _c;
|
|
34
|
-
if (!filename.endsWith(".js"))
|
|
35
|
-
return;
|
|
36
|
-
const { RawSource } = compiler.webpack.sources;
|
|
37
|
-
const output = (_e = (_d = transformSync(source.source().toString(), {
|
|
38
|
-
sourceType: "unambiguous",
|
|
39
|
-
babelrc: false,
|
|
40
|
-
configFile: false,
|
|
41
|
-
plugins: [
|
|
42
|
-
[
|
|
43
|
-
systemRequire.resolve("@saneksa/babel-plugin-function-transform"),
|
|
44
|
-
{
|
|
45
|
-
functionName: "executePagination",
|
|
46
|
-
fieldName: "integration",
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
],
|
|
50
|
-
})) === null || _d === void 0 ? void 0 : _d.code) === null || _e === void 0 ? void 0 : _e.trim();
|
|
51
|
-
if (output) {
|
|
52
|
-
const outputCode = yield minifyCode(output, this.isBeautifyCode);
|
|
53
|
-
compilation.updateAsset(filename, new RawSource(outputCode));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
58
|
-
finally {
|
|
59
|
-
try {
|
|
60
|
-
if (!_f && !_a && (_b = _g.return)) yield _b.call(_g);
|
|
61
|
-
}
|
|
62
|
-
finally { if (e_1) throw e_1.error; }
|
|
63
|
-
}
|
|
64
|
-
}));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|