Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Resolved CI/CD issues when publishing npm packages (#2024)

Martin Peeters991db7f61fae
diff --git a/ui/component/or-attribute-history/package.json b/ui/component/or-attribute-history/package.json
index c5165cbf5..ad5a28945 100644
--- a/ui/component/or-attribute-history/package.json
+++ b/ui/component/or-attribute-history/package.json
@@ -24,7 +24,7 @@
"@openremote/or-components": "workspace:*",
"@openremote/or-mwc-components": "workspace:*",
"@openremote/or-translate": "workspace:*",
- "echarts": "^5.6.0",
+ "echarts": "~5.6.0",
"jsonpath-plus": "^6.0.1",
"lit": "^2.0.2"
},
diff --git a/ui/component/or-attribute-history/src/index.ts b/ui/component/or-attribute-history/src/index.ts
index 5f5057237..3e79b0044 100644
--- a/ui/component/or-attribute-history/src/index.ts
+++ b/ui/component/or-attribute-history/src/index.ts
@@ -1,6 +1,10 @@
// Declare require method which we'll use for importing webpack resources (using ES6 imports will confuse typescript parser)
declare function require(name: string): any;
-import {ECharts, EChartsOption, init} from "echarts";
+import * as echarts from "echarts/core";
+import {GridComponent, GridComponentOption, DataZoomComponent, DataZoomComponentOption, TooltipComponent, TooltipComponentOption, DatasetComponentOption} from "echarts/components";
+import {LineChart, LineSeriesOption} from "echarts/charts";
+import {UniversalTransition} from "echarts/features";
+import {CanvasRenderer} from "echarts/renderers";
import {debounce} from "lodash";
import {
css,
@@ -14,7 +18,7 @@ import {customElement, property, query} from "lit/decorators.js";
import i18next from "i18next";
import {translate} from "@openremote/or-translate";
import {AssetModelUtil, Attribute, AttributeRef, DatapointInterval, ValueDatapoint, ValueDescriptor} from "@openremote/model";
-import manager, {DefaultColor2, DefaultColor3, DefaultColor4, DefaultColor5} from "@openremote/core";
+import manager, {DefaultColor2, DefaultColor3, DefaultColor4} from "@openremote/core";
import "@openremote/or-mwc-components/or-mwc-input";
import "@openremote/or-components/or-panel";
import "@openremote/or-translate";
@@ -28,6 +32,8 @@ import {isAxiosError} from "@openremote/rest";
import {styleMap} from "lit/directives/style-map.js";
import { when } from "lit/directives/when.js";
+echarts.use([GridComponent, TooltipComponent, DataZoomComponent, LineChart, CanvasRenderer, UniversalTransition]);
+
export class OrAttributeHistoryEvent extends CustomEvent<OrAttributeHistoryEventDetail> {
public static readonly NAME = "or-attribute-history-event";
@@ -98,6 +104,14 @@ export interface HistoryConfig {
chart?: ChartConfig;
}
+export type ECAttributeHistoryOption = echarts.ComposeOption<
+ | LineSeriesOption
+ | TooltipComponentOption
+ | GridComponentOption
+ | DatasetComponentOption
+ | DataZoomComponentOption
+>;
+
// TODO: Add webpack/rollup to build so consumers aren't forced to use the same tooling
const tableStyle = require("@material/data-table/dist/mdc.data-table.css");
@@ -260,11 +274,11 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {
@query("#chart")
protected _chartElem!: HTMLDivElement;
- protected _chartOptions: EChartsOption = {};
+ protected _chartOptions: ECAttributeHistoryOption = {};
@query("#table")
protected _tableElem!: HTMLDivElement;
protected _table?: MDCDataTable;
- protected _chart?: ECharts;
+ protected _chart?: echarts.ECharts;
protected _type?: ValueDescriptor;
protected _style!: CSSStyleDeclaration;
protected _error?: string;
@@ -497,7 +511,7 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {
]
}
// Initialize echarts instance
- this._chart = init(this._chartElem);
+ this._chart = echarts.init(this._chartElem);
// Set chart options to default
this._chart.setOption(this._chartOptions);
// Make chart size responsive
diff --git a/yarn.lock b/yarn.lock
index 500e030e2..8e93d0a0f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1402,7 +1402,7 @@ __metadata:
"@openremote/or-mwc-components": "workspace:*"
"@openremote/or-translate": "workspace:*"
"@openremote/util": "workspace:*"
- echarts: "npm:^5.6.0"
+ echarts: "npm:~5.6.0"
jsonpath-plus: "npm:^6.0.1"
lit: "npm:^2.0.2"
languageName: unknown
@@ -4119,7 +4119,7 @@ __metadata:
languageName: node
linkType: hard
-"echarts@npm:^5.6.0":
+"echarts@npm:~5.6.0":
version: 5.6.0
resolution: "echarts@npm:5.6.0"
dependencies: