@cedarjs/project-config 2.8.1-next.0 → 2.8.1-next.116
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.
- package/dist/cjs/index.js +43 -10
- package/dist/cjs/prisma.d.ts +13 -3
- package/dist/cjs/prisma.d.ts.map +1 -1
- package/dist/index.js +42 -10
- package/dist/prisma.d.ts +13 -3
- package/dist/prisma.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/cjs/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __export(src_exports, {
|
|
|
46
46
|
getEnvVarDefinitions: () => getEnvVarDefinitions,
|
|
47
47
|
getMigrationsPath: () => getMigrationsPath,
|
|
48
48
|
getPaths: () => getPaths,
|
|
49
|
+
getPrismaSchemas: () => getPrismaSchemas,
|
|
49
50
|
getRawConfig: () => getRawConfig,
|
|
50
51
|
getRouteHookForPage: () => getRouteHookForPage,
|
|
51
52
|
getSchemaPath: () => getSchemaPath,
|
|
@@ -470,6 +471,16 @@ async function getSchemaPath(prismaConfigPath) {
|
|
|
470
471
|
}
|
|
471
472
|
return import_node_path.default.join(configDir, "schema.prisma");
|
|
472
473
|
}
|
|
474
|
+
async function getPrismaSchemas() {
|
|
475
|
+
const mod = require("@prisma/internals");
|
|
476
|
+
const { createSchemaPathInput, getSchemaWithPath } = mod.default || mod;
|
|
477
|
+
const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
|
|
478
|
+
const schemaPathInput = createSchemaPathInput({
|
|
479
|
+
baseDir: import_node_fs4.default.lstatSync(schemaPath).isDirectory() ? schemaPath : import_node_path.default.dirname(schemaPath),
|
|
480
|
+
schemaPathFromConfig: schemaPath
|
|
481
|
+
});
|
|
482
|
+
return getSchemaWithPath({ schemaPath: schemaPathInput });
|
|
483
|
+
}
|
|
473
484
|
async function getMigrationsPath(prismaConfigPath) {
|
|
474
485
|
const config = await loadPrismaConfig(prismaConfigPath);
|
|
475
486
|
const configDir = import_node_path.default.dirname(prismaConfigPath);
|
|
@@ -492,17 +503,38 @@ async function getDataMigrationsPath(prismaConfigPath) {
|
|
|
492
503
|
const migrationsDir = import_node_path.default.dirname(migrationsPath);
|
|
493
504
|
return import_node_path.default.join(migrationsDir, "dataMigrations");
|
|
494
505
|
}
|
|
495
|
-
function resolveGeneratedPrismaClient(
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
);
|
|
506
|
+
async function resolveGeneratedPrismaClient() {
|
|
507
|
+
let generatorOutputPath;
|
|
508
|
+
let ext = "ts";
|
|
509
|
+
try {
|
|
510
|
+
const prismaInternalsMod = require("@prisma/internals");
|
|
511
|
+
const { getConfig: getConfig3 } = prismaInternalsMod.default || prismaInternalsMod;
|
|
512
|
+
const { schemas, schemaRootDir } = await getPrismaSchemas();
|
|
513
|
+
const config = await getConfig3({ datamodel: schemas });
|
|
514
|
+
const generator = config.generators.find((entry) => entry.name === "client") ?? config.generators[0];
|
|
515
|
+
const output = generator?.output?.value;
|
|
516
|
+
const generatedFileExtension = generator?.config?.generatedFileExtension;
|
|
517
|
+
const resolvedExtension = Array.isArray(generatedFileExtension) ? generatedFileExtension[0] : generatedFileExtension;
|
|
518
|
+
if (typeof resolvedExtension === "string" && resolvedExtension.length > 0) {
|
|
519
|
+
ext = resolvedExtension;
|
|
520
|
+
}
|
|
521
|
+
if (output) {
|
|
522
|
+
generatorOutputPath = import_node_path.default.isAbsolute(output) ? output : import_node_path.default.resolve(schemaRootDir, output);
|
|
523
|
+
}
|
|
524
|
+
} catch {
|
|
525
|
+
}
|
|
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)) {
|
|
528
|
+
const checked = prismaClientEntry ?? "(could not determine output path)";
|
|
529
|
+
return {
|
|
530
|
+
clientPath: prismaClientEntry,
|
|
531
|
+
error: `Could not find generated Prisma client entry. Checked: ${checked}. Run \`yarn cedar prisma generate\` and try again.`
|
|
532
|
+
};
|
|
504
533
|
}
|
|
505
|
-
return
|
|
534
|
+
return {
|
|
535
|
+
clientPath: prismaClientEntry,
|
|
536
|
+
error: void 0
|
|
537
|
+
};
|
|
506
538
|
}
|
|
507
539
|
|
|
508
540
|
// src/envVarDefinitions.ts
|
|
@@ -566,6 +598,7 @@ function getEnvVarDefinitions() {
|
|
|
566
598
|
getEnvVarDefinitions,
|
|
567
599
|
getMigrationsPath,
|
|
568
600
|
getPaths,
|
|
601
|
+
getPrismaSchemas,
|
|
569
602
|
getRawConfig,
|
|
570
603
|
getRouteHookForPage,
|
|
571
604
|
getSchemaPath,
|
package/dist/cjs/prisma.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export declare function loadPrismaConfig(prismaConfigPath: string): Promise<Pris
|
|
|
15
15
|
* @returns Absolute path to the schema file or directory
|
|
16
16
|
*/
|
|
17
17
|
export declare function getSchemaPath(prismaConfigPath: string): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the Prisma schemas for the current project's default schema location.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getPrismaSchemas(): Promise<import("@prisma/schema-files-loader").GetSchemaResult>;
|
|
18
22
|
/**
|
|
19
23
|
* Gets the migrations path from Prisma config.
|
|
20
24
|
* Defaults to 'migrations' in the same directory as the schema.
|
|
@@ -42,7 +46,13 @@ export declare function getDbDir(prismaConfigPath: string): Promise<string>;
|
|
|
42
46
|
* @returns Absolute path to the data migrations directory
|
|
43
47
|
*/
|
|
44
48
|
export declare function getDataMigrationsPath(prismaConfigPath: string): Promise<string>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
type ResolveReturnType = {
|
|
50
|
+
clientPath: string;
|
|
51
|
+
error: undefined;
|
|
52
|
+
} | {
|
|
53
|
+
clientPath: string | undefined;
|
|
54
|
+
error: string;
|
|
55
|
+
};
|
|
56
|
+
export declare function resolveGeneratedPrismaClient(): Promise<ResolveReturnType>;
|
|
57
|
+
export {};
|
|
48
58
|
//# sourceMappingURL=prisma.d.ts.map
|
package/dist/cjs/prisma.d.ts.map
CHANGED
|
@@ -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;;;;;;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,
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -407,6 +407,16 @@ async function getSchemaPath(prismaConfigPath) {
|
|
|
407
407
|
}
|
|
408
408
|
return path3.join(configDir, "schema.prisma");
|
|
409
409
|
}
|
|
410
|
+
async function getPrismaSchemas() {
|
|
411
|
+
const mod = await import("@prisma/internals");
|
|
412
|
+
const { createSchemaPathInput, getSchemaWithPath } = mod.default || mod;
|
|
413
|
+
const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
|
|
414
|
+
const schemaPathInput = createSchemaPathInput({
|
|
415
|
+
baseDir: fs4.lstatSync(schemaPath).isDirectory() ? schemaPath : path3.dirname(schemaPath),
|
|
416
|
+
schemaPathFromConfig: schemaPath
|
|
417
|
+
});
|
|
418
|
+
return getSchemaWithPath({ schemaPath: schemaPathInput });
|
|
419
|
+
}
|
|
410
420
|
async function getMigrationsPath(prismaConfigPath) {
|
|
411
421
|
const config = await loadPrismaConfig(prismaConfigPath);
|
|
412
422
|
const configDir = path3.dirname(prismaConfigPath);
|
|
@@ -429,17 +439,38 @@ async function getDataMigrationsPath(prismaConfigPath) {
|
|
|
429
439
|
const migrationsDir = path3.dirname(migrationsPath);
|
|
430
440
|
return path3.join(migrationsDir, "dataMigrations");
|
|
431
441
|
}
|
|
432
|
-
function resolveGeneratedPrismaClient(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
);
|
|
442
|
+
async function resolveGeneratedPrismaClient() {
|
|
443
|
+
let generatorOutputPath;
|
|
444
|
+
let ext = "ts";
|
|
445
|
+
try {
|
|
446
|
+
const prismaInternalsMod = await import("@prisma/internals");
|
|
447
|
+
const { getConfig: getConfig3 } = prismaInternalsMod.default || prismaInternalsMod;
|
|
448
|
+
const { schemas, schemaRootDir } = await getPrismaSchemas();
|
|
449
|
+
const config = await getConfig3({ datamodel: schemas });
|
|
450
|
+
const generator = config.generators.find((entry) => entry.name === "client") ?? config.generators[0];
|
|
451
|
+
const output = generator?.output?.value;
|
|
452
|
+
const generatedFileExtension = generator?.config?.generatedFileExtension;
|
|
453
|
+
const resolvedExtension = Array.isArray(generatedFileExtension) ? generatedFileExtension[0] : generatedFileExtension;
|
|
454
|
+
if (typeof resolvedExtension === "string" && resolvedExtension.length > 0) {
|
|
455
|
+
ext = resolvedExtension;
|
|
456
|
+
}
|
|
457
|
+
if (output) {
|
|
458
|
+
generatorOutputPath = path3.isAbsolute(output) ? output : path3.resolve(schemaRootDir, output);
|
|
459
|
+
}
|
|
460
|
+
} catch {
|
|
461
|
+
}
|
|
462
|
+
const prismaClientEntry = typeof generatorOutputPath === "string" ? path3.join(generatorOutputPath, "client." + ext) : void 0;
|
|
463
|
+
if (!prismaClientEntry || !fs4.existsSync(prismaClientEntry)) {
|
|
464
|
+
const checked = prismaClientEntry ?? "(could not determine output path)";
|
|
465
|
+
return {
|
|
466
|
+
clientPath: prismaClientEntry,
|
|
467
|
+
error: `Could not find generated Prisma client entry. Checked: ${checked}. Run \`yarn cedar prisma generate\` and try again.`
|
|
468
|
+
};
|
|
441
469
|
}
|
|
442
|
-
return
|
|
470
|
+
return {
|
|
471
|
+
clientPath: prismaClientEntry,
|
|
472
|
+
error: void 0
|
|
473
|
+
};
|
|
443
474
|
}
|
|
444
475
|
|
|
445
476
|
// src/envVarDefinitions.ts
|
|
@@ -502,6 +533,7 @@ export {
|
|
|
502
533
|
getEnvVarDefinitions,
|
|
503
534
|
getMigrationsPath,
|
|
504
535
|
getPaths,
|
|
536
|
+
getPrismaSchemas,
|
|
505
537
|
getRawConfig,
|
|
506
538
|
getRouteHookForPage,
|
|
507
539
|
getSchemaPath,
|
package/dist/prisma.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export declare function loadPrismaConfig(prismaConfigPath: string): Promise<Pris
|
|
|
15
15
|
* @returns Absolute path to the schema file or directory
|
|
16
16
|
*/
|
|
17
17
|
export declare function getSchemaPath(prismaConfigPath: string): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the Prisma schemas for the current project's default schema location.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getPrismaSchemas(): Promise<import("@prisma/schema-files-loader").GetSchemaResult>;
|
|
18
22
|
/**
|
|
19
23
|
* Gets the migrations path from Prisma config.
|
|
20
24
|
* Defaults to 'migrations' in the same directory as the schema.
|
|
@@ -42,7 +46,13 @@ export declare function getDbDir(prismaConfigPath: string): Promise<string>;
|
|
|
42
46
|
* @returns Absolute path to the data migrations directory
|
|
43
47
|
*/
|
|
44
48
|
export declare function getDataMigrationsPath(prismaConfigPath: string): Promise<string>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
type ResolveReturnType = {
|
|
50
|
+
clientPath: string;
|
|
51
|
+
error: undefined;
|
|
52
|
+
} | {
|
|
53
|
+
clientPath: string | undefined;
|
|
54
|
+
error: string;
|
|
55
|
+
};
|
|
56
|
+
export declare function resolveGeneratedPrismaClient(): Promise<ResolveReturnType>;
|
|
57
|
+
export {};
|
|
48
58
|
//# sourceMappingURL=prisma.d.ts.map
|
package/dist/prisma.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../src/prisma.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAA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AE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAuD/E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/project-config",
|
|
3
|
-
"version": "2.8.1-next.
|
|
3
|
+
"version": "2.8.1-next.116+784d2c048",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"test:watch": "vitest watch"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@prisma/internals": "7.5.0",
|
|
39
40
|
"deepmerge": "4.3.1",
|
|
40
41
|
"fast-glob": "3.3.3",
|
|
41
42
|
"smol-toml": "1.6.0",
|
|
@@ -43,9 +44,9 @@
|
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@arethetypeswrong/cli": "0.18.2",
|
|
46
|
-
"@cedarjs/framework-tools": "2.8.1-next.
|
|
47
|
+
"@cedarjs/framework-tools": "2.8.1-next.116",
|
|
47
48
|
"concurrently": "9.2.1",
|
|
48
|
-
"prisma": "
|
|
49
|
+
"prisma": "7.5.0",
|
|
49
50
|
"publint": "0.3.18",
|
|
50
51
|
"rimraf": "6.1.3",
|
|
51
52
|
"tsx": "4.21.0",
|
|
@@ -55,5 +56,5 @@
|
|
|
55
56
|
"publishConfig": {
|
|
56
57
|
"access": "public"
|
|
57
58
|
},
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "784d2c0484936b2d853e5b316d167602bd80d996"
|
|
59
60
|
}
|