diff options
author | Chris Swithinbank | 2023-05-18 08:32:09 +0200 |
---|---|---|
committer | GitHub | 2023-05-18 08:32:09 +0200 |
commit | 4e0c701e42f6893cc30b14ceb3455236605abec5 (patch) | |
tree | 6a1718b99b45b9a6130f8faa5b5d6d8663238006 | |
parent | acc58a488c47de9451bb5a74ffddf1b9e9de3585 (diff) | |
download | IT.starlight-4e0c701e42f6893cc30b14ceb3455236605abec5.tar.gz IT.starlight-4e0c701e42f6893cc30b14ceb3455236605abec5.tar.bz2 IT.starlight-4e0c701e42f6893cc30b14ceb3455236605abec5.zip |
Create a starter template (#71)
-rw-r--r-- | examples/basics/.gitignore | 21 | ||||
-rw-r--r-- | examples/basics/.vscode/extensions.json | 4 | ||||
-rw-r--r-- | examples/basics/.vscode/launch.json | 11 | ||||
-rw-r--r-- | examples/basics/README.md | 51 | ||||
-rw-r--r-- | examples/basics/astro.config.mjs | 31 | ||||
-rw-r--r-- | examples/basics/package.json | 17 | ||||
-rw-r--r-- | examples/basics/public/favicon.svg | 1 | ||||
-rw-r--r-- | examples/basics/src/assets/example-image.jpg | bin | 0 -> 21173 bytes | |||
-rw-r--r-- | examples/basics/src/content/config.ts | 8 | ||||
-rw-r--r-- | examples/basics/src/content/docs/guides/example.md | 11 | ||||
-rw-r--r-- | examples/basics/src/content/docs/index.md | 18 | ||||
-rw-r--r-- | examples/basics/src/content/docs/reference/example.md | 11 | ||||
-rw-r--r-- | examples/basics/src/env.d.ts | 2 | ||||
-rw-r--r-- | examples/basics/tsconfig.json | 3 | ||||
-rw-r--r-- | pnpm-lock.yaml | 10 |
15 files changed, 191 insertions, 8 deletions
diff --git a/examples/basics/.gitignore b/examples/basics/.gitignore new file mode 100644 index 00000000..6240da8b --- /dev/null +++ b/examples/basics/.gitignore @@ -0,0 +1,21 @@ +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/basics/.vscode/extensions.json b/examples/basics/.vscode/extensions.json new file mode 100644 index 00000000..22a15055 --- /dev/null +++ b/examples/basics/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/examples/basics/.vscode/launch.json b/examples/basics/.vscode/launch.json new file mode 100644 index 00000000..d6422097 --- /dev/null +++ b/examples/basics/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/examples/basics/README.md b/examples/basics/README.md new file mode 100644 index 00000000..5739bcb5 --- /dev/null +++ b/examples/basics/README.md @@ -0,0 +1,51 @@ +# Starlight Starter Kit: Basics + +``` +npm create astro@latest -- --template starlight +``` + +[](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics) +[](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics) + +> π§βπ **Seasoned astronaut?** Delete this file. Have fun! + +## π Project Structure + +Inside of your Astro + Starlight project, you'll see the following folders and files: + +``` +. +βββ astro.config.mjs +βββ package.json +βββ public/ +βββ src/ +β βββ assets/ +β βββ content/ +β β βββ config.ts +β β βββ docs/ +β βββ env.d.ts +βββ tsconfig.json +``` + +Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name. + +Images can be added to `src/assets/` and embedded in Markdown with a relative link. + +Static assets, like favicons, can be placed in the `public/` directory. + +## π§ Commands + +All commands are run from the root of the project, from a terminal: + +| Command | Action | +| :------------------------ | :----------------------------------------------- | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:3000` | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | +| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | +| `npm run astro -- --help` | Get help using the Astro CLI | + +## π Want to learn more? + +Check out [Starlightβs docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat). diff --git a/examples/basics/astro.config.mjs b/examples/basics/astro.config.mjs new file mode 100644 index 00000000..b3e86d36 --- /dev/null +++ b/examples/basics/astro.config.mjs @@ -0,0 +1,31 @@ +import { defineConfig } from 'astro/config'; +import starlight from '@astrojs/starlight'; + +// https://astro.build/config +export default defineConfig({ + integrations: [ + starlight({ + title: 'My Docs', + social: { + github: 'https://github.com/withastro/starlight', + }, + sidebar: [ + { + label: 'Start Here', + items: [ + // Each item here is one entry in the navigation menu. + { label: 'Getting Started', link: '/' }, + ], + }, + { + label: 'Guides', + autogenerate: { directory: 'guides' }, + }, + { + label: 'Reference', + autogenerate: { directory: 'reference' }, + }, + ], + }), + ], +}); diff --git a/examples/basics/package.json b/examples/basics/package.json new file mode 100644 index 00000000..c5d7a3b9 --- /dev/null +++ b/examples/basics/package.json @@ -0,0 +1,17 @@ +{ + "name": "@example/starlight-basics", + "type": "module", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "@astrojs/starlight": "^0.0.8", + "astro": "^2.4.1" + } +} diff --git a/examples/basics/public/favicon.svg b/examples/basics/public/favicon.svg new file mode 100644 index 00000000..cba5ac14 --- /dev/null +++ b/examples/basics/public/favicon.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M81 36 64 0 47 36l-1 2-9-10a6 6 0 0 0-9 9l10 10h-2L0 64l36 17h2L28 91a6 6 0 1 0 9 9l9-10 1 2 17 36 17-36v-2l9 10a6 6 0 1 0 9-9l-9-9 2-1 36-17-36-17-2-1 9-9a6 6 0 1 0-9-9l-9 10v-2Zm-17 2-2 5c-4 8-11 15-19 19l-5 2 5 2c8 4 15 11 19 19l2 5 2-5c4-8 11-15 19-19l5-2-5-2c-8-4-15-11-19-19l-2-5Z" clip-rule="evenodd"/><path d="M118 19a6 6 0 0 0-9-9l-3 3a6 6 0 1 0 9 9l3-3Zm-96 4c-2 2-6 2-9 0l-3-3a6 6 0 1 1 9-9l3 3c3 2 3 6 0 9Zm0 82c-2-2-6-2-9 0l-3 3a6 6 0 1 0 9 9l3-3c3-2 3-6 0-9Zm96 4a6 6 0 0 1-9 9l-3-3a6 6 0 1 1 9-9l3 3Z"/><style>path{fill:#000}@media (prefers-color-scheme:dark){path{fill:#fff}}</style></svg>
\ No newline at end of file diff --git a/examples/basics/src/assets/example-image.jpg b/examples/basics/src/assets/example-image.jpg Binary files differnew file mode 100644 index 00000000..ad32033f --- /dev/null +++ b/examples/basics/src/assets/example-image.jpg diff --git a/examples/basics/src/content/config.ts b/examples/basics/src/content/config.ts new file mode 100644 index 00000000..4cdd345e --- /dev/null +++ b/examples/basics/src/content/config.ts @@ -0,0 +1,8 @@ +import { defineCollection } from 'astro:content'; +import { docsSchema } from '@astrojs/starlight/schema'; + +export const collections = { + docs: defineCollection({ + schema: docsSchema(), + }), +}; diff --git a/examples/basics/src/content/docs/guides/example.md b/examples/basics/src/content/docs/guides/example.md new file mode 100644 index 00000000..ebd0f3bc --- /dev/null +++ b/examples/basics/src/content/docs/guides/example.md @@ -0,0 +1,11 @@ +--- +title: Example Guide +description: A guide in my new Starlight docs site. +--- + +Guides lead a user through a specific task they want to accomplish, often with a sequence of steps. +Writing a good guide requires thinking about what your users are trying to do. + +## Further reading + +- Read [about how-to guides](https://diataxis.fr/how-to-guides/) in the DiΓ‘taxis framework diff --git a/examples/basics/src/content/docs/index.md b/examples/basics/src/content/docs/index.md new file mode 100644 index 00000000..581a1b88 --- /dev/null +++ b/examples/basics/src/content/docs/index.md @@ -0,0 +1,18 @@ +--- +title: Welcome to Starlight +description: Get started building your docs site with Starlight. +--- + +Congrats on setting up a new Starlight project! + + + +## Next steps + +- Edit `src/content/docs/index.md` to see this page change. + +- Add Markdown or MDX files to `src/content/docs` to create new pages. + +- Edit your `sidebar` and other config in `astro.config.mjs`. + +- Learn more in [the Starlight Docs](https://starlight.astro.build/). diff --git a/examples/basics/src/content/docs/reference/example.md b/examples/basics/src/content/docs/reference/example.md new file mode 100644 index 00000000..ac8cfa8b --- /dev/null +++ b/examples/basics/src/content/docs/reference/example.md @@ -0,0 +1,11 @@ +--- +title: Example Reference +description: A reference page in my new Starlight docs site. +--- + +Reference pages are ideal for outlining how things work in terse and clear terms. +Less concerned with telling a story or addressing a specific use case, they should give a comprehensive outline of what your documenting. + +## Further reading + +- Read [about reference](https://diataxis.fr/reference/) in the DiΓ‘taxis framework diff --git a/examples/basics/src/env.d.ts b/examples/basics/src/env.d.ts new file mode 100644 index 00000000..4170bce9 --- /dev/null +++ b/examples/basics/src/env.d.ts @@ -0,0 +1,2 @@ +/// <reference path="../.astro/types.d.ts" /> +/// <reference types="astro/client-image" /> diff --git a/examples/basics/tsconfig.json b/examples/basics/tsconfig.json new file mode 100644 index 00000000..77da9dd0 --- /dev/null +++ b/examples/basics/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "astro/tsconfigs/strict" +}
\ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 35c0e7c0..4bf4f06a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -95,7 +95,7 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/gen-mapping': 0.1.1 - '@jridgewell/trace-mapping': 0.3.17 + '@jridgewell/trace-mapping': 0.3.18 /@astrojs/compiler@1.4.1: resolution: {integrity: sha512-aXAxapNWZwGN41P+Am/ma/2kAzKOhMNaY6YuvLkUHFv+UZkmDHD6F0fE1sQA2Up0bLjgPQa1VQzoAaii5tZWaA==} @@ -829,7 +829,7 @@ packages: dependencies: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.14 - '@jridgewell/trace-mapping': 0.3.17 + '@jridgewell/trace-mapping': 0.3.18 /@jridgewell/resolve-uri@3.1.0: resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==} @@ -842,12 +842,6 @@ packages: /@jridgewell/sourcemap-codec@1.4.14: resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==} - /@jridgewell/trace-mapping@0.3.17: - resolution: {integrity: sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==} - dependencies: - '@jridgewell/resolve-uri': 3.1.0 - '@jridgewell/sourcemap-codec': 1.4.14 - /@jridgewell/trace-mapping@0.3.18: resolution: {integrity: sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==} dependencies: |