Skip to content
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
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
env:
ORIGIN: ${{ vars.ORIGIN }}
RAILWAY_GIT_COMMIT_SHA: ${{ vars.RAILWAY_GIT_COMMIT_SHA }}
VIRALCARDS_API_KEY: ${{ secrets.VIRALCARDS_API_KEY }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: read
Expand All @@ -20,24 +18,28 @@ jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

- uses: pnpm/action-setup@v6
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
with:
version: latest

- uses: actions/setup-node@v7
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 'lts/*'
registry-url: 'https://npm.pkg.github.com'
cache: 'pnpm'

- run: pnpm i --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: pnpm run lint

- run: pnpm build # Generate content collections prior to running `svelte-check`.

- run: pnpm knip --reporter github-actions

- run: pnpm run check

# - name: Install Playwright Chromium
Expand Down
25 changes: 25 additions & 0 deletions knip.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { KnipConfig } from 'knip';

const mdsvexCompiler = (source: string) => {
// Ignore fenced examples because mdsvex does not execute their script tags.
const withoutCodeFences = source.replace(
/^ {0,3}(`{3,}|~{3,})[^\n]*\n[\s\S]*?^ {0,3}\1\s*$/gm,
''
);

return [...withoutCodeFences.matchAll(/<script(?:\s[^>]*)?>([\s\S]*?)<\/script>/gi)]
.map(([, script]) => script)
.join('\n');
};

const config = {
// These files are not all statically traceable through Vite and mdsvex configuration.
entry: ['content-collections.ts', 'src/lib/mdsvex/layouts/default.svelte', 'src/routes/**/*.md'],
project: ['*.{js,ts}', 'src/**/*.{js,ts,svelte,md,css}'],
compilers: {
md: mdsvexCompiler
},
treatConfigHintsAsErrors: true
} satisfies KnipConfig;

export default config;
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"knip": "svelte-kit sync && knip",
"format": "prettier --write ."
},
"devDependencies": {
Expand All @@ -38,13 +39,14 @@
"eslint": "^10.8.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.22.0",
"globals": "^17.8.0",
"globals": "^17.9.0",
"knip": "^6.31.0",
"mdsvex": "^0.12.8",
"prettier": "^3.9.6",
"prettier-plugin-svelte": "^4.1.1",
"prettier-plugin-tailwindcss": "^0.8.1",
"shiki": "^4.4.1",
"simple-icons": "^16.27.1",
"simple-icons": "^16.28.0",
"svelte": "^5.56.8",
"svelte-check": "^4.7.4",
"sveltekit-embed": "^0.0.22",
Expand Down
Loading