Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nvlang committed Jun 28, 2024
1 parent 07738a8 commit cff0bb8
Show file tree
Hide file tree
Showing 23 changed files with 530 additions and 367 deletions.
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ scripts/tex/svg
scripts/tex/svg-optimized

tests/e2e/src/routes/generated
tests/e2e/**/*darwin.png

# Docs
docs/.vitepress/cache/
docs/.vitepress/cache/**/*

# Fonts
{src,tests}/**/*.woff2
{src,tests}/**/*.woff
{src,tests}/**/*.ttf
{src,tests}/**/*.otf
*.woff2
*.woff
*.ttf
*.otf
!docs/**/*.woff2

# Generated by Sveltex in E2E tests
**/sveltex/fonts/**
Expand Down
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm test
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,27 @@ yarn add -D @nvl/sveltex # If using Yarn

```js
// svelte.config.js
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { sveltex } from '@nvl/sveltex';

/** @type {import('@sveltejs/kit').Config} */
const config = {
// ...
preprocess: [
vitePreprocess(), // (optional)
await sveltex({
markdownBackend: 'unified',
codeBackend: 'shiki',
mathBackend: 'mathjax',
}, {
// Options
}),
// ...
],
// ...
};

export default config;
```

## How it works
Expand Down
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"$dev_deps.js": "./src/dev_deps.ts",
"$mod.js": "./src/mod.ts",
"$Sveltex.js": "./src/Sveltex.ts",
"$config/": "./src/config/",
"$base/": "./src/base/",
"$data/": "./src/data/",
"$handlers/": "./src/handlers/",
"$typeGuards/": "./src/typeGuards/",
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"lint": "eslint . && tsc -p tsconfig.check.json",
"test": "vitest run --coverage --watch --",
"test:e2e": "pnpm test:e2e:prepare && playwright test",
"test:e2e:prepare": "pnpm build:release",
"test:e2e:prepare": "pnpm build:release && pnpm exec playwright install",
"test:e2e:golden": "pnpm test:e2e:prepare && playwright test --update-snapshots",
"format": "prettier --write .",
"test:watch": "vitest --watch",
Expand All @@ -72,6 +72,8 @@
"@playwright/test": "^1.45.0",
"@shikijs/transformers": "^1.10.0",
"@shikijs/twoslash": "^1.10.0",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__js": "^8.42.3",
"@types/estree": "^1.0.5",
"@types/hast": "^3.0.4",
"@types/katex": "^0.16.7",
Expand Down Expand Up @@ -123,6 +125,7 @@
"ts-node": "^10.9.2",
"tsc-alias": "^1.8.10",
"tslib": "^2.6.3",
"tsx": "^4.15.8",
"twoslash": "^0.2.9",
"typescript": "^5.5.2",
"typescript-eslint": "8.0.0-alpha.30",
Expand Down
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { defineConfig, devices } from '@playwright/test';
* See https://playwright.dev/docs/test-configuration.
*/
export const config = defineConfig({
testDir: 'tests/e2e',
testDir: './tests/e2e',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand Down Expand Up @@ -73,7 +73,7 @@ export const config = defineConfig({
...devices['iPhone SE'],
colorScheme: 'dark',
baseURL: 'http://localhost:3033',
browserName: 'firefox',
browserName: 'chromium',
},
timeout: 300e3, // 5 minutes
retries: 3,
Expand Down
58 changes: 58 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ export const missingDeps: string[] = [];
/**
* Gets the version of the specified package.
*/
export async function getVersion(
pkg: keyof (typeof import('package.json'))['peerDependencies'],
): Promise<string | undefined> {
export async function getVersion(pkg: string): Promise<string | undefined> {
let backendVersion: string | undefined;
try {
const prefix =
Expand Down
Loading

0 comments on commit cff0bb8

Please sign in to comment.