-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Migrate website to astro [Step 1] (#4587)
Progress for #2564 Changes: - Decided to cut versioning for now. Starlight doesn't support well now and would be a decent amount of work. Our doc have been quite stable and this slows down the build significantly.\ The plan is as follow 1. Merge this as a parallel build to the docusaurus website 2. Add blog back 3. Cleanup things (like migrate more things out of fluentui react components) 4. Switch the website to use this one 5. If we are happy delete docusaurus
- Loading branch information
1 parent
3f7204c
commit 0c3cd36
Showing
126 changed files
with
8,528 additions
and
1,643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: internal | ||
packages: | ||
- "@typespec/http" | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: feature | ||
packages: | ||
- "@typespec/playground" | ||
--- | ||
|
||
Expose state storage helper via its own exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
--- | ||
id: emitters | ||
title: Emitters | ||
--- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
id: installation | ||
title: Installation | ||
slug: / | ||
slug: docs | ||
--- | ||
|
||
## Requirements | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
--- | ||
id: aliases | ||
title: Aliases | ||
--- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Temporary to help with migration | ||
src/content/docs/docs/ | ||
src/content/docs/docs/next/ | ||
src/assets/ | ||
public/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env node | ||
import { runOrExit } from "@typespec/internal-build-utils"; | ||
|
||
if (process.env.TYPESPEC_SKIP_DOCUSAURUS_BUILD?.toLowerCase() === "true") { | ||
console.log("Skipping docusaurus build: TYPESPEC_SKIP_DOCUSAURUS_BUILD=true"); | ||
process.exit(0); | ||
} | ||
|
||
await runOrExit("npm", ["run", "build:web"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Starlight Starter Kit: Basics | ||
|
||
[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build) | ||
|
||
``` | ||
npm create astro@latest -- --template starlight | ||
``` | ||
|
||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics) | ||
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics) | ||
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics) | ||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs) | ||
|
||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun! | ||
## 🚀 Project Structure | ||
|
||
Inside of your Astro + Starlight project, you'll see the following folders and files: | ||
|
||
``` | ||
. | ||
├── public/ | ||
├── src/ | ||
│ ├── assets/ | ||
│ ├── content/ | ||
│ │ ├── docs/ | ||
│ │ └── config.ts | ||
│ └── env.d.ts | ||
├── astro.config.mjs | ||
├── package.json | ||
└── 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:4321` | | ||
| `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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default { | ||
// cspell:disable-next-line | ||
appId: "V3T9EUVLJR", | ||
// This is the search API KEY this can be public https://support.algolia.com/hc/en-us/articles/18966776061329-Can-the-search-API-key-be-public | ||
apiKey: "bae16ae67ddbe24e700ac20d192ad20f", | ||
indexName: "typespec", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// @ts-check | ||
import react from "@astrojs/react"; | ||
import starlight from "@astrojs/starlight"; | ||
import { defineConfig } from "astro/config"; | ||
import { readFile } from "fs/promises"; | ||
import { resolve } from "path"; | ||
import rehypeMermaid from "rehype-mermaid"; | ||
import remarkHeadingID from "remark-heading-id"; | ||
import { resolveSideBars } from "./sidebars"; | ||
import tspTryitCode from "./src/plugins/tsp-tryit-code"; | ||
|
||
const base = process.env.TYPESPEC_WEBSITE_BASE_PATH ?? "/"; | ||
|
||
const grammarPath = resolve(import.meta.dirname, "../../grammars/typespec.json"); | ||
const tspGrammar = JSON.parse((await readFile(grammarPath)).toString()); | ||
|
||
const typespecLang = { | ||
...tspGrammar, | ||
id: "typespec", | ||
scopeName: "source.tsp", | ||
path: grammarPath, | ||
aliases: ["typespec", "tsp"], | ||
}; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
base, | ||
trailingSlash: "always", | ||
integrations: [ | ||
starlight({ | ||
title: "TypeSpec", | ||
sidebar: await resolveSideBars(), | ||
customCss: ["./src/css/custom.css"], | ||
components: { | ||
Header: "./src/components/header/header.astro", | ||
}, | ||
expressiveCode: { | ||
themes: ["one-light", "one-dark-pro"], | ||
styleOverrides: { | ||
frames: { | ||
frameBoxShadowCssValue: "", | ||
}, | ||
}, | ||
plugins: [tspTryitCode(base + "playground/")], | ||
}, | ||
head: [ | ||
{ | ||
tag: "script", | ||
attrs: { | ||
src: "https://consentdeliveryfd.azurefd.net/mscc/lib/v2/wcp-consent.js", | ||
}, | ||
}, | ||
{ | ||
tag: "script", | ||
attrs: { | ||
type: "module", | ||
async: true, | ||
src: "1ds-init.js", | ||
}, | ||
}, | ||
], | ||
plugins: [], | ||
}), | ||
react(), | ||
], | ||
markdown: { | ||
// @ts-expect-error wrong type | ||
remarkPlugins: [remarkHeadingID], | ||
rehypePlugins: [rehypeMermaid], | ||
shikiConfig: { | ||
langs: [typespecLang], | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.