Skip to content

Commit

Permalink
use bun (npm should work fine too)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrionReed committed Dec 2, 2024
1 parent 2d4996a commit efd2867
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 280 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ jobs:
- name: Setup repo
uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v2
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
deno-version: v2.x
bun-version: latest

- name: Install dependencies
run: deno i
run: bun install

- name: Build
run: deno task build
run: bun run build

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./demo/dist"
path: './demo/dist'

- name: Deploy to GitHub Pages
id: deployment
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ dist
.vite
node_modules
.DS_Store
bun.lockb
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@

## Development

1. Install [Deno](https://docs.deno.com/runtime/getting_started/installation/)
1. Install [Bun](https://bun.sh/docs/installation)

```bash
deno i
bun i
# then
deno task dev
bun dev
```

All config is in `deno.json`.

## Primitives

- `<folk-shape>`: Manipulate HTML elements in space.
Expand Down
18 changes: 0 additions & 18 deletions deno.json

This file was deleted.

248 changes: 0 additions & 248 deletions deno.lock

This file was deleted.

22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "folk-canvas",
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite demo",
"build": "vite build demo --base=/folk-canvas",
"preview": "vite build demo && vite preview demo"
},
"dependencies": {
"@types/leaflet": "^1.9.14",
"@types/node": "^22.10.1",
"@webgpu/types": "^0.1.51",
"leaflet": "^1.9.4",
"perfect-arrows": "^0.3.7",
"perfect-freehand": "^1.2.2"
},
"devDependencies": {
"typescript": "^5.7.2",
"vite": "^5.4.10"
}
}
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"isolatedModules": true,
"noEmit": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"allowImportingTsExtensions": true,
"useDefineForClassFields": true,
"skipLibCheck": true,
"lib": ["DOM", "DOM.Iterable", "ESNext", "WebWorker"],
"types": ["@webgpu/types", "@types/node"]
},
"include": ["src/**/*.ts", "demo/**/*.ts", "vite.config.ts"]
}
8 changes: 5 additions & 3 deletions demo/vite.config.ts → vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { resolve } from 'node:path';
import { readdirSync } from 'node:fs';
import { defineConfig, IndexHtmlTransformContext, Plugin } from 'vite';

const files: string[] = readdirSync(__dirname).filter((file) => file.endsWith('.html'));
const demoDir = resolve(__dirname, 'demo');
const files: string[] = readdirSync(demoDir).filter((file) => file.endsWith('.html'));

const input: Record<string, string> = files.reduce((acc, file) => {
acc[file.replace('.html', '')] = resolve(__dirname, file);
acc[file.replace('.html', '')] = resolve(demoDir, file);
return acc;
}, {} as Record<string, string>);

Expand Down Expand Up @@ -50,13 +51,14 @@ export default defineConfig({
modulePreload: {
polyfill: false,
},
outDir: 'demo/dist',
},
worker: {
format: 'es',
},
server: {
fs: {
allow: [resolve(__dirname, '..')],
allow: ['.'],
},
},
});

0 comments on commit efd2867

Please sign in to comment.