chore(tooling): migrate seedit to Yarn 4

This commit is contained in:
Tommaso Casaburi
2026-03-19 13:41:03 +08:00
parent 53689708f4
commit 4698fa77fd
8 changed files with 21982 additions and 16263 deletions

View File

@@ -28,8 +28,9 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 22
- run: corepack enable
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
run: yarn install --immutable --ignore-engines
# make sure the ipfs executable is executable
- name: Download IPFS and set permissions (with Node v22)
run: node electron/download-ipfs && sudo chmod +x bin/linux/ipfs
@@ -77,6 +78,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 22
- run: corepack enable
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
@@ -89,7 +91,7 @@ jobs:
- run: pip install setuptools
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
run: yarn install --immutable --ignore-engines
# make sure the ipfs executable is executable
- name: Download IPFS and set permissions (with Node v22)
run: node electron/download-ipfs && sudo chmod +x bin/mac/ipfs
@@ -132,8 +134,9 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 22
- name: Install dependencies (with Node v22) # --network-timeout and --network-concurrency are yarn v1 flags.
run: yarn install --frozen-lockfile --network-timeout 100000 --network-concurrency 1
- run: corepack enable
- name: Install dependencies (with Node v22)
run: yarn install --immutable
- name: Build React app (with Node v22)
run: npx cross-env NODE_ENV=production yarn build
- name: Build Electron app for Windows (x64)
@@ -171,11 +174,12 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 22
- run: corepack enable
- run: sudo apt install -y apksigner zipalign
# install all dependencies (including devDependencies needed for React build)
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
run: yarn install --immutable --ignore-engines
# build react app
- run: CI='' NODE_ENV=production yarn build
# set android versionCode and versionName
@@ -216,8 +220,9 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 22
- run: corepack enable
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines
run: yarn install --immutable --ignore-engines
- name: Generate final release body from GitHub assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -20,6 +20,7 @@ jobs:
with:
node-version: 22
cache: 'yarn'
- run: corepack enable
- name: Cache electron binaries
uses: actions/cache@v4
@@ -32,7 +33,7 @@ jobs:
run: |
for i in 1 2 3; do
echo "yarn install attempt $i"
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
yarn install --immutable --ignore-engines && break
sleep 5
[ "$i" = "3" ] && exit 1
done
@@ -90,6 +91,7 @@ jobs:
with:
node-version: 22
cache: 'yarn'
- run: corepack enable
- name: Install setuptools for native modules
run: pip3 install --break-system-packages setuptools || pip3 install --user setuptools || true
@@ -105,7 +107,7 @@ jobs:
run: |
for i in 1 2 3; do
echo "yarn install attempt $i"
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
yarn install --immutable --ignore-engines && break
sleep 5
[ "$i" = "3" ] && exit 1
done
@@ -151,6 +153,7 @@ jobs:
with:
node-version: 22
cache: 'yarn'
- run: corepack enable
- name: Install setuptools for native modules
run: pip3 install --break-system-packages setuptools || pip3 install --user setuptools || true
@@ -166,7 +169,7 @@ jobs:
run: |
for i in 1 2 3; do
echo "yarn install attempt $i"
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
yarn install --immutable --ignore-engines && break
sleep 5
[ "$i" = "3" ] && exit 1
done
@@ -212,6 +215,7 @@ jobs:
with:
node-version: 22
cache: 'yarn'
- run: corepack enable
- name: Cache electron binaries
uses: actions/cache@v4
@@ -225,7 +229,7 @@ jobs:
run: |
for i in 1 2 3; do
echo "yarn install attempt $i"
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
yarn install --immutable --ignore-engines && break
sleep 5
[ "$i" = "3" ] && exit 1
done

1
.yarnrc.yml Normal file
View File

@@ -0,0 +1 @@
nodeLinker: node-modules

View File

@@ -12,7 +12,7 @@ Seedit is a serverless, adminless, decentralized Reddit alternative built on the
- **Vite** for bundling
- **plebbit-react-hooks** for Plebbit protocol integration
- **i18next** for translations
- **yarn** as package manager
- **Yarn 4** via **Corepack**
- **oxlint** for linting
- **oxfmt** for formatting
- **tsgo** for type checking (native TypeScript compiler)
@@ -20,7 +20,7 @@ Seedit is a serverless, adminless, decentralized Reddit alternative built on the
## Commands
```bash
yarn install # Install dependencies
corepack yarn install
yarn start # Start dev server (port 3000)
yarn build # Production build
yarn test # Run tests
@@ -118,15 +118,15 @@ Set up these hooks for this project:
| Hook | Command | Purpose |
|------|---------|---------|
| `afterFileEdit` | `npx oxfmt <file>` | Auto-format files after AI edits |
| `stop` | `yarn build && yarn lint && yarn type-check && (yarn audit || true)` | Build, verify code, and check security when agent finishes. Note: `yarn audit` returns non-zero on vulnerabilities, so `|| true` makes it informational only |
| `stop` | `corepack yarn build && corepack yarn lint && corepack yarn type-check && (corepack yarn npm audit || true)` | Build, verify code, and check security when agent finishes. Note: `yarn npm audit` returns non-zero on vulnerabilities, so `|| true` makes it informational only |
### Why Use Hooks
- **Consistent formatting** — Every file follows the same style
- **Catch build errors** — `yarn build` catches compilation errors that would break production
- **Catch issues early** — Lint and type errors are caught before commit/CI
- **Security awareness** — `yarn audit` flags known vulnerabilities in dependencies
- **Less manual work** — No need to run `yarn build`, `yarn lint`, `yarn type-check`, `yarn audit` manually
- **Security awareness** — `yarn npm audit` flags known vulnerabilities in dependencies
- **Less manual work** — No need to run `yarn build`, `yarn lint`, `yarn type-check`, `yarn npm audit` manually
### Example Hook Scripts
@@ -151,10 +151,10 @@ exit 0
# Run build, lint, type-check, and security audit when agent finishes
cat > /dev/null # consume stdin
echo "=== yarn build ===" && yarn build
echo "=== yarn lint ===" && yarn lint
echo "=== yarn type-check ===" && yarn type-check
echo "=== yarn audit ===" && (yarn audit || true) # || true makes audit informational (non-fatal)
echo "=== corepack yarn build ===" && corepack yarn build
echo "=== corepack yarn lint ===" && corepack yarn lint
echo "=== corepack yarn type-check ===" && corepack yarn type-check
echo "=== corepack yarn npm audit ===" && (corepack yarn npm audit || true) # || true makes audit informational (non-fatal)
exit 0
```

View File

@@ -35,8 +35,8 @@ The default list of communities, used on s/all on Seedit, is bitsocial's [defaul
## To run locally
1. Install Node v22 (Download from https://nodejs.org)
2. Install Yarn: `npm install -g yarn`
3. `yarn install --frozen-lockfile` to install Seedit dependencies
2. Enable Corepack: `corepack enable`
3. `corepack yarn install` to install Seedit dependencies
4. `yarn start` to run the web client
### Scripts:

View File

@@ -6,6 +6,7 @@
"type": "module",
"license": "GPL-2.0-only",
"private": true,
"packageManager": "yarn@4.13.0",
"dependencies": {
"@capacitor/app": "7.0.1",
"@capacitor/filesystem": "7.1.4",
@@ -14,7 +15,7 @@
"@capacitor/status-bar": "7.0.1",
"@capawesome/capacitor-android-edge-to-edge-support": "7.2.2",
"@floating-ui/react": "0.26.1",
"@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#df3cb6901f63054870dc127cd7565c98617c2a4f",
"@plebbit/plebbit-react-hooks": "https://codeload.github.com/plebbit/plebbit-react-hooks/tar.gz/df3cb6901f63054870dc127cd7565c98617c2a4f",
"@types/node": "20.8.2",
"@types/react": "19.1.2",
"@types/react-dom": "19.1.2",
@@ -33,6 +34,7 @@
"i18next-browser-languagedetector": "7.1.0",
"i18next-http-backend": "2.2.2",
"json-stringify-pretty-compact": "4.0.0",
"kubo": "0.39.0",
"lodash": "4.17.21",
"memoizee": "0.4.15",
"node-fetch": "2",
@@ -51,15 +53,14 @@
"remark-supersub": "1.0.0",
"tcp-port-used": "1.0.2",
"typescript": "5.1.6",
"zustand": "4.4.3",
"kubo": "0.39.0"
"zustand": "4.4.3"
},
"scripts": {
"start": "vite",
"build": "cross-env NODE_ENV=production PUBLIC_URL=./ GENERATE_SOURCEMAP=false vite build",
"build:preload": "cross-env NODE_ENV=production vite build --config electron/vite.preload.config.js",
"build-netlify": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" NODE_ENV=production PUBLIC_URL=./ GENERATE_SOURCEMAP=true VITE_COMMIT_REF=$COMMIT_REF CI='' vite build",
"test": "vitest",
"test": "vitest --passWithNoTests",
"preview": "vite preview",
"analyze-bundle": "cross-env NODE_ENV=production PUBLIC_URL=./ GENERATE_SOURCEMAP=true vite build && npx source-map-explorer 'build/assets/*.js'",
"electron": "yarn build:preload && yarn electron:before && electron .",
@@ -108,6 +109,7 @@
"@electron-forge/maker-zip": "7.6.0",
"@electron-forge/plugin-auto-unpack-natives": "7.6.0",
"@react-scan/vite-plugin-react-scan": "0.1.8",
"@reforged/maker-appimage": "5.1.1",
"@types/memoizee": "0.4.9",
"@types/node-fetch": "2",
"@typescript/native-preview": "7.0.0-dev.20260115.1",
@@ -123,21 +125,21 @@
"cz-conventional-changelog": "3.3.0",
"decompress": "4.2.1",
"electron": "36.4.0",
"glob": "10.5.0",
"husky": "4.3.8",
"isomorphic-fetch": "3.0.0",
"lint-staged": "12.3.8",
"oxfmt": "0.24.0",
"oxlint": "1.39.0",
"progress": "2.0.3",
"react-grab": "0.1.28",
"react-scan": "0.5.3",
"stream-browserify": "3.0.0",
"vite": "8.0.0",
"vite-plugin-node-polyfills": "0.24.0",
"vite-plugin-pwa": "0.21.1",
"wait-on": "7.0.1",
"@reforged/maker-appimage": "5.1.1",
"glob": "10.5.0",
"progress": "2.0.3"
"vitest": "4.1.0",
"wait-on": "7.0.1"
},
"resolutions": {
"js-yaml": "4.1.1",

View File

@@ -2,7 +2,7 @@
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
],
"buildCommand": "yarn build",
"buildCommand": "corepack yarn build",
"outputDirectory": "build",
"framework": "vite"
}

38173
yarn.lock
View File

File diff suppressed because it is too large Load Diff