Prevent unnecessary outer directory searches (#1082)
Prevent unnecessary outer directory searches (#1082)

* Prevent unnecessary outer directory searches

Without the added checks, every directory in a source path would be scanned even when the project files have already been found. This can cause avoidable permission errors and thus typedoc to break on out-of-the-box builds for the simplest of projects.

* Stops the search when readme.md and package.json are found.
* Stops the search when `--readme = none` and package.json is found.

* simplify logic

While this commit was taken from the pro-src/master branch, I've
made some changes as appropriate:
- Dropped the specs changes as it seemed unrelated to the test failures
- Fixed bug in `reachedTopDirectory` where it appeared to be
  accidentally inversed
- Fixed merge issues

sebastian-lenz/typedoc,sebastian-lenz/typedoc,TypeStrong/typedoc,TypeStrong/typedoc,TypeStrong/typedoc,sebastian-lenz/typedoc