mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-30 00:46:29 +01:00
b569018fef
* Update links * Move blog to site/content * Update site/content/docs/02-component-format.md * Fix docs links * Add global prettierrc * Auto format * Fix git merge artifact * Fix errors * Update html to svelte(remaining ones) * Add 2 blog posts * Modify prettierrc * Minor design fix * Switch package lock to spaces, prettier ignore * Regenerate package lock * prettier format * Push * Remove console.logs * Minor fixes * Fix search * Fix heading <code> style * Fix search some more * Code cleanup * Update deps * Move content around * Allow drafts * Redirect logic * Don't render anything on docs if /docs * Shorten the regex patterns * Fix some more * Hack the build into working * Modernize docs links * Add content to introduction * Modify the content * fix content links * Reduce duplication in redirect regex * Differences from Kit page * Fix link * Make OnThisPage visible on all docs * Misc changes * Move differences page to introduction * Run prettier * Prerender examples api routes * Modify introdution page * replace positions of readonly and get * Minor blog style enhancement --------- Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
// @ts-check
|
|
import adapter from '@sveltejs/adapter-vercel';
|
|
import { get_examples_data, get_examples_list } from './src/lib/server/examples/get-examples.js';
|
|
import { get_tutorial_data, get_tutorial_list } from './src/lib/server/tutorial/get-tutorial.js';
|
|
|
|
/** @type {import('@sveltejs/kit').Config} */
|
|
export default {
|
|
kit: {
|
|
adapter: adapter(),
|
|
prerender: {
|
|
// TODO use route entries instead, once https://github.com/sveltejs/kit/pull/9571 is merged
|
|
entries: ['*', ...repl_json_entries(), ...tutorial_entries(), ...examples_json_entries()]
|
|
}
|
|
}
|
|
};
|
|
|
|
function repl_json_entries() {
|
|
return get_examples_list(
|
|
get_examples_data(new URL('../../site/content/examples', import.meta.url).pathname)
|
|
).flatMap(({ examples }) =>
|
|
examples.map(({ slug }) => /** @type {(`/${string}`)} */ (`/repl/${slug}.json`))
|
|
);
|
|
}
|
|
|
|
function tutorial_entries() {
|
|
return get_tutorial_list(
|
|
get_tutorial_data(new URL('../../site/content/tutorial', import.meta.url).pathname)
|
|
).flatMap(({ tutorials }) =>
|
|
tutorials.map(({ slug }) => /** @type {(`/${string}`)} */ (`/tutorial/${slug}`))
|
|
);
|
|
}
|
|
|
|
function examples_json_entries() {
|
|
return get_examples_list(
|
|
get_examples_data(new URL('../../site/content/examples', import.meta.url).pathname)
|
|
).flatMap(({ examples }) =>
|
|
examples.map(({ slug }) => /** @type {(`/${string}`)} */ (`/examples/api/${slug}.json`))
|
|
);
|
|
}
|