Skip to content

Commit

Permalink
docs: polish
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Sep 16, 2023
1 parent 6e7907b commit ea03cbc
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 28 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ jobs:
with:
bun-version: latest
- name: Install Dependencies
run: bun install --platform=linuxmusl
# - run: bun run check --filter=playground
# - run: bun run lint --filter=playground
- run: bun run build --filter=playground
- run: bun run test:unit:coverage --filter=playground
run: bun install
# - run: bun run check --filter=docs
# - run: bun run lint --filter=docs
- run: bun run build --filter=docs
- run: bun run test:unit:coverage --filter=docs
1 change: 0 additions & 1 deletion apps/docs/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
root: true,
extends: ['custom']
};
4 changes: 2 additions & 2 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm init svelte
bun create svelte@latest

# create a new project in my-app
npm init svelte my-app
bun create svelte@latest my-app
```

## Developing
Expand Down
8 changes: 6 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"format": "prettier --plugin-search-dir . --write --ignore-path=../../.prettierignore ."
},
"devDependencies": {
"@playwright/test": "1.37.1",
"@sveltejs/adapter-auto": "2.1.0",
"@sveltejs/kit": "1.24.1",
"@tailwindcss/container-queries": "0.1.1",
Expand All @@ -27,15 +28,18 @@
"svelte": "4.2.0",
"svelte-check": "3.5.1",
"svelte-meta-tags": "3.0.3",
"svelte-preprocess": "5.0.4",
"sveltekit-rate-limiter": "0.4.1",
"tailwind-merge": "1.14.0",
"tailwindcss-animate": "1.0.7",
"tslib": "2.6.2",
"typescript": "5.2.2",
"ui": "workspace:*",
"vite": "4.4.9",
"vite-imagetools": "5.0.8"
"vitest": "0.34.4"
},
"optionalDependencies": {
"@playwright/test": "1.37.1",
"@vitest/ui": "0.34.4"
},
"type": "module"
}
12 changes: 12 additions & 0 deletions apps/docs/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run build && npm run preview',
port: 4173
},
testDir: 'tests',
testMatch: /(.+\.)?(test|spec)\.[jt]s/
};

export default config;
17 changes: 9 additions & 8 deletions apps/docs/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/// <reference types="@sveltejs/kit" />

// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface Platform {}
// interface Session {}
// interface Stuff {}
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}

export {};
6 changes: 3 additions & 3 deletions apps/docs/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body>
<div>%sveltekit.body%</div>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
7 changes: 7 additions & 0 deletions apps/docs/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';

describe('sum test', () => {
it('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});
1 change: 1 addition & 0 deletions apps/docs/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.
26 changes: 20 additions & 6 deletions apps/docs/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
import adapter from '@sveltejs/adapter-auto';
import preprocess from 'svelte-preprocess';
import adapterNode from '@sveltejs/adapter-node';
import adapterAuto from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/kit/vite';

/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
extensions: ['.svelte'],
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: preprocess(),
preprocess: [vitePreprocess()],

vitePlugin: {
inspector: true
},
kit: {
adapter: adapter()
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: process.env.VERCEL ? adapterAuto() : adapterNode(),
prerender: { crawl: false }, // FIXME: remove after all links are corrected.
output: {
preloadStrategy: 'preload-mjs'
},
version: {
name: process.env.npm_package_version
}
}
};

export default config;
6 changes: 6 additions & 0 deletions apps/docs/tests/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect, test } from '@playwright/test';

test('index page has expected h1', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('heading', { name: 'Welcome to SvelteKit' })).toBeVisible();
});
14 changes: 13 additions & 1 deletion apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"lib": ["es2022", "webworker"],
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
"strict": true,
"types": [
"vitest/globals",
"vitest/importMeta",
"@testing-library/jest-dom",
"vite-plugin-pwa/client"
],
"rootDirs": [".", "./.svelte-kit/types", "./$houdini/types"]
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
9 changes: 9 additions & 0 deletions apps/docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';

export default defineConfig({
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
});
11 changes: 11 additions & 0 deletions apps/docs/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defaultExclude, defineProject, mergeConfig } from 'vitest/config';
import configShared from '../../vitest.config';

export default mergeConfig(
configShared,
defineProject({
test: {
exclude: [...defaultExclude, '**/tests/mocks/**']
}
})
);
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions docs/playbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pnpm add -g turbo
### Create

```shell
# bun create svelte@latest spectacular && cd $_ && code .
pnpm create svelte@latest spectacular && cd $_ && code .
# select `yes` for TypeScript, ESLint, Prettier, Playwright and Vitest
```
Expand Down

0 comments on commit ea03cbc

Please sign in to comment.