Skip to content

Commit

Permalink
Move website asset to astro and disable docusaurus build (#4867)
Browse files Browse the repository at this point in the history
Next step, just moving the files that were also used by astro out of
docusaurus. Will delete the docusausurs package in a later PR to keep
change minimal.
  • Loading branch information
timotheeguerin authored Oct 25, 2024
1 parent b8d4972 commit 74ed99a
Show file tree
Hide file tree
Showing 95 changed files with 74 additions and 74 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/website-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ jobs:
run: pnpm exec playwright install
working-directory: packages/playground-website

# - name: Build
# run: pnpm --filter "@typespec/website..." run build
# env:
# # Only when deploying to microsoft.github.io/typespec. For typespec.io use the default value.
# # TYPESPEC_WEBSITE_BASE_PATH: "/typespec/"
# NODE_OPTIONS: "--max_old_space_size=4096"

# - name: Upload artifact
# uses: actions/upload-pages-artifact@v1
# with:
# path: ./packages/website/build

- name: Build
run: pnpm --filter "@typespec/website-astro..." run build

Expand Down
37 changes: 0 additions & 37 deletions packages/website/.scripts/docusaurus-build.mjs

This file was deleted.

7 changes: 0 additions & 7 deletions packages/website/.scripts/tsconfig.json

This file was deleted.

3 changes: 1 addition & 2 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "npm run regen-all-packages-docs && node .scripts/docusaurus-build.mjs 2>&1",
"build:skip": "npm run regen-all-packages-docs && node .scripts/docusaurus-build.mjs 2>&1",
"swizzle": "docusaurus swizzle",
"clear": "docusaurus clear",
"clean": "docusaurus clear",
Expand All @@ -18,7 +18,6 @@
"update-playground-versions": "node ./.scripts/update-playground-versions.mjs",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "node ./.scripts/regen-compiler-docs.mjs",
"regen-all-packages-docs": "pnpm -w --filter \"@typespec/website...\" --filter \"!@typespec/monorepo\" run regen-docs"
},
"keywords": [],
Expand Down
40 changes: 38 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
src/content/docs/docs/
src/content/docs/docs/next/
src/content/blog/
src/assets/
public/

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node
// @ts-check
import { NodeHost, joinPaths, logDiagnostics } from "@typespec/compiler";
import { generateJsApiDocs, resolveLibraryRefDocsBase } from "@typespec/tspd/ref-doc";
import {
Expand All @@ -13,7 +11,7 @@ import { writeFile } from "fs/promises";
import { dirname, join, resolve } from "path";
import { fileURLToPath } from "url";

export const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
export const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");

const diagnostics = new Map();

Expand Down Expand Up @@ -60,13 +58,14 @@ async function generateCompilerDocs() {
namespaces: { include: ["TypeSpec"] },
});
assert(results, "Unexpected ref doc should have been resolved for compiler.");
/** @type {*} */
const [refDoc, diagnostics] = results;
const renderer = new CompilerDocusaurusRenderer(refDoc);
const renderer = new CompilerDocusaurusRenderer(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);
const dataTypeContent = renderDataTypes(renderer, refDoc, { title: "Built-in Data types" });
const dataTypeContent = renderDataTypes(renderer, refDoc as any, {
title: "Built-in Data types",
});
assert(dataTypeContent, "Unexpected data type file shouldn't be empty for compiler.");
await writeFile(join(outputDir, "built-in-data-types.md"), dataTypeContent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ console.log("Current versions:", current);

async function getMajorMinorVersion() {
const version = JSON.parse(
(await readFile(resolve(__dirname, "../../compiler/package.json"))).toString(),
(await readFile(resolve(__dirname, "../compiler/package.json"))).toString(),
).version;
const [major, minor] = version.split(".");
return `${major}.${minor}.x`;
Expand Down
24 changes: 20 additions & 4 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
"private": true,
"version": "0.0.1",
"scripts": {
"copy": "cp -r ../docs/. ./src/content/docs/docs && cp -r ../packages/website/static/. ./src/assets && cp -r ../packages/website/static/img/. ./public/img && cp ../packages/website/static/1ds-init.js ./public/1ds-init.js && cp -r ../blog/. ./src/content/blog",
"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 copy && astro check --minimumFailingSeverity warning && astro build",
"build:web": "pnpm regen-all-packages-docs && pnpm copy && astro check --minimumFailingSeverity warning && astro build",
"preview": "astro preview",
"astro": "astro"
"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"
},
"imports": {
"@theme/TabItem": "./src/components/docusaurus/tab-item.ts"
Expand Down Expand Up @@ -45,9 +48,22 @@
"@types/react": "~18.3.11",
"@types/react-dom": "~18.3.0",
"@types/remark-heading-id": "^1.0.0",
"@typespec/compiler": "workspace:~",
"@typespec/events": "workspace:~",
"@typespec/http": "workspace:~",
"@typespec/internal-build-utils": "workspace:~",
"@typespec/json-schema": "workspace:~",
"@typespec/openapi": "workspace:~",
"@typespec/openapi3": "workspace:~",
"@typespec/playground-website": "workspace:*",
"@typespec/website": "workspace:*",
"@typespec/protobuf": "workspace:~",
"@typespec/rest": "workspace:~",
"@typespec/spec": "workspace:*",
"@typespec/sse": "workspace:~",
"@typespec/streams": "workspace:~",
"@typespec/tspd": "workspace:~",
"@typespec/versioning": "workspace:~",
"@typespec/xml": "workspace:~",
"astro-expressive-code": "^0.37.0",
"rehype-mermaid": "^3.0.0",
"remark-heading-id": "^1.0.1",
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
8 changes: 8 additions & 0 deletions website/src/assets/img/favicon.svg
Binary file added website/src/assets/img/social.png
2 changes: 1 addition & 1 deletion website/src/components/footer/footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const { class: className } = Astro.props;
<MicrosoftLogo />
Microsoft
</div>
<div${new Date().getFullYear()} Microsoft</div>
<div{new Date().getFullYear()} Microsoft</div>
</div>
<div class="general-links">
<div>
Expand Down

0 comments on commit 74ed99a

Please sign in to comment.