Use `require` to check if the project uses TypeScript
Motivation: I have an oclif project as a package in a yarn workspaces monorepo. When running oclif-dev readme, the command path in the "See code" entries isn't correct. I found out that this is because it's looking for TypeScript in the devDependencies to determine if TypeScript is being used. I have TypeScript in the root devDependencies of my monorepo, not in the package devDependencies.
To solve this, this PR proposes that instead of checking the package's devDependencies to determine if the package uses TypeScript, try to require('typescript') and use success as an indicator that the package uses TypeScript. This allows TypeScript to be detected even if it is not listed in the project's dependencies.
Makes sense, though this could produce false positives as-well (albeit likely low). We could add a check for an explicit oclif config "typescript" : true.
Yeah, that would work for my use case as well. Are you thinking something similar to this line:
https://github.com/oclif/dev-cli/blob/6b319b274ce4eacefe5b47240ebe079a8c779d24/src/commands/readme.ts#L183
but instead it would check plugin.pjson.oclif.typescript? That's probably less risky.