From fbd6dbf2eb2c8583bb8c5eff5ed290d157caa4f8 Mon Sep 17 00:00:00 2001 From: "danil.radkovskyi" Date: Fri, 31 Jul 2026 17:02:35 +0200 Subject: [PATCH] Add CI workflow config Add .github/workflows/ci.yaml matching the bare template (with node-version 22.20.0, since this template uses vite 8 / rolldown which require node >=22.12.0). package.json: add test:types and test:unit scripts, remove the duplicate type-check script (point deploy at test:types), bump engines.node to >=22.12.0, and downgrade typescript 7.0.2 -> 6.0.3 so it satisfies the typescript-eslint peer range. src/core/nuke.ts: fix two pre-existing no-useless-assignment lint errors by declaring success without the redundant initializer (it is always assigned in both the success and catch paths before use). Built with Snoocode --- .github/workflows/ci.yaml | 30 ++++++++++++++++++++++++++++++ package.json | 9 +++++---- src/core/nuke.ts | 4 ++-- 3 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..10e7193 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,30 @@ +# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs +name: CI + +on: + push: + branches: ['main'] + pull_request: + branches: ['main'] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7.0.0 + - name: Install Node.js + uses: actions/setup-node@v6.4.0 + with: + node-version: 22.20.0 + - name: Install Dependencies + run: npm install --no-fund + - parallel: + - name: Typecheck + run: npm run test:types + - name: Lint + run: npm run lint + - name: Unit Test + run: npm run test:unit + - name: Build + run: npm run build diff --git a/package.json b/package.json index 2f5bbd5..c85a24d 100644 --- a/package.json +++ b/package.json @@ -6,16 +6,17 @@ "type": "module", "scripts": { "build": "vite build", - "deploy": "npm run type-check && npm run lint && devvit upload", + "deploy": "npm run test:types && npm run lint && devvit upload", "dev": "devvit playtest", "launch": "npm run deploy && devvit publish", "lint": "eslint 'src/**/*.{ts,tsx}'", "login": "devvit login", "prettier": "prettier --write .", - "type-check": "tsc --build" + "test:types": "tsc --build", + "test:unit": "node --experimental-strip-types --no-warnings=ExperimentalWarning --test \"src/**/*.test.ts\"" }, "engines": { - "node": ">=22.2.0" + "node": ">=22.12.0" }, "dependencies": { "@devvit/start": "0.13.10", @@ -30,7 +31,7 @@ "eslint": "10.8.0", "globals": "17.8.0", "prettier": "3.9.6", - "typescript": "7.0.2", + "typescript": "6.0.3", "typescript-eslint": "8.65.0", "vite": "8.1.5" } diff --git a/src/core/nuke.ts b/src/core/nuke.ts index be7df74..2d779ea 100644 --- a/src/core/nuke.ts +++ b/src/core/nuke.ts @@ -47,7 +47,7 @@ async function* getAllCommentsInPost( export async function handleNukePost(props: NukePostProps) { const startTime = Date.now(); - let success = true; + let success: boolean; let message: string; const shouldLock = props.lock; @@ -133,7 +133,7 @@ export async function handleNukePost(props: NukePostProps) { export async function handleNuke(props: NukeProps) { const startTime = Date.now(); - let success = true; + let success: boolean; let message: string; const shouldLock = props.lock;