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
12 changes: 2 additions & 10 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ jobs:
echo "CSC_LINK=$(echo $MACOS_CSC_LINK)" >> $GITHUB_ENV
echo "CSC_KEY_PASSWORD=$(echo $MACOS_CSC_KEY_PASSWORD)" >> $GITHUB_ENV
echo -n $DEVELOPER_ID_APPLICATION_CERTIFICATE_BASE64 | base64 -d > $MACOS_CSC_LINK
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install bun
if: ${{ matrix.name != 'Windows (ARM)' }}
uses: oven-sh/setup-bun@v2
Expand Down Expand Up @@ -103,12 +99,8 @@ jobs:
timezoneLinux: 'Pacific/Auckland'
- name: Check out OpenCOR
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install bun
run: npm install -g bun
uses: oven-sh/setup-bun@v2
- name: OpenCOR dependencies
run: bun install
- name: Build OpenCOR's Web app
Expand Down Expand Up @@ -153,7 +145,7 @@ jobs:
# https://docs.npmjs.com/trusted-publishers).
run: npm install -g npm@latest
- name: Install bun
run: npm install -g bun
uses: oven-sh/setup-bun@v2
- name: OpenCOR dependencies
run: |
cd src/renderer
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/cddev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ jobs:
timezoneLinux: 'Pacific/Auckland'
- name: Check out OpenCOR
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install bun
run: npm install -g bun
uses: oven-sh/setup-bun@v2
- name: OpenCOR dependencies
run: bun install
- name: Build OpenCOR's Web app
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ jobs:
uses: actions/checkout@v4
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install bun
if: ${{ matrix.name != 'Windows (ARM)' }}
uses: oven-sh/setup-bun@v2
Expand All @@ -67,7 +63,7 @@ jobs:
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.VITE_FIREBASE_MEASUREMENT_ID }}
run: bun build:web
- name: Build OpenCOR's npm library
- name: Build OpenCOR as a library
if: ${{ matrix.name != 'Code formatting' && matrix.name != 'Linting' }}
run: |
cd src/renderer
Expand Down
17 changes: 4 additions & 13 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
# Prerequisites

- [Node.js](https://nodejs.org/) (version 22+);
- [npm](https://npmjs.com/) (it comes with Node.js);
- [bun](https://bun.com/package-manager) (for package management); and
- [bun](https://bun.com/) (version 1.2+); and
- [C](<https://en.wikipedia.org/wiki/C_(programming_language)>)/[C++](https://en.wikipedia.org/wiki/C%2B%2B) toolchain.

## Installation

1. **Install Node.js and npm from [here](https://nodejs.org/en/download/package-manager);**
**Note:** on [Windows](https://en.wikipedia.org/wiki/Microsoft_Windows) on [ARM](https://en.wikipedia.org/wiki/ARM_architecture_family), you can install [Node.js](https://nodejs.org/) using [fnm](https://github.com/Schniz/fnm). However, if you use `fnm install --lts`, it will install the [Intel](https://en.wikipedia.org/wiki/List_of_Intel_processors) version of [Node.js](https://nodejs.org/), which may or may not be what you want. If you want to install the [ARM](https://en.wikipedia.org/wiki/ARM_architecture_family) version of [Node.js](https://nodejs.org/), you should use `fnm install --lts --arch arm64`.
1. **Install bun from [here](https://bun.com/docs/installation).**

2. **Install bun globally:**

```bash
npm install -g bun
```

3. **Install a C/C++ toolchain:**
2. **Install a C/C++ toolchain:**
- **[Windows](https://en.wikipedia.org/wiki/Microsoft_Windows):**
- **[Intel](https://en.wikipedia.org/wiki/List_of_Intel_processors):**
- [Visual Studio Community 2019](https://apps.microsoft.com/detail/xp8cdjnzkfm06w) (`Desktop development with C++` with `MSVC v142 - VS 2019 C++ x64/x86 build tools` and `Windows 10 SDK`); or
Expand All @@ -27,7 +18,7 @@ npm install -g bun
- **[Linux](https://en.wikipedia.org/wiki/Linux):** G++ (`g++` package) on [Ubuntu 22.04 LTS](https://en.wikipedia.org/wiki/Ubuntu_version_history#2204)/[Ubuntu 24.04 LTS](https://en.wikipedia.org/wiki/Ubuntu_version_history#2404); and
- **[macOS](https://en.wikipedia.org/wiki/MacOS):** [Xcode](https://developer.apple.com/xcode/) (including its [Command Line Tools](https://developer.apple.com/downloads/?q=Command%20Line%20Tools)).

4. **Install additional dependencies:**
3. **Install additional dependencies:**
- On [Ubuntu](https://en.wikipedia.org/wiki/Ubuntu) on [ARM](https://en.wikipedia.org/wiki/ARM_architecture_family), you need to install the `libopenjp2-tools` package so that [`electron-builder`](https://electron.build/) can get access to [`opj_decompress`](https://manpages.ubuntu.com/manpages/man1/opj_decompress.1.html).

# Getting Started
Expand Down
20 changes: 16 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,26 @@
"url": "git+https://github.com/opencor/webapp.git"
},
"type": "module",
"version": "0.20260227.2",
"version": "0.20260301.0",
"engines": {
"bun": ">=1.2.0"
},
"scripts": {
"archive:web": "bun src/renderer/scripts/archive.web.js",
"build": "bun src/renderer/scripts/libopencor.js && electron-vite build",
"build:web": "cd ./src/renderer && vite build && bun scripts/generate.version.js",
"build:web": "bun --cwd src/renderer build",
"clean": "bun src/renderer/scripts/clean.js",
"dependencies:update": "bun clean && bun update -i && bun install && bun clean && cd ./src/renderer && bun clean && bun update -i && bun install && bun clean",
"dependencies:update": "bun src/renderer/scripts/dependencies.update.js",
"dev": "bun src/renderer/scripts/libopencor.js && electron-vite dev --watch",
"dev:web": "cd ./src/renderer && vite dev",
"dev:web": "bun --cwd src/renderer dev",
"format": "bunx --bun biome format --fix --max-diagnostics=none && clang-format -i src/renderer/src/libopencor/src/*",
"format:check": "bunx --bun biome format --max-diagnostics=none && clang-format --dry-run -Werror src/renderer/src/libopencor/src/*",
"lint": "bunx --bun biome lint --fix --error-on-warnings --max-diagnostics=none && bunx stylelint '**/*.css' --fix",
"release": "bun src/renderer/scripts/libopencor.js && electron-builder",
"release:local": "bun src/renderer/scripts/libopencor.js && CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --config.mac.notarize=false --publish=never",
"start": "bun src/renderer/scripts/libopencor.js && electron-vite preview",
"start:web": "bun build:web && cd ./src/renderer && vite preview",
"version:new": "bun src/renderer/scripts/version.js"
"start:web": "bun --cwd src/renderer start",
"version:new": "bun src/renderer/scripts/version.new.js"
},
"bun": {
"overrides": {
Expand All @@ -65,7 +68,7 @@
"@electron-toolkit/utils": "^4.0.0",
"@tailwindcss/postcss": "^4.2.1",
"@tailwindcss/vite": "^4.2.1",
"@types/node": "^25.3.2",
"@types/node": "^25.3.3",
"@types/plotly.js": "^3.0.10",
"@vitejs/plugin-vue": "^6.0.4",
"@vue/tsconfig": "^0.8.1",
Expand All @@ -78,7 +81,7 @@
"electron-updater": "^6.8.3",
"electron-vite": "^5.0.0",
"esbuild": "^0.27.3",
"node-addon-api": "^8.5.0",
"node-addon-api": "^8.6.0",
"rollup-plugin-visualizer": "^7.0.0",
"stylelint": "^17.4.0",
"stylelint-config-standard": "^40.0.0",
Expand Down
13 changes: 3 additions & 10 deletions src/renderer/BUILD.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
# Prerequisites

- [Node.js](https://nodejs.org/) (version 22+);
- [npm](https://npmjs.com/) (it comes with Node.js); and
- [bun](https://bun.com/package-manager) (for package management).
- [bun](https://bun.com/) (version 1.2+).

## Installation

1. **Install Node.js and npm from [here](https://nodejs.org/en/download/package-manager);** and
2. **Install bun globally:**

```bash
npm install -g bun
```
1. **Install bun from [here](https://bun.com/docs/installation).**

# Getting Started

Expand All @@ -36,7 +29,7 @@ npm install -g bun
| Script | Description |
| -------------- | ----------------------------------------------------------------|
| `build` | Build OpenCOR's Web app |
| `build:lib` | Build OpenCOR's Web app as a library for npm publishing |
| `build:lib` | Build OpenCOR's Web app as a library |
| `clean` | Clean OpenCOR's environment |
| `dev` | (Build and) start OpenCOR's Web app with hot reload |
| `format` | Format the code using |
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions src/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,28 @@
},
"type": "module",
"types": "dist/index.d.ts",
"engines": {
"bun": ">=1.2.0"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/opencor.es.js"
},
"./style.css": "./dist/opencor.css"
},
"version": "0.20260227.2",
"version": "0.20260301.0",
"scripts": {
"build": "vite build && bun scripts/generate.version.js",
"build:lib": "vite build --config vite.lib.config.ts && cp index.d.ts dist/index.d.ts",
"build:lib": "vite build --config vite.lib.config.ts && bun scripts/copy.indexdts.js",
"clean": "bun scripts/clean.js",
"dependencies:update": "cd ../.. && bun clean && bun update -i && bun install && bun clean && cd src/renderer && bun clean && bun update -i && bun install && bun clean",
"dependencies:update": "bun scripts/dependencies.update.js",
"dev": "vite dev",
"format": "cd ../.. && bunx --bun biome format --fix --max-diagnostics=none && clang-format -i src/renderer/src/libopencor/src/*",
"format:check": "cd ../.. && bunx --bun biome format --max-diagnostics=none && clang-format --dry-run -Werror src/renderer/src/libopencor/src/*",
"format": "bun --cwd ../.. format",
"format:check": "bun --cwd ../.. format:check",
"lint": "bunx --bun biome lint --fix --error-on-warnings --max-diagnostics=none && bunx stylelint '**/*.css' --fix",
"start": "bun run build && vite preview",
"version:new": "bun scripts/version.js"
"version:new": "bun scripts/version.new.js"
},
"bun": {
"overrides": {
Expand All @@ -74,7 +77,7 @@
"@biomejs/biome": "^2.4.4",
"@tailwindcss/postcss": "^4.2.1",
"@tailwindcss/vite": "^4.2.1",
"@types/node": "^25.3.2",
"@types/node": "^25.3.3",
"@types/plotly.js": "^3.0.10",
"@vitejs/plugin-vue": "^6.0.4",
"@vue/tsconfig": "^0.8.1",
Expand Down
16 changes: 16 additions & 0 deletions src/renderer/scripts/copy.indexdts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bun

import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const srcPath = path.join(__dirname, '../index.d.ts');
const destDir = path.join(__dirname, '../dist');
const destPath = path.join(destDir, 'index.d.ts');

if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true });
}

fs.copyFileSync(srcPath, destPath);
34 changes: 34 additions & 0 deletions src/renderer/scripts/dependencies.update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bun

import { spawnSync } from 'bun';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const run = (command, args) => {
const result = spawnSync({
cmd: [command, ...args],
stdio: ['inherit', 'inherit', 'inherit']
});

if (result.exitCode !== 0) {
console.error(`Command failed: ${command} ${args.join(' ')}`);

process.exit(result.exitCode);
}
};

const updateDependencies = (dir) => {
process.chdir(dir);

run('bun', ['clean']);
run('bun', ['update', '-i']);
run('bun', ['install']);
run('bun', ['clean']);
};

// Update dependencies in our root and renderer directories.

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

updateDependencies(path.join(__dirname, '../../..'));
updateDependencies(path.join(__dirname, '..'));
File renamed without changes.