Skip to content

Commit

Permalink
Added tooling, worked on styles, xterm
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Oct 11, 2024
1 parent ba0ef9b commit 78259b8
Show file tree
Hide file tree
Showing 10 changed files with 674 additions and 31 deletions.
1 change: 1 addition & 0 deletions .github/codeowners
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @james-pre
50 changes: 50 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Continuous Integration

on:
push:
branches:
- main
workflow_dispatch:
workflow_call:
pull_request:

jobs:
ci:
name: CI
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: npm install

- name: Formatting
run: npm run format:check

- name: Linting
run: npm run lint

- name: Build
run: npm run build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./build

- name: Deploy
id: deploy
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
tmp
dist
dist
build
48 changes: 48 additions & 0 deletions build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env node
import { build, context, type BuildOptions } from 'esbuild';
import { parseArgs } from 'node:util';

const {
values: { mode = 'build' },
} = parseArgs({
options: {
mode: { short: 'm', type: 'string', default: 'build' },
},
strict: false,
allowPositionals: true,
});

const outdir = 'build';

const config: BuildOptions = {
entryPoints: ['src/index.ts', 'src/index.html', 'src/styles.css'],
target: 'es2021',
outdir,
loader: {
'.html': 'copy',
},
sourcemap: true,
keepNames: true,
bundle: true,
format: 'esm',
platform: 'browser',
};

switch (mode) {
case 'watch': {
const ctx = await context(config);
console.log('Watching for changes...');
await ctx.watch();
break;
}
case 'dev': {
const ctx = await context(config);
await ctx.watch();
const { host, port } = await ctx.serve({ servedir: outdir });
console.log(`Development server started at http://${['127.0.0.1', '0.0.0.0'].includes(host) ? 'localhost' : host}:${port}`);
break;
}
case 'build':
default:
await build(config);
}
Loading

0 comments on commit 78259b8

Please sign in to comment.