diff --git a/.github/workflows/website-gh-pages.yml b/.github/workflows/website-gh-pages.yml index 18aa59b372..0c4ea28577 100644 --- a/.github/workflows/website-gh-pages.yml +++ b/.github/workflows/website-gh-pages.yml @@ -33,7 +33,6 @@ jobs: - name: Install browsers run: pnpm exec playwright install - working-directory: packages/playground-website - name: Build run: pnpm --filter "@typespec/website..." run build diff --git a/eng/tsp-core/pipelines/jobs/website.yml b/eng/tsp-core/pipelines/jobs/website.yml new file mode 100644 index 0000000000..1756ac1f8c --- /dev/null +++ b/eng/tsp-core/pipelines/jobs/website.yml @@ -0,0 +1,11 @@ +steps: + - template: /eng/tsp-core/pipelines/templates/install.yml + + - script: pnpm exec playwright install + displayName: Install browsers + + - script: pnpm --filter "@typespec/website..." run build + displayName: Build + + - script: node eng/common/scripts/check-for-changed-files.js + displayName: Check Git Status For Changed Files diff --git a/eng/tsp-core/pipelines/stages/ci-stages.yml b/eng/tsp-core/pipelines/stages/ci-stages.yml index 8b1488182a..52ac0f19f8 100644 --- a/eng/tsp-core/pipelines/stages/ci-stages.yml +++ b/eng/tsp-core/pipelines/stages/ci-stages.yml @@ -61,6 +61,16 @@ stages: nodeVersion: $(nodeVersion) os: linux + - job: website + displayName: Website + pool: + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) + os: linux + + steps: + - template: /eng/tsp-core/pipelines/jobs/website.yml + - template: /eng/tsp-core/pipelines/jobs/publish-artifacts.yml - template: /eng/tsp-core/pipelines/jobs/e2e.yml diff --git a/package.json b/package.json index e18ce113f4..3fb1fbd214 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "eslint-plugin-vitest": "^0.5.4", "micromatch": "^4.0.8", "picocolors": "~1.1.0", + "playwright": "^1.48.2", "prettier": "~3.3.3", "prettier-plugin-astro": "^0.14.1", "prettier-plugin-organize-imports": "~4.1.0", diff --git a/packages/tspd/package.json b/packages/tspd/package.json index 8708254f0d..22d6678acc 100644 --- a/packages/tspd/package.json +++ b/packages/tspd/package.json @@ -24,16 +24,16 @@ "main": "./dist/src/index.js", "exports": { ".": { - "types": "./dist/src/index.d.ts", - "default": "./dist/src/index.js" + "import": "./dist/src/index.js" }, "./ref-doc": { - "types": "./dist/src/ref-doc/index.d.ts", - "default": "./dist/src/ref-doc/index.js" + "import": "./dist/src/ref-doc/index.js" }, "./ref-doc/emitters/docusaurus": { - "types": "./dist/src/ref-doc/emitters/docusaurus.d.ts", - "default": "./dist/src/ref-doc/emitters/docusaurus.js" + "import": "./dist/src/ref-doc/emitters/docusaurus.js" + }, + "./ref-doc/emitters/starlight": { + "import": "./dist/src/ref-doc/emitters/starlight.js" } }, "engines": { diff --git a/packages/tspd/src/ref-doc/emitters/starlight.ts b/packages/tspd/src/ref-doc/emitters/starlight.ts index 49a0d5ef73..2187c2d168 100644 --- a/packages/tspd/src/ref-doc/emitters/starlight.ts +++ b/packages/tspd/src/ref-doc/emitters/starlight.ts @@ -20,7 +20,7 @@ import { MarkdownRenderer, groupByNamespace } from "./markdown.js"; * Render doc to a markdown using docusaurus addons. */ export function renderToAstroStarlightMarkdown(refDoc: TypeSpecRefDoc): Record { - const renderer = new DocusaurusRenderer(refDoc); + const renderer = new StarlightRenderer(refDoc); const files: Record = { "index.mdx": renderIndexFile(renderer, refDoc), }; @@ -52,7 +52,7 @@ export function renderToAstroStarlightMarkdown(refDoc: TypeSpecRefDoc): Record x.operations.length > 0 || x.interfaces.length > 0)) { @@ -152,7 +152,7 @@ export type DataTypeRenderOptions = { }; export function renderDataTypes( - renderer: DocusaurusRenderer, + renderer: StarlightRenderer, refDoc: TypeSpecRefDoc, options?: DataTypeRenderOptions, ): string | undefined { @@ -193,7 +193,7 @@ export function renderDataTypes( } function renderEmitter( - renderer: DocusaurusRenderer, + renderer: StarlightRenderer, refDoc: TypeSpecLibraryRefDoc, ): string | undefined { if (refDoc.emitter?.options === undefined) { @@ -209,7 +209,7 @@ function renderEmitter( return renderMarkdowDoc(content, 2); } function renderLinter( - renderer: DocusaurusRenderer, + renderer: StarlightRenderer, refDoc: TypeSpecLibraryRefDoc, ): string | undefined { if (refDoc.linter === undefined) { @@ -225,7 +225,7 @@ function renderLinter( return renderMarkdowDoc(content, 2); } -export class DocusaurusRenderer extends MarkdownRenderer { +export class StarlightRenderer extends MarkdownRenderer { headingTitle(item: NamedTypeRefDoc): string { // Set an explicit anchor id. return `${inlinecode(item.name)} {#${item.id}}`; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 794d936af2..3ae8e3a7cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -74,6 +74,9 @@ importers: picocolors: specifier: ~1.1.0 version: 1.1.0 + playwright: + specifier: ^1.48.2 + version: 1.48.2 prettier: specifier: ~3.3.3 version: 3.3.3 @@ -2073,7 +2076,7 @@ importers: version: 0.37.0(astro@4.16.8(@types/node@22.7.5)(rollup@4.24.0)(terser@5.34.1)(typescript@5.6.3)) rehype-mermaid: specifier: ^3.0.0 - version: 3.0.0(playwright@1.48.0) + version: 3.0.0(playwright@1.48.2) remark-heading-id: specifier: ^1.0.1 version: 1.0.1 @@ -9755,11 +9758,21 @@ packages: engines: {node: '>=18'} hasBin: true + playwright-core@1.48.2: + resolution: {integrity: sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA==} + engines: {node: '>=18'} + hasBin: true + playwright@1.48.0: resolution: {integrity: sha512-qPqFaMEHuY/ug8o0uteYJSRfMGFikhUysk8ZvAtfKmUK3kc/6oNl/y3EczF8OFGYIi/Ex2HspMfzYArk6+XQSA==} engines: {node: '>=18'} hasBin: true + playwright@1.48.2: + resolution: {integrity: sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==} + engines: {node: '>=18'} + hasBin: true + plist@3.1.0: resolution: {integrity: sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==} engines: {node: '>=10.4.0'} @@ -20982,12 +20995,12 @@ snapshots: merge2@1.4.1: {} - mermaid-isomorphic@3.0.0(playwright@1.48.0): + mermaid-isomorphic@3.0.0(playwright@1.48.2): dependencies: '@fortawesome/fontawesome-free': 6.6.0 mermaid: 11.3.0 optionalDependencies: - playwright: 1.48.0 + playwright: 1.48.2 transitivePeerDependencies: - supports-color @@ -21995,12 +22008,20 @@ snapshots: playwright-core@1.48.0: {} + playwright-core@1.48.2: {} + playwright@1.48.0: dependencies: playwright-core: 1.48.0 optionalDependencies: fsevents: 2.3.2 + playwright@1.48.2: + dependencies: + playwright-core: 1.48.2 + optionalDependencies: + fsevents: 2.3.2 + plist@3.1.0: dependencies: '@xmldom/xmldom': 0.8.10 @@ -22426,19 +22447,19 @@ snapshots: '@types/hast': 3.0.4 hast-util-format: 1.1.0 - rehype-mermaid@3.0.0(playwright@1.48.0): + rehype-mermaid@3.0.0(playwright@1.48.2): dependencies: '@types/hast': 3.0.4 hast-util-from-html-isomorphic: 2.0.0 hast-util-to-text: 4.0.2 - mermaid-isomorphic: 3.0.0(playwright@1.48.0) + mermaid-isomorphic: 3.0.0(playwright@1.48.2) mini-svg-data-uri: 1.4.4 space-separated-tokens: 2.0.2 unified: 11.0.5 unist-util-visit-parents: 6.0.1 vfile: 6.0.3 optionalDependencies: - playwright: 1.48.0 + playwright: 1.48.2 transitivePeerDependencies: - supports-color diff --git a/website/.scripts/regen-compiler-docs.ts b/website/.scripts/regen-compiler-docs.ts index f1335970e8..69646819f8 100644 --- a/website/.scripts/regen-compiler-docs.ts +++ b/website/.scripts/regen-compiler-docs.ts @@ -1,10 +1,10 @@ import { NodeHost, joinPaths, logDiagnostics } from "@typespec/compiler"; import { generateJsApiDocs, resolveLibraryRefDocsBase } from "@typespec/tspd/ref-doc"; import { - DocusaurusRenderer, + StarlightRenderer, renderDataTypes, renderDecoratorFile, -} from "@typespec/tspd/ref-doc/emitters/docusaurus"; +} from "@typespec/tspd/ref-doc/emitters/starlight"; import assert from "assert"; import { writeFile } from "fs/promises"; @@ -15,7 +15,7 @@ export const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../.." const diagnostics = new Map(); -class CompilerDocusaurusRenderer extends DocusaurusRenderer { +class CompilerRenderer extends StarlightRenderer { /** * @param {import("../../tspd/dist/src/ref-doc/types.js").RefDocEntity} type */ @@ -59,7 +59,7 @@ async function generateCompilerDocs() { }); assert(results, "Unexpected ref doc should have been resolved for compiler."); const [refDoc, diagnostics] = results; - const renderer = new CompilerDocusaurusRenderer(refDoc as any); + const renderer = new CompilerRenderer(refDoc as any); const decoratorContent = renderDecoratorFile(renderer, refDoc, { title: "Built-in Decorators" }); assert(decoratorContent, "Unexpected decorator file shouldn't be empty for compiler."); await writeFile(join(outputDir, "built-in-decorators.md"), decoratorContent); diff --git a/website/src/content/docs/docs/standard-library/built-in-data-types.md b/website/src/content/docs/docs/standard-library/built-in-data-types.md index f9d6801f31..c167efacde 100644 --- a/website/src/content/docs/docs/standard-library/built-in-data-types.md +++ b/website/src/content/docs/docs/standard-library/built-in-data-types.md @@ -1,7 +1,5 @@ --- title: "Built-in Data types" -toc_min_heading_level: 2 -toc_max_heading_level: 3 --- ## TypeSpec ### `Array` {#Array}