marge example into monorepo
This commit is contained in:
parent
3f42182fb1
commit
37513bfc2c
23 changed files with 442 additions and 96 deletions
15
examples/vite/README.md
Normal file
15
examples/vite/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# test-jsx
|
||||
|
||||
To install dependencies:
|
||||
|
||||
```bash
|
||||
bun install
|
||||
```
|
||||
|
||||
To run:
|
||||
|
||||
```bash
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
This project was created using `bun init` in bun v1.2.0. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
||||
2
examples/vite/bunfig.toml
Normal file
2
examples/vite/bunfig.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[install.scopes]
|
||||
baobeld = { url = "https://git.palko.ca/api/packages/baobeld/npm/", token = "$NPM_TOKEN" }
|
||||
27
examples/vite/package.json
Normal file
27
examples/vite/package.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "test-jsx",
|
||||
"module": "src/index.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "gjs -m dist/main.js",
|
||||
"build": "vite build",
|
||||
"check": "biome check --write **/*",
|
||||
"format": "biome format --write **/*",
|
||||
"lint": "biome lint --write **/*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest",
|
||||
"vite": "^6.2.6",
|
||||
"vite-tsconfig-paths": "^5.1.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@baobeld/greact": "workspace:*",
|
||||
"@girs/gio-2.0": "^2.84.0-4.0.0-beta.23",
|
||||
"@girs/gjs": "^4.0.0-beta.23",
|
||||
"@girs/glib-2.0": "^2.84.0-4.0.0-beta.23",
|
||||
"@girs/gtk-4.0": "^4.18.3-4.0.0-beta.23"
|
||||
}
|
||||
}
|
||||
17
examples/vite/src/main.ts
Normal file
17
examples/vite/src/main.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import GLib from "gi://GLib?version=2.0";
|
||||
import Gtk40 from "gi://Gtk?version=4.0";
|
||||
import Window from "./windows";
|
||||
|
||||
Gtk40.init();
|
||||
|
||||
const root = Window({ name: "foo" });
|
||||
|
||||
if (root instanceof Gtk40.Window) {
|
||||
const loop = GLib.MainLoop.new(null, false);
|
||||
|
||||
root.connect("close-request", () => loop.quit());
|
||||
root.present();
|
||||
|
||||
loop.run();
|
||||
console.log(root.name);
|
||||
}
|
||||
9
examples/vite/src/windows/index.tsx
Normal file
9
examples/vite/src/windows/index.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
interface Props {
|
||||
name: string;
|
||||
}
|
||||
|
||||
const Window = function ({ name }: Props) {
|
||||
return <window name={name} />;
|
||||
};
|
||||
|
||||
export default Window;
|
||||
36
examples/vite/tsconfig.json
Normal file
36
examples/vite/tsconfig.json
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
// Enable latest features
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleDetection": "force",
|
||||
"types": [
|
||||
"@baobeld/greact",
|
||||
"@girs/gjs",
|
||||
"@girs/gtk-4.0",
|
||||
"@girs/gio-2.0",
|
||||
"@girs/glib-2.0"
|
||||
],
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "@baobeld/greact",
|
||||
"allowJs": true,
|
||||
|
||||
// Bundler mode
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
|
||||
// Best practices
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
||||
// Some stricter flags (disabled by default)
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noPropertyAccessFromIndexSignature": false
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
29
examples/vite/vite.config.ts
Normal file
29
examples/vite/vite.config.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { defineConfig } from "vite";
|
||||
import { resolve } from "node:path";
|
||||
import tsconfigpaths from "vite-tsconfig-paths";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tsconfigpaths()],
|
||||
build: {
|
||||
target: "firefox115",
|
||||
outDir: "dist",
|
||||
lib: {
|
||||
formats: ["es"],
|
||||
entry: [resolve(__dirname, "src", "main.ts")],
|
||||
fileName: (_, entryName) => {
|
||||
return `${entryName}.js`;
|
||||
},
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [
|
||||
/^gi:\/\/*/i,
|
||||
/^resource:\/\/*/i,
|
||||
"gettext",
|
||||
"system",
|
||||
"cairo",
|
||||
],
|
||||
output: {},
|
||||
},
|
||||
minify: false,
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue