@trigger.dev/cli ini: Make it more clear which API key the init command expects

This commit is contained in:
Eric Allam
2023-08-22 11:16:29 +01:00
parent fc083de102
commit 3897e6e695
4 changed files with 22 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@trigger.dev/cli": patch
---
Make it more clear which API key the init command expects
+4 -5
View File
@@ -136,11 +136,10 @@ pnpm run dev
3. Create a new temporary Next.js app in examples directory
```sh
cd ./examples
pnpm create next-app@latest test-cli --ts --no-eslint --tailwind --app --src-dir --import-alias "@/*"
```
Follow the prompts to create a TypeScript project using the App Directory.
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:
```json
@@ -150,15 +149,15 @@ Follow the prompts to create a TypeScript project using the App Directory.
}
```
5. Open a new terminal window, navigate into the example, and initialize the CLI:
5. Back in the terminal, navigate into the example, and initialize the CLI:
```sh
cd examples/test-cli
cd ./test-cli
pnpm i
pnpm exec trigger-cli init
```
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.
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.
7. Run the CLI
+12 -2
View File
@@ -153,11 +153,21 @@ export const promptApiKey = async (instanceUrl: string): Promise<string> => {
const { apiKey } = await inquirer.prompt<{ apiKey: string }>({
type: "password",
name: "apiKey",
message: `Enter your development API key (Find yours ➡️ ${instanceUrl})`,
message: `Enter your secret dev API key (Find yours ➡️ ${instanceUrl})`,
validate: (input) => {
// Make sure they enter something like tr_dev_********
if (!input) {
return "Please enter your development API key";
return "Please enter your secret dev API key";
}
// If they enter a public key like pk_dev_, let them know
if (input.startsWith("pk_dev_")) {
return "Please enter your secret dev API key, you've entered a public key";
}
// If they enter a prod key (tr_prod_), let them know
if (input.startsWith("tr_prod_")) {
return "Please enter your secret dev API key, you've entered a production key";
}
if (!input.startsWith("tr_dev_")) {
+1 -1
View File
@@ -21054,7 +21054,7 @@ packages:
'@next/env': 13.4.19
'@swc/helpers': 0.5.1
busboy: 1.6.0
caniuse-lite: 1.0.30001504
caniuse-lite: 1.0.30001522
postcss: 8.4.14
react: 18.2.0
react-dom: 18.2.0_react@18.2.0