@cedarjs/cli 6.0.0-canary.2906 → 6.0.0-canary.2908

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,12 +1,14 @@
1
1
  import path from "path";
2
2
  import prismaInternals from "@prisma/internals";
3
3
  import { Listr } from "listr2";
4
+ import prompts from "prompts";
4
5
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
5
6
  import { getPaths, getPrismaSchemas } from "@cedarjs/project-config";
6
7
  import { errorTelemetry } from "@cedarjs/telemetry";
7
8
  import { writeFilesTask, printSetupNotes } from "../../../../lib/index.js";
8
9
  import { POSTGRES_YAML, RENDER_YAML, SQLITE_YAML } from "../templates/render.js";
9
10
  const { getConfig } = prismaInternals;
11
+ const SQLITE_API_PLAN = "starter";
10
12
  const getRenderYamlContent = async (database) => {
11
13
  if (database === "none") {
12
14
  return {
@@ -27,7 +29,7 @@ const getRenderYamlContent = async (database) => {
27
29
  case "sqlite":
28
30
  return {
29
31
  path: path.join(getPaths().base, "render.yaml"),
30
- content: RENDER_YAML(SQLITE_YAML)
32
+ content: RENDER_YAML(SQLITE_YAML, SQLITE_API_PLAN)
31
33
  };
32
34
  default:
33
35
  throw new Error(`
@@ -61,6 +63,26 @@ const handler = async ({
61
63
  force,
62
64
  database
63
65
  });
66
+ if (database === "sqlite") {
67
+ console.warn(
68
+ c.warning(
69
+ `Render's free plan doesn't support persistent disks, which the \`sqlite\` deploy option requires for its database file. The generated render.yaml will set the api service's plan to "${SQLITE_API_PLAN}" (a paid plan) instead of "free" so the disk can actually attach.
70
+
71
+ If you want to stay on the free plan, rerun this command with \`--database postgresql\` (a managed database, not a disk) or \`--database none\`.`
72
+ )
73
+ );
74
+ console.log();
75
+ const { confirmed } = await prompts({
76
+ type: "confirm",
77
+ name: "confirmed",
78
+ message: `Generate render.yaml with the api service on the "${SQLITE_API_PLAN}" plan?`
79
+ });
80
+ if (!confirmed) {
81
+ console.log("Aborting render setup.");
82
+ return;
83
+ }
84
+ console.log();
85
+ }
64
86
  const tasks = new Listr(
65
87
  [
66
88
  {
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import { getPaths } from "../../../../lib/index.js";
3
3
  import { getUserApiUrl } from "../helpers/index.js";
4
4
  const PROJECT_NAME = path.basename(getPaths().base);
5
- const RENDER_YAML = (database) => {
5
+ const RENDER_YAML = (database, plan = "free") => {
6
6
  const apiUrl = getUserApiUrl().replace(/\/$/, "");
7
7
  return `# Quick links to the docs:
8
8
  # - Deploying Cedar: https://cedarjs.com/docs/deploy/render
@@ -41,7 +41,7 @@ services:
41
41
 
42
42
  - name: ${PROJECT_NAME}-api
43
43
  type: web
44
- plan: free
44
+ plan: ${plan}
45
45
  runtime: node
46
46
  region: oregon
47
47
  buildCommand: npm install --global corepack && yarn install && yarn cedar build api
@@ -69,9 +69,12 @@ const POSTGRES_YAML = ` - key: DATABASE_URL
69
69
 
70
70
  databases:
71
71
  - name: ${PROJECT_NAME}-db
72
+ plan: free
72
73
  region: oregon`;
73
74
  const SQLITE_YAML = ` - key: DATABASE_URL
74
75
  value: file:./data/sqlite.db
76
+ # Persistent disks aren't available on Render's free plan, which is why
77
+ # the api service above is on a paid plan when SQLite is selected.
75
78
  disk:
76
79
  name: sqlite-data
77
80
  mountPath: /opt/render/project/src/api/db/data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "6.0.0-canary.2906",
3
+ "version": "6.0.0-canary.2908",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,17 +36,17 @@
36
36
  "@babel/preset-typescript": "7.29.7",
37
37
  "@babel/traverse": "7.29.7",
38
38
  "@babel/types": "7.29.7",
39
- "@cedarjs/api-server": "6.0.0-canary.2906",
40
- "@cedarjs/babel-config": "6.0.0-canary.2906",
41
- "@cedarjs/cli-helpers": "6.0.0-canary.2906",
42
- "@cedarjs/internal": "6.0.0-canary.2906",
43
- "@cedarjs/prerender": "6.0.0-canary.2906",
44
- "@cedarjs/project-config": "6.0.0-canary.2906",
45
- "@cedarjs/structure": "6.0.0-canary.2906",
46
- "@cedarjs/telemetry": "6.0.0-canary.2906",
47
- "@cedarjs/utils": "6.0.0-canary.2906",
48
- "@cedarjs/vite": "6.0.0-canary.2906",
49
- "@cedarjs/web-server": "6.0.0-canary.2906",
39
+ "@cedarjs/api-server": "6.0.0-canary.2908",
40
+ "@cedarjs/babel-config": "6.0.0-canary.2908",
41
+ "@cedarjs/cli-helpers": "6.0.0-canary.2908",
42
+ "@cedarjs/internal": "6.0.0-canary.2908",
43
+ "@cedarjs/prerender": "6.0.0-canary.2908",
44
+ "@cedarjs/project-config": "6.0.0-canary.2908",
45
+ "@cedarjs/structure": "6.0.0-canary.2908",
46
+ "@cedarjs/telemetry": "6.0.0-canary.2908",
47
+ "@cedarjs/utils": "6.0.0-canary.2908",
48
+ "@cedarjs/vite": "6.0.0-canary.2908",
49
+ "@cedarjs/web-server": "6.0.0-canary.2908",
50
50
  "@listr2/prompt-adapter-enquirer": "4.3.0",
51
51
  "@opentelemetry/api": "1.9.1",
52
52
  "@opentelemetry/core": "1.30.1",
@@ -94,7 +94,7 @@
94
94
  "yargs": "17.7.3"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/framework-tools": "6.0.0-canary.2906",
97
+ "@cedarjs/framework-tools": "6.0.0-canary.2908",
98
98
  "@prisma/dmmf": "7.8.0",
99
99
  "@types/archiver": "^7.0.0",
100
100
  "memfs": "4.64.0",