Skip to content

Commit

Permalink
Properly pass through errors generated by pnpm (#6)
Browse files Browse the repository at this point in the history
JaninaWibkerQC authored Dec 17, 2024

Verified

This commit was signed with the committer’s verified signature.
sourabhxyz Sourabh
1 parent abcff00 commit 83e8dbf
Showing 6 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
with:
version: 6.32.2
version: 9.14.4
- uses: actions/setup-node@v3
with:
node-version: "18"
node-version: "22"
cache: "pnpm"
- run: pnpm install

6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -20,13 +20,13 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
with:
version: 6.32.2
version: 9.14.4
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: "18"
node-version: "22"
cache: "pnpm"
registry-url: ${{ matrix.packages.registry }}
scope: ${{ matrix.packages.scope }}
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
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": {
@@ -24,7 +24,7 @@
"pnpm",
"cli"
],
"author": "Jannik Wibker",
"author": "Janina Wibker",
"license": "MIT",
"scripts": {
"build": "tsup",
10 changes: 8 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -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') {
@@ -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
@@ -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)
})
})

0 comments on commit 83e8dbf

Please sign in to comment.