Skip to content

Commit

Permalink
properly pass through errors generated by pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
JaninaWibkerQC committed Dec 17, 2024
1 parent abcff00 commit d703f81
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Jannik Wibker
Copyright (c) 2023-2024 Janina Wibker

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@quantco/pnpm-licenses",
"version": "2.1.0",
"version": "2.2.0",
"description": "Generate third party license disclaimers in pnpm-based projects",
"homepage": "https://github.com/Quantco/pnpm-licenses",
"repository": {
Expand All @@ -24,7 +24,7 @@
"pnpm",
"cli"
],
"author": "Jannik Wibker",
"author": "Janina Wibker",
"license": "MIT",
"scripts": {
"build": "tsup",
Expand Down
10 changes: 8 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ if (argv._.length === 1 && argv._[0] === 'list') {
process.exit(1)
}

listCommand({ prod: argv.prod, filters }, ioOptions)
listCommand({ prod: argv.prod, filters }, ioOptions).catch((error) => {
console.log(error)
process.exit(1)
})
}

if (argv._.length === 1 && argv._[0] === 'generate-disclaimer') {
Expand Down Expand Up @@ -253,5 +256,8 @@ if (argv._.length === 1 && argv._[0] === 'generate-disclaimer') {
process.exit(1)
}

generateDisclaimerCommand({ prod: argv.prod, filters }, ioOptions)
generateDisclaimerCommand({ prod: argv.prod, filters }, ioOptions).catch((error) => {
console.log(error)
process.exit(1)
})
}
2 changes: 1 addition & 1 deletion src/get-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const getDependencies = (
} else {
inputPromise = new Promise((resolve, reject) => {
exec(`pnpm licenses list ${options.prod ? '--prod' : ''} --json`, (error, stdout, stderr) => {
if (error) return reject(new Error(stderr))
if (error) return reject(new Error(`${error.message}\nstdout: ${stdout}\nstderr: ${stderr}`))
resolve(stdout)
})
})
Expand Down

0 comments on commit d703f81

Please sign in to comment.