Skip to content

Commit

Permalink
Merge pull request #4316 from GordonSmith/V3TWEAKS_ECLWATCH_II
Browse files Browse the repository at this point in the history
feat: Switch to vite for dev server and build process
  • Loading branch information
GordonSmith authored Nov 28, 2024
2 parents b4f63e0 + fdd3cac commit 1c01a39
Show file tree
Hide file tree
Showing 222 changed files with 5,172 additions and 1,787 deletions.
29 changes: 25 additions & 4 deletions demos/gallery/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,15 +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",
"type": "shell",
"command": "npm run dev",
"dependsOn": [
"gen-types-watch",
"bundle-watch",
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
}
]
}
7 changes: 6 additions & 1 deletion demos/gallery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script type="module">
import { main } from "./src/index.tsx";

main();

</script>
</body>

</html>
22 changes: 15 additions & 7 deletions demos/gallery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,35 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"clean": "rimraf --glob types dist *.tsbuildinfo",
"clean": "rimraf --glob lib* types dist *.tsbuildinfo .turbo",
"bundle": "vite build",
"bundle-watch": "vite",
"gen-types": "tsc --project tsconfig.json",
"gen-types-watch": "npm run gen-types -- --watch",
"build": "run-p gen-types bundle",
"lint": "eslint ./src",
"dev": "vite",
"preview": "vite preview",
"lint-fix": "eslint --fix src/**/*.ts",
"gen-filejson": "node ./util/dir2json ./samples",
"build": "npm run gen-filejson",
"update": "npx --yes npm-check-updates -u -t minor"
},
"dependencies": {
"@fluentui/react-components": "9.56.2",
"@fluentui/react-hooks": "8.8.16",
"@fluentui/react-icons-mdl2": "1.3.80",
"@fluentui/react-nav-preview": "0.10.1",
"d3-random": "3"
"d3-random": "3",
"@hpcc-js/composite": "^3.1.1",
"@hpcc-js/map": "^3.1.1"
},
"devDependencies": {
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@vitejs/plugin-react-swc": "3.7.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"vite": "5.4.11"
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "18.3.1",
"react-dom": "18.3.1"
}
}
54 changes: 27 additions & 27 deletions demos/gallery/samples/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,27 @@
}
]
},
{
"path": "./samples/chart/dataMeta",
"name": "dataMeta",
"type": "folder",
"children": [
{
"path": "./samples/chart/dataMeta/PieColumn.js",
"name": "PieColumn.js",
"type": "file",
"imports": {
"@hpcc-js/chart": [
"Column",
"Pie"
],
"@hpcc-js/layout": [
"FlexGrid"
]
}
}
]
},
{
"path": "./samples/chart/Gantt",
"name": "Gantt",
Expand Down Expand Up @@ -681,27 +702,6 @@
"SummaryC"
]
}
},
{
"path": "./samples/chart/dataMeta",
"name": "dataMeta",
"type": "folder",
"children": [
{
"path": "./samples/chart/dataMeta/PieColumn.js",
"name": "PieColumn.js",
"type": "file",
"imports": {
"@hpcc-js/chart": [
"Column",
"Pie"
],
"@hpcc-js/layout": [
"FlexGrid"
]
}
}
]
}
]
},
Expand Down Expand Up @@ -901,22 +901,22 @@
}
},
{
"path": "./samples/common/SVGWidget.js",
"name": "SVGWidget.js",
"path": "./samples/common/Shape.js",
"name": "Shape.js",
"type": "file",
"imports": {
"@hpcc-js/common": [
"SVGWidget"
"Shape"
]
}
},
{
"path": "./samples/common/Shape.js",
"name": "Shape.js",
"path": "./samples/common/SVGWidget.js",
"name": "SVGWidget.js",
"type": "file",
"imports": {
"@hpcc-js/common": [
"Shape"
"SVGWidget"
]
}
},
Expand Down
4 changes: 2 additions & 2 deletions demos/gallery/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { DrawerProps, makeStyles, tokens } from "@fluentui/react-components";
import { useConst } from "@fluentui/react-hooks";
import { NavDrawer, NavDrawerBody, NavDrawerHeader } from "@fluentui/react-nav-preview";
import { JSEditor } from "@hpcc-js/codemirror";
import { AutosizeHpccJSComponent } from "./HpccJSAdapter";
import { Samples } from "./Samples";
import { AutosizeHpccJSComponent } from "./HpccJSAdapter.tsx";
import { Samples } from "./Samples.tsx";

function useLocationSearch() {
const [search, setSearch] = React.useState(window.location.search);
Expand Down
14 changes: 14 additions & 0 deletions demos/gallery/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { FluentProvider, webLightTheme } from "@fluentui/react-components";
import { App } from "./App.tsx";

export function main() {
createRoot(document.getElementById("root")!).render(
<StrictMode>
<FluentProvider theme={webLightTheme}>
<App />
</FluentProvider>
</StrictMode>
);
}
14 changes: 0 additions & 14 deletions demos/gallery/src/main.tsx

This file was deleted.

1 change: 1 addition & 0 deletions demos/gallery/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"emitDeclarationOnly": true,
"declaration": true,
"declarationDir": "types",
"jsx": "react",
"strict": false,
"noImplicitAny": false,
"noImplicitThis": false,
Expand Down
33 changes: 33 additions & 0 deletions demos/gallery/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { defineConfig } from "vite";
import { resolve } from "path";
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
import { hpccBundleNames } from "@hpcc-js/esbuild-plugins";
import pkg from "./package.json" with { type: "json" };

const { alias, external, globals } = hpccBundleNames(pkg);

export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, "src/index.tsx"),
name: pkg.name,
fileName: "index",
},
rollupOptions: {
external,
output: {
globals,
},
},
sourcemap: true
},
resolve: {
alias
},
esbuild: {
minifyIdentifiers: false
},
plugins: [
cssInjectedByJsPlugin()
],
});
4 changes: 1 addition & 3 deletions demos/imdb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@
"@hpcc-js/util": "^3.1.0",
"d3-fetch": "^1"
},
"devDependencies": {
"vite": "5.4.11"
}
"devDependencies": {}
}
Loading

0 comments on commit 1c01a39

Please sign in to comment.