Skip to content

Commit

Permalink
build: use pnpm (DIYgod#12438)
Browse files Browse the repository at this point in the history
* build: use pnpm

* fix: use corepack pnpm

* chore: use pnpm in gha

* chore: add setup pnpm

* fix: install command

* fix: pnpm lock file not updated

* chore: pnpm no recursive install

* docs: use pnpm

* fix: ignore yarn lock

* chore: update command for cloud dev env
  • Loading branch information
TonyRL authored May 5, 2023
1 parent 4ba6c30 commit 1de1e9a
Show file tree
Hide file tree
Showing 29 changed files with 18,249 additions and 17,254 deletions.
8 changes: 4 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@

"onCreateCommand": "sudo apt-get update && export DEBIAN_FRONTEND=noninteractive && sudo apt-get -y install --no-install-recommends ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libexpat1 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 wget xdg-utils redis-server && sudo apt-get autoremove -y && sudo apt-get clean -y && sudo rm -rf /var/lib/apt/lists/*",

"updateContentCommand": "yarn && yarn --cwd docs",
"updateContentCommand": "pnpm -i && pnpm -i -C docs",

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "yarn && yarn --cwd docs",
"postCreateCommand": "pnpm -i && pnpm -i -C docs",

// Disable auto start dev env since codespaces sometimes fails to attach to the terminal
// "postAttachCommand": {
// "app": "yarn",
// // "docs": "yarn docs:dev"
// "app": "pnpm -i",
// // "docs": "pnpm run docs:dev"
// },

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Build file
run: yarn && npm run build:all
cache: 'pnpm'
- name: Install dependencies (yarn)
run: pnpm i
- name: Build assets
run: npm run build:all
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/comment-on-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3 # just need its cache
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies (yarn) # needed since we need to parse markdown, so we also use got instead
run: yarn
cache: 'pnpm'
- name: Install dependencies (pnpm) # needed since we need to parse markdown, so we also use got instead
run: pnpm i
- name: Generate feedback
uses: actions/github-script@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- '!**/radar-rules.js'
- 'Dockerfile'
- 'package.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
workflow_dispatch: ~

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- '!**/radar-rules.js'
- 'Dockerfile'
- 'package.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
types: [opened, reopened, synchronize, edited]
# Please, always create a pull request instead of push to master.

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install
- run: yarn install
working-directory: ./docs
cache: 'pnpm'
- run: pnpm i
- run: pnpm i
working-directory: docs
- run: npm run format
- name: Commit files
run: |
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/issue-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies (yarn)
run: yarn
- name: Install dependencies (pnpm)
run: pnpm i

- name: Fetch affected routes
id: fetchRoute
Expand All @@ -76,7 +81,7 @@ jobs:
- name: Start RSSHub
if: env.TEST_CONTINUE
run: yarn start &
run: pnpm start &
env:
ALLOW_USER_HOTLINK_TEMPLATE: true
ALLOW_USER_SUPPLY_UNSAFE_DOMAIN: true
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/pr-deploy-route-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,19 @@ jobs:
-p 1200:1200 \
rsshub:latest
- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v3 # just need its cache
if: (env.TEST_CONTINUE)
with:
node-version: 18
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies (yarn) # `got` needed since `github.request` disallows HTTP requests
- name: Install dependencies (pnpm) # `got` needed since `github.request` disallows HTTP requests
if: (env.TEST_CONTINUE)
run: yarn
run: pnpm i

- name: Generate feedback
if: (env.TEST_CONTINUE)
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn
cache: 'pnpm'
- run: pnpm i
- name: Lint
run: yarn lint
run: pnpm run lint

eslint-warning:
name: Lint
Expand All @@ -28,13 +31,16 @@ jobs:
security-events: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn
cache: 'pnpm'
- run: pnpm i
- name: Lint
run: yarn lint
run: pnpm run lint
--format @microsoft/eslint-formatter-sarif
--output-file eslint-results.sarif
continue-on-error: true
Expand Down
41 changes: 27 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- '!**/radar.js'
- '!**/radar-rules.js'
- 'package.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
- '.github/workflows/test.yml'
pull_request: ~

Expand Down Expand Up @@ -40,14 +40,17 @@ jobs:
with:
api_key: ${{ secrets.FORESIGHT_KEY }}
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies (yarn)
run: yarn
cache: 'pnpm'
- name: Install dependencies (pnpm)
run: pnpm i
- name: Test all and generate coverage
run: npm run jest:coverage
run: pnpm run jest:coverage
env:
REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}/
- name: Upload coverage to Codecov
Expand Down Expand Up @@ -87,12 +90,15 @@ jobs:
name: Jest puppeteer on Node ${{ matrix.node-version }} with ${{ matrix.chromium.name }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies (yarn)
run: yarn
cache: 'pnpm'
- name: Install dependencies (pnpm)
run: pnpm i
- name: Install Chromium
if: ${{ matrix.chromium.dependency != '' }}
# 'chromium-browser' from Ubuntu APT repo is a dummy package. Its version (85.0.4183.83) means
Expand All @@ -108,7 +114,7 @@ jobs:
sudo apt-get update
sudo apt-get install -yq --no-install-recommends ${{ matrix.chromium.dependency }}
- name: Test puppeteer
run: npm run jest puppeteer
run: pnpm run jest puppeteer
env: ${{ fromJSON(matrix.chromium.environment) }}

docs:
Expand All @@ -124,17 +130,21 @@ jobs:
name: Build docs on Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache-dependency-path: docs/yarn.lock
- run: yarn
cache: 'pnpm'
cache-dependency-path: docs/pnpm-lock.yaml
- run: pnpm i
- name: Set environment variable for Node v16 above
if: ${{ matrix.node-version > '16' }}
run: echo "NODE_OPTIONS=--openssl-legacy-provider" >> $GITHUB_ENV
- name: Build docs
run: npm run docs:build
working-directory: docs
- name: Unset environment variable for Node v16 above
if: ${{ matrix.node-version > '16' }}
run: echo "NODE_OPTIONS=''" >> $GITHUB_ENV
Expand All @@ -149,11 +159,14 @@ jobs:
name: Build radar and maintainer on Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn
cache: 'pnpm'
- run: pnpm i
- name: Build radar and maintainer
run: npm run build:all

Expand Down
42 changes: 21 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
node_modules
npm-debug.log
error.log
combined.log
.log
.vscode
.idea
.DS_Store
docs/.vuepress/dist
lib/config/app.json
lib/config/config.js
yarn-error.log
tmp
*.swp
*.iml
coverage
.env
app-minimal/
dump.rdb
Session.vim

.idea
.log
.now
.vercel
.vscode
.yarn

*.swp
*.iml

app-minimal/
assets/build/
coverage
docs/.vuepress/dist
node_modules
tmp

Session.vim
combined.log
dump.rdb
error.log
npm-debug.log
package-lock.json
pnpm-lock.yaml
.yarn
# pnpm-lock.yaml
yarn.lock
yarn-error.log
8 changes: 5 additions & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ tasks:
sudo apt update
sudo apt install -y ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libexpat1 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 wget xdg-util
sudo apt install -y redis-server
init: yarn && yarn --cwd docs
init: pnpm -i && pnpm -i -C docs
- name: app
command: yarn dev
command: pnpm run dev
openMode: tab-after
# - name: docs
# command: yarn docs:dev
# command: |
# cd docs
# pnpm run docs:dev
# openMode: tab-after

vscode:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
lts/hydrogen
Loading

0 comments on commit 1de1e9a

Please sign in to comment.