Shared type definition makes doc build interrupt.
Closed this issue · 3 comments
My project folder structure just like
MyProject
├── packages
│ ├── a
│ ├── b
│ └── c
└── types
├── shared-type-1.ts
└── shared-type-2.ts
When doc generation for packages
folder, import the type definition from types
throws a error.
added some logs for tracking
packagePath: /Users/xuqingkuang/MyProject/packages/a/
path: /Users/xuqingkuang/MyProject/types/shared-type-1.ts
packagePath: /Users/xuqingkuang/MyProject/packages/b/
path: /Users/xuqingkuang/MyProject/types/share-type-1.ts
fit: ""
/Users/xuqingkuang/MyProject/node_modules/typedoc-plugin-lerna-packages/plugin.js:73
throw new Error(`No lerna package found for ${path}`);
^
Error: No lerna package found for /Users/xuqingkuang/MyProject/types/share-type-1.ts
at findLernaPackageForChildOriginalName (/Users/xuqingkuang/MyProject/node_modules/typedoc-plugin-lerna-packages/plugin.js:73:23)
...
I located the code at: https://github.com/marcj/typedoc-plugin-lerna-packages/blob/master/plugin.ts#L84
It will check import, and throw a error when the import is not in packages
folder
My typedoc.js
content:
module.exports = {
name: 'MyProject',
mode: 'modules',
out: 'docs/en-US',
allowJs: true,
ignoreCompilerErrors: true,
excludePrivate: true,
excludeProtected: true,
skipInternal: true,
exclude: [
'**/node_modules/**',
'**/__tests__/*.test.*',
],
lernaExclude: [
'@localTypes/shared-type-1',
'@localTypes/shared-type-2',
],
plugin: [
'typedoc-plugin-markdown',
'typedoc-plugin-no-inherit',
'typedoc-plugin-lerna-packages',
],
};
tsconfig.json
defined @localTypes
as alias to types
folder, but the lernaExclude
option seems doesn't work.
Sorry for my Engilsh is bad, hope you can understand.
Oh, I see. The question is, what is the expectation? That types in shared-type-1.ts
will be part of all packages that use it, or should those types just be ignored entirely?
Oh, I see. The question is, what is the expectation? That types in
shared-type-1.ts
will be part of all packages that use it, or should those types just be ignored entirely?
The shared definitions just use for the private interfaces, ignore them will be ok.
Finally use pathExclude
option solved the problem.