Skip to content

Commit 2a18def

Browse files
author
Illia Obukhau
authored
[WC-1294] Charts v4 (#27)
2 parents 35cd4b1 + e242133 commit 2a18def

File tree

11 files changed

+177
-150
lines changed

11 files changed

+177
-150
lines changed

packages/modules/charts/package.json

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/modules/charts/scripts/build.js

Lines changed: 0 additions & 99 deletions
This file was deleted.

packages/modules/charts/src/themesource/charts/public/com.mendix.charts.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/modules/data-widgets/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
"scripts": {
3737
"verify": "rui-verify-package-format",
3838
"update-changelog": "rui-update-changelog-module",
39-
"build:module": "scripts/build.ts",
39+
"build:module": "ts-node --project scripts/tsconfig.json scripts/build.ts",
4040
"create-gh-release": "rui-create-gh-release",
41-
"push-update": "scripts/push-update.ts",
42-
"release:module": "scripts/release.ts",
43-
"start": "scripts/start.ts"
41+
"push-update": "ts-node --project scripts/tsconfig.json scripts/push-update.ts",
42+
"release:module": "ts-node --project scripts/tsconfig.json scripts/release.ts",
43+
"start": "ts-node --project scripts/tsconfig.json scripts/start.ts"
4444
},
4545
"dependencies": {
4646
"datagrid-date-filter-web": "workspace:*",
File renamed without changes.
File renamed without changes.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "charts-web",
3+
"version": "4.0.0",
4+
"description": "Chart widgets collection for data visualization",
5+
"license": "Apache-2.0",
6+
"private": false,
7+
"copyright": "© Mendix Technology BV 2022. All rights reserved.",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/mendix/web-widgets.git"
11+
},
12+
"mxpackage": {
13+
"name": "Charts",
14+
"type": "widget",
15+
"mpkName": "Charts.mpk",
16+
"dependencies": [
17+
"area-chart-web",
18+
"bar-chart-web",
19+
"bubble-chart-web",
20+
"column-chart-web",
21+
"heatmap-chart-web",
22+
"line-chart-web",
23+
"pie-doughnut-chart-web",
24+
"time-series-chart-web"
25+
]
26+
},
27+
"packagePath": "com.mendix.widget.web",
28+
"marketplace": {
29+
"minimumMXVersion": "9.6.0.27784",
30+
"appNumber": 105695,
31+
"appName": "Charts"
32+
},
33+
"testProject": {
34+
"githubUrl": "https://github.com/mendix/Charts-module",
35+
"branchName": "main"
36+
},
37+
"scripts": {
38+
"build": "ts-node --project scripts/tsconfig.json scripts/build.ts development",
39+
"release": "ts-node --project scripts/tsconfig.json scripts/build.ts production",
40+
"create-gh-release": "rui-create-gh-release",
41+
"publish-marketplace": "rui-publish-marketplace",
42+
"verify": "rui-verify-package-format",
43+
"update-changelog": "rui-update-changelog-module"
44+
},
45+
"dependencies": {
46+
"area-chart-web": "workspace:*",
47+
"bar-chart-web": "workspace:*",
48+
"bubble-chart-web": "workspace:*",
49+
"column-chart-web": "workspace:*",
50+
"heatmap-chart-web": "workspace:*",
51+
"line-chart-web": "workspace:*",
52+
"pie-doughnut-chart-web": "workspace:*",
53+
"time-series-chart-web": "workspace:*"
54+
},
55+
"devDependencies": {
56+
"cross-env": "^7.0.2",
57+
"@mendix/release-utils-internal": "workspace:*"
58+
}
59+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env ts-node-script
2+
3+
import { cp, mkdir, rm, unzip, zip } from "@mendix/release-utils-internal/shell";
4+
import { logStep, removeDist, runWidgetSteps, WidgetStepParams } from "@mendix/release-utils-internal/steps";
5+
import { getWidgetInfo, listPackages } from "@mendix/release-utils-internal/utils";
6+
import { dirname, join } from "node:path";
7+
8+
// Charts specific steps
9+
10+
const [, , env] = process.argv;
11+
const copyToProject = env !== "production" && process.env.MX_PROJECT_PATH;
12+
13+
async function repackChartWidgets({ config }: WidgetStepParams): Promise<void> {
14+
logStep("Repack chart widgets");
15+
const { dependencies, paths, output } = config;
16+
const packages = await listPackages(dependencies);
17+
const widgets = await Promise.all(packages.map(({ path }) => getWidgetInfo(path)));
18+
19+
mkdir("-p", [paths.tmp, dirname(output.files.mpk)]);
20+
21+
console.info("Unpacking mpks and create correct file tree...");
22+
for (const pkg of widgets) {
23+
console.info(`Unpack ${pkg.name}@${pkg.version.format()}`);
24+
const contentDir = join(paths.tmp, pkg.mxpackage.name);
25+
const pkgSource = join(contentDir, "com");
26+
const pkgXml = join(contentDir, "package.xml");
27+
mkdir("-p", contentDir);
28+
await unzip(pkg.mpk, contentDir);
29+
cp("-r", pkgSource, paths.tmp);
30+
rm("-rf", pkgSource);
31+
rm(pkgXml);
32+
}
33+
34+
console.log("Copying package.xml...");
35+
cp(join(paths.package, "src", "package.xml"), join(paths.tmp, "package.xml"));
36+
console.log("Creating mpk...");
37+
await zip(paths.tmp, output.files.mpk);
38+
}
39+
40+
async function main(): Promise<void> {
41+
await runWidgetSteps({
42+
packagePath: process.cwd(),
43+
steps: [
44+
removeDist,
45+
repackChartWidgets,
46+
async ({ config }) => {
47+
if (copyToProject) {
48+
logStep("Copy widget to targetProject");
49+
const dir = join(config.paths.targetProject, "widgets");
50+
mkdir("-p", dir);
51+
cp(config.output.files.mpk, dir);
52+
}
53+
}
54+
]
55+
});
56+
}
57+
58+
main().catch(err => {
59+
console.error(err);
60+
process.exit(1);
61+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@mendix/release-utils-internal/tsconfig"
3+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<package xmlns="http://www.mendix.com/package/1.0/">
3+
<clientModule name="Charts" version="4.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
4+
<widgetFiles>
5+
<widgetFile path="AreaChart/AreaChart.xml" />
6+
<widgetFile path="BarChart/BarChart.xml" />
7+
<widgetFile path="BubbleChart/BubbleChart.xml" />
8+
<widgetFile path="ColumnChart/ColumnChart.xml" />
9+
<widgetFile path="HeatMap/HeatMap.xml" />
10+
<widgetFile path="LineChart/LineChart.xml" />
11+
<widgetFile path="PieChart/PieChart.xml" />
12+
<widgetFile path="TimeSeries/TimeSeries.xml" />
13+
</widgetFiles>
14+
<files>
15+
<file path="com/mendix/widget/web/areachart" />
16+
<file path="com/mendix/widget/web/barchart" />
17+
<file path="com/mendix/widget/web/bubblechart" />
18+
<file path="com/mendix/widget/web/columnchart" />
19+
<file path="com/mendix/widget/web/heatmap" />
20+
<file path="com/mendix/widget/web/linechart" />
21+
<file path="com/mendix/widget/web/piechart" />
22+
<file path="com/mendix/widget/web/timeseries" />
23+
</files>
24+
</clientModule>
25+
</package>

0 commit comments

Comments
 (0)