Skip to content

Commit

Permalink
feat: Switch to esbuild and ESM first packaging (comms)
Browse files Browse the repository at this point in the history
Changed type to "module" and dropped UMD support

Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
  • Loading branch information
GordonSmith committed Sep 25, 2024
1 parent 4a426f6 commit b225f92
Show file tree
Hide file tree
Showing 127 changed files with 6,384 additions and 7,082 deletions.
61 changes: 7 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 17 additions & 31 deletions packages/comms/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,36 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "WSDL Generation",
"request": "launch",
"runtimeArgs": [
"run-script",
"wsdl-workunits"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"sourceMaps": true
},
{
"name": "index.html",
"name": "test-browser",
"type": "msedge",
"request": "launch",
"url": "file:///${workspaceRoot}/index.html",
"url": "http://localhost:8888",
"webRoot": "${workspaceFolder}",
"runtimeArgs": [
"--disable-web-security"
],
"webRoot": "${workspaceRoot}"
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
},
{
"name": "Mocha Tests",
"name": "test-node",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/lib-umd/__tests__"
"runtimeArgs": [
"run-script",
"test-node"
],
"internalConsoleOptions": "openOnSessionStart",
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
]
],
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
}
]
}
28 changes: 18 additions & 10 deletions packages/comms/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"version": "2.0.0",
"tasks": [
{
"label": "es6 watch",
"label": "check-watch",
"type": "npm",
"script": "compile-es6-watch",
"script": "check-watch",
"problemMatcher": [
"$tsc-watch"
],
Expand All @@ -13,9 +13,9 @@
}
},
{
"label": "umd watch",
"label": "gen-types-watch",
"type": "npm",
"script": "compile-umd-watch",
"script": "gen-types-watch",
"problemMatcher": [
"$tsc-watch"
],
Expand All @@ -24,26 +24,34 @@
}
},
{
"label": "bundle watch",
"label": "bundle-watch",
"type": "npm",
"script": "bundle-watch",
"problemMatcher": [],
"presentation": {
"group": "group-build"
}
},
{
"type": "npm",
"label": "test-serve",
"script": "test-serve",
"presentation": {
"group": "group-build"
}
},
{
"label": "build",
"dependsOn": [
"es6 watch",
"umd watch",
"bundle watch"
"check-watch",
"gen-types-watch",
"bundle-watch",
"test-serve"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
}
]
}
9 changes: 9 additions & 0 deletions packages/comms/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { browserTpl, nodeTpl } from "@hpcc-js/esbuild-plugins";

// config ---
await Promise.all([nodeTpl("src/index.node.ts", "dist/index.node"), browserTpl("src/index.ts", "dist/index")]);
await Promise.all([
browserTpl("spec/index.browser.ts", "dist-test/index.browser", undefined, undefined, undefined, ["@hpcc-js/comms"]),
nodeTpl("spec/index.node.ts", "dist-test/index.node", undefined, undefined, undefined, ["@hpcc-js/*"]),
]);

66 changes: 30 additions & 36 deletions packages/comms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,40 @@
"name": "@hpcc-js/comms",
"version": "2.96.1",
"description": "hpcc-js - Communications",
"main": "dist/index.node.js",
"module": "dist/index.es6",
"module-node": "dist/index.node.es6",
"browser": "dist/index.js",
"unpkg": "dist/index.min.js",
"jsdelivr": "dist/index.min.js",
"types": "types/index.node.d.ts",
"type": "module",
"exports": {
".": {
"types": "./types/index.d.ts",
"node": "./dist/index.node.js",
"default": "./dist/index.js"
}
},
"main": "./dist/index.node.js",
"browsermain": "./dist/index.js",
"types": "./types/index.d.ts",
"files": [
"types/*",
"types-3.4/*",
"lib-es6/*",
"dist/*",
"src/*",
"dist/*"
"types/*"
],
"scripts": {
"clean": "rimraf --glob lib* types dist *.tsbuildinfo",
"compile-es6": "tsc --module es6 --outDir ./lib-es6",
"compile-es6-watch": "npm run compile-es6 -- -w",
"compile-umd": "tsc --module umd --outDir ./lib-umd",
"compile-umd-watch": "npm run compile-umd -- -w",
"compile-util": "tsc --esModuleInterop --target es2019 --skipLibCheck --module commonjs --sourcemap --outDir ./lib-cjs ./utils/index.ts",
"compile-util-watch": "npm run compile-util -- -w",
"bundle": "rollup -c",
"bundle-watch": "npm run bundle -- -w",
"minimize-browser": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",
"minimize-node": "terser dist/index.node.js -c -m --source-map \"content='dist/index.node.js.map',url='index.node.min.js.map'\" -o dist/index.node.min.js",
"minimize": "npm run minimize-browser && npm run minimize-node",
"gen-legacy-types": "downlevel-dts ./types ./types-3.4",
"build": "npm run compile-es6 && npm run bundle",
"watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch",
"clean": "rimraf --glob lib* types dist dist-test *.tsbuildinfo .turbo",
"check": "tsc --project tsconfig.spec.json",
"check-watch": "npm run check -- --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": "run-p gen-types bundle",
"stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
"lint": "eslint ./src",
"lint-fix": "eslint --fix src/**/*.ts",
"test-old": "mocha lib-umd/__tests__ --reporter spec",
"docs": "typedoc --options tdoptions.json .",
"update": "npx --yes npm-check-updates -u -t minor",
"test-serve": "jasmine-browser-runner serve",
"test-browser": "jasmine-browser-runner runSpecs --source-map=false",
"test-node": "jasmine",
"test": "run-p check test-node",
"update": "npx -y npm-check-updates -u -t minor",
"update-major": "npx -y npm-check-updates -u",
"wsdl-access": "node ./lib-cjs/index.js -k --url=http://localhost:8010/ws_access?wsdl --outDir=./src/services/wsdl",
"wsdl-account": "node ./lib-cjs/index.js -k --url=http://localhost:8010/Ws_Account?wsdl --outDir=./src/services/wsdl",
"wsdl-cloud": "node ./lib-cjs/index.js -k --url=http://localhost:8010/WsCloud?wsdl --outDir=./src/services/wsdl",
Expand Down Expand Up @@ -65,14 +63,11 @@
"@hpcc-js/ddl-shim": "^2.21.0",
"@hpcc-js/util": "^2.52.0",
"@xmldom/xmldom": "0.8.10",
"abort-controller": "3.0.0",
"node-fetch": "2.7.0",
"safe-buffer": "5.2.1",
"tmp": "0.2.3",
"undici": "5.28.4"
},
"devDependencies": {
"@hpcc-js/bundle": "^2.12.0",
"@hpcc-js/esbuild-plugins": "^1.1.2",
"@types/d3-request": "1.0.9",
"@types/d3-time-format": "2.3.4",
"@types/node": "^18",
Expand All @@ -81,8 +76,7 @@
"d3-time-format": "^2",
"soap": "1.0.4",
"tslib": "2.6.3",
"typescript-formatter": "^7.2.2",
"whatwg-fetch": "3.6.20"
"typescript-formatter": "^7.2.2"
},
"repository": {
"type": "git",
Expand All @@ -94,5 +88,5 @@
"bugs": {
"url": "https://github.com/hpcc-systems/Visualization/issues"
},
"homepage": "https://github.com/hpcc-systems/Visualization"
"homepage": "https://github.com/hpcc-systems/Visualization/tree/trunk/packages/comms"
}
Loading

0 comments on commit b225f92

Please sign in to comment.