From 2871e0285017f31d496bc54f2c894d5f6eeb754b Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sun, 1 Mar 2026 16:31:15 +1300 Subject: [PATCH 1/3] New version. --- package.json | 2 +- src/renderer/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7dd7663b..e64ddffc 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "url": "git+https://github.com/opencor/webapp.git" }, "type": "module", - "version": "0.20260227.2", + "version": "0.20260301.0", "scripts": { "archive:web": "bun src/renderer/scripts/archive.web.js", "build": "bun src/renderer/scripts/libopencor.js && electron-vite build", diff --git a/src/renderer/package.json b/src/renderer/package.json index cf38ad6d..0170c8f2 100644 --- a/src/renderer/package.json +++ b/src/renderer/package.json @@ -39,7 +39,7 @@ }, "./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", From 458b594f3a2c1f856f867ecf3d46eb39b4cac888 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sun, 1 Mar 2026 16:32:00 +1300 Subject: [PATCH 2/3] Updated our dependencies. --- bun.lock | 20 ++++++++++++++++---- package.json | 4 ++-- src/renderer/bun.lock | 4 ++-- src/renderer/package.json | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/bun.lock b/bun.lock index c7cafe32..b00522af 100644 --- a/bun.lock +++ b/bun.lock @@ -19,7 +19,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", @@ -32,7 +32,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", @@ -377,7 +377,7 @@ "@types/ms": ["@types/ms@2.1.0", "", {}, "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="], - "@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="], + "@types/node": ["@types/node@25.3.3", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ=="], "@types/plist": ["@types/plist@3.0.5", "", { "dependencies": { "@types/node": "*", "xmlbuilder": ">=11.0.1" } }, "sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA=="], @@ -947,7 +947,7 @@ "node-abi": ["node-abi@4.26.0", "", { "dependencies": { "semver": "^7.6.3" } }, "sha512-8QwIZqikRvDIkXS2S93LjzhsSPJuIbfaMETWH+Bx8oOT9Sa9UsUtBFQlc3gBNd1+QINjaTloitXr1W3dQLi9Iw=="], - "node-addon-api": ["node-addon-api@8.5.0", "", {}, "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A=="], + "node-addon-api": ["node-addon-api@8.6.0", "", {}, "sha512-gBVjCaqDlRUk0EwoPNKzIr9KkS9041G/q31IBShPs1Xz6UTA+EXdZADbzqAJQrpDRq71CIMnOP5VMut3SL0z5Q=="], "node-api-headers": ["node-api-headers@1.8.0", "", {}, "sha512-jfnmiKWjRAGbdD1yQS28bknFM1tbHC1oucyuMPjmkEs+kpiu76aRs40WlTmBmyEgzDM76ge1DQ7XJ3R5deiVjQ=="], @@ -1303,6 +1303,18 @@ "@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@types/cacheable-request/@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="], + + "@types/fs-extra/@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="], + + "@types/keyv/@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="], + + "@types/plist/@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="], + + "@types/responselike/@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="], + + "@types/yauzl/@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="], + "ajv-keywords/ajv": ["ajv@6.14.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="], "app-builder-lib/@electron/get": ["@electron/get@3.1.0", "", { "dependencies": { "debug": "^4.1.1", "env-paths": "^2.2.0", "fs-extra": "^8.1.0", "got": "^11.8.5", "progress": "^2.0.3", "semver": "^6.2.0", "sumchecker": "^3.0.1" }, "optionalDependencies": { "global-agent": "^3.0.0" } }, "sha512-F+nKc0xW+kVbBRhFzaMgPy3KwmuNTYX1fx6+FxxoSnNgwYX6LD7AKBTWkU0MQ6IBoe7dz069CNkR673sPAgkCQ=="], diff --git a/package.json b/package.json index e64ddffc..04a43553 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,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", @@ -78,7 +78,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", diff --git a/src/renderer/bun.lock b/src/renderer/bun.lock index 8fd467db..a1facc35 100644 --- a/src/renderer/bun.lock +++ b/src/renderer/bun.lock @@ -17,7 +17,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", @@ -285,7 +285,7 @@ "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="], - "@types/node": ["@types/node@25.3.2", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-RpV6r/ij22zRRdyBPcxDeKAzH43phWVKEjL2iksqo1Vz3CuBUrgmPpPhALKiRfU7OMCmeeO9vECBMsV0hMTG8Q=="], + "@types/node": ["@types/node@25.3.3", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ=="], "@types/plotly.js": ["@types/plotly.js@3.0.10", "", {}, "sha512-q+MgO4aajC2HrO7FllTYWzrpdfbTjboSMfjkz/aXKjg1v7HNo1zMEFfAW7quKfk6SL+bH74A5ThBEps/7hZxOA=="], diff --git a/src/renderer/package.json b/src/renderer/package.json index 0170c8f2..3b4c17a8 100644 --- a/src/renderer/package.json +++ b/src/renderer/package.json @@ -74,7 +74,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", From 2b47f15fe3d677fc75908271bc888e4955d486c2 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sun, 1 Mar 2026 17:48:06 +1300 Subject: [PATCH 3/3] Use bun wherever and whenever possible. --- .github/workflows/cd.yml | 12 ++----- .github/workflows/cddev.yml | 6 +--- .github/workflows/ci.yml | 6 +--- BUILD.md | 17 +++------- package.json | 13 ++++--- src/renderer/BUILD.md | 13 ++----- src/renderer/package.json | 13 ++++--- src/renderer/scripts/copy.indexdts.js | 16 +++++++++ src/renderer/scripts/dependencies.update.js | 34 +++++++++++++++++++ .../scripts/{version.js => version.new.js} | 0 10 files changed, 77 insertions(+), 53 deletions(-) create mode 100644 src/renderer/scripts/copy.indexdts.js create mode 100644 src/renderer/scripts/dependencies.update.js rename src/renderer/scripts/{version.js => version.new.js} (100%) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index bbb41d77..edf26625 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/cddev.yml b/.github/workflows/cddev.yml index 4c8bbf3b..1ea5ed4e 100644 --- a/.github/workflows/cddev.yml +++ b/.github/workflows/cddev.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ee8b98b..7073705d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 diff --git a/BUILD.md b/BUILD.md index 1907c76d..1ae149b7 100644 --- a/BUILD.md +++ b/BUILD.md @@ -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]()/[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 @@ -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 diff --git a/package.json b/package.json index 04a43553..ee7368a1 100644 --- a/package.json +++ b/package.json @@ -24,22 +24,25 @@ }, "type": "module", "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": { diff --git a/src/renderer/BUILD.md b/src/renderer/BUILD.md index 5ce49c40..8a7f7099 100644 --- a/src/renderer/BUILD.md +++ b/src/renderer/BUILD.md @@ -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 @@ -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 | diff --git a/src/renderer/package.json b/src/renderer/package.json index 3b4c17a8..b2fcde54 100644 --- a/src/renderer/package.json +++ b/src/renderer/package.json @@ -32,6 +32,9 @@ }, "type": "module", "types": "dist/index.d.ts", + "engines": { + "bun": ">=1.2.0" + }, "exports": { ".": { "types": "./dist/index.d.ts", @@ -42,15 +45,15 @@ "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": { diff --git a/src/renderer/scripts/copy.indexdts.js b/src/renderer/scripts/copy.indexdts.js new file mode 100644 index 00000000..187c75b8 --- /dev/null +++ b/src/renderer/scripts/copy.indexdts.js @@ -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); diff --git a/src/renderer/scripts/dependencies.update.js b/src/renderer/scripts/dependencies.update.js new file mode 100644 index 00000000..36d1147b --- /dev/null +++ b/src/renderer/scripts/dependencies.update.js @@ -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, '..')); diff --git a/src/renderer/scripts/version.js b/src/renderer/scripts/version.new.js similarity index 100% rename from src/renderer/scripts/version.js rename to src/renderer/scripts/version.new.js