@infomaximum/package-cli 2.23.0 → 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 CHANGED
@@ -2,6 +2,13 @@
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
+
5
12
  ## [2.23.0](https://github.com/Infomaximum/package-cli/compare/v2.22.6...v2.23.0) (2025-04-09)
6
13
 
7
14
 
@@ -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 в конфиге");
@@ -4,6 +4,7 @@ type FetchCodeToServerPluginParams = {
4
4
  fetcher: IntegrationFetcher;
5
5
  };
6
6
  export declare class FetchCodeToServerPlugin {
7
+ name: string;
7
8
  private fetcher;
8
9
  constructor({ fetcher }: FetchCodeToServerPluginParams);
9
10
  apply(compiler: Compiler): void;
@@ -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("FetchCodeToServerPlugin", () => {
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("⚠️ [FetchCodeToServerPlugin] Dynamic file names are not supported.");
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] File ${filename} was not found.`);
43
+ console.warn(`⚠️ [${FetchCodeToServerPlugin.name}] Файл ${filename} не найден.`);
43
44
  }
44
45
  });
45
46
  }
@@ -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, experimentalTransform, } = options;
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({
@@ -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\": \"ES2015\",\n \"lib\": [\"ES2015\"],\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# 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": "ES2015",
7
- "lib": ["ES2015"],
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 = "integration = {\n schema: 1,\n meta: {\n key: \"integrationKey\",\n name: \"\",\n description: \"\",\n },\n blocks: [],\n connections: [],\n};\n";
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
- integration = {
2
+ const app = {
3
3
  schema: 1,
4
- meta: {
5
- key: "integrationKey",
6
- name: "",
7
- description: "",
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 \"debug\": \"node --import tsx ./node_modules/.bin/im-package-cli integration debug\"\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";
@@ -14,7 +14,8 @@ export const INTEGRATION_PACKAGE_JSON_TEMPLATE = `\
14
14
  "test": "vitest --run",
15
15
  "test:coverage": "vitest --run --coverage",
16
16
  "test:ui": "vitest --ui",
17
- "debug": "node --import tsx ./node_modules/.bin/im-package-cli integration debug"
17
+ "debug": "node --import tsx ./node_modules/.bin/im-package-cli integration debug",
18
+ "prepare": "husky"
18
19
  },
19
20
  "devDependencies": {
20
21
  "@babel/plugin-transform-block-scoping": "^7.25.9",
@@ -30,7 +31,8 @@ export const INTEGRATION_PACKAGE_JSON_TEMPLATE = `\
30
31
  "typescript-eslint": "^8.29.0",
31
32
  "vitest": "^3.0.4",
32
33
  "@vitest/coverage-v8": "3.0.7",
33
- "@vitest/ui": "3.0.7"
34
+ "@vitest/ui": "3.0.7",
35
+ "husky": "^9.1.7"
34
36
  }
35
37
  }
36
38
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/package-cli",
3
- "version": "2.23.0",
3
+ "version": "2.23.1",
4
4
  "exports": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -29,7 +29,6 @@
29
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",
@@ -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
- }