@infomaximum/package-cli 1.8.0 → 1.9.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,13 @@
|
|
|
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.9.0](https://github.com/Infomaximum/package-cli/compare/v1.8.0...v1.9.0) (2023-12-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* добавлено генерирование файлов настроек панели ([120dc23](https://github.com/Infomaximum/package-cli/commit/120dc236d2d3967f5c5cbb022cc21baeb042841a))
|
|
11
|
+
|
|
5
12
|
## [1.8.0](https://github.com/Infomaximum/package-cli/compare/v1.7.0...v1.8.0) (2023-12-04)
|
|
6
13
|
|
|
7
14
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @infomaximum/package-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
@infomaximum/package-cli - предоставляет разработчикам набор команд и функций для сборки пакетов, запуска пакетов в режиме разработки и создания шаблонного кода для виджетов и приложений.
|
|
4
4
|
|
|
5
5
|
<a href="https://www.npmjs.com/package/@infomaximum/package-cli">
|
|
6
6
|
<img alt="npm" src="https://img.shields.io/npm/v/@infomaximum/package-cli?style=for-the-badge">
|
|
@@ -10,6 +10,8 @@ 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
15
|
const addIconActionName = "addIcon";
|
|
14
16
|
const addInitActions = (basePath, plop) => {
|
|
15
17
|
plop.setActionType(addIconActionName, function (answers, config, plop) {
|
|
@@ -63,6 +65,16 @@ const actions = ({ customWidgetVersion, packageCliVersion }) => {
|
|
|
63
65
|
path: "src/index.css",
|
|
64
66
|
template: WIDGET_INDEX_CSS_TEMPLATE,
|
|
65
67
|
},
|
|
68
|
+
{
|
|
69
|
+
type: "add",
|
|
70
|
+
path: "src/settings.ts",
|
|
71
|
+
template: WIDGET_SETTINGS_TEMPLATE,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: "add",
|
|
75
|
+
path: "src/panel.ts",
|
|
76
|
+
template: WIDGET_PANEL_TEMPLATE,
|
|
77
|
+
},
|
|
66
78
|
{
|
|
67
79
|
type: "add",
|
|
68
80
|
path: "tsconfig.json",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const WIDGET_PANEL_TEMPLATE = `\
|
|
2
|
+
import {
|
|
3
|
+
type IPanelDescriptionCreator,
|
|
4
|
+
type IGroupSettings,
|
|
5
|
+
} from "@infomaximum/custom-widget";
|
|
6
|
+
import type { WidgetSettings } from "settings";
|
|
7
|
+
|
|
8
|
+
export const createPanelDescription: IPanelDescriptionCreator<
|
|
9
|
+
WidgetSettings,
|
|
10
|
+
IGroupSettings
|
|
11
|
+
> = () => ({});
|
|
12
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const WIDGET_SETTINGS_TEMPLATE = `\
|
|
2
|
+
import type {
|
|
3
|
+
IBaseWidgetSettings,
|
|
4
|
+
IFillSettings,
|
|
5
|
+
} from "@infomaximum/custom-widget";
|
|
6
|
+
|
|
7
|
+
export interface WidgetSettings extends IBaseWidgetSettings {}
|
|
8
|
+
|
|
9
|
+
export const fillSettings: IFillSettings<WidgetSettings> = (settings) => {};
|
|
10
|
+
`;
|
|
@@ -7,25 +7,34 @@ import "./index.css";
|
|
|
7
7
|
import {
|
|
8
8
|
type IWidget,
|
|
9
9
|
type IPanelDescription,
|
|
10
|
-
type IBaseWidgetSettings,
|
|
11
10
|
type ICustomWidgetProps,
|
|
11
|
+
type IWidgetsContext,
|
|
12
|
+
type IWidgetMeasure,
|
|
13
|
+
type IWidgetDimension,
|
|
14
|
+
type IWidgetDimensionHierarchy,
|
|
12
15
|
} from "@infomaximum/custom-widget";
|
|
13
16
|
import manifest from "../${MANIFEST_JSON_FILE_NAME}";
|
|
17
|
+
import { fillSettings, type WidgetSettings } from "settings";
|
|
18
|
+
import { createPanelDescription } from "panel";
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class CustomWidget implements IWidget<Settings> {
|
|
20
|
+
class CustomWidget implements IWidget<WidgetSettings> {
|
|
18
21
|
root: ReactDOM.Root | null = null;
|
|
19
22
|
|
|
20
23
|
public initialize(container: HTMLElement) {
|
|
21
24
|
this.root = ReactDOM.createRoot(container);
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
public update(
|
|
27
|
+
public update(
|
|
28
|
+
container: HTMLElement,
|
|
29
|
+
props: ICustomWidgetProps<WidgetSettings>
|
|
30
|
+
) {
|
|
25
31
|
this.render(props);
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
public mount(
|
|
34
|
+
public mount(
|
|
35
|
+
container: HTMLElement,
|
|
36
|
+
props: ICustomWidgetProps<WidgetSettings>
|
|
37
|
+
) {
|
|
29
38
|
this.render(props);
|
|
30
39
|
}
|
|
31
40
|
|
|
@@ -35,23 +44,35 @@ class CustomWidget implements IWidget<Settings> {
|
|
|
35
44
|
this.root = null;
|
|
36
45
|
}
|
|
37
46
|
|
|
38
|
-
public render(props: ICustomWidgetProps<
|
|
47
|
+
public render(props: ICustomWidgetProps<WidgetSettings>) {
|
|
39
48
|
this.root?.render(
|
|
40
49
|
<React.StrictMode>
|
|
41
|
-
|
|
50
|
+
<div>{{ ${capitalizeHelperName} packageName}}</div>
|
|
42
51
|
</React.StrictMode>
|
|
43
52
|
);
|
|
44
53
|
}
|
|
45
54
|
|
|
46
|
-
public static createPanelDescription(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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);
|
|
50
67
|
}
|
|
51
68
|
|
|
52
|
-
public static
|
|
69
|
+
public static getDimensions(
|
|
70
|
+
settings: WidgetSettings
|
|
71
|
+
): (IWidgetDimension | IWidgetDimensionHierarchy)[] {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
53
74
|
|
|
54
|
-
public static
|
|
75
|
+
public static getMeasures(settings: WidgetSettings): IWidgetMeasure[] {
|
|
55
76
|
return [];
|
|
56
77
|
}
|
|
57
78
|
}
|