Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/deploy-sandbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy sandbox to GitHub Pages

on:
push:
branches:
- master
workflow_dispatch:

permissions:
contents: read

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm

- uses: actions/configure-pages@v5

- run: npm ci

- run: npm run sandbox:typecheck

- run: npm run sandbox:build

- uses: actions/upload-pages-artifact@v4
with:
path: sandbox/dist

deploy:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
26 changes: 26 additions & 0 deletions sandbox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Demo WebApp project

A live deployment of this demo can be found here: https://bitboxswiss.github.io/bitbox-api-ts/.

This folder contains a React project showcasing the TypeScript API. It uses the bitbox-api library
in `../src` through the Vite alias in [./vite.config.ts](./vite.config.ts).

The main entry point of the sandbox is at [./src/App.tsx](./src/App.tsx).

The full package API is described by the TypeScript definitions file `../dist/index.d.ts` after
running `npm run build`.

Install the deps from the repository root using:

npm ci

Run the sandbox from the repository root using:

npm run sandbox:dev

Hot-reloading is supported - you can change the library source or sandbox files without restarting
the server.

To build the sandbox from the repository root:

npm run sandbox:build
5 changes: 3 additions & 2 deletions sandbox/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

export default defineConfig({
export default defineConfig(({ command }) => ({
root: __dirname,
base: command === 'build' ? '/bitbox-api-ts/' : '/',
plugins: [react()],
resolve: {
alias: {
Expand All @@ -21,4 +22,4 @@ export default defineConfig({
outDir: path.resolve(__dirname, 'dist'),
emptyOutDir: true,
},
});
}));
Loading