@cedarjs/cli 4.0.0-canary.13865 → 4.0.0-canary.13866
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/experimental/templates/opentelemetry.ts.template +2 -1
- package/dist/commands/setup/deploy/helpers/index.js +5 -1
- package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +14 -10
- package/dist/commands/setup/deploy/providers/renderHandler.js +1 -2
- package/dist/commands/setup/deploy/templates/flightcontrol.js +8 -8
- package/dist/commands/setup/deploy/templates/render.js +3 -1
- package/package.json +12 -12
|
@@ -24,11 +24,12 @@ const resource = Resource.default().merge(
|
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
const studioPort = getConfig().studio.basePort
|
|
27
|
+
const apiUrl = getConfig().web.apiUrl.replace(/\/$/, '')
|
|
27
28
|
const exporter = new OTLPTraceExporter({
|
|
28
29
|
// Update this URL to point to where your OTLP compatible collector is listening
|
|
29
30
|
// The redwood development studio (`yarn cedar exp studio`) can collect your
|
|
30
31
|
// telemetry at `http://127.0.0.1:<PORT>/v1/traces` (default PORT is 4318)
|
|
31
|
-
url: `http://127.0.0.1:${studioPort}
|
|
32
|
+
url: `http://127.0.0.1:${studioPort}${apiUrl}/otel-trace`,
|
|
32
33
|
concurrencyLimit: 64,
|
|
33
34
|
})
|
|
34
35
|
|
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import execa from "execa";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
|
-
import { getConfigPath } from "@cedarjs/project-config";
|
|
5
|
+
import { getConfigPath, getConfig } from "@cedarjs/project-config";
|
|
6
6
|
import { getPaths, writeFilesTask } from "../../../../lib/index.js";
|
|
7
7
|
const updateApiURLTask = (apiUrl) => {
|
|
8
8
|
const configTomlPath = getConfigPath();
|
|
@@ -25,6 +25,9 @@ const updateApiURLTask = (apiUrl) => {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
+
function getUserApiUrl() {
|
|
29
|
+
return getConfig().web.apiUrl;
|
|
30
|
+
}
|
|
28
31
|
const preRequisiteCheckTask = (preRequisites) => {
|
|
29
32
|
return {
|
|
30
33
|
title: "Checking pre-requisites",
|
|
@@ -101,6 +104,7 @@ export {
|
|
|
101
104
|
addFilesTask,
|
|
102
105
|
addToDotEnvTask,
|
|
103
106
|
addToGitIgnoreTask,
|
|
107
|
+
getUserApiUrl,
|
|
104
108
|
preRequisiteCheckTask,
|
|
105
109
|
updateApiURLTask
|
|
106
110
|
};
|
|
@@ -7,7 +7,7 @@ import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
|
7
7
|
import { getPaths, getPrismaSchemas } from "@cedarjs/project-config";
|
|
8
8
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
9
9
|
import { writeFilesTask, printSetupNotes } from "../../../../lib/index.js";
|
|
10
|
-
import { updateApiURLTask } from "../helpers/index.js";
|
|
10
|
+
import { getUserApiUrl, updateApiURLTask } from "../helpers/index.js";
|
|
11
11
|
import {
|
|
12
12
|
flightcontrolConfig,
|
|
13
13
|
databaseEnvVariables,
|
|
@@ -47,7 +47,7 @@ const getFlightcontrolJson = async (database) => {
|
|
|
47
47
|
...flightcontrolConfig.environments[0],
|
|
48
48
|
services: [
|
|
49
49
|
...flightcontrolConfig.environments[0].services.map((service) => {
|
|
50
|
-
if (service.id === "
|
|
50
|
+
if (service.id === "cedar-api") {
|
|
51
51
|
return {
|
|
52
52
|
...service,
|
|
53
53
|
envVariables: {
|
|
@@ -96,7 +96,7 @@ const updateGraphQLFunction = () => {
|
|
|
96
96
|
Couldn't find graphql handler in api/src/functions/graphql.js.
|
|
97
97
|
You'll have to add the following cors config manually:
|
|
98
98
|
|
|
99
|
-
cors: { origin: process.env.
|
|
99
|
+
cors: { origin: process.env.CEDAR_WEB_URL, credentials: true}
|
|
100
100
|
`);
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
@@ -109,14 +109,14 @@ const updateGraphQLFunction = () => {
|
|
|
109
109
|
Couldn't find graphql handler in api/src/functions/graphql.js.
|
|
110
110
|
You'll have to add the following cors config manually:
|
|
111
111
|
|
|
112
|
-
cors: { origin: process.env.
|
|
112
|
+
cors: { origin: process.env.CEDAR_WEB_URL, credentials: true}
|
|
113
113
|
`);
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
graphqlContent.splice(
|
|
117
117
|
graphqlHanderIndex + 1,
|
|
118
118
|
0,
|
|
119
|
-
" cors: { origin: process.env.
|
|
119
|
+
" cors: { origin: process.env.CEDAR_WEB_URL, credentials: true },"
|
|
120
120
|
);
|
|
121
121
|
fs.writeFileSync(graphqlFunctionsPath, graphqlContent.join(EOL));
|
|
122
122
|
}
|
|
@@ -158,14 +158,14 @@ const updateDbAuth = () => {
|
|
|
158
158
|
Couldn't find DbAuthHandler in api/src/functions/auth.js.
|
|
159
159
|
You'll have to add the following cors config manually:
|
|
160
160
|
|
|
161
|
-
cors: { origin: process.env.
|
|
161
|
+
cors: { origin: process.env.CEDAR_WEB_URL, credentials: true}
|
|
162
162
|
`);
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
authContent.splice(
|
|
166
166
|
dbHandlerIndex + 1,
|
|
167
167
|
0,
|
|
168
|
-
" cors: { origin: process.env.
|
|
168
|
+
" cors: { origin: process.env.CEDAR_WEB_URL, credentials: true },"
|
|
169
169
|
);
|
|
170
170
|
fs.writeFileSync(authFnPath, authContent.join(EOL));
|
|
171
171
|
}
|
|
@@ -229,13 +229,17 @@ const addToDotEnvDefaultTask = () => {
|
|
|
229
229
|
|
|
230
230
|
You'll have to add the following env var manually:
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
CEDAR_API_URL=${getUserApiUrl()}
|
|
233
233
|
`;
|
|
234
234
|
}
|
|
235
235
|
},
|
|
236
236
|
task: async (_ctx) => {
|
|
237
237
|
const env = path.resolve(getPaths().base, ".env.defaults");
|
|
238
|
-
const
|
|
238
|
+
const apiUrl = getUserApiUrl();
|
|
239
|
+
const line = `
|
|
240
|
+
|
|
241
|
+
CEDAR_API_URL=${apiUrl}
|
|
242
|
+
`;
|
|
239
243
|
fs.appendFileSync(env, line);
|
|
240
244
|
}
|
|
241
245
|
};
|
|
@@ -266,7 +270,7 @@ const handler = async ({ force, database }) => {
|
|
|
266
270
|
updateGraphQLFunction(),
|
|
267
271
|
updateDbAuth(),
|
|
268
272
|
updateApp(),
|
|
269
|
-
updateApiURLTask("${
|
|
273
|
+
updateApiURLTask("${CEDAR_API_URL}"),
|
|
270
274
|
addToDotEnvDefaultTask(),
|
|
271
275
|
printSetupNotes(notes)
|
|
272
276
|
],
|
|
@@ -5,7 +5,7 @@ import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
|
5
5
|
import { getPaths, getPrismaSchemas } from "@cedarjs/project-config";
|
|
6
6
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
7
7
|
import { writeFilesTask, printSetupNotes } from "../../../../lib/index.js";
|
|
8
|
-
import { addFilesTask
|
|
8
|
+
import { addFilesTask } from "../helpers/index.js";
|
|
9
9
|
import {
|
|
10
10
|
POSTGRES_YAML,
|
|
11
11
|
RENDER_HEALTH_CHECK,
|
|
@@ -80,7 +80,6 @@ const handler = async ({ force, database }) => {
|
|
|
80
80
|
return writeFilesTask(files, { overwriteExisting: force });
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
updateApiURLTask("/.redwood/functions"),
|
|
84
83
|
// Add health check api function
|
|
85
84
|
addFilesTask({
|
|
86
85
|
files: additionalFiles,
|
|
@@ -10,8 +10,8 @@ const flightcontrolConfig = {
|
|
|
10
10
|
},
|
|
11
11
|
services: [
|
|
12
12
|
{
|
|
13
|
-
id: "
|
|
14
|
-
name: "
|
|
13
|
+
id: "cedar-api",
|
|
14
|
+
name: "Cedar API",
|
|
15
15
|
type: "web",
|
|
16
16
|
buildType: "nixpacks",
|
|
17
17
|
cpu: 0.5,
|
|
@@ -24,14 +24,14 @@ const flightcontrolConfig = {
|
|
|
24
24
|
type: "ec2"
|
|
25
25
|
},
|
|
26
26
|
envVariables: {
|
|
27
|
-
|
|
28
|
-
fromService: { id: "
|
|
27
|
+
CEDAR_WEB_URL: {
|
|
28
|
+
fromService: { id: "cedar-web", value: "origin" }
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
id: "
|
|
34
|
-
name: "
|
|
33
|
+
id: "cedar-web",
|
|
34
|
+
name: "Cedar Web",
|
|
35
35
|
type: "static",
|
|
36
36
|
buildType: "nixpacks",
|
|
37
37
|
singlePageApp: true,
|
|
@@ -41,8 +41,8 @@ const flightcontrolConfig = {
|
|
|
41
41
|
type: "ec2"
|
|
42
42
|
},
|
|
43
43
|
envVariables: {
|
|
44
|
-
|
|
45
|
-
fromService: { id: "
|
|
44
|
+
CEDAR_API_URL: {
|
|
45
|
+
fromService: { id: "cedar-api", value: "origin" }
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { getPaths } from "../../../../lib/index.js";
|
|
3
|
+
import { getUserApiUrl } from "../helpers/index.js";
|
|
3
4
|
const PROJECT_NAME = path.basename(getPaths().base);
|
|
4
5
|
const RENDER_YAML = (database) => {
|
|
6
|
+
const apiUrl = getUserApiUrl().replace(/\/$/, "");
|
|
5
7
|
return `# Quick links to the docs:
|
|
6
8
|
# - Redwood on Render: https://render.com/docs/deploy-redwood
|
|
7
9
|
# - Render's Blueprint spec: https://render.com/docs/yaml-spec
|
|
@@ -19,7 +21,7 @@ services:
|
|
|
19
21
|
|
|
20
22
|
routes:
|
|
21
23
|
- type: rewrite
|
|
22
|
-
source:
|
|
24
|
+
source: ${apiUrl}/*
|
|
23
25
|
# Replace \`destination\` here after your first deploy:
|
|
24
26
|
#
|
|
25
27
|
# \`\`\`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.13866+7648078da1",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/parser": "7.29.2",
|
|
35
35
|
"@babel/preset-typescript": "7.28.5",
|
|
36
|
-
"@cedarjs/api-server": "4.0.0-canary.
|
|
37
|
-
"@cedarjs/cli-helpers": "4.0.0-canary.
|
|
38
|
-
"@cedarjs/fastify-web": "4.0.0-canary.
|
|
39
|
-
"@cedarjs/internal": "4.0.0-canary.
|
|
40
|
-
"@cedarjs/prerender": "4.0.0-canary.
|
|
41
|
-
"@cedarjs/project-config": "4.0.0-canary.
|
|
42
|
-
"@cedarjs/structure": "4.0.0-canary.
|
|
43
|
-
"@cedarjs/telemetry": "4.0.0-canary.
|
|
44
|
-
"@cedarjs/utils": "4.0.0-canary.
|
|
45
|
-
"@cedarjs/web-server": "4.0.0-canary.
|
|
36
|
+
"@cedarjs/api-server": "4.0.0-canary.13866",
|
|
37
|
+
"@cedarjs/cli-helpers": "4.0.0-canary.13866",
|
|
38
|
+
"@cedarjs/fastify-web": "4.0.0-canary.13866",
|
|
39
|
+
"@cedarjs/internal": "4.0.0-canary.13866",
|
|
40
|
+
"@cedarjs/prerender": "4.0.0-canary.13866",
|
|
41
|
+
"@cedarjs/project-config": "4.0.0-canary.13866",
|
|
42
|
+
"@cedarjs/structure": "4.0.0-canary.13866",
|
|
43
|
+
"@cedarjs/telemetry": "4.0.0-canary.13866",
|
|
44
|
+
"@cedarjs/utils": "4.0.0-canary.13866",
|
|
45
|
+
"@cedarjs/web-server": "4.0.0-canary.13866",
|
|
46
46
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
47
47
|
"@opentelemetry/api": "1.9.0",
|
|
48
48
|
"@opentelemetry/core": "1.30.1",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"publishConfig": {
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "7648078da12445eb41f35b7dce028119f22bf5cf"
|
|
112
112
|
}
|