@infomaximum/package-cli 2.16.1 → 2.17.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/arguments.d.ts +2 -0
- package/dist/const.d.ts +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/integration/commands/build.d.ts +12 -0
- package/dist/integration/commands/build.js +10 -1
- package/dist/integration/commands/init.d.ts +2 -0
- package/dist/integration/commands.d.ts +2 -0
- package/dist/integration/configs/file.d.ts +12 -0
- package/dist/integration/configs/file.js +12 -0
- package/dist/integration/configs/webpack/CopyToClipboardPlugin.d.ts +4 -0
- package/dist/integration/configs/webpack/FetchCodeToServerPlugin.d.ts +11 -0
- package/dist/integration/configs/webpack/FetchCodeToServerPlugin.js +46 -0
- package/dist/integration/configs/webpack/common.d.ts +4 -0
- package/dist/integration/const.d.ts +3 -0
- package/dist/integration/const.js +2 -0
- package/dist/integration/index.d.ts +1 -0
- package/dist/integration/integrationPaths.d.ts +20 -0
- package/dist/integration/scripts/actions.d.ts +24 -0
- package/dist/integration/scripts/actions.js +12 -2
- package/dist/integration/scripts/build.d.ts +3 -0
- package/dist/integration/scripts/build.js +13 -2
- package/dist/integration/templates/integrationConfigs.d.ts +8 -0
- package/dist/integration/templates/integrationConfigs.js +36 -0
- package/dist/integration/templates/integrationIndex.d.ts +1 -0
- package/dist/integration/templates/integrationPackageJson.d.ts +1 -0
- package/dist/integration/templates/integrationPackageJson.js +2 -0
- package/dist/package/commands.d.ts +6 -0
- package/dist/package/configs/webpack/buildPackage.d.ts +33 -0
- package/dist/package/packagePaths.d.ts +17 -0
- package/dist/package/scripts/actions.d.ts +18 -0
- package/dist/package/scripts/prompts.d.ts +24 -0
- package/dist/package/templates/additionalFiles.d.ts +2 -0
- package/dist/package/templates/packageIcon.d.ts +1 -0
- package/dist/package/templates/packageManifest.d.ts +1 -0
- package/dist/paths.d.ts +16 -0
- package/dist/plopHelpers.d.ts +11 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +21 -0
- package/dist/widget/commands/build.d.ts +22 -0
- package/dist/widget/commands/common.d.ts +18 -0
- package/dist/widget/commands/init.d.ts +2 -0
- package/dist/widget/commands/release.d.ts +10 -0
- package/dist/widget/commands/start.d.ts +19 -0
- package/dist/widget/commands.d.ts +2 -0
- package/dist/widget/configs/file.d.ts +11 -0
- package/dist/widget/configs/webpack/common.d.ts +4 -0
- package/dist/widget/configs/webpack/sections/devServer.d.ts +21 -0
- package/dist/widget/configs/webpack/sections/devtool.d.ts +3 -0
- package/dist/widget/configs/webpack/sections/loaders/cssLoaders.d.ts +8 -0
- package/dist/widget/configs/webpack/sections/plugins/minimizer.d.ts +9 -0
- package/dist/widget/configs/webpack/sections/plugins/modifyManifestWidget.d.ts +10 -0
- package/dist/widget/configs/webpack/sections/plugins/reactRefresh.d.ts +2 -0
- package/dist/widget/configs/webpack/sections/plugins/zipWidget.d.ts +7 -0
- package/dist/widget/const.d.ts +10 -0
- package/dist/widget/index.d.ts +1 -0
- package/dist/widget/scripts/build.d.ts +2 -0
- package/dist/widget/scripts/init/actions.d.ts +27 -0
- package/dist/widget/scripts/release/release.d.ts +2 -0
- package/dist/widget/scripts/release/utils.d.ts +5 -0
- package/dist/widget/scripts/start.d.ts +2 -0
- package/dist/widget/templates/src/definition/definition.d.ts +1 -0
- package/dist/widget/templates/src/definition/panel.d.ts +1 -0
- package/dist/widget/templates/src/definition/settings.d.ts +1 -0
- package/dist/widget/templates/src/widgetAppDTs.d.ts +1 -0
- package/dist/widget/templates/src/widgetIndex.d.ts +1 -0
- package/dist/widget/templates/src/widgetIndexCSS.d.ts +1 -0
- package/dist/widget/templates/widgetConfigs.d.ts +6 -0
- package/dist/widget/templates/widgetManifest.d.ts +1 -0
- package/dist/widget/templates/widgetPackageJson.d.ts +1 -0
- package/dist/widget/templates/widgetRCConfig.d.ts +1 -0
- package/dist/widget/utils.d.ts +3 -0
- package/dist/widget/widgetPaths.d.ts +17 -0
- package/package.json +2 -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.17.1](https://github.com/Infomaximum/package-cli/compare/v2.17.0...v2.17.1) (2025-03-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* исправлено отсутствие , ([71582c2](https://github.com/Infomaximum/package-cli/commit/71582c208132ca0f84b036598235dc563a6226ef))
|
|
11
|
+
|
|
12
|
+
## [2.17.0](https://github.com/Infomaximum/package-cli/compare/v2.16.1...v2.17.0) (2025-03-07)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* реализована отправка кода на сервер при изменений ([44f4f16](https://github.com/Infomaximum/package-cli/commit/44f4f16e48e8175216d01fa46bd77e5f02f4e31e))
|
|
18
|
+
|
|
5
19
|
### [2.16.1](https://github.com/Infomaximum/package-cli/compare/v2.16.0...v2.16.1) (2025-03-05)
|
|
6
20
|
|
|
7
21
|
|
package/dist/const.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const CUSTOM_PACKAGE_CLI_LIB_NAME = "@infomaximum/package-cli";
|
|
2
|
+
export declare const BUILD_ARCHIVE_EXT = "zip";
|
|
3
|
+
export declare const MANIFEST_JSON_FILE_NAME = "manifest.json";
|
|
4
|
+
export declare const MANIFEST_REG_EXP: RegExp;
|
|
5
|
+
export declare const DEV_POSTFIX = "__DEV";
|
|
6
|
+
export declare const DEFAULT_BUILD_DIR_NAME = "build";
|
|
7
|
+
export declare const MANIFEST_SERVICE_FIELDS_FOR_DEVELOPMENT: string[];
|
|
8
|
+
export declare const AVAILABLE_LANGUAGES: readonly ["ru", "en"];
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type InputPackageOptions } from "../../package/commands.js";
|
|
3
|
+
export type InputBuildIntegrationOptions = {
|
|
4
|
+
entry: string;
|
|
5
|
+
buildDir: string;
|
|
6
|
+
type: BuildType;
|
|
7
|
+
watch: boolean;
|
|
8
|
+
copy: boolean;
|
|
9
|
+
fetchToServer: boolean;
|
|
10
|
+
} & InputPackageOptions;
|
|
11
|
+
export type BuildType = "package" | "script";
|
|
12
|
+
export declare const registerIntegrationBuildCommand: (integrationCommand: Command) => void;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { runBuildIntegration } from "../scripts/build.js";
|
|
2
2
|
import { registerPackageOptions, } from "../../package/commands.js";
|
|
3
|
+
import { getConfigIntegrationFromFile } from "../configs/file.js";
|
|
4
|
+
import { INTEGRATION_CONFIG_RC_EXT, INTEGRATION_CONFIG_RC_FILE_NAME, } from "../const.js";
|
|
3
5
|
export const registerIntegrationBuildCommand = (integrationCommand) => {
|
|
4
6
|
const integrationBuildCommand = integrationCommand.command("build");
|
|
5
7
|
registerPackageOptions(integrationBuildCommand);
|
|
8
|
+
const config = getConfigIntegrationFromFile();
|
|
6
9
|
integrationBuildCommand
|
|
7
10
|
.description("Выполняет сборку пакета c интеграцией")
|
|
8
11
|
.option("--entry <path>", "путь до entrypoint", "src/index.ts")
|
|
@@ -10,5 +13,11 @@ export const registerIntegrationBuildCommand = (integrationCommand) => {
|
|
|
10
13
|
.option("--type <buildType>", "тип сборки, <package> - сборка пакета (в архив), <script> - сборка в js файл", "package")
|
|
11
14
|
.option("--watch", "при изменении файлов скрипт будет пересобран", false)
|
|
12
15
|
.option("--copy", "копирование скрипта интеграции в буфер обмена", false)
|
|
13
|
-
.
|
|
16
|
+
.option("--fetchToServer", `отправка изменений на сервер (должен быть настроен файл ${INTEGRATION_CONFIG_RC_FILE_NAME}${INTEGRATION_CONFIG_RC_EXT})`, false)
|
|
17
|
+
.action((options) => {
|
|
18
|
+
if (options.fetchToServer && typeof (config === null || config === void 0 ? void 0 : config.fetcher) !== "function") {
|
|
19
|
+
throw new Error("Не настроен конфиг или нет функции fetcher в конфиге");
|
|
20
|
+
}
|
|
21
|
+
runBuildIntegration(options, config);
|
|
22
|
+
});
|
|
14
23
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type IntegrationFetcher = (integrationCode: string) => IntegrationFetcherReturnType;
|
|
2
|
+
export type IntegrationFetcherReturnType = {
|
|
3
|
+
graphqlUrl: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
query: string;
|
|
6
|
+
headers?: Record<string, any>;
|
|
7
|
+
variables: Record<string, any>;
|
|
8
|
+
};
|
|
9
|
+
export type IntegrationRCConfig = {
|
|
10
|
+
fetcher?: IntegrationFetcher;
|
|
11
|
+
};
|
|
12
|
+
export declare const getConfigIntegrationFromFile: () => IntegrationRCConfig | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { rcFile } from "rc-config-loader";
|
|
2
|
+
import { INTEGRATION_CONFIG_RC_EXT, INTEGRATION_CONFIG_RC_FILE_NAME, } from "../const.js";
|
|
3
|
+
export const getConfigIntegrationFromFile = () => {
|
|
4
|
+
var _a;
|
|
5
|
+
const config = (_a = rcFile(INTEGRATION_CONFIG_RC_FILE_NAME, {
|
|
6
|
+
cwd: process.cwd(),
|
|
7
|
+
packageJSON: false,
|
|
8
|
+
configFileName: INTEGRATION_CONFIG_RC_FILE_NAME,
|
|
9
|
+
defaultExtension: INTEGRATION_CONFIG_RC_EXT,
|
|
10
|
+
})) === null || _a === void 0 ? void 0 : _a.config;
|
|
11
|
+
return config;
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Compiler } from "webpack";
|
|
2
|
+
import type { IntegrationFetcher } from "../file.js";
|
|
3
|
+
type FetchCodeToServerPluginParams = {
|
|
4
|
+
fetcher: IntegrationFetcher;
|
|
5
|
+
};
|
|
6
|
+
export declare class FetchCodeToServerPlugin {
|
|
7
|
+
private fetcher;
|
|
8
|
+
constructor({ fetcher }: FetchCodeToServerPluginParams);
|
|
9
|
+
apply(compiler: Compiler): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import crypto from "crypto";
|
|
4
|
+
export class FetchCodeToServerPlugin {
|
|
5
|
+
constructor({ fetcher }) {
|
|
6
|
+
this.fetcher = fetcher;
|
|
7
|
+
}
|
|
8
|
+
apply(compiler) {
|
|
9
|
+
compiler.hooks.afterEmit.tap("FetchCodeToServerPlugin", () => {
|
|
10
|
+
const outputPath = compiler.options.output.path || "";
|
|
11
|
+
let filename = compiler.options.output.filename;
|
|
12
|
+
if (typeof filename !== "string") {
|
|
13
|
+
console.warn("⚠️ [FetchCodeToServerPlugin] Dynamic file names are not supported.");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const filePath = path.resolve(outputPath, filename);
|
|
17
|
+
if (fs.existsSync(filePath)) {
|
|
18
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
19
|
+
const result = this.fetcher(content);
|
|
20
|
+
const url = new URL(result.graphqlUrl);
|
|
21
|
+
url.searchParams.set("api_key", result.apiKey);
|
|
22
|
+
const query = result.query;
|
|
23
|
+
const variables = result.variables;
|
|
24
|
+
fetch(url, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
headers: Object.assign(Object.assign({}, result.headers), { "X-Trace-Id": crypto.randomUUID() }),
|
|
27
|
+
body: JSON.stringify({ query, variables }),
|
|
28
|
+
})
|
|
29
|
+
.then((r) => r.json())
|
|
30
|
+
.then((d) => {
|
|
31
|
+
if (d === null || d === void 0 ? void 0 : d.error) {
|
|
32
|
+
throw d;
|
|
33
|
+
}
|
|
34
|
+
console.log(`✅ Отправлено на сервер`);
|
|
35
|
+
})
|
|
36
|
+
.catch((e) => {
|
|
37
|
+
console.error(`❗ Ошибка при отправке кода на сервер\n`);
|
|
38
|
+
console.error(JSON.stringify(e));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
console.warn(`⚠️ [FetchCodeToServerPlugin] File ${filename} was not found.`);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerIntegrationCommands } from "./commands.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type IntegrationPaths = ReturnType<typeof generateIntegrationPaths>;
|
|
2
|
+
type Options = {
|
|
3
|
+
entry: string;
|
|
4
|
+
buildDir: string;
|
|
5
|
+
packageDir: string;
|
|
6
|
+
packageManifest: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function generateIntegrationPaths({ entry, buildDir, packageDir, packageManifest, }: Options): {
|
|
9
|
+
outputFile: string;
|
|
10
|
+
moduleIndex: string;
|
|
11
|
+
packagePath: string;
|
|
12
|
+
packageDirPath: string;
|
|
13
|
+
packageManifestPath: string;
|
|
14
|
+
appPath: string;
|
|
15
|
+
appBuildPath: string;
|
|
16
|
+
appPackageJson: string;
|
|
17
|
+
appTsConfig: string;
|
|
18
|
+
appNodeModules: string;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Answers } from "../../package/scripts/prompts.js";
|
|
2
|
+
declare const getInitIntegrationActions: () => Promise<(data: Answers) => ({
|
|
3
|
+
type: string;
|
|
4
|
+
path: string;
|
|
5
|
+
template: string;
|
|
6
|
+
data: {
|
|
7
|
+
packageIconName: string;
|
|
8
|
+
packageType: import("../../types.js").PackageType;
|
|
9
|
+
};
|
|
10
|
+
} | {
|
|
11
|
+
type: string;
|
|
12
|
+
path: string;
|
|
13
|
+
template: string;
|
|
14
|
+
data?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
type: "add";
|
|
17
|
+
path: string;
|
|
18
|
+
template: string;
|
|
19
|
+
data: {
|
|
20
|
+
packageCliVersion: string;
|
|
21
|
+
integrationSdkVersion: string;
|
|
22
|
+
};
|
|
23
|
+
})[]>;
|
|
24
|
+
export { getInitIntegrationActions };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { CUSTOM_PACKAGE_CLI_LIB_NAME } from "../../const.js";
|
|
3
|
-
import { INTEGRATION_BABEL_CONFIG, INTEGRATION_BROWSERLIST_CONFIG, INTEGRATION_ESLINTRC, INTEGRATION_GITIGNORE, INTEGRATION_TSCONFIG_JSON, INTEGRATION_VITEST_CONFIG, } from "../templates/integrationConfigs.js";
|
|
3
|
+
import { INTEGRATION_BABEL_CONFIG, INTEGRATION_BROWSERLIST_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";
|
|
7
7
|
import { getLatestVersionOfLibrary } from "../../utils.js";
|
|
8
|
-
import { INTEGRATION_SDK_LIB_NAME } from "../const.js";
|
|
8
|
+
import { INTEGRATION_CONFIG_RC_FILE_NAME, INTEGRATION_CONFIG_RC_EXT, INTEGRATION_SDK_LIB_NAME, } from "../const.js";
|
|
9
9
|
const actions = ({ packageCliVersion, integrationSdkVersion }) => {
|
|
10
10
|
return [
|
|
11
11
|
...getPackageActions({ packageType: "integration" }),
|
|
@@ -44,6 +44,16 @@ const actions = ({ packageCliVersion, integrationSdkVersion }) => {
|
|
|
44
44
|
path: "vitest.config.js",
|
|
45
45
|
template: INTEGRATION_VITEST_CONFIG,
|
|
46
46
|
},
|
|
47
|
+
{
|
|
48
|
+
type: "add",
|
|
49
|
+
path: `${INTEGRATION_CONFIG_RC_FILE_NAME}${INTEGRATION_CONFIG_RC_EXT}`,
|
|
50
|
+
template: INTEGRATION_RC_CONFIG,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: "add",
|
|
54
|
+
path: `.env_example`,
|
|
55
|
+
template: INTEGRATION_ENV_EXAMPLE_CONFIG,
|
|
56
|
+
},
|
|
47
57
|
{
|
|
48
58
|
type: "add",
|
|
49
59
|
path: "package.json",
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InputBuildIntegrationOptions } from "../commands/build.js";
|
|
2
|
+
import type { IntegrationRCConfig } from "../configs/file.js";
|
|
3
|
+
export declare const runBuildIntegration: (options: InputBuildIntegrationOptions, rcConfig: IntegrationRCConfig | undefined) => Promise<void>;
|
|
@@ -8,7 +8,8 @@ import { getPackageBuildConfig } from "../../package/configs/webpack/buildPackag
|
|
|
8
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
|
+
export const runBuildIntegration = (options, rcConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
13
|
const { entry, buildDir, packageDir, packageManifest, type, watch, copy } = options;
|
|
13
14
|
const INTEGRATION_PATHS = generateIntegrationPaths({
|
|
14
15
|
entry,
|
|
@@ -18,12 +19,22 @@ export const runBuildIntegration = (options) => __awaiter(void 0, void 0, void 0
|
|
|
18
19
|
});
|
|
19
20
|
const mode = "production";
|
|
20
21
|
const commonConfig = getCommonIntegrationConfig(mode, INTEGRATION_PATHS);
|
|
22
|
+
const fetcherFromConfig = rcConfig === null || rcConfig === void 0 ? void 0 : rcConfig.fetcher;
|
|
21
23
|
const config = merge([
|
|
22
24
|
commonConfig,
|
|
23
25
|
watch && {
|
|
24
26
|
watch: true,
|
|
25
27
|
},
|
|
26
|
-
|
|
28
|
+
{
|
|
29
|
+
plugins: [
|
|
30
|
+
copy && new CopyToClipboardPlugin(),
|
|
31
|
+
options.fetchToServer &&
|
|
32
|
+
typeof fetcherFromConfig === "function" &&
|
|
33
|
+
new FetchCodeToServerPlugin({
|
|
34
|
+
fetcher: fetcherFromConfig,
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
},
|
|
27
38
|
]);
|
|
28
39
|
const integrationScriptPath = path.resolve(INTEGRATION_PATHS.appBuildPath, INTEGRATION_PATHS.outputFile);
|
|
29
40
|
if (watch) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const INTEGRATION_TSCONFIG_JSON = "{\n \"compilerOptions\": {\n \"target\": \"ES5\",\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_BABEL_CONFIG = "module.exports = {\n sourceType: \"unambiguous\",\n presets: [\n [\n \"@babel/preset-env\",\n {\n useBuiltIns: \"usage\",\n corejs: \"3.41\",\n },\n ],\n \"@babel/preset-typescript\",\n ],\n};\n";
|
|
3
|
+
export declare const INTEGRATION_BROWSERLIST_CONFIG = "node >=14\n";
|
|
4
|
+
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";
|
|
5
|
+
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";
|
|
6
|
+
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";
|
|
7
|
+
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: 0,\n js_code: integrationCode,\n },\n };\n },\n};\n";
|
|
8
|
+
export declare const INTEGRATION_ENV_EXAMPLE_CONFIG = "API_KEY=123456789qwertyuiop\nGRAPHQL_URL=https://example.com/graphql\n";
|
|
@@ -47,6 +47,7 @@ export const INTEGRATION_GITIGNORE = `\
|
|
|
47
47
|
|
|
48
48
|
# misc
|
|
49
49
|
.DS_Store
|
|
50
|
+
.env
|
|
50
51
|
.env.local
|
|
51
52
|
.env.development.local
|
|
52
53
|
.env.test.local
|
|
@@ -94,3 +95,38 @@ export default defineConfig({
|
|
|
94
95
|
},
|
|
95
96
|
});
|
|
96
97
|
`;
|
|
98
|
+
export const INTEGRATION_RC_CONFIG = `\
|
|
99
|
+
require("dotenv").config();
|
|
100
|
+
|
|
101
|
+
const query = \`
|
|
102
|
+
mutation UpdateIntegration($id: Long!, $js_code: String) {
|
|
103
|
+
automation {
|
|
104
|
+
integration {
|
|
105
|
+
update(id: $id, js_code: $js_code) {
|
|
106
|
+
id
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}\`;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @type {import("@infomaximum/package-cli").IntegrationRCConfig}
|
|
114
|
+
*/
|
|
115
|
+
module.exports = {
|
|
116
|
+
fetcher: (integrationCode) => {
|
|
117
|
+
return {
|
|
118
|
+
graphqlUrl: process.env.GRAPHQL_URL,
|
|
119
|
+
apiKey: process.env.API_KEY,
|
|
120
|
+
query,
|
|
121
|
+
variables: {
|
|
122
|
+
id: 0,
|
|
123
|
+
js_code: integrationCode,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
`;
|
|
129
|
+
export const INTEGRATION_ENV_EXAMPLE_CONFIG = `\
|
|
130
|
+
API_KEY=123456789qwertyuiop
|
|
131
|
+
GRAPHQL_URL=https://example.com/graphql
|
|
132
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const INTEGRATION_INDEX_TEMPLATE = "/// <reference types=\"@infomaximum/integration-sdk\" />\n\nintegration = {\n schema: 1,\n meta: {\n key: \"integrationKey\",\n name: \"\",\n description: \"\",\n },\n blocks: [],\n connections: [],\n};\n";
|
|
@@ -0,0 +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 \"@babel/core\": \"^7.26.9\",\n \"@babel/preset-env\": \"^7.26.9\",\n \"@babel/preset-typescript\": \"^7.26.0\",\n \"@eslint/js\": \"^9.19.0\",\n \"@infomaximum/integration-sdk\": \"^{{integrationSdkVersion}}\",\n \"@infomaximum/package-cli\": \"^{{packageCliVersion}}\",\n \"@types/node\": \"^0\",\n \"core-js\": \"^3.41.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";
|
|
@@ -9,6 +9,7 @@ export const INTEGRATION_PACKAGE_JSON_TEMPLATE = `\
|
|
|
9
9
|
"build": "im-package-cli integration build",
|
|
10
10
|
"build:script": "im-package-cli integration build --type=script",
|
|
11
11
|
"dev": "im-package-cli integration build --watch",
|
|
12
|
+
"serve": "im-package-cli integration build --watch --fetchToServer",
|
|
12
13
|
"lint": "tsc --noEmit && eslint src/ --ext .ts,.tsx --quiet",
|
|
13
14
|
"test": "vitest --run",
|
|
14
15
|
"test:coverage": "vitest --run --coverage",
|
|
@@ -23,6 +24,7 @@ export const INTEGRATION_PACKAGE_JSON_TEMPLATE = `\
|
|
|
23
24
|
"${CUSTOM_PACKAGE_CLI_LIB_NAME}": "^{{packageCliVersion}}",
|
|
24
25
|
"@types/node": "^0",
|
|
25
26
|
"core-js": "^3.41.0",
|
|
27
|
+
"dotenv": "^16.4.7",
|
|
26
28
|
"eslint": "^9.19.0",
|
|
27
29
|
"globals": "^15.14.0",
|
|
28
30
|
"typescript": "^5.7.2",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ZipPlugin from "zip-webpack-plugin";
|
|
2
|
+
import RemovePlugin from "remove-files-webpack-plugin";
|
|
3
|
+
import CopyWebpackPlugin, { type ObjectPattern } from "copy-webpack-plugin";
|
|
4
|
+
import type { Mode } from "../../../paths.js";
|
|
5
|
+
import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
|
|
6
|
+
import type { PackagePaths } from "../../packagePaths.js";
|
|
7
|
+
type Params = {
|
|
8
|
+
mode: Mode;
|
|
9
|
+
PATHS: PackagePaths;
|
|
10
|
+
isBuildDevMode: boolean;
|
|
11
|
+
entityArchivePath?: string;
|
|
12
|
+
copyFiles?: ObjectPattern[];
|
|
13
|
+
};
|
|
14
|
+
export declare const getPackageBuildConfig: ({ mode, PATHS, isBuildDevMode, entityArchivePath, copyFiles, }: Params) => Promise<{
|
|
15
|
+
mode: Mode;
|
|
16
|
+
entry: string[];
|
|
17
|
+
output: {
|
|
18
|
+
path: string;
|
|
19
|
+
filename: string;
|
|
20
|
+
clean: true;
|
|
21
|
+
};
|
|
22
|
+
module: {
|
|
23
|
+
rules: {
|
|
24
|
+
test: RegExp;
|
|
25
|
+
type: string;
|
|
26
|
+
generator: {
|
|
27
|
+
filename: string;
|
|
28
|
+
};
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
plugins: (ZipPlugin | RemovePlugin | CopyWebpackPlugin | JsonModifyWebpackPlugin)[];
|
|
32
|
+
}>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type PackageOptions = {
|
|
2
|
+
buildDir: string;
|
|
3
|
+
packageDir: string;
|
|
4
|
+
packageManifest: string;
|
|
5
|
+
};
|
|
6
|
+
export type PackagePaths = ReturnType<typeof generatePackagePaths>;
|
|
7
|
+
export declare function generatePackagePaths({ packageDir, packageManifest, buildDir, }: PackageOptions): {
|
|
8
|
+
packagePath: string;
|
|
9
|
+
packageDirPath: string;
|
|
10
|
+
packageManifestPath: string;
|
|
11
|
+
appPath: string;
|
|
12
|
+
appBuildPath: string;
|
|
13
|
+
appPackageJson: string;
|
|
14
|
+
appTsConfig: string;
|
|
15
|
+
appNodeModules: string;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PackageType } from "../../types.js";
|
|
2
|
+
export type PackageActionsParams = {
|
|
3
|
+
packageType: PackageType;
|
|
4
|
+
};
|
|
5
|
+
export declare const getPackageActions: ({ packageType }: PackageActionsParams) => ({
|
|
6
|
+
type: string;
|
|
7
|
+
path: string;
|
|
8
|
+
template: string;
|
|
9
|
+
data: {
|
|
10
|
+
packageIconName: string;
|
|
11
|
+
packageType: PackageType;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
type: string;
|
|
15
|
+
path: string;
|
|
16
|
+
template: string;
|
|
17
|
+
data?: undefined;
|
|
18
|
+
})[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ListQuestion } from "inquirer";
|
|
2
|
+
type PackageManager = "npm" | "yarn";
|
|
3
|
+
type Answers = {
|
|
4
|
+
packageName: string;
|
|
5
|
+
author: string;
|
|
6
|
+
widgetName: string;
|
|
7
|
+
packageDescription?: string;
|
|
8
|
+
packageManager: PackageManager;
|
|
9
|
+
};
|
|
10
|
+
declare const prompts: (ListQuestion<import("inquirer").Answers> | {
|
|
11
|
+
message: string;
|
|
12
|
+
type: "input";
|
|
13
|
+
name: string;
|
|
14
|
+
validate: (input: string) => boolean;
|
|
15
|
+
default?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
message: string;
|
|
18
|
+
type: "input";
|
|
19
|
+
name: string;
|
|
20
|
+
default: string;
|
|
21
|
+
validate?: undefined;
|
|
22
|
+
})[];
|
|
23
|
+
export { prompts };
|
|
24
|
+
export type { Answers, PackageManager };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PACKAGE_ICON_TEMPLATE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20px\" height=\"20px\" viewBox=\"0 0 20 20\">\n <path fill=\"#0CB3B3\" d=\"M 2.65625 1.25 C 1.878906 1.25 1.25 1.878906 1.25 2.65625 L 1.25 7.890625 C 1.25 8.667969 1.878906 9.296875 2.65625 9.296875 L 7.890625 9.296875 C 8.667969 9.296875 9.296875 8.667969 9.296875 7.890625 L 9.296875 2.65625 C 9.296875 1.878906 8.667969 1.25 7.890625 1.25 Z M 2.65625 1.25 \"/>\n <path fill=\"#0CB3B3\" d=\"M 2.65625 10.703125 C 1.878906 10.703125 1.25 11.332031 1.25 12.109375 L 1.25 17.34375 C 1.25 18.121094 1.878906 18.75 2.65625 18.75 L 7.890625 18.75 C 8.667969 18.75 9.296875 18.121094 9.296875 17.34375 L 9.296875 12.109375 C 9.296875 11.332031 8.667969 10.703125 7.890625 10.703125 Z M 2.65625 10.703125 \"/>\n <path fill=\"#0CB3B3\" d=\"M 10.703125 2.65625 C 10.703125 1.878906 11.332031 1.25 12.109375 1.25 L 17.34375 1.25 C 18.121094 1.25 18.75 1.878906 18.75 2.65625 L 18.75 7.890625 C 18.75 8.667969 18.121094 9.296875 17.34375 9.296875 L 12.109375 9.296875 C 11.332031 9.296875 10.703125 8.667969 10.703125 7.890625 Z M 10.703125 2.65625 \"/>\n <path fill=\"#0CB3B3\" d=\"M 14.726562 10.703125 C 12.503906 10.703125 10.703125 12.503906 10.703125 14.726562 C 10.703125 16.949219 12.503906 18.75 14.726562 18.75 C 16.949219 18.75 18.75 16.949219 18.75 14.726562 C 18.75 12.503906 16.949219 10.703125 14.726562 10.703125 Z M 14.726562 10.703125 \"/>\n</svg>";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PACKAGE_MANIFEST_TEMPLATE: string;
|
package/dist/paths.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TGeneratePathsArgs = {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
buildDir: string;
|
|
4
|
+
};
|
|
5
|
+
export type Mode = "development" | "production";
|
|
6
|
+
export type GlobalPaths = ReturnType<typeof generateGlobalPaths>;
|
|
7
|
+
export declare const appDirectory: string;
|
|
8
|
+
export declare const _resolveApp: (cwd?: string) => (relativePath: string) => string;
|
|
9
|
+
export declare const generateIndexPath: (entryPath?: string) => string;
|
|
10
|
+
export declare const generateGlobalPaths: (args: TGeneratePathsArgs) => {
|
|
11
|
+
appPath: string;
|
|
12
|
+
appBuildPath: string;
|
|
13
|
+
appPackageJson: string;
|
|
14
|
+
appTsConfig: string;
|
|
15
|
+
appNodeModules: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Actions, NodePlopAPI } from "node-plop";
|
|
2
|
+
import type { PackageType } from "./types.js";
|
|
3
|
+
declare const capitalizeHelperName = "capitalize";
|
|
4
|
+
declare const addCommonHelpers: (plop: NodePlopAPI) => void;
|
|
5
|
+
export { capitalizeHelperName, addCommonHelpers };
|
|
6
|
+
type InitEntityScriptParams = {
|
|
7
|
+
entity: PackageType;
|
|
8
|
+
dirName: string;
|
|
9
|
+
actions: Actions;
|
|
10
|
+
};
|
|
11
|
+
export declare const runInitEntityScript: ({ entity, dirName, actions, }: InitEntityScriptParams) => Promise<void>;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PackageType = "widget" | "integration";
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WriteFileOptions } from "node:fs";
|
|
2
|
+
import { type SpawnOptions } from "node:child_process";
|
|
3
|
+
import { type Configuration, type Stats } from "webpack";
|
|
4
|
+
export declare const isExist: (entityPath: string) => Promise<boolean>;
|
|
5
|
+
type Dependency = {
|
|
6
|
+
version: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const systemRequire: NodeRequire;
|
|
9
|
+
export declare function capitalizeFirstLetter(str?: string): string;
|
|
10
|
+
export declare function safeWriteFile(pathToFile: string, contents: any, options: WriteFileOptions): Promise<void>;
|
|
11
|
+
export declare function getLatestVersionOfLibrary(libraryName: string): Promise<string>;
|
|
12
|
+
export declare function getLibraryVersionInProject(libraryName: string): Promise<{
|
|
13
|
+
dependencies?: Record<string, Dependency>;
|
|
14
|
+
devDependencies?: Record<string, Dependency>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function spawnCommand(command: string, args: ReadonlyArray<string>, options: SpawnOptions): Promise<void>;
|
|
17
|
+
export declare function removeServiceFieldsForDevelopment(obj: Record<string, any>): void;
|
|
18
|
+
export declare const compact: <T>(items: (T | null | undefined | false | "" | 0)[]) => T[];
|
|
19
|
+
export declare function runWebpackBuild(config: Configuration): Promise<void>;
|
|
20
|
+
export declare function handleWebpackCallback(err?: any | null, stats?: Stats, okCb?: () => void, errCb?: () => void): void;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type InputCommonOptions } from "./common.js";
|
|
3
|
+
export type InputBuildOptions = {
|
|
4
|
+
dev: boolean;
|
|
5
|
+
port?: string | number;
|
|
6
|
+
host?: string;
|
|
7
|
+
buildDir?: string;
|
|
8
|
+
} & InputCommonOptions;
|
|
9
|
+
export type MergedBuildOptions = ReturnType<typeof configMergeWithOptionsBuild>;
|
|
10
|
+
declare function configMergeWithOptionsBuild(options: InputBuildOptions): {
|
|
11
|
+
entry: string;
|
|
12
|
+
assetsDir: string | undefined;
|
|
13
|
+
packageDir: string;
|
|
14
|
+
packageManifest: string;
|
|
15
|
+
widgetManifest: string;
|
|
16
|
+
buildDir: string;
|
|
17
|
+
host: string | undefined;
|
|
18
|
+
port: string | number | undefined;
|
|
19
|
+
dev: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare const registerWidgetBuildCommand: (widgetCommand: Command) => void;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WidgetRCConfig } from "../configs/file.js";
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
import { type InputPackageOptions } from "../../package/commands.js";
|
|
4
|
+
export type InputCommonOptions = {
|
|
5
|
+
entry: string;
|
|
6
|
+
widgetManifest?: string;
|
|
7
|
+
assetsDir?: string;
|
|
8
|
+
} & InputPackageOptions;
|
|
9
|
+
export type MergedCommonOptions = ReturnType<typeof configMergeWithOptionsCommon>;
|
|
10
|
+
export declare function registerCommonOption(command: Command): void;
|
|
11
|
+
export declare function configMergeWithOptionsCommon(config: WidgetRCConfig | undefined, options: InputCommonOptions): {
|
|
12
|
+
entry: string;
|
|
13
|
+
assetsDir: string | undefined;
|
|
14
|
+
packageDir: string;
|
|
15
|
+
packageManifest: string;
|
|
16
|
+
widgetManifest: string;
|
|
17
|
+
buildDir: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export type InputReleaseOptions = {
|
|
3
|
+
first: boolean;
|
|
4
|
+
dryRun: boolean;
|
|
5
|
+
skipTag: boolean;
|
|
6
|
+
skipChangelog: boolean;
|
|
7
|
+
skipBump: boolean;
|
|
8
|
+
skipCommit: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const registerWidgetReleaseCommand: (widgetCommand: Command) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type InputCommonOptions } from "./common.js";
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
export type InputStartOptions = {
|
|
4
|
+
port: string | number;
|
|
5
|
+
host: string;
|
|
6
|
+
} & InputCommonOptions;
|
|
7
|
+
export type MergedStartOptions = ReturnType<typeof configMergeWithOptionsStart>;
|
|
8
|
+
declare function configMergeWithOptionsStart(options: InputStartOptions): {
|
|
9
|
+
entry: string;
|
|
10
|
+
assetsDir: string | undefined;
|
|
11
|
+
packageDir: string;
|
|
12
|
+
packageManifest: string;
|
|
13
|
+
widgetManifest: string;
|
|
14
|
+
buildDir: string;
|
|
15
|
+
host: string;
|
|
16
|
+
port: string | number;
|
|
17
|
+
};
|
|
18
|
+
export declare const registerWidgetStartCommand: (widgetCommand: Command) => void;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type WidgetRCConfig = {
|
|
2
|
+
entry: string;
|
|
3
|
+
widgetManifest: string;
|
|
4
|
+
packageManifest: string;
|
|
5
|
+
packageDir: string;
|
|
6
|
+
assetsDir: string;
|
|
7
|
+
buildDir: string;
|
|
8
|
+
port: number;
|
|
9
|
+
host: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const getConfigFromFile: () => WidgetRCConfig | undefined;
|
|
@@ -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,9 @@
|
|
|
1
|
+
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
2
|
+
import TerserWebpackPlugin from "terser-webpack-plugin";
|
|
3
|
+
export declare const getMinimizer: () => {
|
|
4
|
+
optimization: {
|
|
5
|
+
minimize: boolean;
|
|
6
|
+
splitChunks: boolean;
|
|
7
|
+
minimizer: (TerserWebpackPlugin<import("terser").MinifyOptions> | CssMinimizerPlugin<CssMinimizerPlugin.CssNanoOptionsExtended>)[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
|
|
2
|
+
import type { WidgetPaths } from "../../../../widgetPaths.js";
|
|
3
|
+
type Params = {
|
|
4
|
+
port?: string | number;
|
|
5
|
+
host?: string;
|
|
6
|
+
isBuildDevMode: boolean;
|
|
7
|
+
WIDGET_PATHS: WidgetPaths;
|
|
8
|
+
};
|
|
9
|
+
export declare const getModifyManifestWidgetPlugin: ({ host, port, isBuildDevMode, WIDGET_PATHS, }: Params) => JsonModifyWebpackPlugin;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const WIDGET_SDK_LIB_NAME = "@infomaximum/widget-sdk";
|
|
2
|
+
export declare const WIDGET_OUTPUT_FILE_NAME = "widget";
|
|
3
|
+
export declare const WIDGET_OUTPUT_FULL_FILE_NAME = "widget.js";
|
|
4
|
+
export declare const WIDGET_CONFIG_FIELD_NAME = "widget";
|
|
5
|
+
export declare const WIDGET_CONFIG_FILE_NAME = "widgetrc";
|
|
6
|
+
export declare const WIDGET_ARCHIVE_NAME = "widget";
|
|
7
|
+
export declare const WIDGET_ARCHIVE_FULL_NAME = "widget.zip";
|
|
8
|
+
export declare const WIDGET_DEFAULT_HOST = "localhost";
|
|
9
|
+
export declare const WIDGET_DEFAULT_PORT = "5555";
|
|
10
|
+
export declare const WIDGET_SDK_VERSION_FIELD_NAME = "sdk_version";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerWidgetCommands } from "./commands.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Answers } from "../../../package/scripts/prompts.js";
|
|
2
|
+
declare const getInitWidgetActions: () => Promise<(data: Answers) => ({
|
|
3
|
+
type: string;
|
|
4
|
+
path: string;
|
|
5
|
+
template: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: "add";
|
|
8
|
+
path: string;
|
|
9
|
+
template: string;
|
|
10
|
+
data: {
|
|
11
|
+
packageIconName: string;
|
|
12
|
+
packageType: string;
|
|
13
|
+
widgetSDKVersion?: undefined;
|
|
14
|
+
packageCliVersion?: undefined;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
type: "add";
|
|
18
|
+
path: string;
|
|
19
|
+
template: string;
|
|
20
|
+
data: {
|
|
21
|
+
widgetSDKVersion: string;
|
|
22
|
+
packageCliVersion: string;
|
|
23
|
+
packageIconName?: undefined;
|
|
24
|
+
packageType?: undefined;
|
|
25
|
+
};
|
|
26
|
+
})[]>;
|
|
27
|
+
export { getInitWidgetActions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WIDGET_DEFINITION_TEMPLATE = "import type {\n IDefinition,\n IFillSettings,\n IGroupSettings,\n IPanelDescriptionCreator,\n} from \"@infomaximum/widget-sdk\";\nimport { fillSettings, type WidgetSettings } from \"./settings\";\nimport { createPanelDescription } from \"./panel\";\n\nexport class Definition implements IDefinition<WidgetSettings, IGroupSettings> {\n public createPanelDescription: IPanelDescriptionCreator<\n WidgetSettings,\n IGroupSettings\n > = createPanelDescription;\n\n public fillSettings: IFillSettings<WidgetSettings> = fillSettings;\n\n public getLocalMigrateVersions(): string[] {\n return [];\n }\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WIDGET_PANEL_TEMPLATE = "import {\n type IPanelDescriptionCreator,\n type IGroupSettings,\n} from \"@infomaximum/widget-sdk\";\nimport type { WidgetSettings } from \"./settings\";\n\nexport const createPanelDescription: IPanelDescriptionCreator<\n WidgetSettings,\n IGroupSettings\n> = () => ({});\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WIDGET_SETTINGS_TEMPLATE = "import type {\n IBaseWidgetSettings,\n IFillSettings,\n} from \"@infomaximum/widget-sdk\";\n\nexport interface WidgetSettings extends IBaseWidgetSettings {}\n\nexport const fillSettings: IFillSettings<WidgetSettings> = (settings) => {}; \n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const APP_D_TS_TEMPLATE = "/* eslint-disable @typescript-eslint/triple-slash-reference */\n/// <reference types=\"@infomaximum/global-types\" />\n/// <reference types=\"@infomaximum/widget-sdk\" />\n\ndeclare module \"*.gif\" {\n const src: string;\n export default src;\n}\n\ndeclare module \"*.jpg\" {\n const src: string;\n export default src;\n}\n\ndeclare module \"*.jpeg\" {\n const src: string;\n export default src;\n}\n\ndeclare module \"*.png\" {\n const src: string;\n export default src;\n}\n\ndeclare module \"*.webp\" {\n const src: string;\n export default src;\n}\n\ndeclare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\ndeclare module \"*.module.scss\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\ndeclare module \"*.module.sass\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\ndeclare module \"*.module.less\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WIDGET_INDEX_TEMPLATE = "import React from \"react\";\nimport ReactDOM from \"react-dom/client\";\nimport \"./index.css\";\nimport {\n type IWidget,\n type ICustomWidgetProps,\n} from \"@infomaximum/widget-sdk\";\nimport manifest from \"../manifest.json\";\nimport { type WidgetSettings } from \"./definition/settings\";\nimport { Definition } from \"./definition/definition\";\n\nclass CustomWidget implements IWidget<WidgetSettings> {\n public static definition = new Definition();\n\n private root: ReactDOM.Root | null = null;\n\n public initialize(container: HTMLElement) {\n this.root = ReactDOM.createRoot(container);\n }\n\n public update(\n container: HTMLElement,\n props: ICustomWidgetProps<WidgetSettings>\n ) {\n this.render(props);\n }\n\n public mount(\n container: HTMLElement,\n props: ICustomWidgetProps<WidgetSettings>\n ) {\n this.render(props);\n }\n\n public unmount() {\n this.root?.unmount();\n }\n\n private render(props: ICustomWidgetProps<WidgetSettings>) {\n this.root?.render(\n <React.StrictMode>\n <div>{{ capitalize packageName}}</div>\n </React.StrictMode>\n );\n }\n}\n\nwindow.im.widget.defineWidget(manifest.uuid, CustomWidget);\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WIDGET_INDEX_CSS_TEMPLATE = "body {\n margin: 0;\n overflow: hidden;\n font-family: -apple-system, BlinkMacSystemFont, \"Montserrat Segoe UI\",\n \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\",\n \"Helvetica Neue\", sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const WIDGET_TSCONFIG_JSON = "{\n \"compilerOptions\": {\n \"target\": \"ES2015\",\n \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n \"allowJs\": true,\n \"skipLibCheck\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true,\n \"noUncheckedIndexedAccess\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"incremental\": true,\n \"module\": \"esnext\",\n \"moduleResolution\": \"node\",\n \"resolveJsonModule\": true,\n \"isolatedModules\": true,\n \"verbatimModuleSyntax\": true,\n \"noEmit\": true,\n \"jsx\": \"react-jsx\"\n },\n \"include\": [\"src\"]\n}\n";
|
|
2
|
+
export declare const WIDGET_BABEL_CONFIG = "module.exports = {\n presets: [\n \"@babel/preset-env\",\n [\"@babel/preset-react\", { runtime: \"automatic\" }],\n \"@babel/preset-typescript\",\n ],\n};\n";
|
|
3
|
+
export declare const WIDGET_GITIGNORE = "# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\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";
|
|
4
|
+
export declare const WIDGET_ESLINTIGNORE = "node_modules\nbuild\n";
|
|
5
|
+
export declare const WIDGET_ESLINTRC = "{\n \"root\": true,\n \"parser\": \"@typescript-eslint/parser\",\n \"plugins\": [\"@typescript-eslint\", \"react-hooks\"],\n \"extends\": [\n \"plugin:@typescript-eslint/recommended\",\n \"plugin:react/recommended\",\n \"plugin:react-hooks/recommended\"\n ],\n \"settings\": {\n \"react\": {\n \"version\": \"detect\"\n }\n },\n \"rules\": {\n \"react/jsx-uses-react\": \"off\", // React 17+\n \"react/react-in-jsx-scope\": \"off\", // React 17+\n \"react/prop-types\": \"off\",\n \"react/no-unknown-property\": [\"error\", { \"ignore\": [\"css\"] }],\n \"@typescript-eslint/no-explicit-any\": \"off\"\n }\n}\n";
|
|
6
|
+
export declare const WIDGET_JEST_CONFIG = "/**\n * @type {import(\"jest\").Config}\n */\nmodule.exports = {\n setupFilesAfterEnv: [\"jest-canvas-mock\"],\n testEnvironment: \"jest-environment-jsdom-global\",\n moduleDirectories: [\"node_modules\", \"src\"],\n};\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WIDGET_MANIFEST_TEMPLATE: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WIDGET_PACKAGE_JSON_TEMPLATE = "{\n \"name\": \"template_widget\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"main\": \"src/index.tsx\",\n \"scripts\": {\n \"build\": \"im-package-cli widget build\",\n \"build:dev\": \"im-package-cli widget build --dev\",\n \"start\": \"im-package-cli widget start\",\n \"lint\": \"tsc --noEmit && eslint src/ --ext .ts,.tsx --quiet\",\n \"test\": \"jest --passWithNoTests\",\n \"release\": \"im-package-cli widget release\",\n \"changelog\":\"im-package-cli widget release --dry-run\"\n },\n \"dependencies\": {\n \"@infomaximum/widget-sdk\": \"{{widgetSDKVersion}}\",\n \"react\": \"18.3.1\",\n \"react-dom\": \"18.3.1\"\n },\n \"devDependencies\": {\n \"@babel/core\": \"7.25.2\",\n \"@babel/preset-env\": \"7.25.4\",\n \"@babel/preset-react\": \"7.24.7\",\n \"@babel/preset-typescript\": \"7.24.7\",\n \"@infomaximum/package-cli\": \"^{{packageCliVersion}}\",\n \"@types/jest\": \"29.5.11\",\n \"@types/react\": \"18.3.4\",\n \"@types/react-dom\": \"18.3.0\",\n \"@typescript-eslint/eslint-plugin\": \"8.3.0\",\n \"@typescript-eslint/parser\": \"8.3.0\",\n \"eslint\": \"8.57.0\",\n \"eslint-plugin-react\": \"7.35.0\",\n \"eslint-plugin-react-hooks\": \"4.6.2\",\n \"jest\": \"29.7.0\",\n \"jest-canvas-mock\": \"2.5.2\",\n \"jest-environment-jsdom\": \"29.7.0\",\n \"jest-environment-jsdom-global\": \"4.0.0\",\n \"prettier\": \"3.1.1\",\n \"typescript\": \"5.5.4\"\n },\n \"browserslist\": [\n \"defaults and supports es6-module\"\n ]\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WIDGET_RC_CONFIG: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MergedBuildOptions } from "./commands/build.js";
|
|
2
|
+
import type { MergedStartOptions } from "./commands/start.js";
|
|
3
|
+
export type WidgetPaths = ReturnType<typeof generateWidgetPaths>;
|
|
4
|
+
type Options = MergedBuildOptions | MergedStartOptions;
|
|
5
|
+
export declare function generateWidgetPaths({ entry, assetsDir, widgetManifest, buildDir, }: Options): {
|
|
6
|
+
moduleIndex: string;
|
|
7
|
+
widgetManifestJsonPath: string;
|
|
8
|
+
widgetResourcesPath: string | null;
|
|
9
|
+
widgetResourcesDirName: string | null;
|
|
10
|
+
widgetBuildDirPath: string;
|
|
11
|
+
appPath: string;
|
|
12
|
+
appBuildPath: string;
|
|
13
|
+
appPackageJson: string;
|
|
14
|
+
appTsConfig: string;
|
|
15
|
+
appNodeModules: string;
|
|
16
|
+
};
|
|
17
|
+
export {};
|