Skip to content

Commit

Permalink
fix: unintended project initialization at absolute path /trigger du…
Browse files Browse the repository at this point in the history
…ring project initialization (#1412)

* Fix parsing of project path for cli init command

* Update development instructions for cli-v3

* Create gentle-mails-sip.md

---------

Co-authored-by: Eric Allam <[email protected]>
  • Loading branch information
amuwal and ericallam authored Nov 15, 2024
1 parent 64be7b0 commit 2be1062
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-mails-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trigger.dev": patch
---

fix: unintended project initialization at absolute path `/trigger` during project initialization
4 changes: 2 additions & 2 deletions packages/cli-v3/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ cd packages/cli-v3
pnpm run dev
```

2. In the job-catalog folder you can use the CLI
2. Test the local CLI using the job-catalogs located in the `/references` directory

```sh
pnpm i
pnpm exec trigger-v3-cli
pnpm exec trigger <command>
```

---
Expand Down
5 changes: 4 additions & 1 deletion packages/cli-v3/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ async function createTriggerDir(
throw new OutroCommandError();
}

const triggerDir = resolve(process.cwd(), location);
// Ensure that the path is always relative by stripping leading '/' if present
const relativeLocation = location.replace(/^\//, "");

const triggerDir = resolve(process.cwd(), relativeLocation);

logger.debug({ triggerDir });

Expand Down

0 comments on commit 2be1062

Please sign in to comment.