Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC astro #2562

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,715 changes: 1,519 additions & 196 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ dictionaries:
- node
- typescript
words:
- astro
- astrojs
- autorest
- azsdkengsys
- azurecr
Expand Down Expand Up @@ -55,6 +57,7 @@ words:
- safeint
- segmentof
- sfixed
- shiki
- sint
- ssvs
- strs
Expand Down
4 changes: 4 additions & 0 deletions packages/compiler/src/server/tmlanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,4 +889,8 @@ export async function main() {
});
await mkdir("./dist", { recursive: true });
await writeFile("./dist/typespec.tmLanguage", plist);
const json = await tm.emitJSON(grammar, {
errorSourceFilePath: resolve("./src/tmlanguage.ts"),
});
await writeFile("./dist/typespec.tmLanguage.json", json);
}
21 changes: 21 additions & 0 deletions packages/website-astro/.gitignore
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions packages/website-astro/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions packages/website-astro/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
53 changes: 53 additions & 0 deletions packages/website-astro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 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)

> 🧑‍🚀 **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).
47 changes: 47 additions & 0 deletions packages/website-astro/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// @ts-check
import starlight from "@astrojs/starlight";
import { defineConfig } from "astro/config";
import { readFileSync } from "fs";
import { dirname, resolve } from "path";
import { fileURLToPath } from "url";

const websiteRoot = dirname(fileURLToPath(import.meta.url));

const grammarPath = resolve(websiteRoot, "../compiler/dist/typespec.tmLanguage.json");
const tspGrammar = JSON.parse(readFileSync(grammarPath).toString());

const myLanguage = {
id: "typespec",
scopeName: "source.tsp",
path: grammarPath,
grammar: tspGrammar,
aliases: ["typespec", "tsp"],
};

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: "My Docs",
social: {
github: "https://github.com/withastro/starlight",
},
sidebar: [
{
label: `Next 🚧`,
autogenerate: { directory: "current" },
},
{
label: `Latest 🚀`,
autogenerate: { directory: "current" },
},
],
}),
],
markdown: {
shikiConfig: {
theme: "one-dark-pro",
langs: [myLanguage],
},
},
});
18 changes: 18 additions & 0 deletions packages/website-astro/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@typespec/website-astro",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"copy-docs": "cp -r ../../docs/ ./src/content/docs/current/"
},
"dependencies": {
"@astrojs/starlight": "^0.11.0",
"astro": "^3.2.3",
"sharp": "^0.32.5"
}
}
1 change: 1 addition & 0 deletions packages/website-astro/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/website-astro/src/assets/houston.webp
Binary file not shown.
7 changes: 7 additions & 0 deletions packages/website-astro/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineCollection } from 'astro:content';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
};
Loading