Skip to content

Commit 523d227

Browse files
authored
Merge pull request #19 from andyjessop/aj/better-console
Aj/better console
2 parents e5d6527 + 9545219 commit 523d227

File tree

13 files changed

+268
-56
lines changed

13 files changed

+268
-56
lines changed

package-lock.json

Lines changed: 202 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"@mantine/modals": "^7.16.3",
3838
"@mantine/notifications": "^7.16.3",
3939
"ai": "^4.1.39",
40+
"chalk": "^5.4.1",
4041
"dayjs": "^1.11.13",
4142
"ejs": "^3.1.10",
4243
"eventsource-parser": "^3.0.0",

scripts/generate-worker/index.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
log,
88
select,
99
} from "@clack/prompts";
10+
import chalk from "chalk";
1011
import * as path from "path";
1112
import {
1213
copyDirectory,
@@ -123,17 +124,34 @@ async function main(): Promise<void> {
123124
try {
124125
formatDirectory(newLocation);
125126

126-
log.success(`Project successfully generated at ${newLocation}`);
127+
log.success(
128+
`${chalk.green(`Project successfully generated at ${newLocation}`)}`,
129+
);
127130
} catch (error) {
128131
log.error(JSON.stringify(error, null, 2));
129132
log.error("An error occurred while generating the project.");
130133
process.exit(1);
131134
}
132135

133-
// Display outro message.
134-
log.warning(
135-
"In order to use your worker in staging/production, you need to provide an API_KEY secret, and pass that value in requests with the x-api-key header.",
136+
const missingSecrets = [];
137+
138+
if (provider === "openai") {
139+
missingSecrets.push(
140+
`${chalk.yellow("OPENAI_API_KEY")} (Required for OpenAI integration.)`,
141+
);
142+
}
143+
144+
missingSecrets.push(
145+
`${chalk.yellow("API_KEY")} (Required to access your worker in staging/production. Use the "${chalk.yellow("x-api-key")}" header in your requests.)`,
136146
);
147+
148+
if (missingSecrets.length > 0) {
149+
log.warning(
150+
"Please add the following secrets to your account (or .dev.vars for local development):\n- " +
151+
missingSecrets.join("\n- "),
152+
);
153+
}
154+
137155
outro(`You're all set! Run 'npx nx dev ${projectName}' to start the worker.`);
138156
}
139157

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% if (provider === 'openai') { %>
2+
OPENAI_API_KEY=
3+
<% } %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% if (provider === 'openai') { %>
2+
OPENAI_API_KEY=
3+
<% } %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% if (provider === 'openai') { %>
2+
OPENAI_API_KEY=
3+
<% } %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% if (provider === 'openai') { %>
2+
OPENAI_API_KEY=
3+
<% } %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% if (provider === 'openai') { %>
2+
OPENAI_API_KEY=
3+
<% } %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% if (provider === 'openai') { %>
2+
OPENAI_API_KEY=
3+
<% } %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% if (provider === 'openai') { %>
2+
OPENAI_API_KEY=
3+
<% } %>

0 commit comments

Comments
 (0)