Skip to content

Commit

Permalink
Merge pull request #4283 from GordonSmith/V3_CODEMIRROR
Browse files Browse the repository at this point in the history
feat: Upgrade codemirror to v3
  • Loading branch information
GordonSmith authored Nov 11, 2024
2 parents 8f35244 + 377d6b5 commit b74cffd
Show file tree
Hide file tree
Showing 30 changed files with 1,875 additions and 1,028 deletions.
2,298 changes: 1,502 additions & 796 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"packages/api",
"xpackages/bundle",
"packages/chart",
"xpackages/codemirror",
"xpackages/codemirror-shim",
"packages/codemirror",
"packages/codemirror-shim",
"packages/common",
"packages/comms",
"xpackages/composite",
Expand Down Expand Up @@ -118,7 +118,7 @@
"@vitest/coverage-v8": "2.1.4",
"eslint": "8.57.1",
"eslint-plugin-react-hooks": "4.6.2",
"lerna": "8.1.8",
"lerna": "8.1.9",
"npm-check-updates": "16.14.20",
"npm-run-all": "4.1.5",
"playwright": "1.48.2",
Expand Down
34 changes: 25 additions & 9 deletions packages/codemirror-shim/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "gen-types-watch",
"type": "npm",
"script": "compile-umd-watch",
"group": {
"kind": "build",
"isDefault": true
},
"script": "gen-types-watch",
"problemMatcher": [
"$tsc-watch"
],
"label": "npm: compile-umd-watch",
"detail": "tsc --module umd --outDir ./lib-umd --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/codemirror-shim/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { browserTpl } from "@hpcc-js/esbuild-plugins";
import pkg from "./package.json" with { type: "json" };

// config ---
await Promise.all([
browserTpl("src/index.ts", "dist/index", {
keepNames: true,
external: [
...Object.keys(pkg.dependencies),
]
})
]);
48 changes: 23 additions & 25 deletions packages/codemirror-shim/package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
{
"name": "@hpcc-js/codemirror-shim",
"version": "2.37.0",
"version": "3.0.0",
"description": "hpcc-js - codemirror shim",
"main": "dist/index.js",
"module": "dist/index.es6",
"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"
}
},
"module": "./dist/index.js",
"browser": "./dist/index.js",
"types": "./types/index.d.ts",
"files": [
"dist/*",
"types/*",
"types-3.4/*",
"src/*"
"src/*",
"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",
"bundle": "rollup -c",
"bundle-watch": "npm run bundle -- -w",
"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 *.tsbuildinfo .turbo",
"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",
"docs": "typedoc --options tdoptions.json .",
"update": "npx --yes npm-check-updates -u -t minor"
"update": "npx --yes npm-check-updates -u -t minor",
"update-major": "npx --yes npm-check-updates -u"
},
"dependencies": {},
"devDependencies": {
"@hpcc-js/bundle": "^2.12.0",
"@hpcc-js/esbuild-plugins": "^1.2.0",
"codemirror": "5.65.18"
},
"repository": {
Expand All @@ -49,4 +47,4 @@
"url": "https://github.com/hpcc-systems/Visualization/issues"
},
"homepage": "https://github.com/hpcc-systems/Visualization"
}
}
37 changes: 0 additions & 37 deletions packages/codemirror-shim/rollup.config.mjs

This file was deleted.

6 changes: 3 additions & 3 deletions packages/codemirror-shim/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export * from "./__package__";
export * from "./__package__.ts";
import "codemirror/mode/css/css";
import "codemirror/mode/ecl/ecl";
import "codemirror/mode/gfm/gfm";
import "codemirror/mode/htmlmixed/htmlmixed";
import "codemirror/mode/javascript/javascript";
import "codemirror/mode/xml/xml";
import "codemirror/mode/sql/sql";
import "./mode/dot/dot";
import "./mode/markdown/markdown";
import "./mode/dot/dot.ts";
import "./mode/markdown/markdown.ts";

import "codemirror/lib/codemirror.css";

Expand Down
23 changes: 18 additions & 5 deletions packages/codemirror-shim/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
{
"extends": "../tsconfig.settings.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib-umd",
"declarationDir": "./types",
"rootDir": "src",
"module": "NodeNext",
"target": "ESNext",
"resolveJsonModule": true,
"emitDeclarationOnly": true,
"declaration": true,
"declarationDir": "types",
"strict": true,
"noImplicitAny": false,
"strictNullChecks": false,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"lib": [
"DOM",
"ESNext",
"ES2020"
]
},
"include": [
"./src/**/*"
"./src/index.ts"
]
}
47 changes: 47 additions & 0 deletions packages/codemirror/.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:63315",
"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/**"
]
}
]
}
25 changes: 6 additions & 19 deletions packages/codemirror/.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": "gen-types-watch",
"type": "npm",
"script": "compile-es6-watch",
"script": "gen-types-watch",
"problemMatcher": [
"$tsc-watch"
],
Expand All @@ -13,18 +13,7 @@
}
},
{
"label": "umd watch",
"type": "npm",
"script": "compile-umd-watch",
"problemMatcher": [
"$tsc-watch"
],
"presentation": {
"group": "group-build"
}
},
{
"label": "bundle watch",
"label": "bundle-watch",
"type": "npm",
"script": "bundle-watch",
"problemMatcher": [],
Expand All @@ -35,15 +24,13 @@
{
"label": "build",
"dependsOn": [
"es6 watch",
"umd watch",
"bundle watch"
"gen-types-watch",
"bundle-watch",
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
}
]
}
14 changes: 10 additions & 4 deletions packages/codemirror/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ This package is part of the mono repository "@hpcc-js" (aka Visualization Framew
</html>
```

<ClientOnly>
```js exec echo
import { ECLEditor } from "./dist/index.js";
ECLEditor.version
```


<!-- <ClientOnly>
<hpcc-vitepress style="width:100%;height:600px">
<div id="target" style="height:600px">
</div>
<script type="module">
<script type="module">
import { ECLEditor } from "@hpcc-js/codemirror";
const code = `\
Expand All @@ -55,6 +61,6 @@ This package is part of the mono repository "@hpcc-js" (aka Visualization Framew
.target("target")
.render()
;
</script>
</script>
</hpcc-vitepress>
</ClientOnly>
</ClientOnly> -->
29 changes: 29 additions & 0 deletions packages/codemirror/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { browserTpl } from "@hpcc-js/esbuild-plugins";
import pkg from "./package.json" with { type: "json" };

// config ---
await Promise.all([
browserTpl("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),
]
})
]);
Loading

0 comments on commit b74cffd

Please sign in to comment.