Skip to content

Commit

Permalink
feat: Upgrade ddl-shim to v3
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Nov 13, 2024
1 parent d8d4ae6 commit fd95ae2
Show file tree
Hide file tree
Showing 18 changed files with 793 additions and 183 deletions.
569 changes: 497 additions & 72 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"packages/comms",
"packages/composite",
"packages/dataflow",
"xpackages/ddl-shim",
"packages/ddl-shim",
"xpackages/deck-shim",
"packages/dgrid",
"packages/dgrid-shim",
Expand Down
2 changes: 1 addition & 1 deletion packages/comms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"wsdl-all": "npm-run-all --aggregate-output -c --serial build --parallel wsdl-*"
},
"dependencies": {
"@hpcc-js/ddl-shim": "^2.22.0",
"@hpcc-js/util": "^3.1.0",
"@xmldom/xmldom": "0.9.5",
"abort-controller": "3.0.0",
Expand All @@ -69,6 +68,7 @@
},
"devDependencies": {
"@hpcc-js/esbuild-plugins": "^1.2.0",
"@hpcc-js/ddl-shim": "^3.0.0",
"@types/d3-request": "1.0.9",
"@types/d3-time-format": "2.3.4",
"@types/node": "^18",
Expand Down
47 changes: 47 additions & 0 deletions packages/ddl-shim/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "test-browser",
"type": "msedge",
"request": "launch",
"url": "http://localhost:8888",
"webRoot": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
},
{
"name": "test-node",
"type": "node",
"request": "launch",
"runtimeArgs": [
"run-script",
"test-node"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
},
{
"name": "index.html",
"request": "launch",
"type": "msedge",
"url": "file:///${workspaceFolder}/index.html",
"runtimeArgs": [
"--disable-web-security"
],
"webRoot": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
]
}
]
}
36 changes: 36 additions & 0 deletions packages/ddl-shim/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "gen-types-watch",
"type": "npm",
"script": "gen-types-watch",
"problemMatcher": [
"$tsc-watch"
],
"presentation": {
"group": "group-build"
}
},
{
"label": "bundle-watch",
"type": "npm",
"script": "bundle-watch",
"problemMatcher": [],
"presentation": {
"group": "group-build"
}
},
{
"label": "build",
"dependsOn": [
"gen-types-watch",
"bundle-watch",
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
29 changes: 29 additions & 0 deletions packages/ddl-shim/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { neutralTpl } from "@hpcc-js/esbuild-plugins";
import pkg from "./package.json" with { type: "json" };

// config ---
await Promise.all([
neutralTpl("src/index.ts", "dist/index", {
keepNames: true,
alias: {
"d3-array": "@hpcc-js/common",
"d3-brush": "@hpcc-js/common",
"d3-collection": "@hpcc-js/common",
"d3-color": "@hpcc-js/common",
"d3-dispatch": "@hpcc-js/common",
"d3-drag": "@hpcc-js/common",
"d3-dsv": "@hpcc-js/common",
"d3-ease": "@hpcc-js/common",
"d3-format": "@hpcc-js/common",
"d3-interpolate": "@hpcc-js/common",
"d3-scale": "@hpcc-js/common",
"d3-selection": "@hpcc-js/common",
"d3-time-format": "@hpcc-js/common",
"d3-transition": "@hpcc-js/common",
"d3-zoom": "@hpcc-js/common"
},
external: [
...Object.keys(pkg.dependencies),
]
})
]);
108 changes: 108 additions & 0 deletions packages/ddl-shim/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!DOCTYPE html>
<html>

<head>
<title>Home</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}

h1 {
text-align: center;
margin-top: 50px;
}

#placeholder {
width: 100%;
height: 500px;
background-color: #fff;
margin-top: 20px;
}
</style>
<script type="importmap">
{
"imports": {
"@observablehq/runtime": "https://cdn.jsdelivr.net/npm/@observablehq/[email protected]/dist/runtime.js",

"@hpcc-js/util": "../util/dist/index.js",
"@hpcc-js/common": "../common/dist/index.js",
"@hpcc-js/api": "../api/dist/index.js",
"@hpcc-js/chart": "../chart/dist/index.js",
"@hpcc-js/codemirror": "../codemirror/dist/index.js",
"@hpcc-js/comms": "../comms/dist/index.js",
"@hpcc-js/dgrid": "../dgrid/dist/index.js",
"@hpcc-js/react": "../react/dist/index.js",
"@hpcc-js/html": "../html/dist/index.js",
"@hpcc-js/graph": "../graph/dist/index.js",
"@hpcc-js/layout": "../layout/dist/index.js",
"@hpcc-js/observablehq-compiler": "../observablehq-compiler/dist/index.js"
}
}
</script>
<link rel="stylesheet" href="./dist/index.css">
</head>

<body onresize="doResize()">
<h1>ESM Quick Test</h1>
<div id="placeholder"></div>
<script type="module">
import { Area, Column } from "@hpcc-js/chart";
import { ChartPanel } from "@hpcc-js/layout";

import "@hpcc-js/common/dist/index.css";
import "@hpcc-js/common/font-awesome/css/font-awesome.min.css";
import "@hpcc-js/chart/dist/index.css";
import "@hpcc-js/dgrid2/dist/index.css";

const simple = {
ND: {
columns: ["Subject", "Year 1", "Year 2", "Year 3", "Year 4"],
data: [
["English", 5, 43, 41, 92],
["English II", 17, 43, 83, 93],
["English III", 6, 43, 64, 93],
["Geography", 7, 45, 52, 83],
["Geography II", 16, 73, 52, 83],
["Geography III", 26, 83, 11, 72],
["Science", 66, 60, 85, 6],
["Science II", 46, 20, 53, 7],
["Science III", 46, 20, 38, 7],
["Math", 98, 30, 23, 13],
["Math II", 76, 30, 34, 6],
["Math III", 80, 30, 27, 8]
]
},
WordCloud: {
columns: ["Word", "Weight"],
words: ["Myriel", "Napoleon", "Mlle.Baptistine", "Mme.Magloire", "CountessdeLo", "Geborand", "Champtercier", "Cravatte", "Count", "OldMan", "Labarre", "Valjean", "Marguerite", "Mme.deR", "Isabeau", "Gervais", "Tholomyes", "Listolier", "Fameuil", "Blacheville", "Favourite", "Dahlia", "Zephine", "Fantine", "Mme.Thenardier", "Thenardier", "Cosette", "Javert", "Fauchelevent", "Bamatabois", "Perpetue", "Simplice", "Scaufflaire", "Woman1", "Judge", "Champmathieu", "Brevet", "Chenildieu", "Cochepaille", "Pontmercy", "Boulatruelle", "Eponine", "Anzelma", "Woman2", "MotherInnocent", "Gribier", "Jondrette", "Mme.Burgon", "Gavroche", "Gillenormand", "Magnon", "Mlle.Gillenormand", "Mme.Pontmercy", "Mlle.Vaubois", "Lt.Gillenormand", "Marius", "BaronessT", "Mabeuf", "Enjolras", "Combeferre", "Prouvaire", "Feuilly", "Courfeyrac", "Bahorel", "Bossuet", "Joly", "Grantaire", "MotherPlutarch", "Gueulemer", "Babet", "Claquesous", "Montparnasse", "Toussaint", "Child1", "Child2", "Brujon", "Mme.Hucheloup"]
}
};

window.__widget = new ChartPanel()
.widget(new Column())
.target("placeholder")
.columns(["Subject", "Year 1", "Year 2", "Year 3"])
.data([
["Geography", 75, 68, 65],
["English", 45, 55, -52],
["Math", 98, 92, 90],
["Science", 66, 60, 72]
])
.title("Exam Results 2008->10")
.legendVisible(true)
.render()
;

</script>
<script>
function doResize() {
window.__widget?.resize()?.render();
}
</script>
</body>

</html>
52 changes: 25 additions & 27 deletions packages/ddl-shim/package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,52 @@
{
"name": "@hpcc-js/ddl-shim",
"version": "2.22.0",
"version": "3.0.0",
"description": "hpcc-js DDL parser",
"main": "dist/index.js",
"module": "dist/index.es6",
"unpkg": "dist/index.min.js",
"jsdelivr": "dist/index.min.js",
"bin": "dist/cli.js",
"types": "types/index.d.ts",
"typesVersions": {
"<3.8": {
"*": [
"types-3.4/index.d.ts"
]
}
"type": "module",
"exports": {
".": {
"types": "./types/index.d.ts",
"default": "./dist/index.js"
},
"./dist/*": "./dist/*"
},
"module": "./dist/index.js",
"browser": "./dist/index.js",
"types": "./types/index.d.ts",
"files": [
"dist/*",
"src/*",
"schema/*.json",
"types/*"
],
"scripts": {
"preinstall": "echo \"\" > cli.js",
"clean": "rimraf --glob bin lib* types dist ./src/ddl*Schema*.ts ./schema/*.json *.tsbuildinfo",
"compile-es6": "tsc --module es6 --outDir ./lib-es6",
"compile-es6-watch": "npm run compile-es6 -- -w",
"clean": "rimraf --glob bin lib* types dist ./src/ddl*Schema*.ts ./schema/*.json *.tsbuildinfo .turbo",
"generate-v1": "ts-json-schema-generator --tsconfig tsconfig-schema.json --type DDLSchema > ./schema/v1.json",
"generate-v2": "ts-json-schema-generator --tsconfig tsconfig-schema.json --type Schema > ./schema/v2.json",
"generate": "run-p generate-v1 generate-v2",
"bundle": "rollup -c",
"bundle-watch": "npm run bundle -- --watch",
"minimize": "terser dist/index.js -c -m --source-map -o dist/index.min.js",
"gen-legacy-types": "downlevel-dts ./types ./types-3.4",
"build": "run-s generate compile-es6 bundle",
"watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch",
"bundle": "node esbuild.js",
"bundle-watch": "npm run bundle -- --development --watch",
"gen-types": "tsc --project tsconfig.json",
"gen-types-watch": "npm run gen-types -- --watch",
"build": "npm-run-all --serial generate --parallel gen-types bundle",
"stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
"lint": "eslint ./src",
"lint-fix": "eslint --fix src/**/*.ts",
"docs": "typedoc --options tdoptions.json .",
"update": "npx --yes npm-check-updates -u -t minor"
"test-browser": "vitest run --project browser",
"test": "vitest run",
"coverage": "vitest run --coverage",
"update": "npx --yes npm-check-updates -u -t minor",
"update-major": "npx --yes npm-check-updates -u"
},
"dependencies": {
"ajv": "6.12.6"
},
"devDependencies": {
"@hpcc-js/bundle": "^2.12.0",
"@hpcc-js/esbuild-plugins": "^1.2.0",
"@rodrigoff/ajv-cli": "5.2.0",
"@types/node": "^18",
"ts-json-schema-generator": "0.98.0",
"tslib": "2.7.0"
"ts-json-schema-generator": "0.98.0"
},
"repository": {
"type": "git",
Expand Down
58 changes: 0 additions & 58 deletions packages/ddl-shim/rollup.config.mjs

This file was deleted.

Loading

0 comments on commit fd95ae2

Please sign in to comment.