@infomaximum/package-cli 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
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
+ ## [1.16.0](https://github.com/Infomaximum/package-cli/compare/v1.15.0...v1.16.0) (2024-02-14)
6
+
7
+
8
+ ### Features
9
+
10
+ * подержан definition ([13a3617](https://github.com/Infomaximum/package-cli/commit/13a3617493b7349f4ce39f0353c3fd7cdec1261e))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * исправлен шаблон ([a5da473](https://github.com/Infomaximum/package-cli/commit/a5da4737cb2aafd80f716fa984c04e853cb41d35))
16
+
17
+ ## [1.15.0](https://github.com/Infomaximum/package-cli/compare/v1.14.0...v1.15.0) (2023-12-26)
18
+
19
+
20
+ ### Features
21
+
22
+ * добавлены шаблоны документации, и истории изменений пакета ([125891b](https://github.com/Infomaximum/package-cli/commit/125891bd80741171216698204dbf8387c6bafa1c))
23
+
5
24
  ## [1.14.0](https://github.com/Infomaximum/package-cli/compare/v1.13.0...v1.14.0) (2023-12-25)
6
25
 
7
26
 
@@ -10,8 +10,10 @@ import { APP_D_TS_TEMPLATE } from "../../../templates/widget/src/widgetAppDTs.js
10
10
  import { WIDGET_INDEX_CSS_TEMPLATE } from "../../../templates/widget/src/widgetIndexCSS.js";
11
11
  import { WIDGET_PACKAGE_JSON_TEMPLATE } from "../../../templates/widget/widgetPackageJson.js";
12
12
  import { CUSTOM_PACKAGE_CLI_LIB_NAME, CUSTOM_WIDGET_LIB_NAME, MANIFEST_JSON_FILE_NAME, } from "../../../const.js";
13
- import { WIDGET_SETTINGS_TEMPLATE } from "../../../templates/widget/src/settings.js";
14
- import { WIDGET_PANEL_TEMPLATE } from "../../../templates/widget/src/panel.js";
13
+ import { WIDGET_SETTINGS_TEMPLATE } from "../../../templates/widget/src/definition/settings.js";
14
+ import { WIDGET_PANEL_TEMPLATE } from "../../../templates/widget/src/definition/panel.js";
15
+ import { GET_CHANGELOG_MD, GET_DOC_MD, } from "../../../templates/package/additionalFiles.js";
16
+ import { WIDGET_DEFINITION_TEMPLATE } from "../../../templates/widget/src/definition/definition.js";
15
17
  const addIconActionName = "addIcon";
16
18
  const addInitActions = (basePath, plop) => {
17
19
  plop.setActionType(addIconActionName, function (answers, config, plop) {
@@ -45,6 +47,18 @@ const actions = ({ customWidgetVersion, packageCliVersion }) => {
45
47
  path: `package/resources/${packageIconName}.png`,
46
48
  template: PACKAGE_ICON_TEMPLATE,
47
49
  },
50
+ ...["ru", "en"].flatMap((language) => [
51
+ {
52
+ type: "add",
53
+ path: `package/${language}/doc.md`,
54
+ template: GET_DOC_MD(language),
55
+ },
56
+ {
57
+ type: "add",
58
+ path: `package/${language}/changelog.md`,
59
+ template: GET_CHANGELOG_MD(language),
60
+ },
61
+ ]),
48
62
  {
49
63
  type: "add",
50
64
  path: MANIFEST_JSON_FILE_NAME,
@@ -67,12 +81,17 @@ const actions = ({ customWidgetVersion, packageCliVersion }) => {
67
81
  },
68
82
  {
69
83
  type: "add",
70
- path: "src/settings.ts",
84
+ path: "src/definition/definition.ts",
85
+ template: WIDGET_DEFINITION_TEMPLATE,
86
+ },
87
+ {
88
+ type: "add",
89
+ path: "src/definition/settings.ts",
71
90
  template: WIDGET_SETTINGS_TEMPLATE,
72
91
  },
73
92
  {
74
93
  type: "add",
75
- path: "src/panel.ts",
94
+ path: "src/definition/panel.ts",
76
95
  template: WIDGET_PANEL_TEMPLATE,
77
96
  },
78
97
  {
@@ -0,0 +1,20 @@
1
+ export const GET_CHANGELOG_MD = (language) => {
2
+ switch (language) {
3
+ case "en":
4
+ return "<!-- Description of changes -->";
5
+ case "ru":
6
+ return "<!-- Описание изменений -->";
7
+ default:
8
+ return "";
9
+ }
10
+ };
11
+ export const GET_DOC_MD = (language) => {
12
+ switch (language) {
13
+ case "en":
14
+ return "<!-- Package documentation -->";
15
+ case "ru":
16
+ return "<!-- Документация по пакету -->";
17
+ default:
18
+ return "";
19
+ }
20
+ };
@@ -0,0 +1,32 @@
1
+ export const WIDGET_DEFINITION_TEMPLATE = `\
2
+ import type {
3
+ IDefinition,
4
+ IFillSettings,
5
+ IGroupSettings,
6
+ IPanelDescriptionCreator,
7
+ IWidgetDimension,
8
+ IWidgetDimensionHierarchy,
9
+ IWidgetMeasure,
10
+ } from "@infomaximum/custom-widget";
11
+ import { fillSettings, type WidgetSettings } from "definition/settings";
12
+ import { createPanelDescription } from "definition/panel";
13
+
14
+ export class Definition implements IDefinition<WidgetSettings, IGroupSettings> {
15
+ public createPanelDescription: IPanelDescriptionCreator<
16
+ WidgetSettings,
17
+ IGroupSettings
18
+ > = createPanelDescription;
19
+
20
+ public fillSettings: IFillSettings<WidgetSettings> = fillSettings;
21
+
22
+ public getDimensions(
23
+ settings: WidgetSettings
24
+ ): (IWidgetDimension | IWidgetDimensionHierarchy)[] {
25
+ return [];
26
+ }
27
+
28
+ public static getMeasures(settings: WidgetSettings): IWidgetMeasure[] {
29
+ return [];
30
+ }
31
+ }
32
+ `;
@@ -3,7 +3,7 @@ import {
3
3
  type IPanelDescriptionCreator,
4
4
  type IGroupSettings,
5
5
  } from "@infomaximum/custom-widget";
6
- import type { WidgetSettings } from "settings";
6
+ import type { WidgetSettings } from "definition/settings";
7
7
 
8
8
  export const createPanelDescription: IPanelDescriptionCreator<
9
9
  WidgetSettings,
@@ -6,18 +6,15 @@ import ReactDOM from "react-dom/client";
6
6
  import "./index.css";
7
7
  import {
8
8
  type IWidget,
9
- type IPanelDescription,
10
9
  type ICustomWidgetProps,
11
- type IWidgetsContext,
12
- type IWidgetMeasure,
13
- type IWidgetDimension,
14
- type IWidgetDimensionHierarchy,
15
10
  } from "@infomaximum/custom-widget";
16
11
  import manifest from "../${MANIFEST_JSON_FILE_NAME}";
17
- import { fillSettings, type WidgetSettings } from "settings";
18
- import { createPanelDescription } from "panel";
12
+ import { type WidgetSettings } from "definition/settings";
13
+ import { Definition } from "definition/definition";
19
14
 
20
15
  class CustomWidget implements IWidget<WidgetSettings> {
16
+ public static definition = new Definition();
17
+
21
18
  root: ReactDOM.Root | null = null;
22
19
 
23
20
  public initialize(container: HTMLElement) {
@@ -47,34 +44,10 @@ class CustomWidget implements IWidget<WidgetSettings> {
47
44
  private render(props: ICustomWidgetProps<WidgetSettings>) {
48
45
  this.root?.render(
49
46
  <React.StrictMode>
50
- <div>{{ ${capitalizeHelperName} packageName}}</div>
47
+ <div>{{ ${capitalizeHelperName} packageName}}</div>
51
48
  </React.StrictMode>
52
49
  );
53
50
  }
54
-
55
- public static createPanelDescription(
56
- context: IWidgetsContext,
57
- settings: WidgetSettings
58
- ): IPanelDescription<WidgetSettings> {
59
- return createPanelDescription(context, settings);
60
- }
61
-
62
- public static fillSettings(
63
- settings: WidgetSettings,
64
- context: IWidgetsContext
65
- ) {
66
- return fillSettings(settings, context);
67
- }
68
-
69
- public static getDimensions(
70
- settings: WidgetSettings
71
- ): (IWidgetDimension | IWidgetDimensionHierarchy)[] {
72
- return [];
73
- }
74
-
75
- public static getMeasures(settings: WidgetSettings): IWidgetMeasure[] {
76
- return [];
77
- }
78
51
  }
79
52
 
80
53
  window.im.defineWidget(manifest.uuid, CustomWidget);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/package-cli",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "exports": "./dist/index.js",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",