Skip to content

Commit

Permalink
feat: bun (#491)
Browse files Browse the repository at this point in the history
partial bun.sh support

https://bun.sh/
  • Loading branch information
RPDeshaies authored Sep 12, 2023
1 parent 133bef6 commit 3327a5f
Show file tree
Hide file tree
Showing 14 changed files with 2,745 additions and 29,291 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0 #
# Use Node
- name: Use Node
uses: actions/setup-node@v2
# Use Bun
- name: Use Bun
uses: oven-sh/setup-bun@v1
with:
node-version: "18"
bun-version: latest
- name: Install dependencies
run: npm install
run: bun install
# 👇 Adds Chromatic as a step in the workflow
- name: Publish to Chromatic
uses: chromaui/action@v1
Expand Down
63 changes: 22 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,24 @@ jobs:
# Checkout
- name: Checkout
uses: actions/checkout@v2
# Use Node
- name: Use Node
uses: actions/setup-node@v2
# Use Bun
- name: Use Bun
uses: oven-sh/setup-bun@v1
with:
node-version: "18"
# Cache
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
bun-version: latest
# Install
- name: Install
run: npm install
run: bun install
# Build
- name: Build
run: |
CONTEXT=production npm run build
CONTEXT=production bun run build
env:
VITE_GITHUB_RUN_NUMBER: ${{github.run_number}}
VITE_GITHUB_SHA: ${{github.sha}}
# Validate
- name: Validate
run: npm run validate
run: bun run validate
# Upload Artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v1
Expand All @@ -55,22 +48,17 @@ jobs:
name: Preview
url: https://${{github.run_id}}--fari.netlify.app
steps:
# Setup
- uses: actions/checkout@v2
- name: Use Node
uses: actions/setup-node@v2
with:
node-version: "18"
# Cache
- uses: actions/cache@v2
# Checkout
- name: Checkout
uses: actions/checkout@v2
# Use Bun
- name: Use Bun
uses: oven-sh/setup-bun@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
bun-version: latest
# Install
- name: Install
run: npm install
run: bun install
# Download Artifacts
- name: Download Artifacts
uses: actions/download-artifact@master
Expand All @@ -79,7 +67,7 @@ jobs:
path: dist
# Deploy Preview
- name: Deploy Preview
run: npm run deploy:preview -- --auth ${{secrets.NETLIFY_AUTH_TOKEN}} --alias $GITHUB_RUN_ID
run: bun run deploy:preview -- --auth ${{secrets.NETLIFY_AUTH_TOKEN}} --alias $GITHUB_RUN_ID
deploy-production:
needs: [build]
runs-on: ubuntu-latest
Expand All @@ -90,21 +78,14 @@ jobs:
steps:
# Setup
- uses: actions/checkout@v2
- name: Use Node
uses: actions/setup-node@v2
with:
node-version: "18"
# Cache
- name: Cache
uses: actions/cache@v2
# Use Bun
- name: Use Bun
uses: oven-sh/setup-bun@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
bun-version: latest
# Install
- name: Install
run: npm install
run: bun install
# Download Artifacts
- name: Download Artifacts
uses: actions/download-artifact@master
Expand All @@ -113,4 +94,4 @@ jobs:
path: dist
# Deploy Production
- name: Deploy Production
run: npm run deploy:prod -- --auth ${{secrets.NETLIFY_AUTH_TOKEN}}
run: bun run deploy:prod -- --auth ${{secrets.NETLIFY_AUTH_TOKEN}}
5 changes: 5 additions & 0 deletions .github/workflows/int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Use Bun
- name: Use Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
# Install
- name: Install
run: npm install
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,24 @@ If you want to make a contribution to Fari, you will need to fork / clone this r

### Prerequisites

1. Install Node `^16.2.0` (to match engine property in `package.json`) or use the [devcontainer](https://microsoft.github.io/code-with-engineering-playbook/developer-experience/devcontainers/) provided using [VS Code](https://code.visualstudio.com/).
1. Install Bun at [bun.sh](bun.sh).

### Installation

Fari relies on Node and the Node Package Manager to download its dependencies and run.
Fari relies on Bun download its dependencies and run the app.

If you are using the proper node and npm version, you then need to install Fari's dependencies
To install the dependencies, simply run:

```sh
npm install
bun install
```

Once the dependencies are installed, Fari will also build some of it's static content (e.g. the content of the SRD) using [11ty](https://www.11ty.dev/) which will convert the markdown files to HTML files insides a `_site` directory.

### Running the application

If you want to run Fari on your machine, simply run:

```sh
npm run run dev
bun run dev
```

This will start and bundle the app using [ViteJS](https://vitejs.dev/) and make it available on http://localhost:1234
Expand Down
Binary file added bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
preload = "./happydom.ts"
3 changes: 3 additions & 0 deletions happydom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { GlobalRegistrator } from "@happy-dom/global-registrator";

GlobalRegistrator.register();
4 changes: 2 additions & 2 deletions lib/domains/character/CharacterFactory.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ describe("CharacterFactory.duplicate", () => {

const characterWithFakeIds = produce(defaultCharacter, (draft) => {
draft.id = "1";
draft.pages.forEach((p) => {
draft.pages?.forEach((p) => {
p.id = "1";
p.rows.forEach((r) => {
r.columns.forEach((c) => {
Expand All @@ -677,7 +677,7 @@ describe("CharacterFactory.duplicate", () => {

const duplicate = CharacterFactory.duplicate(characterWithFakeIds);
expect(duplicate.id).not.toBe("1");
duplicate.pages.forEach((p) => {
duplicate.pages?.forEach((p) => {
expect(p.id).not.toBe("1");
p.rows.forEach((r) => {
r.columns.forEach((c) => {
Expand Down
3 changes: 2 additions & 1 deletion lib/domains/character/CharacterFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export const CharacterFactory = {
resetAllIds(character: ICharacter): ICharacter {
return produce(character, (draft) => {
draft.id = Id.generate();
draft.pages.forEach((page) => {

draft.pages?.forEach((page) => {
page.id = Id.generate();
page.rows.forEach((row) => {
row.columns.forEach((col) => {
Expand Down
25 changes: 0 additions & 25 deletions lib/hooks/useBlocker/useBlocker.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions lib/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/// <reference lib="dom" />
/// <reference lib="dom.iterable" />

import { setAutoFreeze } from "immer";
import React from "react";
import { createRoot } from "react-dom/client";
Expand Down
Loading

0 comments on commit 3327a5f

Please sign in to comment.