diff --git a/package.json b/package.json index 7629aa0d46..932476cb70 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,10 @@ "styles": "dev-utils styles", "variables": "dev-utils variables", "run-indexer": "dev-utils doc-index", - "generate-typedoc": "typedoc", - "prebuild-docs": "npm-run-all sandbox sassdoc run-indexer generate-typedoc", + "generate-typedoc": "dev-utils typedoc", + "build-docs-meta": "npm-run-all sandbox sassdoc run-indexer generate-typedoc", "build-docs": "yarn workspace documentation build", - "build-website": "npm-run-all prebuild-docs build-docs", + "build-website": "npm-run-all build-docs-meta build-docs", "build-dev-utils": "yarn workspace @react-md/dev-utils build", "build-ejs": "tsc -b tsconfig.ejs.json", "build-cjs": "tsc -b tsconfig.cjs.json", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 08e708bd49..b603ef5ce7 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -42,6 +42,7 @@ "sassdoc": "^2.7.2", "ts-morph": "^10.0.2", "typedoc": "^0.20.36", + "typedoc-plugin-sourcefile-url": "^1.0.6", "typescript": "^4.2.4" }, "devDependencies": { diff --git a/packages/dev-utils/src/cli.ts b/packages/dev-utils/src/cli.ts index 6473c99ab5..5626350a67 100644 --- a/packages/dev-utils/src/cli.ts +++ b/packages/dev-utils/src/cli.ts @@ -13,6 +13,7 @@ import { sandbox } from "./sandbox"; import { sassdoc } from "./sassdoc"; import { shared } from "./shared"; import { themes } from "./themes"; +import { typedoc } from "./typedoc"; import { umd } from "./umd"; import { copyStyles } from "./utils"; import { variables } from "./variables"; @@ -201,4 +202,10 @@ createCommand("watch") ) .action(({ cjs = false }) => watch(cjs)); +createCommand("typedoc") + .description( + "A wrapper for the typedoc cli that is really used to just work with vercel deployments" + ) + .action(() => typedoc()); + commander.parse(process.argv); diff --git a/packages/dev-utils/src/typedoc.ts b/packages/dev-utils/src/typedoc.ts new file mode 100644 index 0000000000..bc4aad207f --- /dev/null +++ b/packages/dev-utils/src/typedoc.ts @@ -0,0 +1,13 @@ +import { execSync } from "child_process"; +import log from "loglevel"; + +export function typedoc(): void { + const commitSha = process.env.VERCEL_GIT_COMMIT_SHA; + let command = "typedoc"; + if (commitSha) { + command = `${command} --sourcefile-url-prefix "https://github.com/mlaursen/react-md/blob/${commitSha}/"`; + } + + log.info(command); + execSync(command, { stdio: "inherit" }); +} diff --git a/packages/documentation/package.json b/packages/documentation/package.json index e7c4797d3d..999386013f 100644 --- a/packages/documentation/package.json +++ b/packages/documentation/package.json @@ -4,9 +4,8 @@ "description": "The documentation site for react-md", "private": true, "scripts": { - "prebuild": "npm-run-all run-indexer update-env", + "prebuild": "node updateProdEnv.js", "run-indexer": "dev-utils doc-index", - "update-env": "node updateProdEnv.js", "dev": "cross-env NEXT_TELEMETRY_DISABLED=1 next dev", "build": "cross-env NEXT_TELEMETRY_DISABLED=1 next build", "start": "cross-env NEXT_TELEMETRY_DISABLED=1 NODE_ENV=production next start", diff --git a/yarn.lock b/yarn.lock index c04149c067..f6219cf7bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14420,6 +14420,11 @@ typedoc-default-themes@^0.12.10: resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz#614c4222fe642657f37693ea62cad4dafeddf843" integrity sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA== +typedoc-plugin-sourcefile-url@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/typedoc-plugin-sourcefile-url/-/typedoc-plugin-sourcefile-url-1.0.6.tgz#e0199806616fe6370b3cb7889f647df698438b96" + integrity sha512-xHq9DzkoQywS7FyPneMm2/Hr9GRoCpjSQXkVN0W6SCJKP7fguqg2tasgh+8l5/mW6YSYvqCqEbkSYLbuD4Y6gA== + typedoc@^0.20.36: version "0.20.36" resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.20.36.tgz#ee5523c32f566ad8283fc732aa8ea322d1a45f6a"