Skip to content

Commit a83d7fc

Browse files
committed
working dir flag
1 parent 788fe51 commit a83d7fc

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- [2025-08-20] [working dir flag](https://github.com/RubricLab/package/commit/f61972a605e6a83e16197d12e8ef8adef0d6d11f)
12
- [2025-08-20] [bump](https://github.com/RubricLab/package/commit/5ca988108b9c31d10656464b30d558c3c9b64cd8)
23
- [2025-08-19] [add optional working directory flag to release flow](https://github.com/RubricLab/package/commit/235280bfdc9e89b59854b4a83906e4fb83854842)
34
- [2025-07-01] [run format](https://github.com/RubricLab/package/commit/24386184f8676969165be3b4c991b26b1a90d4a7)

cli.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,18 @@ const cli = createCLI({
4040
name: 'prepare'
4141
},
4242
{
43-
args: z.object({}),
43+
args: z.object({
44+
'working-dir': z.string().optional().describe('Working directory for the package (defaults to current directory)')
45+
}),
4446
description: 'Runs the post-commit hook',
45-
handler: async () => {
47+
handler: async (args) => {
4648
if (process.env.AMENDING) {
4749
process.exit(0)
4850
}
49-
// Use paths relative to current working directory (the package directory)
50-
const CHANGELOG_PATH = join(process.cwd(), 'CHANGELOG.md')
51-
const PACKAGE_PATH = join(process.cwd(), 'package.json')
51+
// Use specified working directory or current working directory
52+
const workingDir = args['working-dir'] || process.cwd()
53+
const CHANGELOG_PATH = join(workingDir, 'CHANGELOG.md')
54+
const PACKAGE_PATH = join(workingDir, 'package.json')
5255

5356
const packageJsonContent = Bun.file(PACKAGE_PATH)
5457
const packageJson = await packageJsonContent.json()

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
"simple-git-hooks": {
2929
"post-commit": "bun run ./cli.ts post-commit"
3030
},
31-
"version": "0.0.120"
31+
"version": "0.0.121"
3232
}

0 commit comments

Comments
 (0)