Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate to pnpm #617

Merged
merged 7 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Build

on:
# Run build tests on pull requests
pull_request:
branches:
- main
Expand All @@ -11,13 +10,23 @@ jobs:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/[email protected]
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false

- name: Install Node.js (v20)
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: yarn
run: pnpm install --frozen-lockfile

- name: Build
run: yarn build:local
run: pnpm build:local
30 changes: 19 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Lint
name: Lint code

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
Expand All @@ -15,13 +13,23 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/[email protected]
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false

- name: Install Node.js (v20)
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: yarn
- name: Lint checks
run: yarn lint:ci
run: pnpm install --frozen-lockfile

- name: Run Lint Checks
run: pnpm lint:ci
47 changes: 27 additions & 20 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,49 @@ on:
push:
branches:
- main
# pull_request:
# branches:
# - main

jobs:
deploy:
name: Push
runs-on: ubuntu-latest
env:
TARGET_BRANCH: dist
permissions:
contents: write
steps:
- name: Check out Git repository
uses: actions/[email protected]
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v2.5.1
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
node-version: 16.x
version: latest
run_install: false

- name: Add dist folder to worktree
run: git worktree add -B dist dist origin/dist
- name: Install Node.js (v20)
uses: actions/setup-node@v3
with:
node-version: 20
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: yarn install and build
- name: Configure Git
run: |
yarn
yarn build:prod
git config --global user.name "Github Actions"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git pull origin HEAD
git worktree add -B $TARGET_BRANCH dist origin/$TARGET_BRANCH

- run: echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV
- name: Install Dependencies and Build
run: |
pnpm install --frozen-lockfile
pnpm build:prod

- name: Push new version
env:
TARGET_BRANCH: "dist"
- name: Push New Version
run: |
export SHORT_SHA=$(git rev-parse --short HEAD)
cd dist
git config --global user.name "Github Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git diff-index --quiet HEAD || git commit -am "Update dist to output generated at $SHORT_SHA"
git diff-index --quiet HEAD || git commit -am "Update to output generated at $SHORT_SHA"
git push origin $TARGET_BRANCH
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint
pnpm lint
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.0.0
20
546 changes: 0 additions & 546 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

786 changes: 0 additions & 786 deletions .yarn/releases/yarn-3.2.1.cjs

This file was deleted.

7 changes: 0 additions & 7 deletions .yarnrc.yml

This file was deleted.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@
"scripts": {
"build": "spicetify-creator",
"build:local": "spicetify-creator --out=dist --minify",
"build:prod": "yarn build:local && yarn copy:docs",
"build:prod": "pnpm build:local && pnpm copy:docs",
"copy:docs": "copyfiles README.md dist/",
"lint": "eslint --fix src",
"lint:ci": "eslint src",
"type-check": "tsc --noEmit",
"watch": "spicetify-creator --watch",
"prepare": "husky install",
"upgrade-deps": "yarn upgrade-interactive"
"prepare": "husky install"
},
"engines": {
"node": ">=20"
},
"packageManager": "[email protected]",
"devDependencies": {
"@types/chroma-js": "^2.4.1",
"@types/react": "^17.0.65",
Expand Down
Loading