From be2c63d303b02dd0caffe64e23fe7ae61a61ac68 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Sun, 18 Aug 2024 23:56:38 +0200 Subject: [PATCH] feat: add a vanilla TS project built with Rsbuild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the same shared code as in other project. The dev server and the build process are very fast! ``` Rsbuild v1.0.1-beta.14 ● web ━━━━━━━━━━━━━━━━━━━━━━━━━ (100%) emitting after emit ready Compiled in 0.47 s (web) info Production file sizes for web: File Size Gzipped dist/index.html 0.37 kB 0.25 kB dist/static/js/index.18915e19.js 3.4 kB 1.6 kB dist/static/css/index.143c2b7c.css 4.6 kB 1.5 kB dist/static/js/843.89efea31.js 431.3 kB 116.3 kB Total size: 439.6 kB Gzipped size: 119.7 kB ``` --- .../workflows/check-typescript-projects.yml | 1 + package-lock.json | 271 +++++++++++++++++- projects/rsbuild-ts/.gitignore | 13 + projects/rsbuild-ts/README.md | 20 ++ projects/rsbuild-ts/package.json | 11 + projects/rsbuild-ts/rsbuild.config.ts | 3 + projects/rsbuild-ts/src/index.ts | 23 ++ projects/rsbuild-ts/tsconfig.json | 18 ++ 8 files changed, 356 insertions(+), 4 deletions(-) create mode 100644 projects/rsbuild-ts/.gitignore create mode 100644 projects/rsbuild-ts/README.md create mode 100644 projects/rsbuild-ts/package.json create mode 100644 projects/rsbuild-ts/rsbuild.config.ts create mode 100644 projects/rsbuild-ts/src/index.ts create mode 100644 projects/rsbuild-ts/tsconfig.json diff --git a/.github/workflows/check-typescript-projects.yml b/.github/workflows/check-typescript-projects.yml index 37ac31b..095aa26 100644 --- a/.github/workflows/check-typescript-projects.yml +++ b/.github/workflows/check-typescript-projects.yml @@ -56,6 +56,7 @@ jobs: - lit-ts - parcel-ts - rollup-ts + - rsbuild-ts - sveltekit-ts - vitejs-ts npm-package: ['release', 'development'] diff --git a/package-lock.json b/package-lock.json index b0c2da8..f8dac9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -625,6 +625,45 @@ "node": ">=12.0.0" } }, + "node_modules/@module-federation/runtime": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@module-federation/runtime/-/runtime-0.2.3.tgz", + "integrity": "sha512-N+ZxBUb1mkmfO9XT1BwgYQgShtUTlijHbukqQ4afFka5lRAT+ayC7RKfHJLz0HbuexKPCmPBDfdmCnErR5WyTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@module-federation/sdk": "0.2.3" + } + }, + "node_modules/@module-federation/runtime-tools": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@module-federation/runtime-tools/-/runtime-tools-0.2.3.tgz", + "integrity": "sha512-capN8CVTCEqNAjnl102girrkevczoQfnQYyiYC4WuyKsg7+LUqfirIe1Eiyv6VSE2UgvOTZDnqvervA6rBOlmg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@module-federation/runtime": "0.2.3", + "@module-federation/webpack-bundler-runtime": "0.2.3" + } + }, + "node_modules/@module-federation/sdk": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@module-federation/sdk/-/sdk-0.2.3.tgz", + "integrity": "sha512-W9zrPchLocyCBc/B8CW21akcfJXLl++9xBe1L1EtgxZGfj/xwHt0GcBWE/y+QGvYTL2a1iZjwscbftbUhxgxXg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@module-federation/webpack-bundler-runtime": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@module-federation/webpack-bundler-runtime/-/webpack-bundler-runtime-0.2.3.tgz", + "integrity": "sha512-L/jt2uJ+8dwYiyn9GxryzDR6tr/Wk8rpgvelM2EBeLIhu7YxCHSmSjQYhw3BTux9zZIr47d1K9fGjBFsVRd/SQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@module-federation/runtime": "0.2.3", + "@module-federation/sdk": "0.2.3" + } + }, "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.2.tgz", @@ -2968,6 +3007,207 @@ "win32" ] }, + "node_modules/@rsbuild/core": { + "version": "1.0.1-beta.14", + "resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-1.0.1-beta.14.tgz", + "integrity": "sha512-dUeEao3/QClKUqUltPFNfBCyLKyK3v/GBu3CKii8IZi61Aky4Sua/lKGX+vz9OesBXFKvbSpWg2B+33Il4n/eA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rspack/core": "1.0.0-beta.5", + "@rspack/lite-tapable": "1.0.0", + "@swc/helpers": "0.5.11", + "caniuse-lite": "^1.0.30001651", + "core-js": "~3.38.0" + }, + "bin": { + "rsbuild": "bin/rsbuild.js" + }, + "engines": { + "node": ">=16.7.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/@rspack/binding": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-1.0.0-beta.5.tgz", + "integrity": "sha512-GT0cxYzD4jrXaB4eaGu1N/l32InSWelDREvqg1MDjZAYZlYreN2yFiA8Ds5+RqPz53csup1WWHFMqYcNH9KipQ==", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "@rspack/binding-darwin-arm64": "1.0.0-beta.5", + "@rspack/binding-darwin-x64": "1.0.0-beta.5", + "@rspack/binding-linux-arm64-gnu": "1.0.0-beta.5", + "@rspack/binding-linux-arm64-musl": "1.0.0-beta.5", + "@rspack/binding-linux-x64-gnu": "1.0.0-beta.5", + "@rspack/binding-linux-x64-musl": "1.0.0-beta.5", + "@rspack/binding-win32-arm64-msvc": "1.0.0-beta.5", + "@rspack/binding-win32-ia32-msvc": "1.0.0-beta.5", + "@rspack/binding-win32-x64-msvc": "1.0.0-beta.5" + } + }, + "node_modules/@rspack/binding-darwin-arm64": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-beta.5.tgz", + "integrity": "sha512-lHiQ5cZrBQEpoh7Cd0AY3ggzlfBy9HiK4T0x2VdtsT2ZMc81hPBJ23hB8WIA+CTfOwbeLUBi0Ypfo26jls+dBw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rspack/binding-darwin-x64": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.0.0-beta.5.tgz", + "integrity": "sha512-uEWJe2Egs0LawG/8pnfHIyZeJWLMCZkQjZM1PY8iH7jVLXh1rELQJbGlMHNFbYvM4cU8Xfk9si2Vi4mPRepzlQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rspack/binding-linux-arm64-gnu": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-beta.5.tgz", + "integrity": "sha512-DHyd2f+H5Y1F12fH5aN1Rx341E6cvH86pGnqcbdsVaOgM+8GM55LIr4p90XIdrjK2vH5PYROFM8g/d6CGzX3VQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rspack/binding-linux-arm64-musl": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-beta.5.tgz", + "integrity": "sha512-QG9NYVcwpaDqkUT1Ny1yr+RAgSmdN8AswqLkLbtD42Q/P+DKlvKUa48BxU7irQgYe21AKEg4E7EnLCXaeSwRFw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rspack/binding-linux-x64-gnu": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-beta.5.tgz", + "integrity": "sha512-r3KB58qDZvTh9zoAdZG0F6soh9f7MtCbhZzhLAiFb8E5J+QBK3dN+hn6LLtap8istZaU0nq9UdYiKDPOthhPiQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rspack/binding-linux-x64-musl": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-beta.5.tgz", + "integrity": "sha512-/IDw2JI273wQXCoQQvnX2sthNglChMhQDig8XxFU3fLQmaPB8zxGFCxowstOQPjN/McSddHGdISGlv6RKh8rCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rspack/binding-win32-arm64-msvc": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-beta.5.tgz", + "integrity": "sha512-HhT79VMinXof1sI7SWBRNBamSUUcwgZwlfhcQlaRtm06YzmK0wieJAWi1Gunr6/tlDPa4UNM+y3le6K5kibwfQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rspack/binding-win32-ia32-msvc": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.0.0-beta.5.tgz", + "integrity": "sha512-oYXpiXpoVBL7v3biBHeUlkrW0EVceG3PsBPcBg/AuVqbpogePu1xN6gRdaN9CYK/uRNcDyFC3QWDOq+Cn3KExg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rspack/binding-win32-x64-msvc": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-beta.5.tgz", + "integrity": "sha512-tXYOIThPgiIvKKoV91GN/+P405DGFcuhdZZ+i0AhrRrtbK7mpkIRdde8aVMXNbTA6NnKAcOSAvJ2bVUVq3F2rQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rspack/core": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@rspack/core/-/core-1.0.0-beta.5.tgz", + "integrity": "sha512-X8amU6N26FE4/3JPs+asTIeBZlESrfCC4jlfEOc6bsjLCiMK8NkF3r84xFG7qpGBe178c+yXwmBluyHUkMGHqg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@module-federation/runtime-tools": "0.2.3", + "@rspack/binding": "1.0.0-beta.5", + "@rspack/lite-tapable": "1.0.0", + "caniuse-lite": "^1.0.30001616" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@swc/helpers": ">=0.5.1" + }, + "peerDependenciesMeta": { + "@swc/helpers": { + "optional": true + } + } + }, + "node_modules/@rspack/lite-tapable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rspack/lite-tapable/-/lite-tapable-1.0.0.tgz", + "integrity": "sha512-7MZf4lburSUZoEenwazwUDKHhqyfnLCGnQ/tKcUtztfmVzfjZfRn/EaiT0AKkYGnL2U8AGsw89oUeVyvaOLVCw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/@sveltejs/adapter-auto": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-2.1.1.tgz", @@ -3748,9 +3988,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001614", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001614.tgz", - "integrity": "sha512-jmZQ1VpmlRwHgdP1/uiKzgiAuGOfLEJsYFP4+GBou/QQ4U6IOJCB4NP1c+1p9RGLpwObcT94jA5/uO+F1vBbog==", + "version": "1.0.30001651", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz", + "integrity": "sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==", "dev": true, "funding": [ { @@ -3765,7 +4005,8 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/chalk": { "version": "2.4.2", @@ -4182,6 +4423,18 @@ "copyup": "copyfiles" } }, + "node_modules/core-js": { + "version": "3.38.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.38.0.tgz", + "integrity": "sha512-XPpwqEodRljce9KswjZShh95qJ1URisBeKCjUdq27YdenkslVe7OO0ZJhlYXAChW7OhXaRLl8AAba7IBfoIHug==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -6092,6 +6345,10 @@ "resolved": "projects/rollup-ts", "link": true }, + "node_modules/maxgraph-ts-example-built-with-rsbuild": { + "resolved": "projects/rsbuild-ts", + "link": true + }, "node_modules/maxgraph-ts-example-built-with-sveltekit": { "resolved": "projects/sveltekit-ts", "link": true @@ -8481,6 +8738,12 @@ "tslib": "~2.6.3" } }, + "projects/rsbuild-ts": { + "name": "maxgraph-ts-example-built-with-rsbuild", + "devDependencies": { + "@rsbuild/core": "1.0.1-beta.14" + } + }, "projects/sveltekit-ts": { "name": "maxgraph-ts-example-built-with-sveltekit", "devDependencies": { diff --git a/projects/rsbuild-ts/.gitignore b/projects/rsbuild-ts/.gitignore new file mode 100644 index 0000000..38d7344 --- /dev/null +++ b/projects/rsbuild-ts/.gitignore @@ -0,0 +1,13 @@ +# Local +.DS_Store +*.local +*.log* + +# Dist +node_modules +dist/ + +# IDE +.vscode/* +!.vscode/extensions.json +.idea diff --git a/projects/rsbuild-ts/README.md b/projects/rsbuild-ts/README.md new file mode 100644 index 0000000..d5f5d30 --- /dev/null +++ b/projects/rsbuild-ts/README.md @@ -0,0 +1,20 @@ +# Rsbuild Project + +A vanilla TypeScript project built with https://rsbuild.dev + +Initialized by following https://rsbuild.dev/guide/start/quick-start: +- `npm create rsbuild@latest` +- this used create-rsbuild@1.0.1-beta.14 + +## Setup + +From the repository root, run `npm install`. For more details, see the [root README](../../README.md#setup). + +If you want to use the maxGraph development version (built locally), see the [root README](../../README.md#maxgraph-dev-version) about maxGraph integration. + +## Running the project + +From the repository root, run `npm run dev -w projects/rsbuild-ts` and go to http://localhost:3000/ + +If you want to bundle the application, run `npm run build -w projects/rsbuild-ts` and then run `npm run preview -w projects/rsbuild-ts` +to access to a preview of the bundled application. diff --git a/projects/rsbuild-ts/package.json b/projects/rsbuild-ts/package.json new file mode 100644 index 0000000..f4dec4a --- /dev/null +++ b/projects/rsbuild-ts/package.json @@ -0,0 +1,11 @@ +{ + "name": "maxgraph-ts-example-built-with-rsbuild", + "scripts": { + "dev": "rsbuild dev --open", + "build": "rsbuild build", + "preview": "rsbuild preview" + }, + "devDependencies": { + "@rsbuild/core": "1.0.1-beta.14" + } +} diff --git a/projects/rsbuild-ts/rsbuild.config.ts b/projects/rsbuild-ts/rsbuild.config.ts new file mode 100644 index 0000000..03f85e1 --- /dev/null +++ b/projects/rsbuild-ts/rsbuild.config.ts @@ -0,0 +1,3 @@ +import { defineConfig } from '@rsbuild/core'; + +export default defineConfig({}); diff --git a/projects/rsbuild-ts/src/index.ts b/projects/rsbuild-ts/src/index.ts new file mode 100644 index 0000000..1114803 --- /dev/null +++ b/projects/rsbuild-ts/src/index.ts @@ -0,0 +1,23 @@ +import '@maxgraph/core/css/common.css'; +import 'maxgraph-examples-shared/css/rubber-band.css' +import 'maxgraph-examples-shared/css/general-style.css' + +import {Client} from "@maxgraph/core"; +import {initializeGraph} from 'maxgraph-examples-shared'; + +document.querySelector('#root')!.innerHTML = ` +

maxGraph Rsbuild TypeScript example

+

Display a test graph. Activated behaviours:

+ +
+ +`; + +const footer = document.querySelector('footer')!; +footer.innerText = `Built with maxGraph ${Client.VERSION}`; + +// Creates the graph inside the given container +initializeGraph(document.querySelector('#graph-container')); diff --git a/projects/rsbuild-ts/tsconfig.json b/projects/rsbuild-ts/tsconfig.json new file mode 100644 index 0000000..65773d6 --- /dev/null +++ b/projects/rsbuild-ts/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2020", + "lib": ["DOM", "ES2020"], + "module": "ESNext", + "noEmit": true, + "strict": true, + "skipLibCheck": true, + "isolatedModules": true, + "resolveJsonModule": true, + "moduleResolution": "bundler", + "useDefineForClassFields": true, + "allowImportingTsExtensions": true + }, + "include": [ + "src" + ] +}