@cedarjs/cli 5.0.0-canary.2533 → 5.0.0-canary.2535

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.
@@ -1,11 +1,11 @@
1
1
  import fs from "node:fs";
2
2
  import boxen from "boxen";
3
- import execa from "execa";
4
3
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
5
4
  import {
6
5
  formatCedarCommand,
7
6
  formatRunBinCommand
8
7
  } from "@cedarjs/cli-helpers/packageManager/display";
8
+ import { runTransitiveBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
9
9
  import { errorTelemetry } from "@cedarjs/telemetry";
10
10
  import { getPaths } from "../lib/index.js";
11
11
  const getErrorMessage = (error) => {
@@ -60,10 +60,10 @@ const handler = async ({
60
60
  }
61
61
  console.log();
62
62
  console.log(c.note("Running Prisma CLI..."));
63
- console.log(c.underline(`$ npx prisma ${args.join(" ")}`));
63
+ console.log(c.underline(`$ <pm exec> prisma ${args.join(" ")}`));
64
64
  console.log();
65
65
  try {
66
- execa.sync("npx", ["prisma", ...args], {
66
+ runTransitiveBinSync("prisma", args, {
67
67
  cwd: cedarPaths.base,
68
68
  stdio: "inherit"
69
69
  });
@@ -4,18 +4,20 @@ import path from "path";
4
4
  import prismaInternals from "@prisma/internals";
5
5
  import { Listr } from "listr2";
6
6
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
7
+ import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
7
8
  import { getPaths, getPrismaSchemas } from "@cedarjs/project-config";
8
9
  import { errorTelemetry } from "@cedarjs/telemetry";
9
10
  import { writeFilesTask, printSetupNotes } from "../../../../lib/index.js";
10
11
  import { getUserApiUrl, updateApiURLTask } from "../helpers/index.js";
11
12
  import {
12
- flightcontrolConfig,
13
+ getFlightcontrolConfig,
13
14
  databaseEnvVariables,
14
15
  postgresDatabaseService,
15
16
  mysqlDatabaseService
16
17
  } from "../templates/flightcontrol.js";
17
18
  const { getConfig } = prismaInternals;
18
19
  const getFlightcontrolJson = async (database) => {
20
+ const flightcontrolConfig = getFlightcontrolConfig();
19
21
  if (database === "none") {
20
22
  return {
21
23
  path: path.join(getPaths().base, "flightcontrol.json"),
@@ -69,8 +71,8 @@ const getFlightcontrolJson = async (database) => {
69
71
  Prisma datasource provider is detected to be ${detectedDatabase}.
70
72
 
71
73
  Update your schema.prisma provider to be postgresql or mysql, then run
72
- yarn cedar prisma migrate dev
73
- yarn cedar setup deploy flightcontrol
74
+ ${formatCedarCommand(["prisma", "migrate", "dev"])}
75
+ ${formatCedarCommand(["setup", "deploy", "flightcontrol"])}
74
76
  `);
75
77
  }
76
78
  };
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import { Listr } from "listr2";
4
4
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
5
+ import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
5
6
  import { errorTelemetry } from "@cedarjs/telemetry";
6
7
  import {
7
8
  addPackagesTask,
@@ -34,7 +35,7 @@ const notes = [
34
35
  ];
35
36
  const udNotes = [
36
37
  "You are ready to deploy to Netlify with Universal Deploy!",
37
- "Build with: yarn cedar build --ud",
38
+ `Build with: ${formatCedarCommand(["build", "--ud"])}`,
38
39
  "See: https://cedarjs.com/docs/deploy/netlify"
39
40
  ];
40
41
  function addNetlifyPluginsToViteConfigTask() {
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import { Listr } from "listr2";
4
4
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
5
+ import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
5
6
  import { errorTelemetry } from "@cedarjs/telemetry";
6
7
  import {
7
8
  addPackagesTask,
@@ -113,32 +114,37 @@ const vercelConfig = {
113
114
  }
114
115
  }
115
116
  };
116
- const vercelUDConfig = {
117
- build: {
118
- command: "yarn cedar build --ud --verbose --apiRootPath=/.api/functions",
119
- env: {
120
- ENABLE_EXPERIMENTAL_COREPACK: "1"
121
- }
122
- }
123
- };
124
117
  const notes = [
125
118
  "You are ready to deploy to Vercel!",
126
119
  "See: https://cedarjs.com/docs/deploy#vercel-deploy"
127
120
  ];
128
121
  const udNotes = [
129
122
  "You are ready to deploy to Vercel with Universal Deploy!",
130
- "Build with: yarn cedar build --ud",
123
+ `Build with: ${formatCedarCommand(["build", "--ud"])}`,
131
124
  "See: https://cedarjs.com/docs/deploy#vercel-deploy"
132
125
  ];
133
126
  function writeVercelUDConfigTask({
134
127
  overwriteExisting = false
135
128
  } = {}) {
129
+ const config = {
130
+ build: {
131
+ command: formatCedarCommand([
132
+ "build",
133
+ "--ud",
134
+ "--verbose",
135
+ "--apiRootPath=/.api/functions"
136
+ ]),
137
+ env: {
138
+ ENABLE_EXPERIMENTAL_COREPACK: "1"
139
+ }
140
+ }
141
+ };
136
142
  return {
137
143
  title: "Writing vercel.json for Universal Deploy...",
138
144
  task: (_ctx, task) => {
139
145
  writeFile(
140
146
  path.join(getPaths().base, "vercel.json"),
141
- JSON.stringify(vercelUDConfig, null, 2),
147
+ JSON.stringify(config, null, 2),
142
148
  { overwriteExisting },
143
149
  task
144
150
  );
@@ -1,55 +1,66 @@
1
- const flightcontrolConfig = {
2
- $schema: "https://app.flightcontrol.dev/schema.json",
3
- environments: [
4
- {
5
- id: "development",
6
- name: "Development",
7
- region: "us-east-1",
8
- source: {
9
- branch: "main"
10
- },
11
- services: [
12
- {
13
- id: "cedar-api",
14
- name: "Cedar API",
15
- type: "web",
16
- buildType: "nixpacks",
17
- cpu: 0.5,
18
- memory: 1,
19
- buildCommand: "yarn cedar deploy flightcontrol api",
20
- startCommand: "yarn cedar deploy flightcontrol api --serve",
21
- port: 8911,
22
- healthCheckPath: "/graphql/health",
23
- ci: {
24
- type: "ec2"
25
- },
26
- envVariables: {
27
- CEDAR_WEB_URL: {
28
- fromService: { id: "cedar-web", value: "origin" }
29
- }
30
- }
1
+ import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
2
+ function getFlightcontrolConfig() {
3
+ const apiBuildCommand = formatCedarCommand(["deploy", "flightcontrol", "api"]);
4
+ const apiStartCommand = formatCedarCommand([
5
+ "deploy",
6
+ "flightcontrol",
7
+ "api",
8
+ "--serve"
9
+ ]);
10
+ const webBuildCommand = formatCedarCommand(["deploy", "flightcontrol", "web"]);
11
+ return {
12
+ $schema: "https://app.flightcontrol.dev/schema.json",
13
+ environments: [
14
+ {
15
+ id: "development",
16
+ name: "Development",
17
+ region: "us-east-1",
18
+ source: {
19
+ branch: "main"
31
20
  },
32
- {
33
- id: "cedar-web",
34
- name: "Cedar Web",
35
- type: "static",
36
- buildType: "nixpacks",
37
- singlePageApp: true,
38
- buildCommand: "yarn cedar deploy flightcontrol web",
39
- outputDirectory: "web/dist",
40
- ci: {
41
- type: "ec2"
21
+ services: [
22
+ {
23
+ id: "cedar-api",
24
+ name: "Cedar API",
25
+ type: "web",
26
+ buildType: "nixpacks",
27
+ cpu: 0.5,
28
+ memory: 1,
29
+ buildCommand: apiBuildCommand,
30
+ startCommand: apiStartCommand,
31
+ port: 8911,
32
+ healthCheckPath: "/graphql/health",
33
+ ci: {
34
+ type: "ec2"
35
+ },
36
+ envVariables: {
37
+ CEDAR_WEB_URL: {
38
+ fromService: { id: "cedar-web", value: "origin" }
39
+ }
40
+ }
42
41
  },
43
- envVariables: {
44
- CEDAR_API_URL: {
45
- fromService: { id: "cedar-api", value: "origin" }
42
+ {
43
+ id: "cedar-web",
44
+ name: "Cedar Web",
45
+ type: "static",
46
+ buildType: "nixpacks",
47
+ singlePageApp: true,
48
+ buildCommand: webBuildCommand,
49
+ outputDirectory: "web/dist",
50
+ ci: {
51
+ type: "ec2"
52
+ },
53
+ envVariables: {
54
+ CEDAR_API_URL: {
55
+ fromService: { id: "cedar-api", value: "origin" }
56
+ }
46
57
  }
47
58
  }
48
- }
49
- ]
50
- }
51
- ]
52
- };
59
+ ]
60
+ }
61
+ ]
62
+ };
63
+ }
53
64
  const postgresDatabaseService = {
54
65
  id: "db",
55
66
  name: "Database",
@@ -79,7 +90,7 @@ const databaseEnvVariables = {
79
90
  };
80
91
  export {
81
92
  databaseEnvVariables,
82
- flightcontrolConfig,
93
+ getFlightcontrolConfig,
83
94
  mysqlDatabaseService,
84
95
  postgresDatabaseService
85
96
  };
@@ -1,7 +1,8 @@
1
+ import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
1
2
  import { getConfig } from "../../../../lib/index.js";
2
3
  const config = getConfig();
3
4
  const NETLIFY_TOML = `[build]
4
- command = "yarn cedar deploy netlify"
5
+ command = "${formatCedarCommand(["deploy", "netlify"])}"
5
6
  publish = "web/dist"
6
7
  functions = "api/dist/functions"
7
8
 
@@ -1,7 +1,8 @@
1
+ import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
1
2
  import { getConfig } from "../../../../lib/index.js";
2
3
  const config = getConfig();
3
4
  const NETLIFY_UD_TOML = `[build]
4
- command = "yarn cedar build --ud --apiRootPath=/.api/functions && yarn cedar prisma migrate deploy && yarn cedar data-migrate up"
5
+ command = "${formatCedarCommand(["build", "--ud", "--apiRootPath=/.api/functions"])} && ${formatCedarCommand(["prisma", "migrate", "deploy"])} && ${formatCedarCommand(["data-migrate", "up"])}"
5
6
  publish = "web/dist"
6
7
 
7
8
  [build.environment]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "5.0.0-canary.2533",
3
+ "version": "5.0.0-canary.2535",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,17 +33,17 @@
33
33
  "dependencies": {
34
34
  "@babel/parser": "7.29.7",
35
35
  "@babel/preset-typescript": "7.29.7",
36
- "@cedarjs/api-server": "5.0.0-canary.2533",
37
- "@cedarjs/cli-helpers": "5.0.0-canary.2533",
38
- "@cedarjs/fastify-web": "5.0.0-canary.2533",
39
- "@cedarjs/internal": "5.0.0-canary.2533",
40
- "@cedarjs/prerender": "5.0.0-canary.2533",
41
- "@cedarjs/project-config": "5.0.0-canary.2533",
42
- "@cedarjs/structure": "5.0.0-canary.2533",
43
- "@cedarjs/telemetry": "5.0.0-canary.2533",
44
- "@cedarjs/utils": "5.0.0-canary.2533",
45
- "@cedarjs/vite": "5.0.0-canary.2533",
46
- "@cedarjs/web-server": "5.0.0-canary.2533",
36
+ "@cedarjs/api-server": "5.0.0-canary.2535",
37
+ "@cedarjs/cli-helpers": "5.0.0-canary.2535",
38
+ "@cedarjs/fastify-web": "5.0.0-canary.2535",
39
+ "@cedarjs/internal": "5.0.0-canary.2535",
40
+ "@cedarjs/prerender": "5.0.0-canary.2535",
41
+ "@cedarjs/project-config": "5.0.0-canary.2535",
42
+ "@cedarjs/structure": "5.0.0-canary.2535",
43
+ "@cedarjs/telemetry": "5.0.0-canary.2535",
44
+ "@cedarjs/utils": "5.0.0-canary.2535",
45
+ "@cedarjs/vite": "5.0.0-canary.2535",
46
+ "@cedarjs/web-server": "5.0.0-canary.2535",
47
47
  "@listr2/prompt-adapter-enquirer": "4.2.1",
48
48
  "@opentelemetry/api": "1.9.1",
49
49
  "@opentelemetry/core": "1.30.1",