switch to fnm from volta

This commit is contained in:
Egor 2025-09-02 23:01:47 -07:00
parent 341c2ea3e7
commit 4d529f9bc4
5 changed files with 27 additions and 33 deletions

View file

@ -14,17 +14,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Node.js version from package.json
- name: Get Node.js version from .nvmrc
id: versions
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
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`);
run: |
NODE_VERSION=$(cat .nvmrc)
echo "node-version=$NODE_VERSION" >> $GITHUB_OUTPUT
echo "📦 Using Node.js $NODE_VERSION from .nvmrc"
- name: Enable Corepack
run: corepack enable

View file

@ -27,26 +27,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Node.js and Yarn versions from package.json
- name: Get Node.js version from .nvmrc
id: versions
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const nodeVersion = packageJson.volta.node;
const yarnVersion = packageJson.volta.yarn;
run: |
NODE_VERSION=$(cat .nvmrc)
echo "node-version=$NODE_VERSION" >> $GITHUB_OUTPUT
echo "📦 Using Node.js $NODE_VERSION from .nvmrc"
core.setOutput('node-version', nodeVersion);
core.setOutput('yarn-version', yarnVersion);
- name: Enable Corepack
run: corepack enable
console.log(`📦 Using Node.js ${nodeVersion} and Yarn ${yarnVersion} from package.json`);
- name: Setup Node.js with Volta
uses: volta-cli/action@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ steps.versions.outputs.node-version }}
yarn-version: ${{ steps.versions.outputs.yarn-version }}
cache: 'yarn'
- name: Install dependencies
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
- **[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
1. **Install Volta** (if not already installed):
1. **Install fnm** (if not already installed):
```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
3. Install dependencies (Volta will auto-install the correct Node.js and Yarn versions):
3. Install Node.js and dependencies:
```bash
# fnm will auto-install Node.js based on .nvmrc or engines field
fnm use --install-if-missing
npm install -g yarn
yarn
```

View file

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