@infomaximum/package-cli 2.19.1 → 2.20.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 +14 -0
- package/dist/integration/commands/build.d.ts +1 -0
- package/dist/integration/commands/build.js +1 -0
- package/dist/integration/configs/webpack/common.d.ts +7 -1
- package/dist/integration/configs/webpack/common.js +11 -5
- package/dist/integration/scripts/actions.js +6 -1
- package/dist/integration/scripts/build.js +6 -2
- package/dist/integration/templates/integrationConfigs.d.ts +2 -1
- package/dist/integration/templates/integrationConfigs.js +8 -1
- package/dist/integration/templates/integrationPackageJson.d.ts +1 -1
- package/dist/integration/templates/integrationPackageJson.js +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.20.1](https://github.com/Infomaximum/package-cli/compare/v2.20.0...v2.20.1) (2025-03-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* target es6 ([eef3785](https://github.com/Infomaximum/package-cli/commit/eef3785afb7b736b49dbb214e7525235b8fe5723))
|
|
11
|
+
|
|
12
|
+
## [2.20.0](https://github.com/Infomaximum/package-cli/compare/v2.19.1...v2.20.0) (2025-03-09)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* использован babel-loader, флаг по форматированию собранного кода ([59a4244](https://github.com/Infomaximum/package-cli/commit/59a4244dfdf85fae97b714f0fbc77de4dc0e6f28))
|
|
18
|
+
|
|
5
19
|
### [2.19.1](https://github.com/Infomaximum/package-cli/compare/v2.19.0...v2.19.1) (2025-03-08)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -7,6 +7,7 @@ export type InputBuildIntegrationOptions = {
|
|
|
7
7
|
watch: boolean;
|
|
8
8
|
copy: boolean;
|
|
9
9
|
fetchToServer: boolean;
|
|
10
|
+
beautify: boolean;
|
|
10
11
|
} & InputPackageOptions;
|
|
11
12
|
export type BuildType = "package" | "script";
|
|
12
13
|
export declare const registerIntegrationBuildCommand: (integrationCommand: Command) => void;
|
|
@@ -14,6 +14,7 @@ export const registerIntegrationBuildCommand = (integrationCommand) => {
|
|
|
14
14
|
.option("--watch", "при изменении файлов скрипт будет пересобран", false)
|
|
15
15
|
.option("--copy", "копирование скрипта интеграции в буфер обмена", false)
|
|
16
16
|
.option("--fetchToServer", `отправка изменений на сервер (должен быть настроен файл ${INTEGRATION_CONFIG_RC_FILE_NAME}${INTEGRATION_CONFIG_RC_EXT})`, false)
|
|
17
|
+
.option("--beautify", `отформатировать код после сборки`, false)
|
|
17
18
|
.action((options) => {
|
|
18
19
|
if (options.fetchToServer && typeof (config === null || config === void 0 ? void 0 : config.fetcher) !== "function") {
|
|
19
20
|
throw new Error("Не настроен конфиг или нет функции fetcher в конфиге");
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Configuration } from "webpack";
|
|
2
2
|
import type { Mode } from "../../../paths.js";
|
|
3
3
|
import type { IntegrationPaths } from "../../integrationPaths.js";
|
|
4
|
-
|
|
4
|
+
type CommonBuildIntegrationParams = {
|
|
5
|
+
mode: Mode;
|
|
6
|
+
PATHS: IntegrationPaths;
|
|
7
|
+
isBeautifyCode: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const getCommonIntegrationConfig: ({ PATHS, mode, isBeautifyCode, }: CommonBuildIntegrationParams) => Configuration;
|
|
10
|
+
export {};
|
|
@@ -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
|
-
export const getCommonIntegrationConfig = (mode,
|
|
4
|
+
export const getCommonIntegrationConfig = ({ PATHS, mode, isBeautifyCode, }) => {
|
|
5
5
|
return {
|
|
6
6
|
mode,
|
|
7
7
|
target: "es5",
|
|
@@ -25,10 +25,15 @@ export const getCommonIntegrationConfig = (mode, PATHS) => {
|
|
|
25
25
|
{
|
|
26
26
|
test: /\.(js|ts|jsx|tsx)$/i,
|
|
27
27
|
exclude: ["/node_modules/"],
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
use: [
|
|
29
|
+
{ loader: systemRequire.resolve("babel-loader") },
|
|
30
|
+
{
|
|
31
|
+
loader: systemRequire.resolve("ts-loader"),
|
|
32
|
+
options: {
|
|
33
|
+
transpileOnly: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
32
37
|
},
|
|
33
38
|
],
|
|
34
39
|
},
|
|
@@ -56,6 +61,7 @@ export const getCommonIntegrationConfig = (mode, PATHS) => {
|
|
|
56
61
|
terserOptions: {
|
|
57
62
|
format: {
|
|
58
63
|
comments: false,
|
|
64
|
+
beautify: isBeautifyCode,
|
|
59
65
|
},
|
|
60
66
|
compress: {
|
|
61
67
|
booleans: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { CUSTOM_PACKAGE_CLI_LIB_NAME } from "../../const.js";
|
|
3
|
-
import { 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, } 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";
|
|
@@ -29,6 +29,11 @@ const actions = ({ packageCliVersion, integrationSdkVersion }) => {
|
|
|
29
29
|
path: "eslint.config.js",
|
|
30
30
|
template: INTEGRATION_ESLINTRC,
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
type: "add",
|
|
34
|
+
path: "babel.config.js",
|
|
35
|
+
template: INTEGRATION_BABEL_CONFIG,
|
|
36
|
+
},
|
|
32
37
|
{
|
|
33
38
|
type: "add",
|
|
34
39
|
path: "vitest.config.js",
|
|
@@ -10,7 +10,7 @@ import { merge } from "webpack-merge";
|
|
|
10
10
|
import { CopyToClipboardPlugin } from "../configs/webpack/CopyToClipboardPlugin.js";
|
|
11
11
|
import { FetchCodeToServerPlugin } from "../configs/webpack/FetchCodeToServerPlugin.js";
|
|
12
12
|
export const runBuildIntegration = (options, rcConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
-
const { entry, buildDir, packageDir, packageManifest, type, watch, copy } = options;
|
|
13
|
+
const { entry, buildDir, packageDir, packageManifest, type, watch, copy, beautify: isBeautifyCode, } = options;
|
|
14
14
|
const INTEGRATION_PATHS = generateIntegrationPaths({
|
|
15
15
|
entry,
|
|
16
16
|
buildDir,
|
|
@@ -18,7 +18,11 @@ export const runBuildIntegration = (options, rcConfig) => __awaiter(void 0, void
|
|
|
18
18
|
packageManifest,
|
|
19
19
|
});
|
|
20
20
|
const mode = "production";
|
|
21
|
-
const commonConfig = getCommonIntegrationConfig(
|
|
21
|
+
const commonConfig = getCommonIntegrationConfig({
|
|
22
|
+
mode,
|
|
23
|
+
isBeautifyCode,
|
|
24
|
+
PATHS: INTEGRATION_PATHS,
|
|
25
|
+
});
|
|
22
26
|
const fetcherFromConfig = rcConfig === null || rcConfig === void 0 ? void 0 : rcConfig.fetcher;
|
|
23
27
|
const config = merge([
|
|
24
28
|
commonConfig,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare const INTEGRATION_TSCONFIG_JSON = "{\n \"compilerOptions\": {\n \"target\": \"
|
|
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
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";
|
|
3
|
+
export declare const INTEGRATION_BABEL_CONFIG = "module.exports = {\n sourceType: \"unambiguous\",\n presets: [],\n plugins: [\"@babel/plugin-transform-block-scoping\"],\n};\n";
|
|
3
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";
|
|
4
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";
|
|
5
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";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const INTEGRATION_TSCONFIG_JSON = `\
|
|
2
2
|
{
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"target": "
|
|
4
|
+
"target": "ES2015",
|
|
5
5
|
"module": "Preserve",
|
|
6
6
|
"esModuleInterop": true,
|
|
7
7
|
"forceConsistentCasingInFileNames": true,
|
|
@@ -43,6 +43,13 @@ yarn-error.log*
|
|
|
43
43
|
.ultra.cache.json
|
|
44
44
|
*.tsbuildinfo
|
|
45
45
|
`;
|
|
46
|
+
export const INTEGRATION_BABEL_CONFIG = `\
|
|
47
|
+
module.exports = {
|
|
48
|
+
sourceType: "unambiguous",
|
|
49
|
+
presets: [],
|
|
50
|
+
plugins: ["@babel/plugin-transform-block-scoping"],
|
|
51
|
+
};
|
|
52
|
+
`;
|
|
46
53
|
export const INTEGRATION_ESLINTRC = `\
|
|
47
54
|
import js from "@eslint/js";
|
|
48
55
|
import globals from "globals";
|
|
@@ -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\",\n \"dev\": \"im-package-cli integration build --watch\",\n \"serve\": \"im-package-cli integration build --watch --fetchToServer\",\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 \"@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 \"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";
|
|
@@ -7,15 +7,16 @@ export const INTEGRATION_PACKAGE_JSON_TEMPLATE = `\
|
|
|
7
7
|
"main": "src/index.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "im-package-cli integration build",
|
|
10
|
-
"build:script": "im-package-cli integration build --type=script",
|
|
11
|
-
"dev": "im-package-cli integration build --watch",
|
|
12
|
-
"serve": "im-package-cli integration build --watch --fetchToServer",
|
|
10
|
+
"build:script": "im-package-cli integration build --type=script --beautify",
|
|
11
|
+
"dev": "im-package-cli integration build --watch --beautify",
|
|
12
|
+
"serve": "im-package-cli integration build --watch --fetchToServer --beautify",
|
|
13
13
|
"lint": "tsc --noEmit && eslint src/ --ext .ts,.tsx --quiet",
|
|
14
14
|
"test": "vitest --run",
|
|
15
15
|
"test:coverage": "vitest --run --coverage",
|
|
16
16
|
"test:ui": "vitest --ui"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
+
"@babel/plugin-transform-block-scoping": "^7.25.9",
|
|
19
20
|
"@eslint/js": "^9.19.0",
|
|
20
21
|
"${INTEGRATION_SDK_LIB_NAME}": "^{{integrationSdkVersion}}",
|
|
21
22
|
"${CUSTOM_PACKAGE_CLI_LIB_NAME}": "^{{packageCliVersion}}",
|