feat: migrate from npm to pnpm (#1316)

This commit is contained in:
JellyBrick
2023-10-15 18:18:20 +09:00
committed by GitHub
parent 9cc13c3757
commit 467f29e363
5 changed files with 5660 additions and 10184 deletions

View File

@ -24,17 +24,23 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ env.NODE_VERSION }} node-version: ${{ env.NODE_VERSION }}
cache: 'npm' cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Install dependencies - name: Install dependencies
run: npm ci run: pnpm install --frozen-lockfile
- name: Test - name: Test
uses: GabrielBB/xvfb-action@v1 uses: coactions/setup-xvfb@@v1
env: env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
with: with:
run: npm run test run: pnpm test
# Build and release if it's the main repository # Build and release if it's the main repository
- name: Build and release on Mac - name: Build and release on Mac
@ -42,37 +48,37 @@ jobs:
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
npm run release:mac pnpm release:mac
- name: Build and release on Linux - name: Build and release on Linux
if: startsWith(matrix.os, 'ubuntu') && github.repository == 'th-ch/youtube-music' if: startsWith(matrix.os, 'ubuntu') && github.repository == 'th-ch/youtube-music'
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
npm run release:linux pnpm release:linux
- name: Build and release on Windows - name: Build and release on Windows
if: startsWith(matrix.os, 'windows') && github.repository == 'th-ch/youtube-music' if: startsWith(matrix.os, 'windows') && github.repository == 'th-ch/youtube-music'
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
npm run release:win pnpm release:win
# Only build without release if it is a fork # Only build without release if it is a fork
- name: Build on Mac - name: Build on Mac
if: startsWith(matrix.os, 'macOS') && github.repository != 'th-ch/youtube-music' if: startsWith(matrix.os, 'macOS') && github.repository != 'th-ch/youtube-music'
run: | run: |
npm run build:mac pnpm build:mac
- name: Build on Linux - name: Build on Linux
if: startsWith(matrix.os, 'ubuntu') && github.repository != 'th-ch/youtube-music' if: startsWith(matrix.os, 'ubuntu') && github.repository != 'th-ch/youtube-music'
run: | run: |
npm run build:linux pnpm build:linux
- name: Build on Windows - name: Build on Windows
if: startsWith(matrix.os, 'windows') && github.repository != 'th-ch/youtube-music' if: startsWith(matrix.os, 'windows') && github.repository != 'th-ch/youtube-music'
run: | run: |
npm run build:win pnpm build:win
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -88,10 +94,16 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ env.NODE_VERSION }} node-version: ${{ env.NODE_VERSION }}
cache: 'npm' cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Install dependencies - name: Install dependencies
run: npm ci run: pnpm install --frozen-lockfile
- name: Get version - name: Get version
run: | run: |
@ -132,7 +144,7 @@ jobs:
- name: Update changelog - name: Update changelog
if: ${{ env.VERSION_HASH == '' }} if: ${{ env.VERSION_HASH == '' }}
run: | run: |
npm run changelog pnpm changelog
- name: Commit changelog - name: Commit changelog
if: ${{ env.VERSION_HASH == '' }} if: ${{ env.VERSION_HASH == '' }}

10137
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -87,33 +87,52 @@
} }
}, },
"scripts": { "scripts": {
"test": "npm run build && playwright test", "test": "yarpm-pnpm run build && playwright test",
"test:debug": "DEBUG=pw:browser* npm run build && playwright test", "test:debug": "DEBUG=pw:browser* yarpm-pnpm run build && playwright test",
"rollup:preload": "rollup -c rollup.preload.config.ts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs", "rollup:preload": "rollup -c rollup.preload.config.ts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs",
"rollup:main": "rollup -c rollup.main.config.ts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs", "rollup:main": "rollup -c rollup.main.config.ts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs",
"build": "npm run rollup:preload && npm run rollup:main", "build": "yarpm-pnpm run rollup:preload && yarpm-pnpm run rollup:main",
"start": "npm run build && electron ./dist/index.js", "start": "yarpm-pnpm run build && electron ./dist/index.js",
"start:debug": "ELECTRON_ENABLE_LOGGING=1 npm run start", "start:debug": "ELECTRON_ENABLE_LOGGING=1 yarpm-pnpm run start",
"postinstall": "patch-package", "postinstall": "patch-package",
"clean": "del-cli dist && del-cli pack", "clean": "del-cli dist && del-cli pack",
"dist": "npm run clean && npm run build && electron-builder --win --mac --linux -p never", "dist": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --win --mac --linux -p never",
"dist:linux": "npm run clean && npm run build && electron-builder --linux -p never", "dist:linux": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --linux -p never",
"dist:mac": "npm run clean && npm run build && electron-builder --mac dmg:x64 -p never", "dist:mac": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --mac dmg:x64 -p never",
"dist:mac:arm64": "npm run clean && npm run build && electron-builder --mac dmg:arm64 -p never", "dist:mac:arm64": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --mac dmg:arm64 -p never",
"dist:win": "npm run clean && npm run build && electron-builder --win -p never", "dist:win": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --win -p never",
"dist:win:x64": "npm run clean && npm run build && electron-builder --win nsis-web:x64 -p never", "dist:win:x64": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --win nsis-web:x64 -p never",
"lint": "eslint .", "lint": "eslint .",
"changelog": "auto-changelog", "changelog": "auto-changelog",
"release:linux": "npm run clean && npm run build && electron-builder --linux -p always -c.snap.publish=github", "release:linux": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --linux -p always -c.snap.publish=github",
"release:mac": "npm run clean && npm run build && electron-builder --mac -p always", "release:mac": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --mac -p always",
"release:win": "npm run clean && npm run build && electron-builder --win -p always", "release:win": "yarpm-pnpm run clean && yarpm-pnpm run build && electron-builder --win -p always",
"typecheck": "tsc -p tsconfig.json --noEmit" "typecheck": "tsc -p tsconfig.json --noEmit"
}, },
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"
}, },
"pnpm": {
"overrides": {
"rollup": "4.1.0",
"node-gyp": "9.4.0",
"xml2js": "0.6.2",
"node-fetch": "2.7.0",
"@electron/universal": "1.4.2",
"@babel/runtime": "7.23.2"
}
},
"overrides": {
"rollup": "4.1.0",
"node-gyp": "9.4.0",
"xml2js": "0.6.2",
"node-fetch": "2.7.0",
"@electron/universal": "1.4.2",
"@babel/runtime": "7.23.2"
},
"dependencies": { "dependencies": {
"@cliqz/adblocker-electron": "1.26.8", "@cliqz/adblocker-electron": "1.26.8",
"@cliqz/adblocker-electron-preload": "1.26.8",
"@ffmpeg.wasm/core-mt": "0.12.0", "@ffmpeg.wasm/core-mt": "0.12.0",
"@ffmpeg.wasm/main": "0.12.0", "@ffmpeg.wasm/main": "0.12.0",
"@foobar404/wave": "2.0.4", "@foobar404/wave": "2.0.4",
@ -144,15 +163,8 @@
"youtubei.js": "6.4.1", "youtubei.js": "6.4.1",
"ytpl": "2.3.0" "ytpl": "2.3.0"
}, },
"overrides": {
"rollup": "4.1.0",
"node-gyp": "9.4.0",
"xml2js": "0.6.2",
"node-fetch": "2.7.0",
"@electron/universal": "1.4.2",
"@babel/runtime": "7.23.2"
},
"devDependencies": { "devDependencies": {
"@milahu/patch-package": "6.4.14",
"@playwright/test": "1.39.0", "@playwright/test": "1.39.0",
"@rollup/plugin-commonjs": "25.0.5", "@rollup/plugin-commonjs": "25.0.5",
"@rollup/plugin-image": "3.0.3", "@rollup/plugin-image": "3.0.3",
@ -167,6 +179,7 @@
"@types/html-to-text": "9.0.2", "@types/html-to-text": "9.0.2",
"@typescript-eslint/eslint-plugin": "6.7.5", "@typescript-eslint/eslint-plugin": "6.7.5",
"auto-changelog": "2.4.0", "auto-changelog": "2.4.0",
"builtin-modules": "^3.3.0",
"del-cli": "5.1.0", "del-cli": "5.1.0",
"electron": "27.0.0", "electron": "27.0.0",
"electron-builder": "24.6.4", "electron-builder": "24.6.4",
@ -175,18 +188,19 @@
"eslint-plugin-import": "2.28.1", "eslint-plugin-import": "2.28.1",
"eslint-plugin-prettier": "5.0.1", "eslint-plugin-prettier": "5.0.1",
"node-gyp": "9.4.0", "node-gyp": "9.4.0",
"patch-package": "8.0.0",
"playwright": "1.39.0", "playwright": "1.39.0",
"rollup": "4.1.0", "rollup": "4.1.0",
"rollup-plugin-copy": "3.5.0", "rollup-plugin-copy": "3.5.0",
"rollup-plugin-import-css": "3.3.5", "rollup-plugin-import-css": "3.3.5",
"rollup-plugin-string": "3.0.0", "rollup-plugin-string": "3.0.0",
"typescript": "5.2.2" "typescript": "5.2.2",
"yarpm": "1.2.0"
}, },
"auto-changelog": { "auto-changelog": {
"hideCredit": true, "hideCredit": true,
"package": true, "package": true,
"unreleased": true, "unreleased": true,
"output": "changelog.md" "output": "changelog.md"
} },
"packageManager": "pnpm@8.9.0"
} }

5587
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
<div align="center"> <div align="center">
<a href="https://github.com/th-ch/youtube-music/releases/latest"> <a href="https://github.com/th-ch/youtube-music/releases/latest">
<img src="web/youtube-music.svg" width="400" height="100"> <img src="web/youtube-music.svg" width="400" height="100" alt="YouTube Music SVG">
</a> </a>
</div> </div>
@ -178,8 +178,8 @@ Some predefined themes are available in https://github.com/kerichdev/themes-for-
```bash ```bash
git clone https://github.com/th-ch/youtube-music git clone https://github.com/th-ch/youtube-music
cd youtube-music cd youtube-music
npm ci pnpm install --frozen-lockfile
npm run start pnpm start
``` ```
## Build your own plugins ## Build your own plugins
@ -266,12 +266,12 @@ export default () => {
## Build ## Build
1. Clone the repo 1. Clone the repo
2. Run `npm i` to install dependencies 2. Run `pnpm install --frozen-lockfile` to install dependencies
3. Run `npm run build:OS` 3. Run `pnpm build:OS`
- `npm run dist:win` - Windows - `pnpm dist:win` - Windows
- `npm run dist:linux` - Linux - `pnpm dist:linux` - Linux
- `npm run dist:mac` - MacOS - `pnpm dist:mac` - MacOS
Builds the app for macOS, Linux, and Windows, Builds the app for macOS, Linux, and Windows,
using [electron-builder](https://github.com/electron-userland/electron-builder). using [electron-builder](https://github.com/electron-userland/electron-builder).
@ -279,7 +279,7 @@ using [electron-builder](https://github.com/electron-userland/electron-builder).
## Tests ## Tests
```bash ```bash
npm run test pnpm test
``` ```
Uses [Playwright](https://playwright.dev/) to test the app. Uses [Playwright](https://playwright.dev/) to test the app.