dev-cli icon indicating copy to clipboard operation
dev-cli copied to clipboard

`oclif-dev readme` fails if `package.json` has no `devDependencies`

Open geelen opened this issue 6 years ago • 1 comments

Using a lerna monorepo & yarn workspaces, I found that moving all my packages' devDependencies up to the root level fixed a bunch of stuff, but when I came to publish versions, oclif-dev readme was exploding with the message:

> @fab/[email protected] version /Users/glen/src/projects/fab/packages/cli
> oclif-dev readme

replacing <!-- usage --> in README.md
TypeError: Cannot read property 'typescript' of undefined
    at Readme.commandPath (~/src/projects/fab/node_modules/@oclif/dev-cli/lib/commands/readme.js:189:42)
    at Readme.commandCode (~/src/projects/fab/node_modules/@oclif/dev-cli/lib/commands/readme.js:137:32)
    at Readme.renderCommand (~/src/projects/fab/node_modules/@oclif/dev-cli/lib/commands/readme.js:122:18)
    at ~/src/projects/fab/node_modules/@oclif/dev-cli/lib/commands/readme.js:110:39
    at Array.map (<anonymous>)
    at Readme.commands (~/src/projects/fab/node_modules/@oclif/dev-cli/lib/commands/readme.js:110:25)
    at Readme.run (~/src/projects/fab/node_modules/@oclif/dev-cli/lib/commands/readme.js:36:123)
    at Readme._run (~/src/projects/fab/node_modules/@oclif/command/lib/command.js:44:20)
    at Config.runCommand (~/src/projects/fab/node_modules/@oclif/config/lib/config.js:151:9)
    at Main.run (~/src/projects/fab/node_modules/@oclif/command/lib/main.js:21:9)
lerna info lifecycle @fab/[email protected]~version: Failed to exec version script
lerna ERR! lifecycle "version" errored in "@fab/cli", exiting 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Making sure package.json had at least:

  "devDependencies": {
    "@oclif/dev-cli": "^1"
  },

was enough to fix the problem, but it could be fixed inside oclif itself

geelen avatar Dec 11 '19 07:12 geelen

This is still an issue. Can confirm that adding @oclif/dev-cli to devDependencies fixes it.

jonascript avatar Jun 08 '20 21:06 jonascript