Skip to content

Commit 3897e6e

Browse files
committed
@trigger.dev/cli ini: Make it more clear which API key the init command expects
1 parent fc083de commit 3897e6e

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

.changeset/cool-buckets-sparkle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/cli": patch
3+
---
4+
5+
Make it more clear which API key the init command expects

CONTRIBUTING.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,10 @@ pnpm run dev
136136
3. Create a new temporary Next.js app in examples directory
137137

138138
```sh
139+
cd ./examples
139140
pnpm create next-app@latest test-cli --ts --no-eslint --tailwind --app --src-dir --import-alias "@/*"
140141
```
141142

142-
Follow the prompts to create a TypeScript project using the App Directory.
143-
144143
4. Then once that's finished, add the `@trigger.dev/cli` to the `devDependencies` of the newly created Next.js app's `package.json` file, like so:
145144

146145
```json
@@ -150,15 +149,15 @@ Follow the prompts to create a TypeScript project using the App Directory.
150149
}
151150
```
152151
153-
5. Open a new terminal window, navigate into the example, and initialize the CLI:
152+
5. Back in the terminal, navigate into the example, and initialize the CLI:
154153
155154
```sh
156-
cd examples/test-cli
155+
cd ./test-cli
157156
pnpm i
158157
pnpm exec trigger-cli init
159158
```
160159
161-
6. When prompted, select `self-hosted` and enter `localhost:3030` for your local version of the webapp. When asked for an API key, use the key you copied earlier.
160+
6. When prompted, select `self-hosted` and enter `localhost:3030` for your local version of the webapp. (You can also use the Trigger.dev cloud). When asked for an API key, use the key you copied earlier.
162161
163162
7. Run the CLI
164163

packages/cli/src/cli/index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,21 @@ export const promptApiKey = async (instanceUrl: string): Promise<string> => {
153153
const { apiKey } = await inquirer.prompt<{ apiKey: string }>({
154154
type: "password",
155155
name: "apiKey",
156-
message: `Enter your development API key (Find yours ➡️ ${instanceUrl})`,
156+
message: `Enter your secret dev API key (Find yours ➡️ ${instanceUrl})`,
157157
validate: (input) => {
158158
// Make sure they enter something like tr_dev_********
159159
if (!input) {
160-
return "Please enter your development API key";
160+
return "Please enter your secret dev API key";
161+
}
162+
163+
// If they enter a public key like pk_dev_, let them know
164+
if (input.startsWith("pk_dev_")) {
165+
return "Please enter your secret dev API key, you've entered a public key";
166+
}
167+
168+
// If they enter a prod key (tr_prod_), let them know
169+
if (input.startsWith("tr_prod_")) {
170+
return "Please enter your secret dev API key, you've entered a production key";
161171
}
162172

163173
if (!input.startsWith("tr_dev_")) {

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)