@infomaximum/package-cli 2.24.0 → 2.26.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 (60) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +183 -183
  3. package/dist/application/applicationPaths.d.ts +15 -0
  4. package/dist/application/applicationPaths.js +9 -0
  5. package/dist/application/commands/build.d.ts +21 -0
  6. package/dist/application/commands/build.js +18 -0
  7. package/dist/application/commands/common.d.ts +16 -0
  8. package/dist/application/commands/common.js +28 -0
  9. package/dist/application/commands/init.d.ts +2 -0
  10. package/dist/application/commands/init.js +15 -0
  11. package/dist/application/commands/start.d.ts +18 -0
  12. package/dist/application/commands/start.js +23 -0
  13. package/dist/application/commands.d.ts +2 -0
  14. package/dist/application/commands.js +9 -0
  15. package/dist/application/configs/file.d.ts +10 -0
  16. package/dist/application/configs/file.js +11 -0
  17. package/dist/application/configs/webpack/common.d.ts +4 -0
  18. package/dist/application/configs/webpack/common.js +139 -0
  19. package/dist/application/configs/webpack/sections/devServer.d.ts +21 -0
  20. package/dist/application/configs/webpack/sections/devServer.js +19 -0
  21. package/dist/application/configs/webpack/sections/devtool.d.ts +3 -0
  22. package/dist/application/configs/webpack/sections/devtool.js +3 -0
  23. package/dist/application/configs/webpack/sections/loaders/cssLoaders.d.ts +8 -0
  24. package/dist/application/configs/webpack/sections/loaders/cssLoaders.js +16 -0
  25. package/dist/application/configs/webpack/sections/plugins/minimizer.d.ts +9 -0
  26. package/dist/application/configs/webpack/sections/plugins/minimizer.js +23 -0
  27. package/dist/application/configs/webpack/sections/plugins/modifyManifestApplication.d.ts +10 -0
  28. package/dist/application/configs/webpack/sections/plugins/modifyManifestApplication.js +35 -0
  29. package/dist/application/configs/webpack/sections/plugins/reactRefresh.d.ts +2 -0
  30. package/dist/application/configs/webpack/sections/plugins/reactRefresh.js +4 -0
  31. package/dist/application/configs/webpack/sections/plugins/zipApplication.d.ts +6 -0
  32. package/dist/application/configs/webpack/sections/plugins/zipApplication.js +11 -0
  33. package/dist/application/const.d.ts +10 -0
  34. package/dist/application/const.js +11 -0
  35. package/dist/application/index.d.ts +1 -0
  36. package/dist/application/index.js +1 -0
  37. package/dist/application/scripts/build.d.ts +2 -0
  38. package/dist/application/scripts/build.js +63 -0
  39. package/dist/application/scripts/init.d.ts +23 -0
  40. package/dist/application/scripts/init.js +60 -0
  41. package/dist/application/scripts/start.d.ts +2 -0
  42. package/dist/application/scripts/start.js +61 -0
  43. package/dist/application/templates/applicationConfigs.d.ts +3 -0
  44. package/dist/application/templates/applicationConfigs.js +60 -0
  45. package/dist/application/templates/applicationManifest.d.ts +1 -0
  46. package/dist/application/templates/applicationManifest.js +11 -0
  47. package/dist/application/templates/applicationPackageJson.d.ts +1 -0
  48. package/dist/application/templates/applicationPackageJson.js +29 -0
  49. package/dist/application/templates/applicationRCConfig.d.ts +1 -0
  50. package/dist/application/templates/applicationRCConfig.js +14 -0
  51. package/dist/application/templates/src/applicationContent.d.ts +1 -0
  52. package/dist/application/templates/src/applicationContent.js +11 -0
  53. package/dist/application/templates/src/applicationIndex.d.ts +1 -0
  54. package/dist/application/templates/src/applicationIndex.js +34 -0
  55. package/dist/arguments.js +2 -0
  56. package/dist/integration/configs/webpack/common.js +5 -0
  57. package/dist/types.d.ts +1 -1
  58. package/package.json +4 -1
  59. package/schemas/applicationConfigSchema.json +48 -0
  60. package/schemas/applicationManifestSchema.json +29 -0
@@ -0,0 +1,11 @@
1
+ import { CUSTOM_PACKAGE_CLI_LIB_NAME } from "../../const.js";
2
+ import { capitalizeHelperName } from "../../plopHelpers.js";
3
+ export const APPLICATION_MANIFEST_TEMPLATE = `\
4
+ {
5
+ "$schema": "node_modules/${CUSTOM_PACKAGE_CLI_LIB_NAME}/schemas/applicationManifestSchema.json",
6
+ "name": {
7
+ "en": "{{${capitalizeHelperName} packageName}}",
8
+ "ru": "{{${capitalizeHelperName} packageName}}"
9
+ }
10
+ }
11
+ `;
@@ -0,0 +1 @@
1
+ export declare const APPLICATION_PACKAGE_JSON_TEMPLATE = "{\n \"name\": \"template_application\",\n \"version\": \"1.0.0\",\n \"main\": \"src/index.tsx\",\n \"scripts\": {\n \"build\": \"im-package-cli application build\",\n \"build:dev\": \"im-package-cli application build --dev\",\n \"start\": \"im-package-cli application start\"\n },\n \"dependencies\": {\n \"react\": \"18.2.0\",\n \"react-dom\": \"18.2.0\"\n },\n \"devDependencies\": {\n \"@infomaximum/application-types\": \"1.1.1\",\n \"@infomaximum/package-cli\": \"^{{packageCliVersion}}\",\n \"@types/react\": \"18.2.55\",\n \"@types/react-dom\": \"18.2.19\",\n \"prettier\": \"3.7.3\",\n \"typescript\": \"5.9.3\"\n },\n \"browserslist\": [\n \"defaults and supports es6-module\"\n ]\n}\n";
@@ -0,0 +1,29 @@
1
+ import { CUSTOM_PACKAGE_CLI_LIB_NAME } from "../../const.js";
2
+ import { APPLICATION_SDK_LIB_NAME, APPLICATION_SDK_LIB_VERSION, } from "../const.js";
3
+ export const APPLICATION_PACKAGE_JSON_TEMPLATE = `\
4
+ {
5
+ "name": "template_application",
6
+ "version": "1.0.0",
7
+ "main": "src/index.tsx",
8
+ "scripts": {
9
+ "build": "im-package-cli application build",
10
+ "build:dev": "im-package-cli application build --dev",
11
+ "start": "im-package-cli application start"
12
+ },
13
+ "dependencies": {
14
+ "react": "18.2.0",
15
+ "react-dom": "18.2.0"
16
+ },
17
+ "devDependencies": {
18
+ "${APPLICATION_SDK_LIB_NAME}": "${APPLICATION_SDK_LIB_VERSION}",
19
+ "${CUSTOM_PACKAGE_CLI_LIB_NAME}": "^{{packageCliVersion}}",
20
+ "@types/react": "18.2.55",
21
+ "@types/react-dom": "18.2.19",
22
+ "prettier": "3.7.3",
23
+ "typescript": "5.9.3"
24
+ },
25
+ "browserslist": [
26
+ "defaults and supports es6-module"
27
+ ]
28
+ }
29
+ `;
@@ -0,0 +1 @@
1
+ export declare const APPLICATION_RC_CONFIG: string;
@@ -0,0 +1,14 @@
1
+ import { CUSTOM_PACKAGE_CLI_LIB_NAME, DEFAULT_BUILD_DIR_NAME, MANIFEST_JSON_FILE_NAME, } from "../../const.js";
2
+ import { APPLICATION_DEFAULT_HOST, APPLICATION_DEFAULT_PORT, } from "../const.js";
3
+ export const APPLICATION_RC_CONFIG = `\
4
+ {
5
+ "$schema": "node_modules/${CUSTOM_PACKAGE_CLI_LIB_NAME}/schemas/applicationConfigSchema.json",
6
+ "entry": "src/index.tsx",
7
+ "applicationManifest": "${MANIFEST_JSON_FILE_NAME}",
8
+ "packageDir": "package",
9
+ "packageManifest": "package/${MANIFEST_JSON_FILE_NAME}",
10
+ "buildDir": "${DEFAULT_BUILD_DIR_NAME}",
11
+ "port": ${+APPLICATION_DEFAULT_PORT},
12
+ "host": "${APPLICATION_DEFAULT_HOST}"
13
+ }
14
+ `;
@@ -0,0 +1 @@
1
+ export declare const APPLICATION_CONTENT_TEMPLATE = "import { FC } from \"react\";\n\nexport interface IContentProps {}\n\nconst Content: FC<IContentProps> = () => {\n return <div>Application example</div>;\n};\n\nexport default Content;\n";
@@ -0,0 +1,11 @@
1
+ export const APPLICATION_CONTENT_TEMPLATE = `\
2
+ import { FC } from "react";
3
+
4
+ export interface IContentProps {}
5
+
6
+ const Content: FC<IContentProps> = () => {
7
+ return <div>Application example</div>;
8
+ };
9
+
10
+ export default Content;
11
+ `;
@@ -0,0 +1 @@
1
+ export declare const APPLICATION_INDEX_TEMPLATE = "import { Root, createRoot } from \"react-dom/client\";\nimport Content from \"./Content\";\nimport { IApplication } from \"@infomaximum/application-types\";\nimport packageManifest from \"../package/manifest.json\";\n\nclass Application implements IApplication {\n public root: Root | null = null;\n\n public initialize(container: HTMLElement) {\n this.root = createRoot(container);\n }\n\n public mount(container: HTMLElement, props: Record<string, any>) {\n this.render(props);\n }\n\n public update(container: HTMLElement, props: Record<string, any>) {\n this.render(props);\n }\n\n public unmount() {\n this.root?.unmount();\n }\n\n private render(props: Record<string, any>) {\n this.root?.render(<Content {...props} />);\n }\n}\n\nwindow.im.defineApplication(packageManifest.guid, Application);\n";
@@ -0,0 +1,34 @@
1
+ import { MANIFEST_JSON_FILE_NAME } from "../../../const.js";
2
+ import { APPLICATION_SDK_LIB_NAME } from "../../const.js";
3
+ export const APPLICATION_INDEX_TEMPLATE = `\
4
+ import { Root, createRoot } from "react-dom/client";
5
+ import Content from "./Content";
6
+ import { IApplication } from "${APPLICATION_SDK_LIB_NAME}";
7
+ import packageManifest from "../package/${MANIFEST_JSON_FILE_NAME}";
8
+
9
+ class Application implements IApplication {
10
+ public root: Root | null = null;
11
+
12
+ public initialize(container: HTMLElement) {
13
+ this.root = createRoot(container);
14
+ }
15
+
16
+ public mount(container: HTMLElement, props: Record<string, any>) {
17
+ this.render(props);
18
+ }
19
+
20
+ public update(container: HTMLElement, props: Record<string, any>) {
21
+ this.render(props);
22
+ }
23
+
24
+ public unmount() {
25
+ this.root?.unmount();
26
+ }
27
+
28
+ private render(props: Record<string, any>) {
29
+ this.root?.render(<Content {...props} />);
30
+ }
31
+ }
32
+
33
+ window.im.defineApplication(packageManifest.guid, Application);
34
+ `;
package/dist/arguments.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import { packageJson } from "./utils.js";
2
2
  import { registerWidgetCommands } from "./widget/index.js";
3
3
  import { registerIntegrationCommands } from "./integration/index.js";
4
+ import { registerApplicationCommands } from "./application/index.js";
4
5
  export const registerCommands = (cli) => {
5
6
  cli.helpOption("-h", "отображает помощь по командам");
6
7
  cli.name("im-package-cli");
7
8
  cli.version(packageJson.version, "-v, --version", "текущая версия библиотеки");
8
9
  registerWidgetCommands(cli);
9
10
  registerIntegrationCommands(cli);
11
+ registerApplicationCommands(cli);
10
12
  };
@@ -20,6 +20,11 @@ export const getCommonIntegrationConfig = ({ PATHS, mode, isBeautifyCode, }) =>
20
20
  },
21
21
  resolve: {
22
22
  extensions: [".ts", ".js", ".json"],
23
+ fallback: {
24
+ stream: require.resolve("stream-browserify"),
25
+ util: require.resolve("util"),
26
+ zlib: require.resolve("browserify-zlib"),
27
+ },
23
28
  },
24
29
  module: {
25
30
  rules: [
package/dist/types.d.ts CHANGED
@@ -1 +1 @@
1
- export type PackageType = "widget" | "integration";
1
+ export type PackageType = "widget" | "integration" | "application";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/package-cli",
3
- "version": "2.24.0",
3
+ "version": "2.26.1",
4
4
  "exports": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -33,6 +33,7 @@
33
33
  "autoprefixer": "^10.4.16",
34
34
  "babel-loader": "^9.1.3",
35
35
  "babel-plugin-inline-json-import": "^0.3.2",
36
+ "browserify-zlib": "^0.2.0",
36
37
  "chalk": "^5.3.0",
37
38
  "clipboardy": "^4.0.0",
38
39
  "commander": "^11.1.0",
@@ -59,11 +60,13 @@
59
60
  "sass-loader": "^13.3.2",
60
61
  "semver": "^7.6.3",
61
62
  "standard-version": "=9.5.0",
63
+ "stream-browserify": "^3.0.0",
62
64
  "stringify-package": "^1.0.1",
63
65
  "style-loader": "^3.3.3",
64
66
  "terser-webpack-plugin": "^5.3.9",
65
67
  "ts-loader": "^9.5.2",
66
68
  "tsconfig-paths-webpack-plugin": "^4.1.0",
69
+ "util": "^0.12.5",
67
70
  "webpack": "^5.94.0",
68
71
  "webpack-dev-server": "^4.15.1",
69
72
  "webpack-merge": "^5.10.0",
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "additionalProperties": false,
5
+ "properties": {
6
+ "$schema": {
7
+ "type": "string"
8
+ },
9
+ "entry": {
10
+ "type": "string",
11
+ "description": "файл который является точкой входа"
12
+ },
13
+ "applicationManifest": {
14
+ "type": "string",
15
+ "description": "путь до файла манифеста приложения"
16
+ },
17
+ "packageManifest": {
18
+ "type": "string",
19
+ "description": "путь до файла манифеста пакета"
20
+ },
21
+ "packageDir": {
22
+ "type": "string",
23
+ "description": "директория с файлами пакета"
24
+ },
25
+ "buildDir": {
26
+ "type": "string",
27
+ "description": "директория в которую будет осуществляться сборка проекта"
28
+ },
29
+ "port": {
30
+ "type": "integer",
31
+ "minimum": 0,
32
+ "maximum": 65535,
33
+ "description": "порт по которому будет доступен сервер разработки"
34
+ },
35
+ "host": {
36
+ "type": "string",
37
+ "description": "хост по которому будет доступен сервер разработки"
38
+ }
39
+ },
40
+ "required": [
41
+ "entry",
42
+ "applicationManifest",
43
+ "packageManifest",
44
+ "packageDir",
45
+ "port",
46
+ "host"
47
+ ]
48
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "entry": {
6
+ "type": "string",
7
+ "title": "Имя файла в который будет собрано приложение",
8
+ "description": "Если не задан, то будет сгенерирован application.[contenthash].js",
9
+ "pattern": "\\w+\\.js$",
10
+ "examples": ["index.js", "main.js"]
11
+ },
12
+ "name": {
13
+ "type": "object",
14
+ "title": "Локализованное имя приложения",
15
+ "required": ["ru", "en"],
16
+ "properties": {
17
+ "en": {
18
+ "type": "string",
19
+ "minLength": 1
20
+ },
21
+ "ru": {
22
+ "type": "string",
23
+ "minLength": 1
24
+ }
25
+ }
26
+ }
27
+ },
28
+ "required": ["name"]
29
+ }