Skip to content

Commit 0c3ba2e

Browse files
chore: add Prettier configuration and ESLint integration, update CI workflow, and enhance code formatting
1 parent 8893c56 commit 0c3ba2e

53 files changed

Lines changed: 996 additions & 472 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ci-${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
check:
15+
runs-on: ubuntu-latest
16+
env:
17+
DATABASE_URL: postgresql://ci:ci@127.0.0.1:5432/ci
18+
S3_BUCKET_NAME: ci-bucket
19+
AWS_REGION: us-east-1
20+
ENCRYPTION_KEY: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: "20"
27+
cache: npm
28+
29+
- run: npm ci
30+
31+
- run: npm run lint
32+
33+
- run: npm run format:check
34+
35+
- run: npm run typecheck
36+
37+
- run: npm run test
38+
39+
- run: npm run build
40+
41+
- run: npm run build:github-action

.prettierignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.next
2+
out
3+
build
4+
dist
5+
node_modules
6+
package-lock.json
7+
src/generated
8+
coverage
9+
*.min.js
10+
11+
# Docs and agent notes: keep editorial formatting separate from code style
12+
**/*.md

dist/github-action/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31146,7 +31146,9 @@ async function run() {
3114631146
const mode = (getInput("mode") || "export").toLowerCase();
3114731147
const outputPath = getInput("output-path");
3114831148
const pickLines = getMultilineInput("pick");
31149-
const pick = pickLines.length > 0 ? pickLines.join("\n") : ((_a = getInput("pick")) === null || _a === void 0 ? void 0 : _a.trim()) || undefined;
31149+
const pick = pickLines.length > 0
31150+
? pickLines.join("\n")
31151+
: ((_a = getInput("pick")) === null || _a === void 0 ? void 0 : _a.trim()) || undefined;
3115031152
const envPrefix = (_b = getInput("env_prefix")) !== null && _b !== void 0 ? _b : "";
3115131153
const url = new URL("/api/ci/file", hostname);
3115231154
url.searchParams.set("secret", secret);

dist/github-action/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
import { defineConfig, globalIgnores } from "eslint/config";
2+
import eslintConfigPrettier from "eslint-config-prettier/flat";
23
import nextVitals from "eslint-config-next/core-web-vitals";
34
import nextTs from "eslint-config-next/typescript";
45

56
const eslintConfig = defineConfig([
67
...nextVitals,
78
...nextTs,
9+
eslintConfigPrettier,
810
// Override default ignores of eslint-config-next.
911
globalIgnores([
1012
// Default ignores of eslint-config-next:
1113
".next/**",
1214
"out/**",
1315
"build/**",
16+
"dist/**",
1417
"next-env.d.ts",
18+
"src/generated/**",
1519
]),
1620
]);
1721

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
"build": "next build",
88
"start": "next start",
99
"lint": "eslint",
10+
"format": "prettier --write .",
11+
"format:check": "prettier --check .",
12+
"typecheck": "tsc --noEmit",
1013
"test": "vitest run",
14+
"ci": "npm run lint && npm run format:check && npm run typecheck && npm run test && npm run build && npm run build:github-action",
1115
"postinstall": "prisma generate",
1216
"db:migrate": "prisma migrate deploy",
1317
"db:push": "prisma db push",
@@ -54,6 +58,8 @@
5458
"@vercel/ncc": "^0.38.4",
5559
"eslint": "^9",
5660
"eslint-config-next": "16.2.1",
61+
"eslint-config-prettier": "^10.1.8",
62+
"prettier": "^3.8.1",
5763
"prisma": "^7.6.0",
5864
"tailwindcss": "^4",
5965
"typescript": "^5",

scripts/pull-secret.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Options:
3838
}
3939

4040
function getEncryptionKey(raw) {
41-
if (!raw?.trim()) throw new Error("ENCRYPTION_KEY or --encryption-key is required");
41+
if (!raw?.trim())
42+
throw new Error("ENCRYPTION_KEY or --encryption-key is required");
4243
const trimmed = raw.trim();
4344
if (trimmed.length === 64 && /^[0-9a-fA-F]+$/.test(trimmed)) {
4445
return Buffer.from(trimmed, "hex");
@@ -74,7 +75,10 @@ function decryptToUtf8(blob, key) {
7475
const tag = blob.subarray(tagStart);
7576
const decipher = createDecipheriv("aes-256-gcm", key, iv);
7677
decipher.setAuthTag(tag);
77-
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
78+
return Buffer.concat([
79+
decipher.update(ciphertext),
80+
decipher.final(),
81+
]).toString("utf8");
7882
}
7983

8084
function parseDotenv(content) {

src/app/api/ci/file/route.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ function parseBearer(req: NextRequest): string | null {
1818
}
1919

2020
function isNotFoundError(err: unknown): boolean {
21-
const e = err as { name?: string; Code?: string; $metadata?: { httpStatusCode?: number } };
21+
const e = err as {
22+
name?: string;
23+
Code?: string;
24+
$metadata?: { httpStatusCode?: number };
25+
};
2226
return (
2327
e.name === "NoSuchKey" ||
2428
e.Code === "NoSuchKey" ||
@@ -31,7 +35,10 @@ export async function GET(req: NextRequest) {
3135
try {
3236
getBucket();
3337
} catch {
34-
return NextResponse.json({ error: "Server misconfigured" }, { status: 500 });
38+
return NextResponse.json(
39+
{ error: "Server misconfigured" },
40+
{ status: 500 },
41+
);
3542
}
3643

3744
const bearer = parseBearer(req);

src/app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@
127127
html {
128128
@apply font-sans;
129129
}
130-
}
130+
}

0 commit comments

Comments
 (0)