@infomaximum/package-cli 2.21.0 → 2.22.0-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.
Files changed (27) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/integration/commands/build.d.ts +2 -2
  3. package/dist/integration/commands/build.js +4 -2
  4. package/dist/integration/commands/common.d.ts +9 -0
  5. package/dist/integration/commands/common.js +12 -0
  6. package/dist/integration/commands/debug.d.ts +6 -0
  7. package/dist/integration/commands/debug.js +17 -0
  8. package/dist/integration/commands/init.js +1 -1
  9. package/dist/integration/commands.js +2 -0
  10. package/dist/integration/configs/file.d.ts +3 -0
  11. package/dist/integration/configs/webpack/ASTIntegrationPreamblePlugin.d.ts +6 -0
  12. package/dist/integration/configs/webpack/ASTIntegrationPreamblePlugin.js +53 -24
  13. package/dist/integration/configs/webpack/common.js +2 -10
  14. package/dist/integration/configs/webpack/utils.d.ts +14 -0
  15. package/dist/integration/configs/webpack/utils.js +16 -0
  16. package/dist/integration/integrationPaths.d.ts +7 -2
  17. package/dist/integration/integrationPaths.js +8 -3
  18. package/dist/integration/scripts/build.js +2 -1
  19. package/dist/integration/scripts/debugger.d.ts +3 -0
  20. package/dist/integration/scripts/debugger.js +31 -0
  21. package/dist/integration/scripts/{actions.js → init.js} +16 -1
  22. package/dist/integration/templates/integrationConfigs.d.ts +5 -2
  23. package/dist/integration/templates/integrationConfigs.js +57 -2
  24. package/dist/integration/templates/integrationPackageJson.d.ts +1 -1
  25. package/dist/integration/templates/integrationPackageJson.js +1 -0
  26. package/package.json +3 -1
  27. /package/dist/integration/scripts/{actions.d.ts → init.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
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.22.0-1](https://github.com/Infomaximum/package-cli/compare/v2.22.0-0...v2.22.0-1) (2025-03-27)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * global integration ([c445f8b](https://github.com/Infomaximum/package-cli/commit/c445f8b1aee8803da29fe9693ac961bccf07730a))
11
+
12
+ ## [2.22.0-0](https://github.com/Infomaximum/package-cli/compare/v2.21.0...v2.22.0-0) (2025-03-27)
13
+
14
+
15
+ ### Features
16
+
17
+ * добавлена обработка флага серий запусков ([7f5d7ec](https://github.com/Infomaximum/package-cli/commit/7f5d7ecc33fa232d5e3aed0489993837d2f5b3b0))
18
+ * начальная реализация отладки интеграции ([9a32dd8](https://github.com/Infomaximum/package-cli/commit/9a32dd838db34a9dc904c1430330d983ba7926c6))
19
+ * передача конфига отладки в библиотеку по отладке интеграций ([1afd19e](https://github.com/Infomaximum/package-cli/commit/1afd19eefa08e1a05114675434d03d4db7b6b377))
20
+ * повторная минификация кода после модификации ([dc0a9c8](https://github.com/Infomaximum/package-cli/commit/dc0a9c856da8381c258ebee041986d34d8214b0e))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * исправлено форматирование ([cac04c3](https://github.com/Infomaximum/package-cli/commit/cac04c359e0f655bc4b2e69544addbb601a1a1ac))
26
+ * исправлены параметры ([60c38c3](https://github.com/Infomaximum/package-cli/commit/60c38c3539a87787e0e8c12c63b06a8bc9b6a4ea))
27
+ * убрана минификация имен переменных ([aaed573](https://github.com/Infomaximum/package-cli/commit/aaed57316455cf3634cf3100fc4bf88bc4d371f4))
28
+ * шаблон integrationrc ([bed299a](https://github.com/Infomaximum/package-cli/commit/bed299a0a431ab73c8796bd0ba25e922f1133e79))
29
+
5
30
  ## [2.21.0](https://github.com/Infomaximum/package-cli/compare/v2.20.1...v2.21.0) (2025-03-17)
6
31
 
7
32
 
@@ -1,7 +1,7 @@
1
1
  import type { Command } from "commander";
2
2
  import { type InputPackageOptions } from "../../package/commands.js";
3
+ import { type CommonIntegrationOptions } from "./common.js";
3
4
  export type InputBuildIntegrationOptions = {
4
- entry: string;
5
5
  buildDir: string;
6
6
  type: BuildType;
7
7
  watch: boolean;
@@ -9,6 +9,6 @@ export type InputBuildIntegrationOptions = {
9
9
  fetchToServer: boolean;
10
10
  beautify: boolean;
11
11
  experimentalTransform: boolean;
12
- } & InputPackageOptions;
12
+ } & CommonIntegrationOptions & InputPackageOptions;
13
13
  export type BuildType = "package" | "script";
14
14
  export declare const registerIntegrationBuildCommand: (integrationCommand: Command) => void;
@@ -2,13 +2,14 @@ import { runBuildIntegration } from "../scripts/build.js";
2
2
  import { registerPackageOptions, } from "../../package/commands.js";
3
3
  import { getConfigIntegrationFromFile } from "../configs/file.js";
4
4
  import { INTEGRATION_CONFIG_RC_EXT, INTEGRATION_CONFIG_RC_FILE_NAME, } from "../const.js";
5
+ import { mergeConfigIntegrationWithOptionsCommon, registerCommonIntegrationOptions, } from "./common.js";
5
6
  export const registerIntegrationBuildCommand = (integrationCommand) => {
6
7
  const integrationBuildCommand = integrationCommand.command("build");
7
8
  registerPackageOptions(integrationBuildCommand);
9
+ registerCommonIntegrationOptions(integrationBuildCommand);
8
10
  const config = getConfigIntegrationFromFile();
9
11
  integrationBuildCommand
10
12
  .description("Выполняет сборку пакета c интеграцией")
11
- .option("--entry <path>", "путь до entrypoint", "src/index.ts")
12
13
  .option("--build-dir <buildDirPath>", "путь до директории в которую будет собран пакет", "build")
13
14
  .option("--type <buildType>", "тип сборки, <package> - сборка пакета (в архив), <script> - сборка в js файл", "package")
14
15
  .option("--watch", "при изменении файлов скрипт будет пересобран", false)
@@ -20,6 +21,7 @@ export const registerIntegrationBuildCommand = (integrationCommand) => {
20
21
  if (options.fetchToServer && typeof (config === null || config === void 0 ? void 0 : config.fetcher) !== "function") {
21
22
  throw new Error("Не настроен конфиг или нет функции fetcher в конфиге");
22
23
  }
23
- runBuildIntegration(options, config);
24
+ const mergedOptions = mergeConfigIntegrationWithOptionsCommon(config, options);
25
+ runBuildIntegration(Object.assign(Object.assign({}, options), mergedOptions), config);
24
26
  });
25
27
  };
@@ -0,0 +1,9 @@
1
+ import type { Command } from "commander";
2
+ import type { IntegrationRCConfig } from "../configs/file.js";
3
+ export type CommonIntegrationOptions = {
4
+ entry: string;
5
+ };
6
+ export declare const registerCommonIntegrationOptions: (command: Command) => void;
7
+ export declare function mergeConfigIntegrationWithOptionsCommon(config: IntegrationRCConfig | undefined, options: CommonIntegrationOptions): {
8
+ entry: string;
9
+ };
@@ -0,0 +1,12 @@
1
+ import chalk from "chalk";
2
+ import { assertSimple } from "@infomaximum/assert";
3
+ export const registerCommonIntegrationOptions = (command) => {
4
+ command.option("--entry <path>", "путь до entrypoint");
5
+ };
6
+ export function mergeConfigIntegrationWithOptionsCommon(config, options) {
7
+ const entry = options.entry || (config === null || config === void 0 ? void 0 : config.entry);
8
+ assertSimple(!!entry, chalk.red("В конфигурации не задан entry"));
9
+ return {
10
+ entry,
11
+ };
12
+ }
@@ -0,0 +1,6 @@
1
+ import { type Command } from "commander";
2
+ import type { Debugging } from "@infomaximum/integration-sdk";
3
+ import { type CommonIntegrationOptions } from "./common.js";
4
+ export type DebugType = "integration" | "entity";
5
+ export type InputDebugIntegrationOptions = Debugging.DebugIntegrationOptions & CommonIntegrationOptions;
6
+ export declare const registerIntegrationDebugCommand: (integrationCommand: Command) => void;
@@ -0,0 +1,17 @@
1
+ import { Option } from "commander";
2
+ import { runDebugIntegration } from "../scripts/debugger.js";
3
+ import { getConfigIntegrationFromFile } from "../configs/file.js";
4
+ import { mergeConfigIntegrationWithOptionsCommon, registerCommonIntegrationOptions, } from "./common.js";
5
+ export const registerIntegrationDebugCommand = (integrationCommand) => {
6
+ const widgetDebugCommand = integrationCommand.command("debug");
7
+ registerCommonIntegrationOptions(widgetDebugCommand);
8
+ widgetDebugCommand
9
+ .description("Отладка проекта интеграции")
10
+ .option("--entityKey <key>", "Ключ сущности для которой запускается отладка")
11
+ .option("--series", "Выполняет серию запусков отладки сущности", false)
12
+ .action((options) => {
13
+ const config = getConfigIntegrationFromFile();
14
+ const mergedOptions = mergeConfigIntegrationWithOptionsCommon(config, options);
15
+ runDebugIntegration(Object.assign(Object.assign({}, options), mergedOptions), config);
16
+ });
17
+ };
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { runInitEntityScript } from "../../plopHelpers.js";
3
- import { getInitIntegrationActions } from "../scripts/actions.js";
3
+ import { getInitIntegrationActions } from "../scripts/init.js";
4
4
  export const registerIntegrationInitCommand = (integrationCommand) => {
5
5
  const widgetInitCommand = integrationCommand.command("init <project-directory>");
6
6
  widgetInitCommand
@@ -1,7 +1,9 @@
1
1
  import { registerIntegrationInitCommand } from "./commands/init.js";
2
2
  import { registerIntegrationBuildCommand } from "./commands/build.js";
3
+ import { registerIntegrationDebugCommand } from "./commands/debug.js";
3
4
  export const registerIntegrationCommands = (cli) => {
4
5
  const integrationCommand = cli.command("integration");
5
6
  registerIntegrationInitCommand(integrationCommand);
6
7
  registerIntegrationBuildCommand(integrationCommand);
8
+ registerIntegrationDebugCommand(integrationCommand);
7
9
  };
@@ -1,3 +1,4 @@
1
+ import type { DebuggingConfig } from "@infomaximum/integration-debugger";
1
2
  export type IntegrationFetcher = (integrationCode: string) => IntegrationFetcherReturnType;
2
3
  export type IntegrationFetcherReturnType = {
3
4
  graphqlUrl: string;
@@ -7,6 +8,8 @@ export type IntegrationFetcherReturnType = {
7
8
  variables: Record<string, any>;
8
9
  };
9
10
  export type IntegrationRCConfig = {
11
+ entry: string;
10
12
  fetcher?: IntegrationFetcher;
13
+ debugging: DebuggingConfig;
11
14
  };
12
15
  export declare const getConfigIntegrationFromFile: () => IntegrationRCConfig | undefined;
@@ -1,4 +1,10 @@
1
1
  import { type Compiler } from "webpack";
2
+ type ASTIntegrationPreamblePluginParams = {
3
+ isBeautifyCode: boolean;
4
+ };
2
5
  export declare class ASTIntegrationPreamblePlugin {
6
+ private isBeautifyCode;
7
+ constructor({ isBeautifyCode }: ASTIntegrationPreamblePluginParams);
3
8
  apply(compiler: Compiler): void;
4
9
  }
10
+ export {};
@@ -1,38 +1,67 @@
1
+ import { __asyncValues, __awaiter } from "tslib";
1
2
  import { systemRequire } from "../../../utils.js";
2
3
  import { transformSync } from "@babel/core";
3
4
  import webpack, {} from "webpack";
5
+ import { minify } from "terser";
6
+ import { TERSER_OPTIONS } from "./utils.js";
4
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
+ }
5
17
  export class ASTIntegrationPreamblePlugin {
18
+ constructor({ isBeautifyCode }) {
19
+ this.isBeautifyCode = isBeautifyCode;
20
+ }
6
21
  apply(compiler) {
7
22
  compiler.hooks.compilation.tap("ASTIntegrationPreamblePlugin", (compilation) => {
8
- compilation.hooks.processAssets.tap({
23
+ compilation.hooks.processAssets.tapPromise({
9
24
  name: "ASTIntegrationPreamblePlugin",
10
25
  stage: Compilation.PROCESS_ASSETS_STAGE_REPORT,
11
- }, (assets) => {
12
- Object.entries(assets).forEach(([filename, source]) => {
13
- var _a, _b;
14
- if (!filename.endsWith(".js"))
15
- return;
16
- const { RawSource } = compiler.webpack.sources;
17
- const output = (_b = (_a = transformSync(source.source().toString(), {
18
- sourceType: "unambiguous",
19
- babelrc: false,
20
- configFile: false,
21
- plugins: [
22
- [
23
- systemRequire.resolve("@saneksa/babel-plugin-function-transform"),
24
- {
25
- functionName: "executePagination",
26
- fieldName: "integration",
27
- },
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
+ ],
28
49
  ],
29
- ],
30
- })) === null || _a === void 0 ? void 0 : _a.code) === null || _b === void 0 ? void 0 : _b.trim();
31
- if (output) {
32
- compilation.updateAsset(filename, new RawSource(output));
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);
33
61
  }
34
- });
35
- });
62
+ finally { if (e_1) throw e_1.error; }
63
+ }
64
+ }));
36
65
  });
37
66
  }
38
67
  }
@@ -1,7 +1,7 @@
1
1
  import TerserPlugin from "terser-webpack-plugin";
2
2
  import { systemRequire } from "../../../utils.js";
3
3
  import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
4
- import { ASTIntegrationPreamblePlugin } from "./ASTIntegrationPreamblePlugin.js";
4
+ import { TERSER_OPTIONS } from "./utils.js";
5
5
  export const getCommonIntegrationConfig = ({ PATHS, mode, isBeautifyCode, }) => {
6
6
  return {
7
7
  mode,
@@ -59,15 +59,7 @@ export const getCommonIntegrationConfig = ({ PATHS, mode, isBeautifyCode, }) =>
59
59
  new TerserPlugin({
60
60
  parallel: true,
61
61
  extractComments: false,
62
- terserOptions: {
63
- format: {
64
- comments: false,
65
- beautify: isBeautifyCode,
66
- },
67
- compress: {
68
- booleans: false,
69
- },
70
- },
62
+ terserOptions: TERSER_OPTIONS(isBeautifyCode),
71
63
  }),
72
64
  ],
73
65
  },
@@ -0,0 +1,14 @@
1
+ export declare const TERSER_OPTIONS: (isBeautifyCode: boolean) => {
2
+ nameCache: {};
3
+ mangle: false;
4
+ toplevel: false;
5
+ format: {
6
+ comments: false;
7
+ beautify: boolean;
8
+ };
9
+ compress: {
10
+ booleans: false;
11
+ keep_fnames: false;
12
+ toplevel: true;
13
+ };
14
+ };
@@ -0,0 +1,16 @@
1
+ import {} from "terser";
2
+ const nameCache = {};
3
+ export const TERSER_OPTIONS = (isBeautifyCode) => ({
4
+ nameCache: nameCache,
5
+ mangle: false,
6
+ toplevel: false,
7
+ format: {
8
+ comments: false,
9
+ beautify: isBeautifyCode,
10
+ },
11
+ compress: {
12
+ booleans: false,
13
+ keep_fnames: false,
14
+ toplevel: true,
15
+ },
16
+ });
@@ -1,13 +1,18 @@
1
1
  export type IntegrationPaths = ReturnType<typeof generateIntegrationPaths>;
2
- type Options = {
2
+ type CommonOptions = {
3
3
  entry: string;
4
+ };
5
+ type Options = {
4
6
  buildDir: string;
5
7
  packageDir: string;
6
8
  packageManifest: string;
9
+ } & CommonOptions;
10
+ export declare function generateCommonIntegrationPaths({ entry }: CommonOptions): {
11
+ readonly moduleIndex: string;
7
12
  };
8
13
  export declare function generateIntegrationPaths({ entry, buildDir, packageDir, packageManifest, }: Options): {
9
- outputFile: string;
10
14
  moduleIndex: string;
15
+ outputFile: string;
11
16
  packagePath: string;
12
17
  packageDirPath: string;
13
18
  packageManifestPath: string;
@@ -1,13 +1,18 @@
1
1
  import { generatePackagePaths } from "../package/packagePaths.js";
2
2
  import { generateIndexPath } from "../paths.js";
3
3
  import { INTEGRATION_OUTPUT_FILE } from "./const.js";
4
+ export function generateCommonIntegrationPaths({ entry }) {
5
+ return {
6
+ get moduleIndex() {
7
+ return generateIndexPath(entry);
8
+ },
9
+ };
10
+ }
4
11
  export function generateIntegrationPaths({ entry, buildDir, packageDir, packageManifest, }) {
5
12
  const packagePaths = generatePackagePaths({
6
13
  buildDir,
7
14
  packageDir,
8
15
  packageManifest,
9
16
  });
10
- return Object.assign(Object.assign({}, packagePaths), { outputFile: INTEGRATION_OUTPUT_FILE, get moduleIndex() {
11
- return generateIndexPath(entry);
12
- } });
17
+ return Object.assign(Object.assign(Object.assign({}, packagePaths), { outputFile: INTEGRATION_OUTPUT_FILE }), generateCommonIntegrationPaths({ entry }));
13
18
  }
@@ -33,7 +33,8 @@ export const runBuildIntegration = (options, rcConfig) => __awaiter(void 0, void
33
33
  {
34
34
  plugins: [
35
35
  copy && new CopyToClipboardPlugin(),
36
- experimentalTransform && new ASTIntegrationPreamblePlugin(),
36
+ experimentalTransform &&
37
+ new ASTIntegrationPreamblePlugin({ isBeautifyCode }),
37
38
  options.fetchToServer &&
38
39
  typeof fetcherFromConfig === "function" &&
39
40
  new FetchCodeToServerPlugin({
@@ -0,0 +1,3 @@
1
+ import type { InputDebugIntegrationOptions } from "../commands/debug.js";
2
+ import type { IntegrationRCConfig } from "../configs/file.js";
3
+ export declare const runDebugIntegration: (options: InputDebugIntegrationOptions, rcConfig: IntegrationRCConfig | undefined) => Promise<void>;
@@ -0,0 +1,31 @@
1
+ import { __awaiter } from "tslib";
2
+ import { IntegrationExecutor } from "@infomaximum/integration-debugger";
3
+ import { generateCommonIntegrationPaths } from "../integrationPaths.js";
4
+ import { assertSimple } from "@infomaximum/assert";
5
+ import { INTEGRATION_CONFIG_RC_EXT, INTEGRATION_CONFIG_RC_FILE_NAME, } from "../const.js";
6
+ const runDebug = (options, rcConfig) => {
7
+ const { entityKey, series } = options;
8
+ const debuggingConfig = rcConfig === null || rcConfig === void 0 ? void 0 : rcConfig.debugging;
9
+ assertSimple(!!debuggingConfig, `Не задана конфигурация для отладки в файле: ${INTEGRATION_CONFIG_RC_FILE_NAME}${INTEGRATION_CONFIG_RC_EXT}`);
10
+ const executor = new IntegrationExecutor(globalThis.integration, {
11
+ entityKey,
12
+ debuggingConfig,
13
+ series,
14
+ });
15
+ try {
16
+ executor === null || executor === void 0 ? void 0 : executor.execute();
17
+ }
18
+ catch (error) {
19
+ console.error("Integration execution failed:", error);
20
+ }
21
+ };
22
+ export const runDebugIntegration = (options, rcConfig) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const { entry } = options;
24
+ const INTEGRATION_PATHS = generateCommonIntegrationPaths({
25
+ entry,
26
+ });
27
+ globalThis.integration = globalThis.integration || {};
28
+ import(INTEGRATION_PATHS.moduleIndex).then(() => {
29
+ runDebug(options, rcConfig);
30
+ });
31
+ });
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { CUSTOM_PACKAGE_CLI_LIB_NAME } from "../../const.js";
3
- import { INTEGRATION_BABEL_CONFIG, INTEGRATION_ENV_EXAMPLE_CONFIG, INTEGRATION_ESLINTRC, INTEGRATION_GITIGNORE, INTEGRATION_RC_CONFIG, INTEGRATION_TSCONFIG_JSON, INTEGRATION_VITEST_CONFIG, } from "../templates/integrationConfigs.js";
3
+ 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";
4
4
  import { getPackageActions } from "../../package/scripts/actions.js";
5
5
  import { INTEGRATION_INDEX_TEMPLATE } from "../templates/integrationIndex.js";
6
6
  import { INTEGRATION_PACKAGE_JSON_TEMPLATE } from "../templates/integrationPackageJson.js";
@@ -55,6 +55,21 @@ const actions = ({ packageCliVersion, integrationSdkVersion }) => {
55
55
  template: INTEGRATION_PACKAGE_JSON_TEMPLATE,
56
56
  data: { packageCliVersion, integrationSdkVersion },
57
57
  },
58
+ {
59
+ type: "add",
60
+ path: ".vscode/launch.json",
61
+ template: INTEGRATION_VSCODE_LAUNCH,
62
+ },
63
+ {
64
+ type: "add",
65
+ path: ".vscode/settings.json",
66
+ template: INTEGRATION_VSCODE_SETTINGS,
67
+ },
68
+ {
69
+ type: "add",
70
+ path: ".vscode/extensions.json",
71
+ template: INTEGRATION_VSCODE_EXTENSIONS,
72
+ },
58
73
  ];
59
74
  };
60
75
  const getInitIntegrationActions = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -1,7 +1,10 @@
1
1
  export declare const INTEGRATION_TSCONFIG_JSON = "{\n \"compilerOptions\": {\n \"target\": \"ES2015\",\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";
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";
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 = "import js from \"@eslint/js\";\nimport globals from \"globals\";\nimport tseslint from \"typescript-eslint\";\n\nexport default tseslint.config(\n { ignores: [\"dist\", \"build\"] },\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 }\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";
6
- export declare const INTEGRATION_RC_CONFIG = "require(\"dotenv\").config();\n\nconst query = `\nmutation UpdateIntegration($id: Long!, $js_code: String) {\n automation {\n integration {\n update(id: $id, js_code: $js_code) {\n id\n }\n }\n }\n}`;\n\n/**\n * @type {import(\"@infomaximum/package-cli\").IntegrationRCConfig}\n */\nmodule.exports = {\n fetcher: (integrationCode) => {\n return {\n graphqlUrl: process.env.GRAPHQL_URL,\n apiKey: process.env.API_KEY,\n query,\n variables: {\n id: process.env.INTEGRATION_ID,\n js_code: integrationCode,\n },\n };\n },\n};\n";
6
+ export declare const INTEGRATION_RC_CONFIG = "//@ts-check\n\nrequire(\"dotenv\").config();\n\nconst query = `\nmutation UpdateIntegration($id: Long!, $js_code: String) {\n automation {\n integration {\n update(id: $id, js_code: $js_code) {\n id\n }\n }\n }\n}`;\n\n/**\n * @type {import(\"@infomaximum/package-cli\").IntegrationRCConfig}\n */\nconst config = {\n entry: \"src/index.ts\",\n fetcher: (integrationCode) => {\n return {\n graphqlUrl: process.env.GRAPHQL_URL,\n apiKey: process.env.API_KEY,\n query,\n variables: {\n id: process.env.INTEGRATION_ID,\n js_code: integrationCode,\n },\n };\n },\n\n debugging: {\n seriesIterations: 3,\n blocks: {},\n connections: {},\n },\n};\n\nmodule.exports = config;\n";
7
7
  export declare const INTEGRATION_ENV_EXAMPLE_CONFIG = "INTEGRATION_ID=0\nGRAPHQL_URL=https://example.com/graphql\nAPI_KEY=123456789qwertyuiop\n";
8
+ export declare const INTEGRATION_VSCODE_LAUNCH = "{\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"type\": \"node\",\n \"request\": \"launch\",\n \"name\": \"Debug Integration\",\n \"skipFiles\": [\"<node_internals>/**\"],\n\n \"runtimeExecutable\": \"tsx\",\n \"runtimeArgs\": [\"--preserve-symlinks\"],\n \"args\": [\n \"${workspaceFolder}/node_modules/@infomaximum/package-cli/dist/index.js\",\n \"integration\",\n \"debug\"\n ],\n \"sourceMaps\": true,\n \"resolveSourceMapLocations\": [\n \"${workspaceFolder}/**\",\n \"!**/node_modules/**\"\n ],\n \"smartStep\": true,\n \"internalConsoleOptions\": \"openOnSessionStart\"\n }\n ]\n}\n";
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\": [\"executePagination\"]\n}\n";
10
+ export declare const INTEGRATION_VSCODE_EXTENSIONS = "{\n \"recommendations\": [\"Jokerok.integration-debugger\"]\n}\n";
@@ -1,3 +1,4 @@
1
+ import { CUSTOM_PACKAGE_CLI_LIB_NAME } from "../../const.js";
1
2
  export const INTEGRATION_TSCONFIG_JSON = `\
2
3
  {
3
4
  "compilerOptions": {
@@ -42,6 +43,8 @@ yarn-error.log*
42
43
  /build
43
44
  .ultra.cache.json
44
45
  *.tsbuildinfo
46
+ .node-xmlhttprequest-content-*
47
+ .node-xmlhttprequest-sync-*
45
48
  `;
46
49
  export const INTEGRATION_BABEL_CONFIG = `\
47
50
  module.exports = {
@@ -85,6 +88,8 @@ export default defineConfig({
85
88
  });
86
89
  `;
87
90
  export const INTEGRATION_RC_CONFIG = `\
91
+ //@ts-check
92
+
88
93
  require("dotenv").config();
89
94
 
90
95
  const query = \`
@@ -99,9 +104,10 @@ mutation UpdateIntegration($id: Long!, $js_code: String) {
99
104
  }\`;
100
105
 
101
106
  /**
102
- * @type {import("@infomaximum/package-cli").IntegrationRCConfig}
107
+ * @type {import("${CUSTOM_PACKAGE_CLI_LIB_NAME}").IntegrationRCConfig}
103
108
  */
104
- module.exports = {
109
+ const config = {
110
+ entry: "src/index.ts",
105
111
  fetcher: (integrationCode) => {
106
112
  return {
107
113
  graphqlUrl: process.env.GRAPHQL_URL,
@@ -113,10 +119,59 @@ module.exports = {
113
119
  },
114
120
  };
115
121
  },
122
+
123
+ debugging: {
124
+ seriesIterations: 3,
125
+ blocks: {},
126
+ connections: {},
127
+ },
116
128
  };
129
+
130
+ module.exports = config;
117
131
  `;
118
132
  export const INTEGRATION_ENV_EXAMPLE_CONFIG = `\
119
133
  INTEGRATION_ID=0
120
134
  GRAPHQL_URL=https://example.com/graphql
121
135
  API_KEY=123456789qwertyuiop
122
136
  `;
137
+ export const INTEGRATION_VSCODE_LAUNCH = `\
138
+ {
139
+ "version": "0.2.0",
140
+ "configurations": [
141
+ {
142
+ "type": "node",
143
+ "request": "launch",
144
+ "name": "Debug Integration",
145
+ "skipFiles": ["<node_internals>/**"],
146
+
147
+ "runtimeExecutable": "tsx",
148
+ "runtimeArgs": ["--preserve-symlinks"],
149
+ "args": [
150
+ "\${workspaceFolder}/node_modules/${CUSTOM_PACKAGE_CLI_LIB_NAME}/dist/index.js",
151
+ "integration",
152
+ "debug"
153
+ ],
154
+ "sourceMaps": true,
155
+ "resolveSourceMapLocations": [
156
+ "\${workspaceFolder}/**",
157
+ "!**/node_modules/**"
158
+ ],
159
+ "smartStep": true,
160
+ "internalConsoleOptions": "openOnSessionStart"
161
+ }
162
+ ]
163
+ }
164
+ `;
165
+ export const INTEGRATION_VSCODE_SETTINGS = `\
166
+ {
167
+ "typescript.tsdk": "node_modules/typescript/lib",
168
+ "integration-debugger.isEnabled": true,
169
+ "integration-debugger.debugConfigurationName": "Debug Integration",
170
+ "integration-debugger.functionNames": ["executePagination"]
171
+ }
172
+ `;
173
+ export const INTEGRATION_VSCODE_EXTENSIONS = `\
174
+ {
175
+ "recommendations": ["Jokerok.integration-debugger"]
176
+ }
177
+ `;
@@ -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.19.0\",\n \"@infomaximum/integration-sdk\": \"^{{integrationSdkVersion}}\",\n \"@infomaximum/package-cli\": \"^{{packageCliVersion}}\",\n \"@types/node\": \"^0\",\n \"dotenv\": \"^16.4.7\",\n \"eslint\": \"^9.19.0\",\n \"globals\": \"^15.14.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.22.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 },\n \"devDependencies\": {\n \"@babel/plugin-transform-block-scoping\": \"^7.25.9\",\n \"@eslint/js\": \"^9.19.0\",\n \"@infomaximum/integration-sdk\": \"^{{integrationSdkVersion}}\",\n \"@infomaximum/package-cli\": \"^{{packageCliVersion}}\",\n \"@types/node\": \"^0\",\n \"dotenv\": \"^16.4.7\",\n \"eslint\": \"^9.19.0\",\n \"globals\": \"^15.14.0\",\n \"tsx\": \"^4.19.3\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.22.0\",\n \"vitest\": \"^3.0.4\",\n \"@vitest/coverage-v8\": \"3.0.7\",\n \"@vitest/ui\": \"3.0.7\"\n }\n}\n";
@@ -24,6 +24,7 @@ export const INTEGRATION_PACKAGE_JSON_TEMPLATE = `\
24
24
  "dotenv": "^16.4.7",
25
25
  "eslint": "^9.19.0",
26
26
  "globals": "^15.14.0",
27
+ "tsx": "^4.19.3",
27
28
  "typescript": "^5.7.2",
28
29
  "typescript-eslint": "^8.22.0",
29
30
  "vitest": "^3.0.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/package-cli",
3
- "version": "2.21.0",
3
+ "version": "2.22.0-1",
4
4
  "exports": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -26,6 +26,7 @@
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.5.0",
29
30
  "@infomaximum/json-modify-webpack-plugin": "^1.1.0",
30
31
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
31
32
  "@saneksa/babel-plugin-function-transform": "^1.0.0",
@@ -70,6 +71,7 @@
70
71
  "zip-webpack-plugin": "^4.0.1"
71
72
  },
72
73
  "devDependencies": {
74
+ "@infomaximum/integration-sdk": "^1.4.2",
73
75
  "@types/babel__core": "^7.20.5",
74
76
  "@types/fs-extra": "^11.0.4",
75
77
  "@types/node": "^20.9.0",