@cedarjs/project-config 3.0.1-next.0 → 3.0.1-next.27

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.
@@ -116,15 +116,18 @@ export interface CLIPlugin {
116
116
  }
117
117
  export declare const DEFAULT_CONFIG: Config;
118
118
  /**
119
- * These configuration options are modified by the user via the Cedar
120
- * config file.
119
+ * These configuration options are modified by the user via the Cedar config
120
+ * file.
121
+ *
122
+ * @param configPath Path to the config file. Defaults to automatically finding
123
+ * the project config file (cedar.toml or redwood.toml)
121
124
  */
122
- export declare const getConfig: (configPath?: string) => Config;
125
+ export declare function getConfig(configPath?: string): Config;
123
126
  /**
124
- * Returns the JSON parse of the config file without any default values.
127
+ * Returns a JSON representation of the config file without any default values.
125
128
  *
126
- * @param configPath Path to the config file, defaults to automatically find the project config file (cedar.toml or redwood.toml)
127
- * @returns A JSON object from the parsed toml values
129
+ * @param configPath Path to the config file. Defaults to automatically finding
130
+ * the project config file (cedar.toml or redwood.toml)
128
131
  */
129
132
  export declare function getRawConfig(configPath?: string): toml.TomlTable;
130
133
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAKjC,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAC,IAAI,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MA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B,CAAA;QACD,iBAAiB,EAAE;YACjB,OAAO,EAAE,OAAO,CAAA;SACjB,CAAA;KACF,CAAA;IACD,yBAAyB,EAAE,OAAO,CAAA;CACnC;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,MAmF5B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,UAAU,SAAkB,kBAMxD"}
package/dist/cjs/index.js CHANGED
@@ -128,7 +128,7 @@ var DEFAULT_CONFIG = {
128
128
  target: "node" /* NODE */,
129
129
  prismaConfig: "./api/prisma.config.cjs",
130
130
  serverConfig: "./api/server.config.js",
131
- debugPort: 18911
131
+ debugPort: void 0
132
132
  },
133
133
  graphql: {
134
134
  fragments: false,
@@ -193,13 +193,10 @@ var DEFAULT_CONFIG = {
193
193
  },
194
194
  eslintLegacyConfigWarning: true
195
195
  };
196
- var getConfig = (configPath = getConfigPath()) => {
197
- try {
198
- return (0, import_deepmerge.default)(DEFAULT_CONFIG, getRawConfig(configPath));
199
- } catch (e) {
200
- throw new Error(`Could not parse "${configPath}": ${e}`);
201
- }
202
- };
196
+ function getConfig(configPath) {
197
+ const config = (0, import_deepmerge.default)(DEFAULT_CONFIG, getRawConfig(configPath));
198
+ return config;
199
+ }
203
200
  function getRawConfig(configPath = getConfigPath()) {
204
201
  try {
205
202
  return toml.parse((0, import_string_env_interpolation.env)(import_node_fs2.default.readFileSync(configPath, "utf8")));
@@ -386,19 +383,19 @@ var processPagesDir = (webPagesDir = getPaths().web.pages) => {
386
383
  };
387
384
  });
388
385
  };
389
- var ensurePosixPath = (path5) => {
390
- let posixPath = path5;
386
+ var ensurePosixPath = (path6) => {
387
+ let posixPath = path6;
391
388
  if (process.platform === "win32") {
392
- if (/^[A-Z]:\\/.test(path5)) {
393
- const drive = path5[0].toLowerCase();
394
- posixPath = `/${drive}/${path5.substring(3)}`;
389
+ if (/^[A-Z]:\\/.test(path6)) {
390
+ const drive = path6[0].toLowerCase();
391
+ posixPath = `/${drive}/${path6.substring(3)}`;
395
392
  }
396
393
  posixPath = posixPath.replace(/\\/g, "/");
397
394
  }
398
395
  return posixPath;
399
396
  };
400
- var importStatementPath = (path5) => {
401
- let importPath = path5;
397
+ var importStatementPath = (path6) => {
398
+ let importPath = path6;
402
399
  if (process.platform === "win32") {
403
400
  importPath = importPath.replaceAll("\\", "/");
404
401
  }
@@ -436,12 +433,45 @@ var isTypeScriptProject = () => {
436
433
  };
437
434
 
438
435
  // src/prisma.ts
436
+ var import_node_fs5 = __toESM(require("node:fs"), 1);
437
+ var import_node_path2 = __toESM(require("node:path"), 1);
438
+ var import_node_url = require("node:url");
439
+
440
+ // src/packageManager.ts
439
441
  var import_node_fs4 = __toESM(require("node:fs"), 1);
440
442
  var import_node_path = __toESM(require("node:path"), 1);
441
- var import_node_url = require("node:url");
443
+ var packageManagerCache;
444
+ function getPackageManager() {
445
+ if (packageManagerCache) {
446
+ return packageManagerCache;
447
+ }
448
+ const base = getPaths().base;
449
+ packageManagerCache = "yarn";
450
+ const envPackageManager = process.env.npm_config_user_agent?.split(" ")[0]?.split("/")[0];
451
+ if (isPackageManager(envPackageManager)) {
452
+ packageManagerCache = envPackageManager;
453
+ } else if (import_node_fs4.default.existsSync(import_node_path.default.join(base, "yarn.lock"))) {
454
+ packageManagerCache = "yarn";
455
+ } else if (import_node_fs4.default.existsSync(import_node_path.default.join(base, "pnpm-lock.yaml"))) {
456
+ packageManagerCache = "pnpm";
457
+ } else if (import_node_fs4.default.existsSync(import_node_path.default.join(base, "package-lock.json"))) {
458
+ packageManagerCache = "npm";
459
+ }
460
+ return packageManagerCache;
461
+ }
462
+ function isPackageManager(pm) {
463
+ return pm === "yarn" || pm === "npm" || pm === "pnpm";
464
+ }
465
+ function prettyPrintCedarCommand(args) {
466
+ const packageManager = getPackageManager();
467
+ const packageManagerBin = packageManager === "npm" ? "npx" : packageManager;
468
+ return `${packageManagerBin} cedar ${args.join(" ")}`;
469
+ }
470
+
471
+ // src/prisma.ts
442
472
  var configCache = /* @__PURE__ */ new Map();
443
473
  async function loadPrismaConfig(prismaConfigPath) {
444
- if (!import_node_fs4.default.existsSync(prismaConfigPath)) {
474
+ if (!import_node_fs5.default.existsSync(prismaConfigPath)) {
445
475
  throw new Error(`Prisma config file not found at: ${prismaConfigPath}`);
446
476
  }
447
477
  if (configCache.has(prismaConfigPath)) {
@@ -465,43 +495,43 @@ async function loadPrismaConfig(prismaConfigPath) {
465
495
  }
466
496
  async function getSchemaPath(prismaConfigPath) {
467
497
  const config = await loadPrismaConfig(prismaConfigPath);
468
- const configDir = import_node_path.default.dirname(prismaConfigPath);
498
+ const configDir = import_node_path2.default.dirname(prismaConfigPath);
469
499
  if (config.schema) {
470
- return import_node_path.default.isAbsolute(config.schema) ? config.schema : import_node_path.default.resolve(configDir, config.schema);
500
+ return import_node_path2.default.isAbsolute(config.schema) ? config.schema : import_node_path2.default.resolve(configDir, config.schema);
471
501
  }
472
- return import_node_path.default.join(configDir, "schema.prisma");
502
+ return import_node_path2.default.join(configDir, "schema.prisma");
473
503
  }
474
504
  async function getPrismaSchemas() {
475
505
  const mod = require("@prisma/internals");
476
506
  const { createSchemaPathInput, getSchemaWithPath } = mod.default || mod;
477
507
  const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
478
508
  const schemaPathInput = createSchemaPathInput({
479
- baseDir: import_node_fs4.default.lstatSync(schemaPath).isDirectory() ? schemaPath : import_node_path.default.dirname(schemaPath),
509
+ baseDir: import_node_fs5.default.lstatSync(schemaPath).isDirectory() ? schemaPath : import_node_path2.default.dirname(schemaPath),
480
510
  schemaPathFromConfig: schemaPath
481
511
  });
482
512
  return getSchemaWithPath({ schemaPath: schemaPathInput });
483
513
  }
484
514
  async function getMigrationsPath(prismaConfigPath) {
485
515
  const config = await loadPrismaConfig(prismaConfigPath);
486
- const configDir = import_node_path.default.dirname(prismaConfigPath);
516
+ const configDir = import_node_path2.default.dirname(prismaConfigPath);
487
517
  if (config.migrations?.path) {
488
- return import_node_path.default.isAbsolute(config.migrations.path) ? config.migrations.path : import_node_path.default.resolve(configDir, config.migrations.path);
518
+ return import_node_path2.default.isAbsolute(config.migrations.path) ? config.migrations.path : import_node_path2.default.resolve(configDir, config.migrations.path);
489
519
  }
490
520
  const schemaPath = await getSchemaPath(prismaConfigPath);
491
- const schemaDir = import_node_fs4.default.statSync(schemaPath).isDirectory() ? schemaPath : import_node_path.default.dirname(schemaPath);
492
- return import_node_path.default.join(schemaDir, "migrations");
521
+ const schemaDir = import_node_fs5.default.statSync(schemaPath).isDirectory() ? schemaPath : import_node_path2.default.dirname(schemaPath);
522
+ return import_node_path2.default.join(schemaDir, "migrations");
493
523
  }
494
524
  async function getDbDir(prismaConfigPath) {
495
525
  const schemaPath = await getSchemaPath(prismaConfigPath);
496
- if (import_node_fs4.default.existsSync(schemaPath) && import_node_fs4.default.statSync(schemaPath).isDirectory()) {
526
+ if (import_node_fs5.default.existsSync(schemaPath) && import_node_fs5.default.statSync(schemaPath).isDirectory()) {
497
527
  return schemaPath;
498
528
  }
499
- return import_node_path.default.dirname(schemaPath);
529
+ return import_node_path2.default.dirname(schemaPath);
500
530
  }
501
531
  async function getDataMigrationsPath(prismaConfigPath) {
502
532
  const migrationsPath = await getMigrationsPath(prismaConfigPath);
503
- const migrationsDir = import_node_path.default.dirname(migrationsPath);
504
- return import_node_path.default.join(migrationsDir, "dataMigrations");
533
+ const migrationsDir = import_node_path2.default.dirname(migrationsPath);
534
+ return import_node_path2.default.join(migrationsDir, "dataMigrations");
505
535
  }
506
536
  async function resolveGeneratedPrismaClient() {
507
537
  let generatorOutputPath;
@@ -519,16 +549,17 @@ async function resolveGeneratedPrismaClient() {
519
549
  ext = resolvedExtension;
520
550
  }
521
551
  if (output) {
522
- generatorOutputPath = import_node_path.default.isAbsolute(output) ? output : import_node_path.default.resolve(schemaRootDir, output);
552
+ generatorOutputPath = import_node_path2.default.isAbsolute(output) ? output : import_node_path2.default.resolve(schemaRootDir, output);
523
553
  }
524
554
  } catch {
525
555
  }
526
- const prismaClientEntry = typeof generatorOutputPath === "string" ? import_node_path.default.join(generatorOutputPath, "client." + ext) : void 0;
527
- if (!prismaClientEntry || !import_node_fs4.default.existsSync(prismaClientEntry)) {
556
+ const prismaClientEntry = typeof generatorOutputPath === "string" ? import_node_path2.default.join(generatorOutputPath, "client." + ext) : void 0;
557
+ if (!prismaClientEntry || !import_node_fs5.default.existsSync(prismaClientEntry)) {
528
558
  const checked = prismaClientEntry ?? "(could not determine output path)";
559
+ const pmCommand = prettyPrintCedarCommand(["prisma", "generate"]);
529
560
  return {
530
561
  clientPath: prismaClientEntry,
531
- error: `Could not find generated Prisma client entry. Checked: ${checked}. Run \`yarn cedar prisma generate\` and try again.`
562
+ error: `Could not find generated Prisma client entry. Checked: ${checked}. Run \`${pmCommand}\` and try again.`
532
563
  };
533
564
  }
534
565
  return {
@@ -538,7 +569,7 @@ async function resolveGeneratedPrismaClient() {
538
569
  }
539
570
 
540
571
  // src/envVarDefinitions.ts
541
- var import_node_path2 = __toESM(require("node:path"), 1);
572
+ var import_node_path3 = __toESM(require("node:path"), 1);
542
573
  var import_project_config = require("@cedarjs/project-config");
543
574
  function getEnvVarDefinitions() {
544
575
  const rwConfig = (0, import_project_config.getConfig)();
@@ -547,7 +578,7 @@ function getEnvVarDefinitions() {
547
578
  RWJS_ENV: {
548
579
  RWJS_API_GRAPHQL_URL: rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql",
549
580
  RWJS_API_URL: rwConfig.web.apiUrl,
550
- __REDWOOD__APP_TITLE: rwConfig.web.title || import_node_path2.default.basename(rwPaths.base),
581
+ __REDWOOD__APP_TITLE: rwConfig.web.title || import_node_path3.default.basename(rwPaths.base),
551
582
  RWJS_EXP_STREAMING_SSR: rwConfig.experimental.streamingSsr?.enabled,
552
583
  RWJS_EXP_RSC: rwConfig.experimental?.rsc?.enabled
553
584
  },
@@ -0,0 +1,20 @@
1
+ export type PackageManager = 'yarn' | 'npm' | 'pnpm';
2
+ /**
3
+ * Returns the package manager used by the Cedar project. Falls back to 'yarn'
4
+ * if we can't determine what package manager the project uses
5
+ */
6
+ export declare function getPackageManager(): PackageManager;
7
+ export declare function resetPackageManagerCache(): void;
8
+ /**
9
+ * Gets a string suitable for displaying to the user when telling them to run a
10
+ * Cedar bin command, like `yarn cedar upgrade` or
11
+ * `yarn cedar generate page home /`.
12
+ *
13
+ * This is a duplicate of what's in `cli-helpers/packageManager`. Please
14
+ * prefer the other one if you can. This one is only here for packages that
15
+ * can't import cli-helpers.
16
+ * TODO: Remove this one when we've fully moved to tree-shakable ESM sub-path
17
+ * imports
18
+ */
19
+ export declare function prettyPrintCedarCommand(args: string[]): string;
20
+ //# sourceMappingURL=packageManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageManager.d.ts","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAIpD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAgClD;AAMD,wBAAgB,wBAAwB,SAEvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9D"}
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/packageManager.ts
31
+ var packageManager_exports = {};
32
+ __export(packageManager_exports, {
33
+ getPackageManager: () => getPackageManager,
34
+ prettyPrintCedarCommand: () => prettyPrintCedarCommand,
35
+ resetPackageManagerCache: () => resetPackageManagerCache
36
+ });
37
+ module.exports = __toCommonJS(packageManager_exports);
38
+ var import_node_fs4 = __toESM(require("node:fs"), 1);
39
+ var import_node_path = __toESM(require("node:path"), 1);
40
+
41
+ // src/paths.ts
42
+ var import_node_fs3 = __toESM(require("node:fs"), 1);
43
+ var import_path2 = __toESM(require("path"), 1);
44
+ var import_fast_glob = __toESM(require("fast-glob"), 1);
45
+
46
+ // src/config.ts
47
+ var import_node_fs2 = __toESM(require("node:fs"), 1);
48
+ var import_deepmerge = __toESM(require("deepmerge"), 1);
49
+ var toml = __toESM(require("smol-toml"), 1);
50
+ var import_string_env_interpolation = require("string-env-interpolation");
51
+
52
+ // src/findUp.ts
53
+ var import_node_fs = __toESM(require("node:fs"), 1);
54
+ var import_path = __toESM(require("path"), 1);
55
+ function findUp(file, startingDirectory = process.cwd()) {
56
+ const possibleFilepath = import_path.default.join(startingDirectory, file);
57
+ if (import_node_fs.default.existsSync(possibleFilepath)) {
58
+ return possibleFilepath;
59
+ }
60
+ const parentDirectory = import_path.default.dirname(startingDirectory);
61
+ if (parentDirectory === startingDirectory) {
62
+ return null;
63
+ }
64
+ return findUp(file, parentDirectory);
65
+ }
66
+
67
+ // src/configPath.ts
68
+ var CONFIG_FILE_NAMES = ["cedar.toml", "redwood.toml"];
69
+ var getConfigPathCache = /* @__PURE__ */ new Map();
70
+ var getConfigPath = (cwd = process.env.CEDAR_CWD ?? process.env.RWJS_CWD ?? process.cwd()) => {
71
+ const cachedPath = getConfigPathCache.get(cwd);
72
+ if (cachedPath) {
73
+ return cachedPath;
74
+ }
75
+ const configPath = findUp("cedar.toml", cwd) || findUp("redwood.toml", cwd);
76
+ if (!configPath) {
77
+ throw new Error(
78
+ `Could not find a "${CONFIG_FILE_NAMES.join('" or "')}" file, are you sure you're in a Cedar project?`
79
+ );
80
+ }
81
+ getConfigPathCache.set(cwd, configPath);
82
+ return configPath;
83
+ };
84
+
85
+ // src/config.ts
86
+ var DEFAULT_CONFIG = {
87
+ web: {
88
+ title: "Cedar App",
89
+ port: 8910,
90
+ path: "./web",
91
+ target: "browser" /* BROWSER */,
92
+ includeEnvironmentVariables: [],
93
+ apiUrl: "/.redwood/functions",
94
+ fastRefresh: true,
95
+ a11y: true,
96
+ sourceMap: false
97
+ },
98
+ api: {
99
+ title: "Cedar App",
100
+ port: 8911,
101
+ path: "./api",
102
+ target: "node" /* NODE */,
103
+ prismaConfig: "./api/prisma.config.cjs",
104
+ serverConfig: "./api/server.config.js",
105
+ debugPort: void 0
106
+ },
107
+ graphql: {
108
+ fragments: false,
109
+ trustedDocuments: false,
110
+ includeScalars: { File: true }
111
+ },
112
+ browser: {
113
+ open: false
114
+ },
115
+ generate: {
116
+ tests: true,
117
+ stories: true,
118
+ nestScaffoldByModel: true
119
+ },
120
+ notifications: {
121
+ versionUpdates: []
122
+ },
123
+ studio: {
124
+ basePort: 4318,
125
+ graphiql: {
126
+ authImpersonation: {
127
+ authProvider: void 0,
128
+ userId: void 0,
129
+ email: void 0,
130
+ jwtSecret: "secret"
131
+ }
132
+ }
133
+ },
134
+ experimental: {
135
+ opentelemetry: {
136
+ enabled: false,
137
+ wrapApi: true
138
+ },
139
+ cli: {
140
+ autoInstall: true,
141
+ plugins: [
142
+ {
143
+ package: "@cedarjs/cli-storybook-vite"
144
+ },
145
+ {
146
+ package: "@cedarjs/cli-data-migrate"
147
+ }
148
+ ]
149
+ },
150
+ useSDLCodeGenForGraphQLTypes: false,
151
+ streamingSsr: {
152
+ enabled: false
153
+ },
154
+ rsc: {
155
+ enabled: false
156
+ },
157
+ realtime: {
158
+ enabled: false
159
+ },
160
+ reactCompiler: {
161
+ enabled: false,
162
+ lintOnly: false
163
+ },
164
+ packagesWorkspace: {
165
+ enabled: false
166
+ }
167
+ },
168
+ eslintLegacyConfigWarning: true
169
+ };
170
+ function getConfig(configPath) {
171
+ const config = (0, import_deepmerge.default)(DEFAULT_CONFIG, getRawConfig(configPath));
172
+ return config;
173
+ }
174
+ function getRawConfig(configPath = getConfigPath()) {
175
+ try {
176
+ return toml.parse((0, import_string_env_interpolation.env)(import_node_fs2.default.readFileSync(configPath, "utf8")));
177
+ } catch (e) {
178
+ throw new Error(`Could not parse "${configPath}": ${e}`);
179
+ }
180
+ }
181
+
182
+ // src/paths.ts
183
+ var getBaseDir = (configPath = getConfigPath()) => {
184
+ return import_path2.default.dirname(configPath);
185
+ };
186
+ var resolveFile = (filePath, extensions = [".js", ".tsx", ".ts", ".jsx", ".mjs", ".mts", ".cjs"]) => {
187
+ for (const extension of extensions) {
188
+ const p = `${filePath}${extension}`;
189
+ if (import_node_fs3.default.existsSync(p)) {
190
+ return p;
191
+ }
192
+ }
193
+ return null;
194
+ };
195
+ var getPathsCache = /* @__PURE__ */ new Map();
196
+ function getPaths(BASE_DIR = getBaseDir()) {
197
+ if (getPathsCache.has(BASE_DIR)) {
198
+ return getPathsCache.get(BASE_DIR);
199
+ }
200
+ const routes = resolveFile(import_path2.default.join(BASE_DIR, "web/src/Routes"));
201
+ const { prismaConfig: prismaConfigFromConfig } = getConfig(
202
+ getConfigPath(BASE_DIR)
203
+ ).api;
204
+ const prismaConfigBase = import_path2.default.join(
205
+ BASE_DIR,
206
+ prismaConfigFromConfig.replace(/\.[^.]+$/, "")
207
+ );
208
+ const prismaConfig = resolveFile(prismaConfigBase) || import_path2.default.join(BASE_DIR, prismaConfigFromConfig);
209
+ const viteConfig = resolveFile(
210
+ import_path2.default.join(BASE_DIR, "web/vite.config")
211
+ );
212
+ const paths = {
213
+ base: BASE_DIR,
214
+ generated: {
215
+ base: import_path2.default.join(BASE_DIR, ".redwood"),
216
+ schema: import_path2.default.join(BASE_DIR, ".redwood/schema.graphql"),
217
+ types: {
218
+ includes: import_path2.default.join(BASE_DIR, ".redwood/types/includes"),
219
+ mirror: import_path2.default.join(BASE_DIR, ".redwood/types/mirror")
220
+ },
221
+ prebuild: import_path2.default.join(BASE_DIR, ".redwood/prebuild")
222
+ },
223
+ scripts: import_path2.default.join(BASE_DIR, "scripts"),
224
+ packages: import_path2.default.join(BASE_DIR, "packages"),
225
+ generatorTemplates: import_path2.default.join(BASE_DIR, "generatorTemplates"),
226
+ api: {
227
+ base: import_path2.default.join(BASE_DIR, "api"),
228
+ prismaConfig,
229
+ functions: import_path2.default.join(BASE_DIR, "api/src/functions"),
230
+ graphql: import_path2.default.join(BASE_DIR, "api/src/graphql"),
231
+ lib: import_path2.default.join(BASE_DIR, "api/src/lib"),
232
+ generators: import_path2.default.join(BASE_DIR, "api/generators"),
233
+ config: import_path2.default.join(BASE_DIR, "api/src/config"),
234
+ services: import_path2.default.join(BASE_DIR, "api/src/services"),
235
+ directives: import_path2.default.join(BASE_DIR, "api/src/directives"),
236
+ subscriptions: import_path2.default.join(BASE_DIR, "api/src/subscriptions"),
237
+ src: import_path2.default.join(BASE_DIR, "api/src"),
238
+ dist: import_path2.default.join(BASE_DIR, "api/dist"),
239
+ types: import_path2.default.join(BASE_DIR, "api/types"),
240
+ models: import_path2.default.join(BASE_DIR, "api/src/models"),
241
+ mail: import_path2.default.join(BASE_DIR, "api/src", "mail"),
242
+ jobs: import_path2.default.join(BASE_DIR, "api/src/jobs"),
243
+ distJobs: import_path2.default.join(BASE_DIR, "api/dist/jobs"),
244
+ jobsConfig: resolveFile(import_path2.default.join(BASE_DIR, "api/src/lib", "jobs")),
245
+ distJobsConfig: resolveFile(
246
+ import_path2.default.join(BASE_DIR, "api/dist", "lib", "jobs")
247
+ ),
248
+ logger: resolveFile(import_path2.default.join(BASE_DIR, "api/src/lib", "logger"))
249
+ },
250
+ web: {
251
+ routes,
252
+ base: import_path2.default.join(BASE_DIR, "web"),
253
+ pages: import_path2.default.join(BASE_DIR, "web/src/pages/"),
254
+ components: import_path2.default.join(BASE_DIR, "web/src/components"),
255
+ layouts: import_path2.default.join(BASE_DIR, "web/src/layouts/"),
256
+ src: import_path2.default.join(BASE_DIR, "web/src"),
257
+ storybook: import_path2.default.join(BASE_DIR, "web/.storybook"),
258
+ generators: import_path2.default.join(BASE_DIR, "web/generators"),
259
+ app: resolveFile(import_path2.default.join(BASE_DIR, "web/src/App")),
260
+ document: resolveFile(import_path2.default.join(BASE_DIR, "web/src/Document")),
261
+ html: import_path2.default.join(BASE_DIR, "web/src/index.html"),
262
+ config: import_path2.default.join(BASE_DIR, "web/config"),
263
+ viteConfig,
264
+ postcss: import_path2.default.join(BASE_DIR, "web/config/postcss.config.cjs"),
265
+ storybookConfig: import_path2.default.join(BASE_DIR, "web/.storybook/main.js"),
266
+ storybookPreviewConfig: resolveFile(
267
+ import_path2.default.join(BASE_DIR, "web/.storybook/preview")
268
+ ),
269
+ storybookManagerConfig: import_path2.default.join(BASE_DIR, "web/.storybook/manager.js"),
270
+ dist: import_path2.default.join(BASE_DIR, "web/dist"),
271
+ distBrowser: import_path2.default.join(BASE_DIR, "web/dist/browser"),
272
+ distRsc: import_path2.default.join(BASE_DIR, "web/dist/rsc"),
273
+ distSsr: import_path2.default.join(BASE_DIR, "web/dist/ssr"),
274
+ distSsrDocument: import_path2.default.join(BASE_DIR, "web/dist/ssr/Document"),
275
+ distSsrEntryServer: import_path2.default.join(BASE_DIR, "web/dist/ssr/entry.server"),
276
+ distRouteHooks: import_path2.default.join(BASE_DIR, "web/dist/ssr/routeHooks"),
277
+ distRscEntries: import_path2.default.join(BASE_DIR, "web/dist/rsc/entries.mjs"),
278
+ routeManifest: import_path2.default.join(BASE_DIR, "web/dist/ssr/route-manifest.json"),
279
+ types: import_path2.default.join(BASE_DIR, "web/types"),
280
+ entryClient: resolveFile(import_path2.default.join(BASE_DIR, "web/src/entry.client")),
281
+ // new vite/stream entry point for client
282
+ entryServer: resolveFile(import_path2.default.join(BASE_DIR, "web/src/entry.server")),
283
+ graphql: import_path2.default.join(BASE_DIR, "web/src/graphql")
284
+ }
285
+ };
286
+ import_node_fs3.default.mkdirSync(paths.generated.types.includes, { recursive: true });
287
+ import_node_fs3.default.mkdirSync(paths.generated.types.mirror, { recursive: true });
288
+ getPathsCache.set(BASE_DIR, paths);
289
+ return paths;
290
+ }
291
+
292
+ // src/packageManager.ts
293
+ var packageManagerCache;
294
+ function getPackageManager() {
295
+ if (packageManagerCache) {
296
+ return packageManagerCache;
297
+ }
298
+ const base = getPaths().base;
299
+ packageManagerCache = "yarn";
300
+ const envPackageManager = process.env.npm_config_user_agent?.split(" ")[0]?.split("/")[0];
301
+ if (isPackageManager(envPackageManager)) {
302
+ packageManagerCache = envPackageManager;
303
+ } else if (import_node_fs4.default.existsSync(import_node_path.default.join(base, "yarn.lock"))) {
304
+ packageManagerCache = "yarn";
305
+ } else if (import_node_fs4.default.existsSync(import_node_path.default.join(base, "pnpm-lock.yaml"))) {
306
+ packageManagerCache = "pnpm";
307
+ } else if (import_node_fs4.default.existsSync(import_node_path.default.join(base, "package-lock.json"))) {
308
+ packageManagerCache = "npm";
309
+ }
310
+ return packageManagerCache;
311
+ }
312
+ function isPackageManager(pm) {
313
+ return pm === "yarn" || pm === "npm" || pm === "pnpm";
314
+ }
315
+ function resetPackageManagerCache() {
316
+ packageManagerCache = void 0;
317
+ }
318
+ function prettyPrintCedarCommand(args) {
319
+ const packageManager = getPackageManager();
320
+ const packageManagerBin = packageManager === "npm" ? "npx" : packageManager;
321
+ return `${packageManagerBin} cedar ${args.join(" ")}`;
322
+ }
323
+ // Annotate the CommonJS export names for ESM import in node:
324
+ 0 && (module.exports = {
325
+ getPackageManager,
326
+ prettyPrintCedarCommand,
327
+ resetPackageManagerCache
328
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/prisma.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAO1C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,yBA8B9D;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,mBAY3D;AAED;;GAEG;AACH,wBAAsB,gBAAgB,mEAgBrC;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,KAAK,iBAAiB,GAClB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACxC;IAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAuD/E"}
1
+ {"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/prisma.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAQ1C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,yBA8B9D;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,mBAY3D;AAED;;GAEG;AACH,wBAAsB,gBAAgB,mEAgBrC;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,KAAK,iBAAiB,GAClB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACxC;IAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAwD/E"}
package/dist/config.d.ts CHANGED
@@ -116,15 +116,18 @@ export interface CLIPlugin {
116
116
  }
117
117
  export declare const DEFAULT_CONFIG: Config;
118
118
  /**
119
- * These configuration options are modified by the user via the Cedar
120
- * config file.
119
+ * These configuration options are modified by the user via the Cedar config
120
+ * file.
121
+ *
122
+ * @param configPath Path to the config file. Defaults to automatically finding
123
+ * the project config file (cedar.toml or redwood.toml)
121
124
  */
122
- export declare const getConfig: (configPath?: string) => Config;
125
+ export declare function getConfig(configPath?: string): Config;
123
126
  /**
124
- * Returns the JSON parse of the config file without any default values.
127
+ * Returns a JSON representation of the config file without any default values.
125
128
  *
126
- * @param configPath Path to the config file, defaults to automatically find the project config file (cedar.toml or redwood.toml)
127
- * @returns A JSON object from the parsed toml values
129
+ * @param configPath Path to the config file. Defaults to automatically finding
130
+ * the project config file (cedar.toml or redwood.toml)
128
131
  */
129
132
  export declare function getRawConfig(configPath?: string): toml.TomlTable;
130
133
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAKjC,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAC,IAAI,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAC7B;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAC,OAAO,CAAA;IAC1B,2BAA2B,EAAE,MAAM,EAAE,CAAA;IACrC;;;;;;QAMI;IACJ,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,WAAW,EAAE,OAAO,CAAA;IACpB,IAAI,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+64,7 @@ var DEFAULT_CONFIG = {
64
64
  target: "node" /* NODE */,
65
65
  prismaConfig: "./api/prisma.config.cjs",
66
66
  serverConfig: "./api/server.config.js",
67
- debugPort: 18911
67
+ debugPort: void 0
68
68
  },
69
69
  graphql: {
70
70
  fragments: false,
@@ -129,13 +129,10 @@ var DEFAULT_CONFIG = {
129
129
  },
130
130
  eslintLegacyConfigWarning: true
131
131
  };
132
- var getConfig = (configPath = getConfigPath()) => {
133
- try {
134
- return merge(DEFAULT_CONFIG, getRawConfig(configPath));
135
- } catch (e) {
136
- throw new Error(`Could not parse "${configPath}": ${e}`);
137
- }
138
- };
132
+ function getConfig(configPath) {
133
+ const config = merge(DEFAULT_CONFIG, getRawConfig(configPath));
134
+ return config;
135
+ }
139
136
  function getRawConfig(configPath = getConfigPath()) {
140
137
  try {
141
138
  return toml.parse(envInterpolation(fs2.readFileSync(configPath, "utf8")));
@@ -322,19 +319,19 @@ var processPagesDir = (webPagesDir = getPaths().web.pages) => {
322
319
  };
323
320
  });
324
321
  };
325
- var ensurePosixPath = (path5) => {
326
- let posixPath = path5;
322
+ var ensurePosixPath = (path6) => {
323
+ let posixPath = path6;
327
324
  if (process.platform === "win32") {
328
- if (/^[A-Z]:\\/.test(path5)) {
329
- const drive = path5[0].toLowerCase();
330
- posixPath = `/${drive}/${path5.substring(3)}`;
325
+ if (/^[A-Z]:\\/.test(path6)) {
326
+ const drive = path6[0].toLowerCase();
327
+ posixPath = `/${drive}/${path6.substring(3)}`;
331
328
  }
332
329
  posixPath = posixPath.replace(/\\/g, "/");
333
330
  }
334
331
  return posixPath;
335
332
  };
336
- var importStatementPath = (path5) => {
337
- let importPath = path5;
333
+ var importStatementPath = (path6) => {
334
+ let importPath = path6;
338
335
  if (process.platform === "win32") {
339
336
  importPath = importPath.replaceAll("\\", "/");
340
337
  }
@@ -372,12 +369,45 @@ var isTypeScriptProject = () => {
372
369
  };
373
370
 
374
371
  // src/prisma.ts
372
+ import fs5 from "node:fs";
373
+ import path4 from "node:path";
374
+ import { pathToFileURL } from "node:url";
375
+
376
+ // src/packageManager.ts
375
377
  import fs4 from "node:fs";
376
378
  import path3 from "node:path";
377
- import { pathToFileURL } from "node:url";
379
+ var packageManagerCache;
380
+ function getPackageManager() {
381
+ if (packageManagerCache) {
382
+ return packageManagerCache;
383
+ }
384
+ const base = getPaths().base;
385
+ packageManagerCache = "yarn";
386
+ const envPackageManager = process.env.npm_config_user_agent?.split(" ")[0]?.split("/")[0];
387
+ if (isPackageManager(envPackageManager)) {
388
+ packageManagerCache = envPackageManager;
389
+ } else if (fs4.existsSync(path3.join(base, "yarn.lock"))) {
390
+ packageManagerCache = "yarn";
391
+ } else if (fs4.existsSync(path3.join(base, "pnpm-lock.yaml"))) {
392
+ packageManagerCache = "pnpm";
393
+ } else if (fs4.existsSync(path3.join(base, "package-lock.json"))) {
394
+ packageManagerCache = "npm";
395
+ }
396
+ return packageManagerCache;
397
+ }
398
+ function isPackageManager(pm) {
399
+ return pm === "yarn" || pm === "npm" || pm === "pnpm";
400
+ }
401
+ function prettyPrintCedarCommand(args) {
402
+ const packageManager = getPackageManager();
403
+ const packageManagerBin = packageManager === "npm" ? "npx" : packageManager;
404
+ return `${packageManagerBin} cedar ${args.join(" ")}`;
405
+ }
406
+
407
+ // src/prisma.ts
378
408
  var configCache = /* @__PURE__ */ new Map();
379
409
  async function loadPrismaConfig(prismaConfigPath) {
380
- if (!fs4.existsSync(prismaConfigPath)) {
410
+ if (!fs5.existsSync(prismaConfigPath)) {
381
411
  throw new Error(`Prisma config file not found at: ${prismaConfigPath}`);
382
412
  }
383
413
  if (configCache.has(prismaConfigPath)) {
@@ -401,43 +431,43 @@ async function loadPrismaConfig(prismaConfigPath) {
401
431
  }
402
432
  async function getSchemaPath(prismaConfigPath) {
403
433
  const config = await loadPrismaConfig(prismaConfigPath);
404
- const configDir = path3.dirname(prismaConfigPath);
434
+ const configDir = path4.dirname(prismaConfigPath);
405
435
  if (config.schema) {
406
- return path3.isAbsolute(config.schema) ? config.schema : path3.resolve(configDir, config.schema);
436
+ return path4.isAbsolute(config.schema) ? config.schema : path4.resolve(configDir, config.schema);
407
437
  }
408
- return path3.join(configDir, "schema.prisma");
438
+ return path4.join(configDir, "schema.prisma");
409
439
  }
410
440
  async function getPrismaSchemas() {
411
441
  const mod = await import("@prisma/internals");
412
442
  const { createSchemaPathInput, getSchemaWithPath } = mod.default || mod;
413
443
  const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
414
444
  const schemaPathInput = createSchemaPathInput({
415
- baseDir: fs4.lstatSync(schemaPath).isDirectory() ? schemaPath : path3.dirname(schemaPath),
445
+ baseDir: fs5.lstatSync(schemaPath).isDirectory() ? schemaPath : path4.dirname(schemaPath),
416
446
  schemaPathFromConfig: schemaPath
417
447
  });
418
448
  return getSchemaWithPath({ schemaPath: schemaPathInput });
419
449
  }
420
450
  async function getMigrationsPath(prismaConfigPath) {
421
451
  const config = await loadPrismaConfig(prismaConfigPath);
422
- const configDir = path3.dirname(prismaConfigPath);
452
+ const configDir = path4.dirname(prismaConfigPath);
423
453
  if (config.migrations?.path) {
424
- return path3.isAbsolute(config.migrations.path) ? config.migrations.path : path3.resolve(configDir, config.migrations.path);
454
+ return path4.isAbsolute(config.migrations.path) ? config.migrations.path : path4.resolve(configDir, config.migrations.path);
425
455
  }
426
456
  const schemaPath = await getSchemaPath(prismaConfigPath);
427
- const schemaDir = fs4.statSync(schemaPath).isDirectory() ? schemaPath : path3.dirname(schemaPath);
428
- return path3.join(schemaDir, "migrations");
457
+ const schemaDir = fs5.statSync(schemaPath).isDirectory() ? schemaPath : path4.dirname(schemaPath);
458
+ return path4.join(schemaDir, "migrations");
429
459
  }
430
460
  async function getDbDir(prismaConfigPath) {
431
461
  const schemaPath = await getSchemaPath(prismaConfigPath);
432
- if (fs4.existsSync(schemaPath) && fs4.statSync(schemaPath).isDirectory()) {
462
+ if (fs5.existsSync(schemaPath) && fs5.statSync(schemaPath).isDirectory()) {
433
463
  return schemaPath;
434
464
  }
435
- return path3.dirname(schemaPath);
465
+ return path4.dirname(schemaPath);
436
466
  }
437
467
  async function getDataMigrationsPath(prismaConfigPath) {
438
468
  const migrationsPath = await getMigrationsPath(prismaConfigPath);
439
- const migrationsDir = path3.dirname(migrationsPath);
440
- return path3.join(migrationsDir, "dataMigrations");
469
+ const migrationsDir = path4.dirname(migrationsPath);
470
+ return path4.join(migrationsDir, "dataMigrations");
441
471
  }
442
472
  async function resolveGeneratedPrismaClient() {
443
473
  let generatorOutputPath;
@@ -455,16 +485,17 @@ async function resolveGeneratedPrismaClient() {
455
485
  ext = resolvedExtension;
456
486
  }
457
487
  if (output) {
458
- generatorOutputPath = path3.isAbsolute(output) ? output : path3.resolve(schemaRootDir, output);
488
+ generatorOutputPath = path4.isAbsolute(output) ? output : path4.resolve(schemaRootDir, output);
459
489
  }
460
490
  } catch {
461
491
  }
462
- const prismaClientEntry = typeof generatorOutputPath === "string" ? path3.join(generatorOutputPath, "client." + ext) : void 0;
463
- if (!prismaClientEntry || !fs4.existsSync(prismaClientEntry)) {
492
+ const prismaClientEntry = typeof generatorOutputPath === "string" ? path4.join(generatorOutputPath, "client." + ext) : void 0;
493
+ if (!prismaClientEntry || !fs5.existsSync(prismaClientEntry)) {
464
494
  const checked = prismaClientEntry ?? "(could not determine output path)";
495
+ const pmCommand = prettyPrintCedarCommand(["prisma", "generate"]);
465
496
  return {
466
497
  clientPath: prismaClientEntry,
467
- error: `Could not find generated Prisma client entry. Checked: ${checked}. Run \`yarn cedar prisma generate\` and try again.`
498
+ error: `Could not find generated Prisma client entry. Checked: ${checked}. Run \`${pmCommand}\` and try again.`
468
499
  };
469
500
  }
470
501
  return {
@@ -474,7 +505,7 @@ async function resolveGeneratedPrismaClient() {
474
505
  }
475
506
 
476
507
  // src/envVarDefinitions.ts
477
- import path4 from "node:path";
508
+ import path5 from "node:path";
478
509
  import { getConfig as getConfig2, getPaths as getPaths2 } from "@cedarjs/project-config";
479
510
  function getEnvVarDefinitions() {
480
511
  const rwConfig = getConfig2();
@@ -483,7 +514,7 @@ function getEnvVarDefinitions() {
483
514
  RWJS_ENV: {
484
515
  RWJS_API_GRAPHQL_URL: rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql",
485
516
  RWJS_API_URL: rwConfig.web.apiUrl,
486
- __REDWOOD__APP_TITLE: rwConfig.web.title || path4.basename(rwPaths.base),
517
+ __REDWOOD__APP_TITLE: rwConfig.web.title || path5.basename(rwPaths.base),
487
518
  RWJS_EXP_STREAMING_SSR: rwConfig.experimental.streamingSsr?.enabled,
488
519
  RWJS_EXP_RSC: rwConfig.experimental?.rsc?.enabled
489
520
  },
@@ -0,0 +1,20 @@
1
+ export type PackageManager = 'yarn' | 'npm' | 'pnpm';
2
+ /**
3
+ * Returns the package manager used by the Cedar project. Falls back to 'yarn'
4
+ * if we can't determine what package manager the project uses
5
+ */
6
+ export declare function getPackageManager(): PackageManager;
7
+ export declare function resetPackageManagerCache(): void;
8
+ /**
9
+ * Gets a string suitable for displaying to the user when telling them to run a
10
+ * Cedar bin command, like `yarn cedar upgrade` or
11
+ * `yarn cedar generate page home /`.
12
+ *
13
+ * This is a duplicate of what's in `cli-helpers/packageManager`. Please
14
+ * prefer the other one if you can. This one is only here for packages that
15
+ * can't import cli-helpers.
16
+ * TODO: Remove this one when we've fully moved to tree-shakable ESM sub-path
17
+ * imports
18
+ */
19
+ export declare function prettyPrintCedarCommand(args: string[]): string;
20
+ //# sourceMappingURL=packageManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageManager.d.ts","sourceRoot":"","sources":["../src/packageManager.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAIpD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAgClD;AAMD,wBAAgB,wBAAwB,SAEvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9D"}
@@ -0,0 +1,291 @@
1
+ // src/packageManager.ts
2
+ import fs4 from "node:fs";
3
+ import path3 from "node:path";
4
+
5
+ // src/paths.ts
6
+ import fs3 from "node:fs";
7
+ import path2 from "path";
8
+ import fg from "fast-glob";
9
+
10
+ // src/config.ts
11
+ import fs2 from "node:fs";
12
+ import merge from "deepmerge";
13
+ import * as toml from "smol-toml";
14
+ import { env as envInterpolation } from "string-env-interpolation";
15
+
16
+ // src/findUp.ts
17
+ import fs from "node:fs";
18
+ import path from "path";
19
+ function findUp(file, startingDirectory = process.cwd()) {
20
+ const possibleFilepath = path.join(startingDirectory, file);
21
+ if (fs.existsSync(possibleFilepath)) {
22
+ return possibleFilepath;
23
+ }
24
+ const parentDirectory = path.dirname(startingDirectory);
25
+ if (parentDirectory === startingDirectory) {
26
+ return null;
27
+ }
28
+ return findUp(file, parentDirectory);
29
+ }
30
+
31
+ // src/configPath.ts
32
+ var CONFIG_FILE_NAMES = ["cedar.toml", "redwood.toml"];
33
+ var getConfigPathCache = /* @__PURE__ */ new Map();
34
+ var getConfigPath = (cwd = process.env.CEDAR_CWD ?? process.env.RWJS_CWD ?? process.cwd()) => {
35
+ const cachedPath = getConfigPathCache.get(cwd);
36
+ if (cachedPath) {
37
+ return cachedPath;
38
+ }
39
+ const configPath = findUp("cedar.toml", cwd) || findUp("redwood.toml", cwd);
40
+ if (!configPath) {
41
+ throw new Error(
42
+ `Could not find a "${CONFIG_FILE_NAMES.join('" or "')}" file, are you sure you're in a Cedar project?`
43
+ );
44
+ }
45
+ getConfigPathCache.set(cwd, configPath);
46
+ return configPath;
47
+ };
48
+
49
+ // src/config.ts
50
+ var DEFAULT_CONFIG = {
51
+ web: {
52
+ title: "Cedar App",
53
+ port: 8910,
54
+ path: "./web",
55
+ target: "browser" /* BROWSER */,
56
+ includeEnvironmentVariables: [],
57
+ apiUrl: "/.redwood/functions",
58
+ fastRefresh: true,
59
+ a11y: true,
60
+ sourceMap: false
61
+ },
62
+ api: {
63
+ title: "Cedar App",
64
+ port: 8911,
65
+ path: "./api",
66
+ target: "node" /* NODE */,
67
+ prismaConfig: "./api/prisma.config.cjs",
68
+ serverConfig: "./api/server.config.js",
69
+ debugPort: void 0
70
+ },
71
+ graphql: {
72
+ fragments: false,
73
+ trustedDocuments: false,
74
+ includeScalars: { File: true }
75
+ },
76
+ browser: {
77
+ open: false
78
+ },
79
+ generate: {
80
+ tests: true,
81
+ stories: true,
82
+ nestScaffoldByModel: true
83
+ },
84
+ notifications: {
85
+ versionUpdates: []
86
+ },
87
+ studio: {
88
+ basePort: 4318,
89
+ graphiql: {
90
+ authImpersonation: {
91
+ authProvider: void 0,
92
+ userId: void 0,
93
+ email: void 0,
94
+ jwtSecret: "secret"
95
+ }
96
+ }
97
+ },
98
+ experimental: {
99
+ opentelemetry: {
100
+ enabled: false,
101
+ wrapApi: true
102
+ },
103
+ cli: {
104
+ autoInstall: true,
105
+ plugins: [
106
+ {
107
+ package: "@cedarjs/cli-storybook-vite"
108
+ },
109
+ {
110
+ package: "@cedarjs/cli-data-migrate"
111
+ }
112
+ ]
113
+ },
114
+ useSDLCodeGenForGraphQLTypes: false,
115
+ streamingSsr: {
116
+ enabled: false
117
+ },
118
+ rsc: {
119
+ enabled: false
120
+ },
121
+ realtime: {
122
+ enabled: false
123
+ },
124
+ reactCompiler: {
125
+ enabled: false,
126
+ lintOnly: false
127
+ },
128
+ packagesWorkspace: {
129
+ enabled: false
130
+ }
131
+ },
132
+ eslintLegacyConfigWarning: true
133
+ };
134
+ function getConfig(configPath) {
135
+ const config = merge(DEFAULT_CONFIG, getRawConfig(configPath));
136
+ return config;
137
+ }
138
+ function getRawConfig(configPath = getConfigPath()) {
139
+ try {
140
+ return toml.parse(envInterpolation(fs2.readFileSync(configPath, "utf8")));
141
+ } catch (e) {
142
+ throw new Error(`Could not parse "${configPath}": ${e}`);
143
+ }
144
+ }
145
+
146
+ // src/paths.ts
147
+ var getBaseDir = (configPath = getConfigPath()) => {
148
+ return path2.dirname(configPath);
149
+ };
150
+ var resolveFile = (filePath, extensions = [".js", ".tsx", ".ts", ".jsx", ".mjs", ".mts", ".cjs"]) => {
151
+ for (const extension of extensions) {
152
+ const p = `${filePath}${extension}`;
153
+ if (fs3.existsSync(p)) {
154
+ return p;
155
+ }
156
+ }
157
+ return null;
158
+ };
159
+ var getPathsCache = /* @__PURE__ */ new Map();
160
+ function getPaths(BASE_DIR = getBaseDir()) {
161
+ if (getPathsCache.has(BASE_DIR)) {
162
+ return getPathsCache.get(BASE_DIR);
163
+ }
164
+ const routes = resolveFile(path2.join(BASE_DIR, "web/src/Routes"));
165
+ const { prismaConfig: prismaConfigFromConfig } = getConfig(
166
+ getConfigPath(BASE_DIR)
167
+ ).api;
168
+ const prismaConfigBase = path2.join(
169
+ BASE_DIR,
170
+ prismaConfigFromConfig.replace(/\.[^.]+$/, "")
171
+ );
172
+ const prismaConfig = resolveFile(prismaConfigBase) || path2.join(BASE_DIR, prismaConfigFromConfig);
173
+ const viteConfig = resolveFile(
174
+ path2.join(BASE_DIR, "web/vite.config")
175
+ );
176
+ const paths = {
177
+ base: BASE_DIR,
178
+ generated: {
179
+ base: path2.join(BASE_DIR, ".redwood"),
180
+ schema: path2.join(BASE_DIR, ".redwood/schema.graphql"),
181
+ types: {
182
+ includes: path2.join(BASE_DIR, ".redwood/types/includes"),
183
+ mirror: path2.join(BASE_DIR, ".redwood/types/mirror")
184
+ },
185
+ prebuild: path2.join(BASE_DIR, ".redwood/prebuild")
186
+ },
187
+ scripts: path2.join(BASE_DIR, "scripts"),
188
+ packages: path2.join(BASE_DIR, "packages"),
189
+ generatorTemplates: path2.join(BASE_DIR, "generatorTemplates"),
190
+ api: {
191
+ base: path2.join(BASE_DIR, "api"),
192
+ prismaConfig,
193
+ functions: path2.join(BASE_DIR, "api/src/functions"),
194
+ graphql: path2.join(BASE_DIR, "api/src/graphql"),
195
+ lib: path2.join(BASE_DIR, "api/src/lib"),
196
+ generators: path2.join(BASE_DIR, "api/generators"),
197
+ config: path2.join(BASE_DIR, "api/src/config"),
198
+ services: path2.join(BASE_DIR, "api/src/services"),
199
+ directives: path2.join(BASE_DIR, "api/src/directives"),
200
+ subscriptions: path2.join(BASE_DIR, "api/src/subscriptions"),
201
+ src: path2.join(BASE_DIR, "api/src"),
202
+ dist: path2.join(BASE_DIR, "api/dist"),
203
+ types: path2.join(BASE_DIR, "api/types"),
204
+ models: path2.join(BASE_DIR, "api/src/models"),
205
+ mail: path2.join(BASE_DIR, "api/src", "mail"),
206
+ jobs: path2.join(BASE_DIR, "api/src/jobs"),
207
+ distJobs: path2.join(BASE_DIR, "api/dist/jobs"),
208
+ jobsConfig: resolveFile(path2.join(BASE_DIR, "api/src/lib", "jobs")),
209
+ distJobsConfig: resolveFile(
210
+ path2.join(BASE_DIR, "api/dist", "lib", "jobs")
211
+ ),
212
+ logger: resolveFile(path2.join(BASE_DIR, "api/src/lib", "logger"))
213
+ },
214
+ web: {
215
+ routes,
216
+ base: path2.join(BASE_DIR, "web"),
217
+ pages: path2.join(BASE_DIR, "web/src/pages/"),
218
+ components: path2.join(BASE_DIR, "web/src/components"),
219
+ layouts: path2.join(BASE_DIR, "web/src/layouts/"),
220
+ src: path2.join(BASE_DIR, "web/src"),
221
+ storybook: path2.join(BASE_DIR, "web/.storybook"),
222
+ generators: path2.join(BASE_DIR, "web/generators"),
223
+ app: resolveFile(path2.join(BASE_DIR, "web/src/App")),
224
+ document: resolveFile(path2.join(BASE_DIR, "web/src/Document")),
225
+ html: path2.join(BASE_DIR, "web/src/index.html"),
226
+ config: path2.join(BASE_DIR, "web/config"),
227
+ viteConfig,
228
+ postcss: path2.join(BASE_DIR, "web/config/postcss.config.cjs"),
229
+ storybookConfig: path2.join(BASE_DIR, "web/.storybook/main.js"),
230
+ storybookPreviewConfig: resolveFile(
231
+ path2.join(BASE_DIR, "web/.storybook/preview")
232
+ ),
233
+ storybookManagerConfig: path2.join(BASE_DIR, "web/.storybook/manager.js"),
234
+ dist: path2.join(BASE_DIR, "web/dist"),
235
+ distBrowser: path2.join(BASE_DIR, "web/dist/browser"),
236
+ distRsc: path2.join(BASE_DIR, "web/dist/rsc"),
237
+ distSsr: path2.join(BASE_DIR, "web/dist/ssr"),
238
+ distSsrDocument: path2.join(BASE_DIR, "web/dist/ssr/Document"),
239
+ distSsrEntryServer: path2.join(BASE_DIR, "web/dist/ssr/entry.server"),
240
+ distRouteHooks: path2.join(BASE_DIR, "web/dist/ssr/routeHooks"),
241
+ distRscEntries: path2.join(BASE_DIR, "web/dist/rsc/entries.mjs"),
242
+ routeManifest: path2.join(BASE_DIR, "web/dist/ssr/route-manifest.json"),
243
+ types: path2.join(BASE_DIR, "web/types"),
244
+ entryClient: resolveFile(path2.join(BASE_DIR, "web/src/entry.client")),
245
+ // new vite/stream entry point for client
246
+ entryServer: resolveFile(path2.join(BASE_DIR, "web/src/entry.server")),
247
+ graphql: path2.join(BASE_DIR, "web/src/graphql")
248
+ }
249
+ };
250
+ fs3.mkdirSync(paths.generated.types.includes, { recursive: true });
251
+ fs3.mkdirSync(paths.generated.types.mirror, { recursive: true });
252
+ getPathsCache.set(BASE_DIR, paths);
253
+ return paths;
254
+ }
255
+
256
+ // src/packageManager.ts
257
+ var packageManagerCache;
258
+ function getPackageManager() {
259
+ if (packageManagerCache) {
260
+ return packageManagerCache;
261
+ }
262
+ const base = getPaths().base;
263
+ packageManagerCache = "yarn";
264
+ const envPackageManager = process.env.npm_config_user_agent?.split(" ")[0]?.split("/")[0];
265
+ if (isPackageManager(envPackageManager)) {
266
+ packageManagerCache = envPackageManager;
267
+ } else if (fs4.existsSync(path3.join(base, "yarn.lock"))) {
268
+ packageManagerCache = "yarn";
269
+ } else if (fs4.existsSync(path3.join(base, "pnpm-lock.yaml"))) {
270
+ packageManagerCache = "pnpm";
271
+ } else if (fs4.existsSync(path3.join(base, "package-lock.json"))) {
272
+ packageManagerCache = "npm";
273
+ }
274
+ return packageManagerCache;
275
+ }
276
+ function isPackageManager(pm) {
277
+ return pm === "yarn" || pm === "npm" || pm === "pnpm";
278
+ }
279
+ function resetPackageManagerCache() {
280
+ packageManagerCache = void 0;
281
+ }
282
+ function prettyPrintCedarCommand(args) {
283
+ const packageManager = getPackageManager();
284
+ const packageManagerBin = packageManager === "npm" ? "npx" : packageManager;
285
+ return `${packageManagerBin} cedar ${args.join(" ")}`;
286
+ }
287
+ export {
288
+ getPackageManager,
289
+ prettyPrintCedarCommand,
290
+ resetPackageManagerCache
291
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../src/prisma.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAO1C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,yBA8B9D;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,mBAY3D;AAED;;GAEG;AACH,wBAAsB,gBAAgB,mEAgBrC;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,KAAK,iBAAiB,GAClB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACxC;IAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAuD/E"}
1
+ {"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../src/prisma.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAQ1C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,yBA8B9D;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,mBAY3D;AAED;;GAEG;AACH,wBAAsB,gBAAgB,mEAgBrC;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,KAAK,iBAAiB,GAClB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACxC;IAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAwD/E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/project-config",
3
- "version": "3.0.1-next.0+776a0f168",
3
+ "version": "3.0.1-next.27+ab492debb",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -18,6 +18,16 @@
18
18
  "types": "./dist/cjs/index.d.ts",
19
19
  "default": "./dist/cjs/index.js"
20
20
  }
21
+ },
22
+ "./packageManager": {
23
+ "import": {
24
+ "types": "./dist/packageManager.d.ts",
25
+ "default": "./dist/packageManager.js"
26
+ },
27
+ "default": {
28
+ "types": "./dist/cjs/packageManager.d.ts",
29
+ "default": "./dist/cjs/packageManager.js"
30
+ }
21
31
  }
22
32
  },
23
33
  "types": "./dist/index.d.ts",
@@ -44,7 +54,7 @@
44
54
  },
45
55
  "devDependencies": {
46
56
  "@arethetypeswrong/cli": "0.18.2",
47
- "@cedarjs/framework-tools": "3.0.1-next.1",
57
+ "@cedarjs/framework-tools": "3.0.1-next.27",
48
58
  "concurrently": "9.2.1",
49
59
  "prisma": "7.5.0",
50
60
  "publint": "0.3.18",
@@ -53,8 +63,11 @@
53
63
  "typescript": "5.9.3",
54
64
  "vitest": "3.2.4"
55
65
  },
66
+ "engines": {
67
+ "node": ">=24"
68
+ },
56
69
  "publishConfig": {
57
70
  "access": "public"
58
71
  },
59
- "gitHead": "776a0f168a2c1aba6f73c068eaec4d4f7029da96"
72
+ "gitHead": "ab492debbba62731613261d67a7b24d747bae5d8"
60
73
  }