Skip to content

Commit

Permalink
Fix exit code error thrown from build command on Node 20+
Browse files Browse the repository at this point in the history
  • Loading branch information
jrolfs committed Nov 15, 2023
1 parent 2f491c5 commit 741d455
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .changeset/many-socks-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@contentlayer/cli': patch
---

Fix exit code error in build command on **Node 20+**:

```sh
Generated 100 documents in .contentlayer
TypeError: The "code" argument must be of type number. Received an instance of Object
at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
at Cli.runExit (./node_modules/@contentlayer/cli/node_modules/clipanion/lib/advanced/Cli.js:232:26)
at run (file:///./node_modules/@contentlayer/cli/src/index.ts:39:3)
at main (./node_modules/contentlayer/bin/cli.cjs:5:3) {
code: 'ERR_INVALID_ARG_TYPE'
}
```
1 change: 1 addition & 0 deletions packages/@contentlayer/cli/src/commands/BuildCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class BuildCommand extends BaseCommand {
T.tap((config) => (config.source.options.disableImportAliasWarning ? T.unit : T.fork(core.validateTsconfig))),
T.chain((config) => core.generateDotpkg({ config, verbose: this.verbose })),
T.tap(core.logGenerateInfo),
T.map(() => 0),
OT.withSpan('@contentlayer/cli/commands/BuildCommand:executeSafe'),
)
}

0 comments on commit 741d455

Please sign in to comment.