chore: Update CI workflow and package.json minimum engines

This commit is contained in:
Dexxiez 2023-12-29 19:39:35 +11:00
parent 1dc24222ca
commit 2f4dbf06a2
3 changed files with 94 additions and 85 deletions

View File

@ -2,62 +2,70 @@ name: BetterDiscord CI
on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20] # Current LTS versions
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Checkout
uses: actions/checkout@v4
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Install Node.js LTS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
# - name: Lint
# run: pnpm lint
# - name: Run tests
# run: pnpm test
- name: Build asar
run: pnpm dist
- uses: actions/upload-artifact@v3
name: Upload artifact
# if: ${{ github.ref == 'refs/heads/main' }} # Only create artifacts when pushed to main
with:
name: betterdiscord.asar
path: dist/betterdiscord.asar
retention-days: 30
if-no-files-found: error
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-frozen-lockfile
- name: Run tests
run: pnpm test
- name: Ensure build compiles on Node.js ${{ matrix.node-version }} LTS
run: pnpm dist
release:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }} # Only build when pushed to main
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js LTS
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-frozen-lockfile
- name: Build asar
run: pnpm dist
- uses: actions/upload-artifact@v3
name: Upload artifact
with:
name: betterdiscord.asar
path: dist/betterdiscord.asar
retention-days: 30
if-no-files-found: error

1
.npmrc Normal file
View File

@ -0,0 +1 @@
auto-install-peers=false # Maintain PNPM v7 behavior for now

View File

@ -1,36 +1,36 @@
{
"name": "betterdiscord",
"version": "1.9.7",
"description": "Enhances Discord by adding functionality and themes.",
"main": "src/index.js",
"scripts": {
"build": "pnpm run build-injector && pnpm run build-preload && pnpm run build-renderer",
"build-prod": "pnpm --filter injector build-prod && pnpm --filter preload build-prod && pnpm --filter renderer build-prod",
"build-injector": "pnpm --filter injector build",
"build-renderer": "pnpm --filter renderer build",
"build-preload": "pnpm --filter preload build",
"inject": "node scripts/inject.js",
"lint": "eslint --ext .js common/ && pnpm --filter injector lint && pnpm --filter preload lint && pnpm --filter renderer lint-js",
"test": "mocha --require @babel/register --recursive \"./tests/renderer/*.js\"",
"dist": "pnpm run build-prod && node scripts/pack.js",
"api": "jsdoc -X -r renderer/src/modules/api/ > jsdoc-ast.json",
"translations": "node -r dotenv/config scripts/translations.js"
},
"devDependencies": {
"@babel/core": "^7.16.12",
"@babel/preset-env": "^7.16.11",
"@babel/register": "^7.16.9",
"asar": "^3.2.0",
"dotenv": "^16.0.3",
"eslint": "^8.23.0",
"eslint-plugin-react": "^7.31.6",
"eslint-plugin-react-hooks": "^4.6.0",
"mocha": "^10.0.0",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
"engines": {
"node": ">=14",
"pnpm": ">=7"
}
"name": "betterdiscord",
"version": "1.9.7",
"description": "Enhances Discord by adding functionality and themes.",
"main": "src/index.js",
"scripts": {
"build": "pnpm run build-injector && pnpm run build-preload && pnpm run build-renderer",
"build-prod": "pnpm --filter injector build-prod && pnpm --filter preload build-prod && pnpm --filter renderer build-prod",
"build-injector": "pnpm --filter injector build",
"build-renderer": "pnpm --filter renderer build",
"build-preload": "pnpm --filter preload build",
"inject": "node scripts/inject.js",
"lint": "eslint --ext .js common/ && pnpm --filter injector lint && pnpm --filter preload lint && pnpm --filter renderer lint-js",
"test": "mocha --require @babel/register --recursive \"./tests/renderer/*.js\"",
"dist": "pnpm run build-prod && node scripts/pack.js",
"api": "jsdoc -X -r renderer/src/modules/api/ > jsdoc-ast.json",
"translations": "node -r dotenv/config scripts/translations.js"
},
"devDependencies": {
"@babel/core": "^7.16.12",
"@babel/preset-env": "^7.16.11",
"@babel/register": "^7.16.9",
"asar": "^3.2.0",
"dotenv": "^16.0.3",
"eslint": "^8.23.0",
"eslint-plugin-react": "^7.31.6",
"eslint-plugin-react-hooks": "^4.6.0",
"mocha": "^10.0.0",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
"engines": {
"node": ">=18",
"pnpm": ">=8"
}
}