Skip to content

Commit

Permalink
chore: package upgrades and maintenance (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoey-kaiser authored Aug 19, 2024
1 parent 8de6fdb commit 19a5322
Show file tree
Hide file tree
Showing 11 changed files with 3,027 additions and 2,359 deletions.
89 changes: 41 additions & 48 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,76 @@ on:
pull_request:
branches: [ main ]

env:
NODE_VER: 22.5

jobs:
testCodebase:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.6.1
uses: actions/setup-node@v4
with:
node-version: 20.6.1

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
- name: Use Node.js ${{ env.NODE_VER }}
uses: actions/setup-node@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
node-version: ${{ env.NODE_VER }}
cache: 'pnpm'

- name: Install deps
run: pnpm i

- run: pnpm install
- name: Check linting
run: pnpm lint

- run: pnpm run lint
- run: pnpm run typecheck
- name: Check typecheck
run: pnpm typecheck

testCli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.6.1
uses: actions/setup-node@v4
with:
node-version: 20.6.1

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
run_install: false

- uses: actions/cache@v4
name: Setup pnpm cache
- name: Use Node.js ${{ env.NODE_VER }}
uses: actions/setup-node@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
node-version: ${{ env.NODE_VER }}
cache: 'pnpm'

- name: Install deps
run: pnpm i

- run: pnpm install
- run: pnpm dev:ci
- name: Run the CI with default options
run: pnpm dev:ci

# This is what the user would do, minus actually starting the application
- run: cd my-sidebase-app && npx prisma db push
# setup the database inside the generated app
- name: app:init the database
run: cd my-sidebase-app && npx prisma db push

# code should be 100% correct at the start
- run: cd my-sidebase-app && pnpm lint
- run: cd my-sidebase-app && npm exec nuxi prepare && pnpm run typecheck
- name: app:check linting
run: cd my-sidebase-app && pnpm lint

- name: app:check typing
run: cd my-sidebase-app && npm exec nuxi prepare && pnpm run typecheck

# start dev-app, all of the following adapted from https://stackoverflow.com/a/60996259
- run: "cd my-sidebase-app && timeout 30 npm run dev || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
- name: app:run in dev
run: "cd my-sidebase-app && timeout 30 npm run dev || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"

# start prod-app
- run: "export AUTH_ORIGIN=http://localhost:3000 && export AUTH_SECRET=test123 && cd my-sidebase-app && npm run build && timeout 30 npm run preview || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
- name: app:run in prod
run: "export AUTH_ORIGIN=http://localhost:3000 && export AUTH_SECRET=test123 && cd my-sidebase-app && npm run build && timeout 30 npm run preview || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"

# start dev-app and curl from it
- run: "cd my-sidebase-app && timeout 30 npm run dev & (sleep 20 && curl --fail localhost:3000) || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
- name: app:test in prod
run: "cd my-sidebase-app && timeout 30 npm run dev & (sleep 20 && curl --fail localhost:3000) || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "vite-node src/ -- --nocounting",
"dev:ci": "vite-node src/ -- --ci",
"lint": "eslint \"./src/**/*.{ts,tsx}\" --max-warnings=0",
"lint": "oxlint --deny-warnings -D correctness -D suspicious -D perf && eslint \"./src/**/*.{ts,tsx}\" --max-warnings=0",
"lint:fix": "eslint \"./src/**/*.{ts,tsx}\" --max-warnings=0 --fix",
"typecheck": "tsc --noEmit",
"build": "rm -rf dist && tsup src/ --format esm",
"start": "npx",
Expand Down Expand Up @@ -43,6 +44,7 @@
"@types/node": "^18.11.16",
"@types/prompts": "^2.4.2",
"eslint": "^8.57.0",
"oxlint": "^0.7.2",
"tsup": "^6.2.3",
"typescript": "^4.8.2",
"vite-node": "^0.25.8"
Expand All @@ -59,5 +61,6 @@
"ora": "^6.1.2",
"pkg-types": "^1.0.1",
"prompts": "^2.4.2"
}
},
"packageManager": "[email protected]+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e"
}
Loading

0 comments on commit 19a5322

Please sign in to comment.