Skip to content

Commit

Permalink
Merge pull request #4297 from GordonSmith/V3_DDLSHIM
Browse files Browse the repository at this point in the history
feat: Upgrade ddl-shim to v3
  • Loading branch information
GordonSmith authored Nov 13, 2024
2 parents d8d4ae6 + 4861665 commit 3e146cd
Show file tree
Hide file tree
Showing 17 changed files with 659 additions and 185 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
2 changes: 1 addition & 1 deletion packages/comms/src/services/wsEcl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DDL2 } from "@hpcc-js/ddl-shim";
import type { DDL2 } from "@hpcc-js/ddl-shim";
import { IConnection, IOptions } from "../connection.ts";
import { ESPExceptions, Service } from "../espConnection.ts";

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
}
}
]
}
12 changes: 12 additions & 0 deletions packages/ddl-shim/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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,
external: [
...Object.keys(pkg.dependencies),
]
})
]);
52 changes: 24 additions & 28 deletions packages/ddl-shim/package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,50 @@
{
"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"
"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 All @@ -61,4 +57,4 @@
"url": "https://github.com/hpcc-systems/Visualization/issues"
},
"homepage": "https://github.com/hpcc-systems/Visualization"
}
}
58 changes: 0 additions & 58 deletions packages/ddl-shim/rollup.config.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ddl-shim/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from "fs";

// @ts-ignore
import * as ddl2Schema from "../schema/v2.json";
import { upgrade } from "./upgrade";
import { upgrade } from "./upgrade.ts";

const args = process.argv.slice(2);

Expand Down
2 changes: 1 addition & 1 deletion packages/ddl-shim/src/dermatology.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as DDL2 from "./ddl/v2";
import * as DDL2 from "./ddl/v2.ts";

const classMappings: any = {
c3chart_Bar: "chart_Bar",
Expand Down
10 changes: 5 additions & 5 deletions packages/ddl-shim/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * from "./__package__";
import * as DDL1 from "./ddl/v1";
import * as DDL2 from "./ddl/v2";
export * from "./upgrade";
export * from "./validate";
export * from "./__package__.ts";
import * as DDL1 from "./ddl/v1.ts";
import * as DDL2 from "./ddl/v2.ts";
export * from "./upgrade.ts";
export * from "./validate.ts";

export { DDL1, DDL2 };

Expand Down
8 changes: 4 additions & 4 deletions packages/ddl-shim/src/upgrade.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PKG_NAME, PKG_VERSION } from "./__package__";
import * as DDL1 from "./ddl/v1";
import * as DDL2 from "./ddl/v2";
import { upgrade as dermatologyUpgrade } from "./dermatology";
import { PKG_NAME, PKG_VERSION } from "./__package__.ts";
import * as DDL1 from "./ddl/v1.ts";
import * as DDL2 from "./ddl/v2.ts";
import { upgrade as dermatologyUpgrade } from "./dermatology.ts";

interface IDatasourceOutput {
datasource: DDL1.IAnyDatasource;
Expand Down
9 changes: 4 additions & 5 deletions packages/ddl-shim/src/validate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as _Ajv from "ajv";
import * as DDL from "./ddl/v1";
import * as DDL2 from "./ddl/v2";
import * as DDL from "./ddl/v1.ts";
import * as DDL2 from "./ddl/v2.ts";

const Ajv = (_Ajv as any).default || _Ajv;

Expand Down Expand Up @@ -31,9 +31,8 @@ export function validate(ddl: DDL.DDLSchema) {
}
*/

// @ts-ignore
import * as _ddl2Schema from "../schema/v2.json";
import _ddl2Schema from "../schema/v2.json" with { type: "json" };

export function validate2(ddl: DDL2.Schema) {
return doValidate(ddl, _ddl2Schema);
return doValidate(ddl, _ddl2Schema as any);
}
25 changes: 18 additions & 7 deletions packages/ddl-shim/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
{
"extends": "../tsconfig.settings.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib-umd",
"declarationDir": "./types",
"types": [
"node"
"rootDir": "src",
"module": "NodeNext",
"target": "ESNext",
"resolveJsonModule": true,
"emitDeclarationOnly": true,
"declaration": true,
"declarationDir": "types",
"strict": false,
"noImplicitAny": false,
"noImplicitThis": false,
"strictNullChecks": false,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"lib": [
"DOM",
"ESNext",
"ES2020"
]
},
"include": [
"./src/**/*"
"./src/index.ts"
]
}
6 changes: 6 additions & 0 deletions packages/ddl-shim/vitest.workspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineWorkspace } from 'vitest/config';
import baseWorkspace from '../../vitest.workspace.ts';

export default defineWorkspace([
...baseWorkspace
])
2 changes: 1 addition & 1 deletion packages/dgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@hpcc-js/esbuild-plugins": "^1.2.0",
"@hpcc-js/ddl-shim": "^2.22.0",
"@hpcc-js/ddl-shim": "^3.0.0",
"@testing-library/dom": "10.4.0",
"d3-format": "^1",
"d3-selection": "^1"
Expand Down

0 comments on commit 3e146cd

Please sign in to comment.