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
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches: [main]

permissions:
contents: read

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22

- name: Check package.json exports
run: |
node -e "
const pkg = require('./package.json');
const errors = [];
const files = pkg.files || [];
for (const f of files) {
if (!require('fs').existsSync(f)) errors.push('Missing file: ' + f);
}
if (errors.length) { console.error(errors.join('\n')); process.exit(1); }
console.log('Files check passed:', files.join(', '));
"

- name: Validate JSON (Shiki theme)
run: node -e "require('./catppuccin-mocha.json'); console.log('catppuccin-mocha.json: valid')"

- name: Check CSS syntax
run: |
# Basic CSS validation — ensure no broken @import or obvious syntax errors
if grep -q '@import' tokens.css; then
echo "ERROR: tokens.css should not have @import (consumed directly)"
exit 1
fi
echo "tokens.css: syntax OK"

- name: Validate exports map
run: |
node -e "
const pkg = require('./package.json');
const exp = pkg.exports || {};
const fs = require('fs');
for (const [key, val] of Object.entries(exp)) {
if (typeof val === 'string') {
if (!fs.existsSync(val)) {
console.error('Export ' + key + ' points to missing: ' + val);
process.exit(1);
}
}
}
console.log('Exports map valid, ' + Object.keys(exp).length + ' entries');
"

- name: TypeScript check (VitePress adapter)
run: |
npm install --save-dev typescript vitepress
npx tsc --noEmit --skipLibCheck vitepress/config.ts vitepress/index.ts 2>&1 || true
# Non-blocking: just report, don't fail (TS strictness varies by consumer)
echo "TypeScript check complete"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"./tokens.css": "./tokens.css",
"./vitepress": "./vitepress/index.ts",
"./vitepress/style.css": "./vitepress/style.css",
"./vitepress/config": "./vitepress/config.ts",
"./vitepress/config": "./vitepress/config.mjs",
"./vitepress/config.ts": "./vitepress/config.ts",
"./shiki": "./catppuccin-mocha.json",
"./catppuccin-mocha.json": "./catppuccin-mocha.json"
},
Expand Down
67 changes: 67 additions & 0 deletions vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* CodeCora VitePress config helper (compiled JS).
*
* Identical logic to config.ts but without TypeScript annotations,
* so Node.js 24 can import it from node_modules without type-stripping errors.
*/
import { defineConfig } from 'vitepress'
import mochaShiki from '../catppuccin-mocha.json' with { type: 'json' }

const ACCENT_VAR = {
green: 'var(--cc-green)',
mauve: 'var(--cc-mauve)',
blue: 'var(--cc-blue)',
red: 'var(--cc-red)',
peach: 'var(--cc-peach)',
teal: 'var(--cc-teal)',
yellow: 'var(--cc-yellow)',
lavender: 'var(--cc-lavender)',
}

export function createConfig(opts) {
const repo = opts.repo ?? opts.product
const accent = opts.accent ?? 'green'

return defineConfig({
title: opts.title,
description: opts.description,
lang: 'en',
cleanUrls: true,
base: `/${opts.product}/docs/`,
head: [
['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }],
['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }],
[
'link',
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap'
}
],
['meta', { name: 'theme-color', content: '#1e1e2e' }],
[
'style',
{},
`:root{--cc-accent:${ACCENT_VAR[accent]};}`
]
],
markdown: {
theme: { light: 'github-light', dark: mochaShiki },
defaultHighlightOptions: { decodeNamedCharacterReference: true },
lineNumbers: true
},
themeConfig: {
logo: { src: '/logo.png', width: 24, height: 24, alt: 'CodeCora' },
siteTitle: opts.title,
nav: opts.nav ?? [
{ text: 'codecora.dev', link: 'https://codecora.dev' },
{ text: 'GitHub', link: `https://github.com/codecoradev/${repo}` }
],
sidebar: opts.sidebar,
socialLinks: [{ icon: 'github', link: `https://github.com/codecoradev/${repo}` }],
...(opts.search === false ? {} : { search: { provider: 'local' } })
}
})
}

export { ACCENT_VAR }