switch to fnm from volta

This commit is contained in:
lone-cloud 2025-09-02 23:01:47 -07:00
parent 31e23805b6
commit 3f37af7ce9
5 changed files with 27 additions and 33 deletions

View file

@ -14,17 +14,12 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Get Node.js version from package.json - name: Get Node.js version from .nvmrc
id: versions id: versions
uses: actions/github-script@v7 run: |
with: NODE_VERSION=$(cat .nvmrc)
script: | echo "node-version=$NODE_VERSION" >> $GITHUB_OUTPUT
const fs = require('fs'); echo "📦 Using Node.js $NODE_VERSION from .nvmrc"
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const nodeVersion = packageJson.volta.node;
core.setOutput('node-version', nodeVersion);
console.log(`📦 Using Node.js ${nodeVersion} from package.json`);
- name: Enable Corepack - name: Enable Corepack
run: corepack enable run: corepack enable

View file

@ -27,26 +27,21 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Get Node.js and Yarn versions from package.json - name: Get Node.js version from .nvmrc
id: versions id: versions
uses: actions/github-script@v7 run: |
with: NODE_VERSION=$(cat .nvmrc)
script: | echo "node-version=$NODE_VERSION" >> $GITHUB_OUTPUT
const fs = require('fs'); echo "📦 Using Node.js $NODE_VERSION from .nvmrc"
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const nodeVersion = packageJson.volta.node;
const yarnVersion = packageJson.volta.yarn;
core.setOutput('node-version', nodeVersion); - name: Enable Corepack
core.setOutput('yarn-version', yarnVersion); run: corepack enable
console.log(`📦 Using Node.js ${nodeVersion} and Yarn ${yarnVersion} from package.json`); - name: Setup Node.js
uses: actions/setup-node@v4
- name: Setup Node.js with Volta
uses: volta-cli/action@v4
with: with:
node-version: ${{ steps.versions.outputs.node-version }} node-version: ${{ steps.versions.outputs.node-version }}
yarn-version: ${{ steps.versions.outputs.yarn-version }} cache: 'yarn'
- name: Install dependencies - name: Install dependencies
run: yarn run: yarn

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
22.18.0

View file

@ -120,20 +120,27 @@ You can use the CLI mode on Windows in exactly the same way as in the Linux/macO
### Prerequisites ### Prerequisites
- **[Volta](https://volta.sh/)** - JavaScript tool manager (installs correct Node.js + Yarn versions automatically) - **[fnm](https://github.com/Schniz/fnm)** - Fast Node.js version manager (installs correct Node.js versions automatically)
### Setup ### Setup
1. **Install Volta** (if not already installed): 1. **Install fnm** (if not already installed):
```bash ```bash
curl https://get.volta.sh | bash # Using package manager (recommended for Arch Linux)
yay -S fnm-bin
# Or using curl (other distros)
curl -fsSL https://fnm.vercel.app/install | bash
``` ```
2. Clone the repository 2. Clone the repository
3. Install dependencies (Volta will auto-install the correct Node.js and Yarn versions): 3. Install Node.js and dependencies:
```bash ```bash
# fnm will auto-install Node.js based on .nvmrc or engines field
fnm use --install-if-missing
npm install -g yarn
yarn yarn
``` ```

View file

@ -9,10 +9,6 @@
"node": ">=22.0.0", "node": ">=22.0.0",
"yarn": "^4.0.0" "yarn": "^4.0.0"
}, },
"volta": {
"node": "22.18.0",
"yarn": "4.9.4"
},
"packageManager": "yarn@4.9.4", "packageManager": "yarn@4.9.4",
"scripts": { "scripts": {
"dev": "electron-vite dev", "dev": "electron-vite dev",