Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
doc: handle generation error
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Jul 4, 2024
1 parent 130de40 commit 26519ba
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 18 deletions.
21 changes: 16 additions & 5 deletions www/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ import * as fs from "fs";
import * as TypeDoc from "typedoc";
import config from "./config";

process.on("uncaughtException", (err) => {
restoreCode();
console.error("There was an uncaught error", err);
process.exit(1);
});
process.on("unhandledRejection", (reason, promise) => {
restoreCode();
console.error("Unhandled Rejection at:", promise, "reason:", reason);
process.exit(1);
});

type CliCommand = {
name: string;
hidden: boolean;
Expand Down Expand Up @@ -36,8 +47,8 @@ function useLinkHashes(module: TypeDoc.DeclarationReflection) {
}

try {
await configureLogger();
await patchCode();
configureLogger();
patchCode();
if (!cmd || cmd === "components") {
const components = await buildComponents();
const sdks = await buildSdk();
Expand Down Expand Up @@ -67,7 +78,7 @@ try {
if (!cmd || cmd === "cli") await generateCliDoc();
if (!cmd || cmd === "examples") await generateExamplesDocs();
} finally {
await restoreCode();
restoreCode();
}

function generateCliDoc() {
Expand Down Expand Up @@ -1700,7 +1711,7 @@ function configureLogger() {
console.debug = () => {};
}

async function patchCode() {
function patchCode() {
// patch Input
fs.renameSync(
"../pkg/platform/src/components/input.ts",
Expand All @@ -1727,7 +1738,7 @@ async function patchCode() {
);
}

async function restoreCode() {
function restoreCode() {
// restore Input
fs.renameSync(
"../pkg/platform/src/components/input.ts.bk",
Expand Down
2 changes: 1 addition & 1 deletion www/src/content/docs/docs/component/aws/astro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
4 changes: 2 additions & 2 deletions www/src/content/docs/docs/component/aws/cdn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down Expand Up @@ -483,7 +483,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
2 changes: 1 addition & 1 deletion www/src/content/docs/docs/component/aws/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
2 changes: 1 addition & 1 deletion www/src/content/docs/docs/component/aws/nuxt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
2 changes: 1 addition & 1 deletion www/src/content/docs/docs/component/aws/remix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
4 changes: 2 additions & 2 deletions www/src/content/docs/docs/component/aws/router.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import InlineSection from '../../../../../../src/components/tsdoc/InlineSection.
<div class="tsdoc">

<Section type="about">
The `Router` component lets you use a CloudFront distribution to direct requests to various parts of your application.
The `Router` component lets you use a CloudFront distribution to direct requests to various parts of your application.
The `routes` prop can route requests to function URLs, different domains, or any component that has an associated URL.

#### Minimal example
Expand Down Expand Up @@ -204,7 +204,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
2 changes: 1 addition & 1 deletion www/src/content/docs/docs/component/aws/solid-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
2 changes: 1 addition & 1 deletion www/src/content/docs/docs/component/aws/static-site.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
2 changes: 1 addition & 1 deletion www/src/content/docs/docs/component/aws/svelte-kit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ To manually set up a domain on an unsupported provider, you'll need to:
</InlineSection>
The DNS provider to use for the domain. Defaults to the AWS.
Takes an adapter that can create the DNS records on the provider. This can automate
Takes an adapter that can create the DNS records on the provider. This can automate
validating the domain and setting up the DNS routing.
Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
Expand Down
4 changes: 2 additions & 2 deletions www/src/content/docs/docs/reference/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ console: {
target(event) {
if (event.type === "pushed" && event.branch === "main") {
return {
stage: "production"
runner: { engine: "codebuild", compute: "large" };
stage: "production",
runner: { engine: "codebuild", compute: "large" }
};
}
}
Expand Down

0 comments on commit 26519ba

Please sign in to comment.