@cedarjs/cli 3.0.0-canary.13544 → 3.0.0-canary.13545

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,19 +1,18 @@
1
1
  import fs from "node:fs";
2
2
  import path from "path";
3
- import prismaInternals from "@prisma/internals";
3
+ import { getSchemaWithPath, getConfig } from "@prisma/internals";
4
4
  import { Listr } from "listr2";
5
5
  import * as toml from "smol-toml";
6
6
  import {
7
7
  colors as c,
8
- getPaths,
9
8
  isTypeScriptProject,
10
9
  getConfigPath
11
10
  } from "@cedarjs/cli-helpers";
11
+ import { getPaths, getSchemaPath } from "@cedarjs/project-config";
12
12
  import { errorTelemetry } from "@cedarjs/telemetry";
13
13
  import { printSetupNotes } from "../../../../lib/index.js";
14
14
  import { serverFileExists } from "../../../../lib/project.js";
15
15
  import { addFilesTask } from "../helpers/index.js";
16
- const { getSchemaWithPath, getConfig } = prismaInternals;
17
16
  const cedarPaths = getPaths();
18
17
  const EXTENSION = isTypeScriptProject ? "ts" : "js";
19
18
  async function handler({ force }) {
@@ -58,7 +57,8 @@ async function getAddCoherenceFilesTask(force) {
58
57
  });
59
58
  }
60
59
  async function getCoherenceConfigFileContent() {
61
- const result = await getSchemaWithPath(cedarPaths.api.dbSchema);
60
+ const schemaPath = await getSchemaPath(cedarPaths.api.prismaConfig);
61
+ const result = await getSchemaWithPath(schemaPath);
62
62
  const prismaConfig = await getConfig({ datamodel: result.schemas });
63
63
  let db = prismaConfig.datasources[0].activeProvider;
64
64
  if (!SUPPORTED_DATABASES.includes(db)) {
@@ -1,16 +1,13 @@
1
1
  import fs from "node:fs";
2
2
  import { EOL } from "os";
3
3
  import path from "path";
4
- import prismaInternals from "@prisma/internals";
4
+ import { getSchemaWithPath, getConfig } from "@prisma/internals";
5
5
  import { Listr } from "listr2";
6
6
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
7
+ import { getPaths, getSchemaPath } from "@cedarjs/project-config";
7
8
  import { errorTelemetry } from "@cedarjs/telemetry";
8
9
  import c from "../../../../lib/colors.js";
9
- import {
10
- getPaths,
11
- writeFilesTask,
12
- printSetupNotes
13
- } from "../../../../lib/index.js";
10
+ import { writeFilesTask, printSetupNotes } from "../../../../lib/index.js";
14
11
  import { updateApiURLTask } from "../helpers/index.js";
15
12
  import {
16
13
  flightcontrolConfig,
@@ -18,7 +15,6 @@ import {
18
15
  postgresDatabaseService,
19
16
  mysqlDatabaseService
20
17
  } from "../templates/flightcontrol.js";
21
- const { getSchemaWithPath, getConfig } = prismaInternals;
22
18
  const getFlightcontrolJson = async (database) => {
23
19
  if (database === "none") {
24
20
  return {
@@ -26,12 +22,11 @@ const getFlightcontrolJson = async (database) => {
26
22
  content: flightcontrolConfig
27
23
  };
28
24
  }
29
- if (!fs.existsSync(path.join(getPaths().base, "api/db/schema.prisma"))) {
30
- throw new Error("Could not find prisma schema at 'api/db/schema.prisma'");
25
+ const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
26
+ if (!fs.existsSync(schemaPath)) {
27
+ throw new Error(`Could not find prisma schema at ${schemaPath}`);
31
28
  }
32
- const result = await getSchemaWithPath(
33
- path.join(getPaths().base, "api/db/schema.prisma")
34
- );
29
+ const result = await getSchemaWithPath(schemaPath);
35
30
  const config = await getConfig({ datamodel: result.schemas });
36
31
  const detectedDatabase = config.datasources[0].activeProvider;
37
32
  if (detectedDatabase === database) {
@@ -1,15 +1,12 @@
1
1
  import fs from "node:fs";
2
2
  import path from "path";
3
- import prismaInternals from "@prisma/internals";
3
+ import { getSchemaWithPath, getConfig } from "@prisma/internals";
4
4
  import { Listr } from "listr2";
5
5
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
6
+ import { getPaths, getSchemaPath } from "@cedarjs/project-config";
6
7
  import { errorTelemetry } from "@cedarjs/telemetry";
7
8
  import c from "../../../../lib/colors.js";
8
- import {
9
- getPaths,
10
- writeFilesTask,
11
- printSetupNotes
12
- } from "../../../../lib/index.js";
9
+ import { writeFilesTask, printSetupNotes } from "../../../../lib/index.js";
13
10
  import { addFilesTask, updateApiURLTask } from "../helpers/index.js";
14
11
  import {
15
12
  POSTGRES_YAML,
@@ -17,7 +14,6 @@ import {
17
14
  RENDER_YAML,
18
15
  SQLITE_YAML
19
16
  } from "../templates/render.js";
20
- const { getSchemaWithPath, getConfig } = prismaInternals;
21
17
  const getRenderYamlContent = async (database) => {
22
18
  if (database === "none") {
23
19
  return {
@@ -25,11 +21,12 @@ const getRenderYamlContent = async (database) => {
25
21
  content: RENDER_YAML("")
26
22
  };
27
23
  }
28
- if (!fs.existsSync("api/db/schema.prisma")) {
29
- throw new Error("Could not find prisma schema at 'api/db/schema.prisma'");
24
+ const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
25
+ if (!fs.existsSync(schemaPath)) {
26
+ throw new Error(`Could not find prisma schema at ${schemaPath}`);
30
27
  }
31
- const { schemas } = await getSchemaWithPath("api/db/schema.prisma");
32
- const config = await getConfig({ datamodel: schemas });
28
+ const result = await getSchemaWithPath(schemaPath);
29
+ const config = await getConfig({ datamodel: result.schemas });
33
30
  const detectedDatabase = config.datasources[0].activeProvider;
34
31
  if (detectedDatabase === database) {
35
32
  switch (database) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "3.0.0-canary.13544+4071bcae9",
3
+ "version": "3.0.0-canary.13545+f5b914f25",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,16 +34,16 @@
34
34
  "@babel/parser": "7.29.0",
35
35
  "@babel/preset-typescript": "7.28.5",
36
36
  "@babel/runtime-corejs3": "7.29.0",
37
- "@cedarjs/api-server": "3.0.0-canary.13544",
38
- "@cedarjs/cli-helpers": "3.0.0-canary.13544",
39
- "@cedarjs/fastify-web": "3.0.0-canary.13544",
40
- "@cedarjs/internal": "3.0.0-canary.13544",
41
- "@cedarjs/prerender": "3.0.0-canary.13544",
42
- "@cedarjs/project-config": "3.0.0-canary.13544",
43
- "@cedarjs/structure": "3.0.0-canary.13544",
44
- "@cedarjs/telemetry": "3.0.0-canary.13544",
45
- "@cedarjs/utils": "3.0.0-canary.13544",
46
- "@cedarjs/web-server": "3.0.0-canary.13544",
37
+ "@cedarjs/api-server": "3.0.0-canary.13545",
38
+ "@cedarjs/cli-helpers": "3.0.0-canary.13545",
39
+ "@cedarjs/fastify-web": "3.0.0-canary.13545",
40
+ "@cedarjs/internal": "3.0.0-canary.13545",
41
+ "@cedarjs/prerender": "3.0.0-canary.13545",
42
+ "@cedarjs/project-config": "3.0.0-canary.13545",
43
+ "@cedarjs/structure": "3.0.0-canary.13545",
44
+ "@cedarjs/telemetry": "3.0.0-canary.13545",
45
+ "@cedarjs/utils": "3.0.0-canary.13545",
46
+ "@cedarjs/web-server": "3.0.0-canary.13545",
47
47
  "@listr2/prompt-adapter-enquirer": "4.2.1",
48
48
  "@opentelemetry/api": "1.9.0",
49
49
  "@opentelemetry/core": "1.30.1",
@@ -107,5 +107,5 @@
107
107
  "publishConfig": {
108
108
  "access": "public"
109
109
  },
110
- "gitHead": "4071bcae9162b5f40536a2899e2fb69612e6e4cd"
110
+ "gitHead": "f5b914f25404954f238dc8e3485c968a710af656"
111
111
  }