Skip to content

discoverNpmPlugins function breaks the generation #1102

@ethikz

Description

@ethikz

Expected Behavior

I expect it to resolve all files/paths and build documentation

Actual Behavior

It fails to build the documentation and crashes.

The error showing in terminal is:

> angular-tour-of-heroes@1.0.0 docs ~/development/angular-tour-of-heroes
> typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/

fs.js:114
    throw err;
    ^

Error: ENOTDIR: not a directory, scandir '~/node_modules/@babel-code-frame-7.0.0-beta.44.tgz'
    at Object.readdirSync (fs.js:790:3)
    at FS.readdirSync.forEach (~/development/angular-tour-of-heroes/node_modules/typedoc/dist/lib/utils/plugins.js:72:24)
    at Array.forEach (<anonymous>)
    at discoverModules (~/development/angular-tour-of-heroes/node_modules/typedoc/dist/lib/utils/plugins.js:69:38)
    at discover (~/development/angular-tour-of-heroes/node_modules/typedoc/dist/lib/utils/plugins.js:61:21)
    at PluginHost.discoverNpmPlugins (~/development/angular-tour-of-heroes/node_modules/typedoc/dist/lib/utils/plugins.js:54:9)
    at PluginHost.load (~/development/angular-tour-of-heroes/node_modules/typedoc/dist/lib/utils/plugins.js:16:46)
    at CliApplication.bootstrap (~/development/angular-tour-of-heroes/node_modules/typedoc/dist/lib/application.js:42:22)
    at CliApplication.bootstrap (~/development/angular-tour-of-heroes/node_modules/typedoc/dist/lib/cli.js:24:30)
    at new Application (~/development/angular-tour-of-heroes/node_modules/typedoc/dist/lib/application.js:31:14)

After some debugging, the breaking happens with this specific line path = Path.resolve(Path.join(previous, '..'));

It seems to get all node_modules in the local directory then it traverses up every directory until it gets to my home directory node_modules and then it breaks looking for that module for whatever reason.

When I comment that line out completely it works fine. Being that I am not 100% sure what this function does completely in the scheme of typedoc, I'm hesitant to submit a PR.

Steps to reproduce the bug

typedoc.js

module.exports = {
  out: 'docs',
  includes: '/',
  exclude: [
    '**/*.spec.ts',
    '**/node_modules/**'
  ],
  mode: 'modules',
  theme: 'default',
  ignoreCompilerErrors: 'true',
  target: 'ES5',
  module: 'commonjs'
};

package.json

"scripts": {
  [...]
  "docs": "npm run typedoc -- --options typedoc.js ./src/",
  "typedoc": "typedoc",
}

Environment

  • Typedoc version: 0.15.0
  • Node.js version: 10.16.0
  • OS: OSX 10.14.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions