Skip to content

Commit

Permalink
Move docs under astro (#4928)
Browse files Browse the repository at this point in the history
Current setup makes it very hard to iterate and see output in website as
you have to always `pnpm copy` after a change

last item for #2564
  • Loading branch information
timotheeguerin authored Oct 31, 2024
1 parent 151be7f commit 67a0680
Show file tree
Hide file tree
Showing 164 changed files with 48 additions and 100 deletions.
16 changes: 16 additions & 0 deletions .chronus/changes/move-docs-2024-9-31-18-4-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: internal
packages:
- "@typespec/events"
- "@typespec/http"
- "@typespec/json-schema"
- "@typespec/openapi"
- "@typespec/openapi3"
- "@typespec/protobuf"
- "@typespec/rest"
- "@typespec/sse"
- "@typespec/streams"
- "@typespec/versioning"
- "@typespec/xml"
---
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ vite.config.ts.timestamp-*

# Api extractor
packages/*/etc/
docs/**/js-api/
website/src/content/docs/current/**/js-api/
**/docs/**/js-api/

# VS Code test web temp files
.vscode-test-web/
Expand Down
13 changes: 3 additions & 10 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,15 @@ packages/compiler/test/formatter/**/*.tsp

# That is an example with error and can't be formatted
packages/samples/specs/local-typespec/test.tsp
packages/website/build/
packages/website/versioned_sidebars/
packages/website/versions.json

spec.emu.html

# Auto generated reference docs.
docs/**/reference/
docs/standard-library/built-in-decorators.md
docs/standard-library/built-in-data-types.md
packages/website/versioned_docs/**/reference/
packages/website/versioned_docs/**/standard-library/built-in-decorators.md
packages/website/versioned_docs/**/standard-library/built-in-data-types.md
website/src/content/docs/docs/**/reference/
website/src/content/docs/docs/standard-library/built-in-decorators.md
website/src/content/docs/docs/standard-library/built-in-data-types.md

# Auto generated version list
packages/website/playground-versions.json
website/playground-versions.json

# Auto generated built-in template list
Expand Down
13 changes: 13 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Docs moved

Docs have moved into the website folder [../website/src/content/docs/docs](../website/src/content/docs/docs)

### For reference

This is an unfortunate current limitation of astro starlight. If things change in the future this is the current limitations:

- content folder MUST be under the astro website package(default src/content)
- astro allows symlink but it MUST be the whole collection(e.g. `src/content/docs`)
- starlight only way to put docs under a `docs/` path is to have another `docs/` folder under the collection one `src/content/docs` (resulting in `src/content/docs/docs`)

If any of the issues above is improve we could potentially move the docs back here or reduce at least some nesting
63 changes: 0 additions & 63 deletions eng/common/scripts/check-docs.js

This file was deleted.

4 changes: 0 additions & 4 deletions eng/tsp-core/pipelines/jobs/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ steps:
- script: node eng/common/scripts/check-for-changed-files.js
displayName: Check Git Status For Changed Files

- script: node eng/common/scripts/check-docs.js
displayName: Check docs
condition: ne(variables['Agent.OS'], 'Windows_NT')

# Unlink node_modules folders to significantly improve performance of subsequent tasks
# which need to walk the directory tree (and are hardcoded to follow symlinks).
- script: pnpm run purge
Expand Down
2 changes: 1 addition & 1 deletion packages/events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"test-official": "vitest run --coverage --reporter=junit --reporter=default --no-file-parallelism",
"lint": "eslint . --ext .ts --max-warnings=0",
"lint:fix": "eslint . --fix --ext .ts",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/events/reference"
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/events/reference"
},
"files": [
"lib/*.tsp",
Expand Down
2 changes: 1 addition & 1 deletion packages/http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/http/reference"
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/http/reference"
},
"files": [
"lib/**/*.tsp",
Expand Down
2 changes: 1 addition & 1 deletion packages/json-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/emitters/json-schema/reference",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/json-schema/reference",
"api-extractor": "api-extractor run --local --verbose"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/openapi/reference",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/openapi/reference",
"api-extractor": "api-extractor run --local --verbose"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/emitters/openapi3/reference",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/openapi3/reference",
"regen-specs": "cross-env RECORD=true vitest run",
"gen-version": "node scripts/generate-version.js"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/protobuf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/emitters/protobuf/reference"
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/protobuf/reference"
},
"peerDependencies": {
"@typespec/compiler": "workspace:~"
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/rest/reference"
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/rest/reference"
},
"files": [
"lib/*.tsp",
Expand Down
2 changes: 1 addition & 1 deletion packages/sse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"test-official": "vitest run --coverage --reporter=junit --reporter=default --no-file-parallelism",
"lint": "eslint . --ext .ts --max-warnings=0",
"lint:fix": "eslint . --fix --ext .ts",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/sse/reference"
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/sse/reference"
},
"files": [
"lib/*.tsp",
Expand Down
2 changes: 1 addition & 1 deletion packages/streams/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"test-official": "vitest run --coverage --reporter=junit --reporter=default --no-file-parallelism",
"lint": "eslint . --ext .ts --max-warnings=0",
"lint:fix": "eslint . --fix --ext .ts",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/streams/reference"
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/streams/reference"
},
"files": [
"lib/*.tsp",
Expand Down
2 changes: 1 addition & 1 deletion packages/versioning/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/versioning/reference"
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/versioning/reference"
},
"files": [
"lib/*.tsp",
Expand Down
2 changes: 1 addition & 1 deletion packages/xml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"test-official": "vitest run --coverage --reporter=junit --reporter=default --no-file-parallelism",
"lint": "eslint . --ext .ts --max-warnings=0",
"lint:fix": "eslint . --fix --ext .ts",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/xml/reference",
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/xml/reference",
"api-extractor": "api-extractor run --local --verbose"
},
"files": [
Expand Down
5 changes: 0 additions & 5 deletions website/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion website/.scripts/regen-compiler-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ process.exit(exitCode);

async function generateCompilerDocs() {
const compilerPath = join(repoRoot, "packages/compiler");
const outputDir = join(repoRoot, "docs/standard-library");
const outputDir = join(repoRoot, "website/src/content/docs/docs/standard-library");
const results = await resolveLibraryRefDocsBase(compilerPath, {
namespaces: { include: ["TypeSpec"] },
});
Expand Down
7 changes: 3 additions & 4 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
{
"name": "@typespec/website-astro",
"name": "@typespec/website",
"type": "module",
"private": true,
"version": "0.0.1",
"scripts": {
"copy": "cp -r ../docs/. ./src/content/docs/docs && cp -r ../blog/. ./src/content/blog",
"clean": "rimraf ./dist ./temp ./.astro",
"dev": "astro dev",
"start": "astro dev",
"build": "tsx ./.scripts/build.ts",
"build:web": "pnpm regen-all-packages-docs && pnpm copy && astro check --minimumFailingSeverity warning && astro build",
"build:web": "pnpm regen-all-packages-docs && astro check --minimumFailingSeverity warning && astro build",
"preview": "astro preview",
"astro": "astro",
"update-playground-versions": "tsx ./.scripts/update-playground-versions.ts",
"regen-docs": "tsx ./.scripts/regen-compiler-docs.ts",
"regen-all-packages-docs": "pnpm -w --filter \"@typespec/website-astro...\" --filter \"!@typespec/monorepo\" run regen-docs"
"regen-all-packages-docs": "pnpm -w --filter \"@typespec/website...\" --filter \"!@typespec/monorepo\" run regen-docs"
},
"imports": {
"@theme/TabItem": "./src/components/docusaurus/tab-item.ts"
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.

0 comments on commit 67a0680

Please sign in to comment.