mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-30 17:37:09 +02:00
feat(v2): Implement proof-of-concept Docusaurus Debug Dashboard (#2928)
* feat(v2): Implement proof-of-concept Docusaurus Debug Dashboard * Ensure we show the exact boolean
This commit is contained in:
parent
729b3cae9b
commit
6e37d3fb12
9 changed files with 127 additions and 0 deletions
|
@ -18,6 +18,7 @@ packages/docusaurus-plugin-client-redirects/lib/
|
||||||
packages/docusaurus-plugin-content-blog/lib/
|
packages/docusaurus-plugin-content-blog/lib/
|
||||||
packages/docusaurus-plugin-content-docs/lib/
|
packages/docusaurus-plugin-content-docs/lib/
|
||||||
packages/docusaurus-plugin-content-pages/lib/
|
packages/docusaurus-plugin-content-pages/lib/
|
||||||
|
packages/docusaurus-plugin-debug/lib/
|
||||||
packages/docusaurus-plugin-sitemap/lib/
|
packages/docusaurus-plugin-sitemap/lib/
|
||||||
packages/docusaurus-plugin-ideal-image/lib/
|
packages/docusaurus-plugin-ideal-image/lib/
|
||||||
packages/docusaurus-plugin-ideal-image/copyUntypedFiles.js
|
packages/docusaurus-plugin-ideal-image/copyUntypedFiles.js
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -22,5 +22,6 @@ packages/docusaurus-plugin-client-redirects/lib/
|
||||||
packages/docusaurus-plugin-content-blog/lib/
|
packages/docusaurus-plugin-content-blog/lib/
|
||||||
packages/docusaurus-plugin-content-docs/lib/
|
packages/docusaurus-plugin-content-docs/lib/
|
||||||
packages/docusaurus-plugin-content-pages/lib/
|
packages/docusaurus-plugin-content-pages/lib/
|
||||||
|
packages/docusaurus-plugin-debug/lib/
|
||||||
packages/docusaurus-plugin-sitemap/lib/
|
packages/docusaurus-plugin-sitemap/lib/
|
||||||
packages/docusaurus-plugin-ideal-image/lib/
|
packages/docusaurus-plugin-ideal-image/lib/
|
||||||
|
|
|
@ -11,6 +11,7 @@ packages/docusaurus-init/templates/**/*.md
|
||||||
packages/docusaurus-plugin-content-blog/lib/
|
packages/docusaurus-plugin-content-blog/lib/
|
||||||
packages/docusaurus-plugin-content-docs/lib/
|
packages/docusaurus-plugin-content-docs/lib/
|
||||||
packages/docusaurus-plugin-content-pages/lib/
|
packages/docusaurus-plugin-content-pages/lib/
|
||||||
|
packages/docusaurus-plugin-debug/lib/
|
||||||
packages/docusaurus-plugin-sitemap/lib/
|
packages/docusaurus-plugin-sitemap/lib/
|
||||||
packages/docusaurus-plugin-ideal-image/lib/
|
packages/docusaurus-plugin-ideal-image/lib/
|
||||||
__fixtures__
|
__fixtures__
|
||||||
|
|
25
packages/docusaurus-plugin-debug/package.json
Normal file
25
packages/docusaurus-plugin-debug/package.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "@docusaurus/plugin-debug",
|
||||||
|
"version": "2.0.0-alpha.56",
|
||||||
|
"description": "Debug plugin for Docusaurus",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"tsc": "tsc"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@docusaurus/types": "^2.0.0-alpha.56",
|
||||||
|
"@docusaurus/utils": "^2.0.0-alpha.56"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@docusaurus/core": "^2.0.0",
|
||||||
|
"react": "^16.8.4",
|
||||||
|
"react-dom": "^16.8.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.15.1"
|
||||||
|
}
|
||||||
|
}
|
31
packages/docusaurus-plugin-debug/src/index.ts
Normal file
31
packages/docusaurus-plugin-debug/src/index.ts
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {LoadContext, Plugin} from '@docusaurus/types';
|
||||||
|
import {normalizeUrl} from '@docusaurus/utils';
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
export default function pluginContentPages({
|
||||||
|
siteConfig: {baseUrl},
|
||||||
|
}: LoadContext): Plugin<void> {
|
||||||
|
return {
|
||||||
|
name: 'docusaurus-plugin-debug',
|
||||||
|
|
||||||
|
getThemePath() {
|
||||||
|
return path.resolve(__dirname, '../src/theme');
|
||||||
|
},
|
||||||
|
|
||||||
|
contentLoaded({actions: {addRoute}}) {
|
||||||
|
addRoute({
|
||||||
|
path: normalizeUrl([baseUrl, '__docusaurus/debug']),
|
||||||
|
component: '@theme/Debug',
|
||||||
|
exact: true,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
47
packages/docusaurus-plugin-debug/src/theme/Debug/index.js
Normal file
47
packages/docusaurus-plugin-debug/src/theme/Debug/index.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import Layout from '@theme/Layout';
|
||||||
|
|
||||||
|
import registry from '@generated/registry';
|
||||||
|
import routes from '@generated/routes';
|
||||||
|
|
||||||
|
import styles from './styles.module.css';
|
||||||
|
|
||||||
|
function Debug() {
|
||||||
|
return (
|
||||||
|
<Layout permalink="__docusaurus/debug" title="Debug">
|
||||||
|
<main className={styles.Container}>
|
||||||
|
<section>
|
||||||
|
<h2>Registry</h2>
|
||||||
|
<ul>
|
||||||
|
{Object.values(registry).map(([, aliasedPath, resolved]) => (
|
||||||
|
<li key={aliasedPath}>
|
||||||
|
<div>Aliased Path: {aliasedPath}</div>
|
||||||
|
<div>Resolved Path: {resolved}</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Routes</h2>
|
||||||
|
<ul>
|
||||||
|
{routes.map(({path, exact}) => (
|
||||||
|
<li key={path}>
|
||||||
|
<div>Route: {path}</div>
|
||||||
|
<div>Is exact: {String(Boolean(exact))}</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</Layout>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Debug;
|
|
@ -0,0 +1,11 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.Container {
|
||||||
|
display: flex;
|
||||||
|
margin: 1em;
|
||||||
|
}
|
9
packages/docusaurus-plugin-debug/tsconfig.json
Normal file
9
packages/docusaurus-plugin-debug/tsconfig.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"incremental": true,
|
||||||
|
"tsBuildInfoFile": "./lib/.tsbuildinfo",
|
||||||
|
"rootDir": "src",
|
||||||
|
"outDir": "lib"
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ module.exports = function preset(context, opts = {}) {
|
||||||
isProd &&
|
isProd &&
|
||||||
googleAnalytics &&
|
googleAnalytics &&
|
||||||
require.resolve('@docusaurus/plugin-google-analytics'),
|
require.resolve('@docusaurus/plugin-google-analytics'),
|
||||||
|
!isProd && require.resolve('@docusaurus/plugin-debug'),
|
||||||
isProd && gtag && require.resolve('@docusaurus/plugin-google-gtag'),
|
isProd && gtag && require.resolve('@docusaurus/plugin-google-gtag'),
|
||||||
isProd && [require.resolve('@docusaurus/plugin-sitemap'), opts.sitemap],
|
isProd && [require.resolve('@docusaurus/plugin-sitemap'), opts.sitemap],
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue