Przeglądaj źródła

typedoc build with v0.20.0-beta.27 now works

- hacks (hopefully temporary)
  - no `@jupyterlab/application-extension` docs
  - all test-related `.ts` sources have to be temporarily deleted immediately before the typedoc build and then restored immediately afterwards
telamonian 4 lat temu
rodzic
commit
f5388e3329
4 zmienionych plików z 121 dodań i 40 usunięć
  1. 11 4
      buildutils/src/ensure-repo.ts
  2. 1 1
      package.json
  3. 1 12
      tsconfigdoc.json
  4. 108 23
      typedoc.js

+ 11 - 4
buildutils/src/ensure-repo.ts

@@ -584,12 +584,19 @@ export async function ensureIntegrity(): Promise<boolean> {
   }
 
   // Handle the refs in the top level tsconfigdoc.json
+  const tsConfigDocExclude = [
+    'application-extension',
+    'metapackage',
+    'nbconvert-css'
+  ];
   const tsConfigdocPath = path.resolve('.', 'tsconfigdoc.json');
   const tsConfigdocData = utils.readJSONFile(tsConfigdocPath);
-  tsConfigdocData.references = [];
-  utils.getCorePaths().forEach(pth => {
-    tsConfigdocData.references.push({ path: './' + path.relative('.', pth) });
-  });
+  tsConfigdocData.references = utils
+    .getCorePaths()
+    .filter(pth => !tsConfigDocExclude.some(pkg => pth.includes(pkg)))
+    .map(pth => {
+      return { path: './' + path.relative('.', pth) };
+    });
   utils.writeJSONFile(tsConfigdocPath, tsConfigdocData);
 
   // Handle buildutils

+ 1 - 1
package.json

@@ -55,7 +55,7 @@
     "create:test": "node buildutils/lib/create-test-package.js",
     "create:theme": "node buildutils/lib/create-theme.js",
     "deduplicate": "jlpm yarn-deduplicate -s fewer --fail",
-    "docs": "typedoc --options typedoc.js packages/*/src/index.ts* packages/*/src/*.d.ts",
+    "docs": "rimraf packages/*/test testutils && typedoc --options typedoc.js && git ls-files -z -d | xargs -0 git checkout --",
     "docs:init": "lerna run docs:init",
     "eslint": "eslint --ext .js,.jsx,.ts,.tsx --fix .",
     "eslint:check": "eslint --ext .js,.jsx,.ts,.tsx .",

+ 1 - 12
tsconfigdoc.json

@@ -2,11 +2,9 @@
   "$schema": "http://json.schemastore.org/tsconfig",
   "extends": "./tsconfigbase",
   "compilerOptions": {
-    "composite": false,
-    "baseUrl": ".",
     "paths": {
       "@jupyterlab/*": [
-        "packages/*/src"
+        "./packages/*/src"
       ]
     }
   },
@@ -14,9 +12,6 @@
     {
       "path": "./packages/application"
     },
-    {
-      "path": "./packages/application-extension"
-    },
     {
       "path": "./packages/apputils"
     },
@@ -164,12 +159,6 @@
     {
       "path": "./packages/mathjax2-extension"
     },
-    {
-      "path": "./packages/metapackage"
-    },
-    {
-      "path": "./packages/nbconvert-css"
-    },
     {
       "path": "./packages/nbformat"
     },

+ 108 - 23
typedoc.js

@@ -1,36 +1,121 @@
 // const git = require('git-rev-sync');
 
-module.exports = {
-  exclude: [
-    // '^((?!index\.ts).)*$',
-    // '^((?!index\.tsx).)*$',
-    // '**/*+(__tests__|internal|lib|node_modules|demos)/**/*',
+const packages = [
+  // 'application-extension',
+  'application',
+  'apputils-extension',
+  'apputils',
+  'attachments',
+  'cells',
+  'celltags-extension',
+  'celltags',
+  'codeeditor',
+  'codemirror-extension',
+  'codemirror',
+  'completer-extension',
+  'completer',
+  'console-extension',
+  'console',
+  'coreutils',
+  'csvviewer-extension',
+  'csvviewer',
+  'docmanager-extension',
+  'docmanager',
+  'docregistry',
+  'documentsearch-extension',
+  'documentsearch',
+  'extensionmanager-extension',
+  'extensionmanager',
+  'filebrowser-extension',
+  'filebrowser',
+  'fileeditor-extension',
+  'fileeditor',
+  'help-extension',
+  'htmlviewer-extension',
+  'htmlviewer',
+  'hub-extension',
+  'imageviewer-extension',
+  'imageviewer',
+  'inspector-extension',
+  'inspector',
+  'javascript-extension',
+  'json-extension',
+  'launcher-extension',
+  'launcher',
+  'logconsole-extension',
+  'logconsole',
+  'mainmenu-extension',
+  'mainmenu',
+  'markdownviewer-extension',
+  'markdownviewer',
+  'mathjax2-extension',
+  'mathjax2',
+  // 'metapackage',
+  // 'nbconvert-css',
+  'nbformat',
+  'notebook-extension',
+  'notebook',
+  'observables',
+  'outputarea',
+  'pdf-extension',
+  'property-inspector',
+  'rendermime-extension',
+  'rendermime-interfaces',
+  'rendermime',
+  'running-extension',
+  'running',
+  'services',
+  'settingeditor-extension',
+  'settingeditor',
+  'settingregistry',
+  'shortcuts-extension',
+  'statedb',
+  'statusbar-extension',
+  'statusbar',
+  'tabmanager-extension',
+  'terminal-extension',
+  'terminal',
+  'theme-dark-extension',
+  'theme-light-extension',
+  'tooltip-extension',
+  'tooltip',
+  'ui-components-extension',
+  'ui-components',
+  'vdom-extension',
+  'vdom',
+  'vega5-extension'
+];
+
+const entryPoints = packages.flatMap(p => [
+  `packages/${p}/src/index.ts`,
+  `packages/${p}/src/index.tsx`
+  // `${__dirname}/packages/${p}/src/*.d.ts`,
+  // `${__dirname}/packages/${p}/src/index.ts`,
+]);
 
-    '.history',
-    '**/.storybook',
-    '**/babel.config.js',
-    '**/*.spec.ts*',
-    '**/*.stories.ts*',
-    '**/buildutils/**',
-    '**/docs/source/**',
-    '**/examples/**',
-    // '**/lib/**',
-    '**/node_modules/**',
-    '**/test/**',
-    '**/tests/**',
-    '**/testutils/**',
+const exclude =
+  packages.flatMap(p => [`packages/${p}/test`]) +
+  [
+    'packages/application-extension/src/index.tsx'
+    //'packages/*/test/*.spec.ts',
+  ];
 
-    '**/packages/metapackage/**'
-  ],
-  // excludeNotExported: true,
-  // ignoreCompilerErrors: false,
-  // mode: 'library',
+module.exports = {
+  entryPoints,
+  exclude,
   name: '@jupyterlab',
   out: 'docs/api',
+  // json: 'docs/api.json',
   readme: 'README.md',
   theme: 'typedoc-theme',
   tsconfig: 'tsconfigdoc.json'
 
+  // theme: minimal,
+  // excludePrivate: true,
+  // excludeProtected: true,
+  // excludeExternals: true,
+  // hideGenerator: true
+
   // gitRevision: 'master',
   // 'sourcefile-url-prefix': `https://github.com/sinnerschrader/feature-hub/tree/${git.short()}/packages/`,
 };