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

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.
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import camelcase from "camelcase";
3
3
  import { Listr } from "listr2";
4
4
  import pascalcase from "pascalcase";
5
- import pluralize, { singular } from "pluralize";
5
+ import pluralize from "pluralize";
6
6
  import prompts from "prompts";
7
7
  import { generate as generateTypes } from "@cedarjs/internal/dist/generate/generate";
8
8
  import { projectIsEsm } from "@cedarjs/project-config";
@@ -17,7 +17,7 @@ import {
17
17
  import { isTypeScriptProject } from "../../../lib/project.js";
18
18
  import { isRealtimeSetup, isServerFileSetup } from "../../experimental/util.js";
19
19
  const templateVariables = (name) => {
20
- name = singular(name.toLowerCase());
20
+ name = pluralize.singular(name.toLowerCase());
21
21
  return {
22
22
  name,
23
23
  collectionName: pluralize(name),
@@ -38,7 +38,7 @@ const templateVariables = (name) => {
38
38
  async function handler({ name, type, force, verbose, silent }) {
39
39
  const redwoodPaths = getPaths();
40
40
  const ts = isTypeScriptProject();
41
- name = singular(name.toLowerCase());
41
+ name = pluralize.singular(name.toLowerCase());
42
42
  let functionType = type;
43
43
  if (!functionType) {
44
44
  const response = await prompts({
@@ -5,10 +5,10 @@ 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";
@@ -58,7 +58,8 @@ async function getAddCoherenceFilesTask(force) {
58
58
  });
59
59
  }
60
60
  async function getCoherenceConfigFileContent() {
61
- const result = await getSchemaWithPath(cedarPaths.api.dbSchema);
61
+ const schemaPath = await getSchemaPath(cedarPaths.api.prismaConfig);
62
+ const result = await getSchemaWithPath(schemaPath);
62
63
  const prismaConfig = await getConfig({ datamodel: result.schemas });
63
64
  let db = prismaConfig.datasources[0].activeProvider;
64
65
  if (!SUPPORTED_DATABASES.includes(db)) {
@@ -4,13 +4,10 @@ import path from "path";
4
4
  import prismaInternals 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,
@@ -26,12 +23,11 @@ const getFlightcontrolJson = async (database) => {
26
23
  content: flightcontrolConfig
27
24
  };
28
25
  }
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'");
26
+ const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
27
+ if (!fs.existsSync(schemaPath)) {
28
+ throw new Error(`Could not find prisma schema at ${schemaPath}`);
31
29
  }
32
- const result = await getSchemaWithPath(
33
- path.join(getPaths().base, "api/db/schema.prisma")
34
- );
30
+ const result = await getSchemaWithPath(schemaPath);
35
31
  const config = await getConfig({ datamodel: result.schemas });
36
32
  const detectedDatabase = config.datasources[0].activeProvider;
37
33
  if (detectedDatabase === database) {
@@ -3,13 +3,10 @@ import path from "path";
3
3
  import prismaInternals 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,
@@ -25,11 +22,12 @@ const getRenderYamlContent = async (database) => {
25
22
  content: RENDER_YAML("")
26
23
  };
27
24
  }
28
- if (!fs.existsSync("api/db/schema.prisma")) {
29
- 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}`);
30
28
  }
31
- const { schemas } = await getSchemaWithPath("api/db/schema.prisma");
32
- const config = await getConfig({ datamodel: schemas });
29
+ const result = await getSchemaWithPath(schemaPath);
30
+ const config = await getConfig({ datamodel: result.schemas });
33
31
  const detectedDatabase = config.datasources[0].activeProvider;
34
32
  if (detectedDatabase === database) {
35
33
  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.13546+ed4ef855e",
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.13546",
38
+ "@cedarjs/cli-helpers": "3.0.0-canary.13546",
39
+ "@cedarjs/fastify-web": "3.0.0-canary.13546",
40
+ "@cedarjs/internal": "3.0.0-canary.13546",
41
+ "@cedarjs/prerender": "3.0.0-canary.13546",
42
+ "@cedarjs/project-config": "3.0.0-canary.13546",
43
+ "@cedarjs/structure": "3.0.0-canary.13546",
44
+ "@cedarjs/telemetry": "3.0.0-canary.13546",
45
+ "@cedarjs/utils": "3.0.0-canary.13546",
46
+ "@cedarjs/web-server": "3.0.0-canary.13546",
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": "ed4ef855ed3fdde4ac0d944fe77de56c3cdbf856"
111
111
  }