@powerlines/plugin-prisma 0.2.71 → 0.2.72
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/_virtual/rolldown_runtime.cjs +29 -1
- package/dist/api/client/client.gen.cjs +176 -1
- package/dist/api/client/client.gen.mjs +176 -1
- package/dist/api/client/index.cjs +14 -1
- package/dist/api/client/index.mjs +7 -1
- package/dist/api/client/types.gen.mjs +1 -1
- package/dist/api/client/utils.gen.cjs +187 -1
- package/dist/api/client/utils.gen.mjs +180 -1
- package/dist/api/client.gen.cjs +9 -1
- package/dist/api/client.gen.mjs +9 -1
- package/dist/api/core/auth.gen.cjs +12 -1
- package/dist/api/core/auth.gen.mjs +11 -1
- package/dist/api/core/bodySerializer.gen.cjs +35 -1
- package/dist/api/core/bodySerializer.gen.mjs +32 -1
- package/dist/api/core/params.gen.cjs +65 -1
- package/dist/api/core/params.gen.mjs +64 -1
- package/dist/api/core/pathSerializer.gen.cjs +87 -1
- package/dist/api/core/pathSerializer.gen.mjs +81 -1
- package/dist/api/core/queryKeySerializer.gen.cjs +66 -1
- package/dist/api/core/queryKeySerializer.gen.mjs +63 -1
- package/dist/api/core/serverSentEvents.gen.cjs +94 -6
- package/dist/api/core/serverSentEvents.gen.mjs +93 -6
- package/dist/api/core/types.gen.mjs +1 -1
- package/dist/api/core/utils.gen.cjs +81 -1
- package/dist/api/core/utils.gen.mjs +78 -1
- package/dist/api/sdk.gen.cjs +256 -1
- package/dist/api/sdk.gen.mjs +256 -1
- package/dist/api/types.gen.mjs +1 -1
- package/dist/helpers/get-schema.cjs +81 -1
- package/dist/helpers/get-schema.mjs +78 -1
- package/dist/helpers/index.cjs +7 -1
- package/dist/helpers/index.mjs +5 -1
- package/dist/helpers/prisma-postgres.cjs +16 -1
- package/dist/helpers/prisma-postgres.mjs +15 -1
- package/dist/helpers/schema-creator.cjs +59 -12
- package/dist/helpers/schema-creator.mjs +58 -12
- package/dist/index.cjs +127 -1
- package/dist/index.mjs +121 -1
- package/dist/powerlines/src/plugin-utils/get-config-path.cjs +49 -1
- package/dist/powerlines/src/plugin-utils/get-config-path.mjs +48 -1
- package/dist/powerlines/src/plugin-utils/paths.cjs +36 -1
- package/dist/powerlines/src/plugin-utils/paths.mjs +35 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/dist/types/prisma.mjs +1 -1
- package/package.json +11 -11
package/dist/helpers/index.mjs
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{getSchema
|
|
1
|
+
import { getSchema } from "./get-schema.mjs";
|
|
2
|
+
import { PrismaSchemaCreator } from "./schema-creator.mjs";
|
|
3
|
+
import { findDatabaseByName } from "./prisma-postgres.mjs";
|
|
4
|
+
|
|
5
|
+
export { PrismaSchemaCreator, findDatabaseByName, getSchema };
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/helpers/prisma-postgres.ts
|
|
3
|
+
/**
|
|
4
|
+
* Find a Postgres database by name.
|
|
5
|
+
*
|
|
6
|
+
* @param context - The Prisma plugin context.
|
|
7
|
+
* @param name - The name of the database to find.
|
|
8
|
+
* @returns The database object if found, otherwise undefined.
|
|
9
|
+
*/
|
|
10
|
+
async function findDatabaseByName(context, name) {
|
|
11
|
+
if (!context.config.prisma.prismaPostgres?.projectId) throw new Error(`Prisma Postgres project ID is not configured. Please set "prisma.prismaPostgres.projectId" in your Powerlines configuration.`);
|
|
12
|
+
return (await context.prisma.api.listDatabases({ path: { projectId: context.config.prisma.prismaPostgres.projectId } })).data.data.find((db) => db.name === name);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.findDatabaseByName = findDatabaseByName;
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/helpers/prisma-postgres.ts
|
|
2
|
+
/**
|
|
3
|
+
* Find a Postgres database by name.
|
|
4
|
+
*
|
|
5
|
+
* @param context - The Prisma plugin context.
|
|
6
|
+
* @param name - The name of the database to find.
|
|
7
|
+
* @returns The database object if found, otherwise undefined.
|
|
8
|
+
*/
|
|
9
|
+
async function findDatabaseByName(context, name) {
|
|
10
|
+
if (!context.config.prisma.prismaPostgres?.projectId) throw new Error(`Prisma Postgres project ID is not configured. Please set "prisma.prismaPostgres.projectId" in your Powerlines configuration.`);
|
|
11
|
+
return (await context.prisma.api.listDatabases({ path: { projectId: context.config.prisma.prismaPostgres.projectId } })).data.data.find((db) => db.name === name);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { findDatabaseByName };
|
|
@@ -1,14 +1,61 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let prisma_util_schema_creator = require("prisma-util/schema-creator");
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/schema-creator.ts
|
|
5
|
+
/**
|
|
6
|
+
* Prisma schema creator that allows building a schema via code.
|
|
7
|
+
*/
|
|
8
|
+
var PrismaSchemaCreator = class extends prisma_util_schema_creator.SchemaCreator {
|
|
9
|
+
/** Prisma plugin context */
|
|
10
|
+
#context;
|
|
11
|
+
get generators() {
|
|
12
|
+
return this.#context.prisma.schema.generators;
|
|
13
|
+
}
|
|
14
|
+
set generators(value) {
|
|
15
|
+
this.#context.prisma.schema.generators = value;
|
|
16
|
+
}
|
|
17
|
+
constructor(context) {
|
|
18
|
+
super();
|
|
19
|
+
this.#context = context;
|
|
20
|
+
this.#context.prisma ??= {};
|
|
21
|
+
this.#context.prisma.schema ??= {
|
|
22
|
+
generators: [],
|
|
23
|
+
datasources: [],
|
|
24
|
+
warnings: []
|
|
25
|
+
};
|
|
26
|
+
this.#context.prisma.schema.generators.forEach((generator) => {
|
|
27
|
+
this.pushGenerator(generator);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
pushGenerator(generator) {
|
|
31
|
+
if (this.generators.some((gen) => gen.name === generator.name)) this.generators = [...this.generators.filter((gen) => gen.name !== generator.name), generator];
|
|
32
|
+
else this.generators.push(generator);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
build() {
|
|
36
|
+
let schema = super.build();
|
|
37
|
+
for (const generator of this.generators) schema = `
|
|
38
|
+
generator ${generator.name} {
|
|
39
|
+
provider = "${generator.provider.value}"
|
|
40
|
+
output = "${generator.output?.value}"${generator.previewFeatures && generator.previewFeatures.length > 0 ? `
|
|
41
|
+
previewFeatures = [${generator.previewFeatures.map((feature) => `"${feature}"`).join(", ")}]` : ""}${generator.config && Object.keys(generator.config).length > 0 ? Object.entries(generator.config).map(([key, value]) => {
|
|
42
|
+
if (Array.isArray(value)) return `${key} = [${value.map((v) => `"${v}"`).join(", ")}]`;
|
|
43
|
+
else return `${key} = "${value}"`;
|
|
44
|
+
}).join("\n ") : ""}${generator.binaryTargets && generator.binaryTargets.length > 0 ? `
|
|
45
|
+
binaryTargets = [${generator.binaryTargets.map((bt) => `"${bt.value}"`).join(", ")}]` : ""}${generator.envPaths?.rootEnvPath || generator.envPaths?.schemaEnvPath ? `
|
|
46
|
+
env = {${generator.envPaths?.rootEnvPath ? `
|
|
47
|
+
root = "${generator.envPaths.rootEnvPath}"` : ""}${generator.envPaths?.schemaEnvPath ? `
|
|
48
|
+
schema = "${generator.envPaths.schemaEnvPath}"` : ""}
|
|
49
|
+
}` : ""}
|
|
12
50
|
}
|
|
13
51
|
|
|
14
|
-
${
|
|
52
|
+
${schema}`;
|
|
53
|
+
return schema;
|
|
54
|
+
}
|
|
55
|
+
async write() {
|
|
56
|
+
await this.#context.fs.write(this.#context.config.prisma.schema, this.build());
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.PrismaSchemaCreator = PrismaSchemaCreator;
|
|
@@ -1,14 +1,60 @@
|
|
|
1
|
-
import{SchemaCreator
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { SchemaCreator } from "prisma-util/schema-creator";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/schema-creator.ts
|
|
4
|
+
/**
|
|
5
|
+
* Prisma schema creator that allows building a schema via code.
|
|
6
|
+
*/
|
|
7
|
+
var PrismaSchemaCreator = class extends SchemaCreator {
|
|
8
|
+
/** Prisma plugin context */
|
|
9
|
+
#context;
|
|
10
|
+
get generators() {
|
|
11
|
+
return this.#context.prisma.schema.generators;
|
|
12
|
+
}
|
|
13
|
+
set generators(value) {
|
|
14
|
+
this.#context.prisma.schema.generators = value;
|
|
15
|
+
}
|
|
16
|
+
constructor(context) {
|
|
17
|
+
super();
|
|
18
|
+
this.#context = context;
|
|
19
|
+
this.#context.prisma ??= {};
|
|
20
|
+
this.#context.prisma.schema ??= {
|
|
21
|
+
generators: [],
|
|
22
|
+
datasources: [],
|
|
23
|
+
warnings: []
|
|
24
|
+
};
|
|
25
|
+
this.#context.prisma.schema.generators.forEach((generator) => {
|
|
26
|
+
this.pushGenerator(generator);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
pushGenerator(generator) {
|
|
30
|
+
if (this.generators.some((gen) => gen.name === generator.name)) this.generators = [...this.generators.filter((gen) => gen.name !== generator.name), generator];
|
|
31
|
+
else this.generators.push(generator);
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
build() {
|
|
35
|
+
let schema = super.build();
|
|
36
|
+
for (const generator of this.generators) schema = `
|
|
37
|
+
generator ${generator.name} {
|
|
38
|
+
provider = "${generator.provider.value}"
|
|
39
|
+
output = "${generator.output?.value}"${generator.previewFeatures && generator.previewFeatures.length > 0 ? `
|
|
40
|
+
previewFeatures = [${generator.previewFeatures.map((feature) => `"${feature}"`).join(", ")}]` : ""}${generator.config && Object.keys(generator.config).length > 0 ? Object.entries(generator.config).map(([key, value]) => {
|
|
41
|
+
if (Array.isArray(value)) return `${key} = [${value.map((v) => `"${v}"`).join(", ")}]`;
|
|
42
|
+
else return `${key} = "${value}"`;
|
|
43
|
+
}).join("\n ") : ""}${generator.binaryTargets && generator.binaryTargets.length > 0 ? `
|
|
44
|
+
binaryTargets = [${generator.binaryTargets.map((bt) => `"${bt.value}"`).join(", ")}]` : ""}${generator.envPaths?.rootEnvPath || generator.envPaths?.schemaEnvPath ? `
|
|
45
|
+
env = {${generator.envPaths?.rootEnvPath ? `
|
|
46
|
+
root = "${generator.envPaths.rootEnvPath}"` : ""}${generator.envPaths?.schemaEnvPath ? `
|
|
47
|
+
schema = "${generator.envPaths.schemaEnvPath}"` : ""}
|
|
48
|
+
}` : ""}
|
|
12
49
|
}
|
|
13
50
|
|
|
14
|
-
${
|
|
51
|
+
${schema}`;
|
|
52
|
+
return schema;
|
|
53
|
+
}
|
|
54
|
+
async write() {
|
|
55
|
+
await this.#context.fs.write(this.#context.config.prisma.schema, this.build());
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { PrismaSchemaCreator };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,127 @@
|
|
|
1
|
-
Object.defineProperty(exports
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_get_config_path = require('./powerlines/src/plugin-utils/get-config-path.cjs');
|
|
4
|
+
const require_paths = require('./powerlines/src/plugin-utils/paths.cjs');
|
|
5
|
+
const require_api_client_utils_gen = require('./api/client/utils.gen.cjs');
|
|
6
|
+
const require_api_client_client_gen = require('./api/client/client.gen.cjs');
|
|
7
|
+
const require_api_client_gen = require('./api/client.gen.cjs');
|
|
8
|
+
const require_api_sdk_gen = require('./api/sdk.gen.cjs');
|
|
9
|
+
const require_helpers_get_schema = require('./helpers/get-schema.cjs');
|
|
10
|
+
const require_helpers_schema_creator = require('./helpers/schema-creator.cjs');
|
|
11
|
+
let __stryke_cli_execute = require("@stryke/cli/execute");
|
|
12
|
+
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
13
|
+
let __stryke_fs_package_fns = require("@stryke/fs/package-fns");
|
|
14
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
15
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
16
|
+
let defu = require("defu");
|
|
17
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
18
|
+
|
|
19
|
+
//#region src/index.ts
|
|
20
|
+
/**
|
|
21
|
+
* A Powerlines plugin to integrate Prisma for code generation.
|
|
22
|
+
*
|
|
23
|
+
* @param options - The plugin options.
|
|
24
|
+
* @returns A Powerlines plugin instance.
|
|
25
|
+
*/
|
|
26
|
+
const plugin = (options = {}) => {
|
|
27
|
+
return {
|
|
28
|
+
name: "prisma",
|
|
29
|
+
config() {
|
|
30
|
+
return { prisma: (0, defu.default)(options, {
|
|
31
|
+
schema: (0, __stryke_path_join_paths.joinPaths)(this.config.projectRoot, "prisma", "schema.prisma"),
|
|
32
|
+
configFile: options.configFile || require_get_config_path.getConfigPath(this, "prisma.config"),
|
|
33
|
+
outputPath: (0, __stryke_path_join_paths.joinPaths)("{builtinPath}", "prisma"),
|
|
34
|
+
prismaPostgres: options?.prismaPostgres ? {
|
|
35
|
+
projectId: this.config.name,
|
|
36
|
+
region: "us-east-1"
|
|
37
|
+
} : void 0
|
|
38
|
+
}) };
|
|
39
|
+
},
|
|
40
|
+
async configResolved() {
|
|
41
|
+
this.dependencies["@prisma/client"] = "latest";
|
|
42
|
+
this.config.prisma.configFile = require_paths.replacePathTokens(this, this.config.prisma.configFile);
|
|
43
|
+
if (!this.config.prisma.schema) throw new Error(`Prisma schema path is not defined. Please specify a valid path in the plugin configuration.`);
|
|
44
|
+
this.config.prisma.schema = require_paths.replacePathTokens(this, this.config.prisma.schema);
|
|
45
|
+
if (this.config.prisma.prismaPostgres) {
|
|
46
|
+
let serviceToken = process.env.PRISMA_SERVICE_TOKEN;
|
|
47
|
+
if (!serviceToken) {
|
|
48
|
+
serviceToken = options.serviceToken;
|
|
49
|
+
if (serviceToken) this.warn("If possible, please use the `PRISMA_SERVICE_TOKEN` environment variable instead of using the `serviceToken` option directly. The `serviceToken` option will work; however, this is a less secure method of configuration.");
|
|
50
|
+
else throw new Error("Unable to determine the Prisma service token. Please set the `PRISMA_SERVICE_TOKEN` environment variable.");
|
|
51
|
+
}
|
|
52
|
+
const client$1 = require_api_client_client_gen.createClient(require_api_client_utils_gen.createConfig({
|
|
53
|
+
baseUrl: "https://api.prisma.io",
|
|
54
|
+
throwOnError: true,
|
|
55
|
+
headers: {
|
|
56
|
+
Authorization: `Bearer ${serviceToken}`,
|
|
57
|
+
"User-Agent": "powerlines/1.0"
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
this.prisma.api = new require_api_sdk_gen.PrismaClient({ client: client$1 });
|
|
61
|
+
await this.prisma.api.createDatabase({
|
|
62
|
+
path: { projectId: this.config.prisma.prismaPostgres.projectId },
|
|
63
|
+
body: {
|
|
64
|
+
isDefault: false,
|
|
65
|
+
name: this.config.prisma.prismaPostgres.databaseName || `${this.config.prisma.prismaPostgres.region}.${this.config.mode}.${this.config.name}`,
|
|
66
|
+
region: this.config.prisma.prismaPostgres.region
|
|
67
|
+
}
|
|
68
|
+
}).then((response) => response.data.data);
|
|
69
|
+
}
|
|
70
|
+
if (!this.config.prisma.outputPath) throw new Error(`Prisma generated path is not defined. Please specify a valid path in the plugin configuration.`);
|
|
71
|
+
this.config.prisma.outputPath = require_paths.replacePathTokens(this, this.config.prisma.outputPath);
|
|
72
|
+
this.prisma ??= {};
|
|
73
|
+
if (!(0, __stryke_fs_exists.existsSync)(this.config.prisma.schema)) this.prisma.schema ??= {
|
|
74
|
+
generators: [],
|
|
75
|
+
datasources: [],
|
|
76
|
+
warnings: []
|
|
77
|
+
};
|
|
78
|
+
else this.prisma.schema = await require_helpers_get_schema.getSchema({ datamodel: this.config.prisma.schema });
|
|
79
|
+
const generator = this.prisma.schema.generators.find((gen) => gen.provider.value === "prisma-client-js");
|
|
80
|
+
if (!generator) this.prisma.schema.generators.push({
|
|
81
|
+
name: "prisma-client-js",
|
|
82
|
+
provider: {
|
|
83
|
+
value: "prisma-client-js",
|
|
84
|
+
fromEnvVar: null
|
|
85
|
+
},
|
|
86
|
+
output: {
|
|
87
|
+
value: this.config.prisma.outputPath,
|
|
88
|
+
fromEnvVar: null
|
|
89
|
+
},
|
|
90
|
+
config: {},
|
|
91
|
+
binaryTargets: [],
|
|
92
|
+
previewFeatures: [],
|
|
93
|
+
sourceFilePath: this.config.prisma.schema
|
|
94
|
+
});
|
|
95
|
+
else generator.output ??= {
|
|
96
|
+
value: this.config.prisma.outputPath,
|
|
97
|
+
fromEnvVar: null
|
|
98
|
+
};
|
|
99
|
+
this.prisma.builder = new require_helpers_schema_creator.PrismaSchemaCreator(this);
|
|
100
|
+
},
|
|
101
|
+
async prepare() {
|
|
102
|
+
await this.prisma.builder.write();
|
|
103
|
+
const args = [
|
|
104
|
+
"generate",
|
|
105
|
+
"--schema",
|
|
106
|
+
this.config.prisma.schema
|
|
107
|
+
];
|
|
108
|
+
if (!this.config.prisma.prismaPath) {
|
|
109
|
+
const isPrismaListed = await (0, __stryke_fs_package_fns.isPackageListed)("prisma", this.config.projectRoot);
|
|
110
|
+
args.unshift(isPrismaListed ? (0, __stryke_path_replace.replacePath)(this.config.sourceRoot, this.config.projectRoot) : this.config.sourceRoot);
|
|
111
|
+
const result = await (0, __stryke_cli_execute.executePackage)("prisma", args, (0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot));
|
|
112
|
+
if (result.failed) throw new Error(`Prisma process exited with code ${result.exitCode}.`);
|
|
113
|
+
} else {
|
|
114
|
+
args.unshift(this.config.prisma.prismaPath);
|
|
115
|
+
const result = await (0, __stryke_cli_execute.execute)(args.join(" "), this.config.projectRoot);
|
|
116
|
+
if (result.failed) throw new Error(`Prisma process exited with code ${result.exitCode}.`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
var src_default = plugin;
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
exports.PrismaClient = require_api_sdk_gen.PrismaClient;
|
|
125
|
+
exports.client = require_api_client_gen.client;
|
|
126
|
+
exports.default = src_default;
|
|
127
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,121 @@
|
|
|
1
|
-
import{getConfigPath
|
|
1
|
+
import { getConfigPath } from "./powerlines/src/plugin-utils/get-config-path.mjs";
|
|
2
|
+
import { replacePathTokens } from "./powerlines/src/plugin-utils/paths.mjs";
|
|
3
|
+
import { createConfig } from "./api/client/utils.gen.mjs";
|
|
4
|
+
import { createClient } from "./api/client/client.gen.mjs";
|
|
5
|
+
import { client } from "./api/client.gen.mjs";
|
|
6
|
+
import { PrismaClient } from "./api/sdk.gen.mjs";
|
|
7
|
+
import { getSchema } from "./helpers/get-schema.mjs";
|
|
8
|
+
import { PrismaSchemaCreator } from "./helpers/schema-creator.mjs";
|
|
9
|
+
import { execute, executePackage } from "@stryke/cli/execute";
|
|
10
|
+
import { existsSync } from "@stryke/fs/exists";
|
|
11
|
+
import { isPackageListed } from "@stryke/fs/package-fns";
|
|
12
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
13
|
+
import { replacePath } from "@stryke/path/replace";
|
|
14
|
+
import defu from "defu";
|
|
15
|
+
|
|
16
|
+
//#region src/index.ts
|
|
17
|
+
/**
|
|
18
|
+
* A Powerlines plugin to integrate Prisma for code generation.
|
|
19
|
+
*
|
|
20
|
+
* @param options - The plugin options.
|
|
21
|
+
* @returns A Powerlines plugin instance.
|
|
22
|
+
*/
|
|
23
|
+
const plugin = (options = {}) => {
|
|
24
|
+
return {
|
|
25
|
+
name: "prisma",
|
|
26
|
+
config() {
|
|
27
|
+
return { prisma: defu(options, {
|
|
28
|
+
schema: joinPaths(this.config.projectRoot, "prisma", "schema.prisma"),
|
|
29
|
+
configFile: options.configFile || getConfigPath(this, "prisma.config"),
|
|
30
|
+
outputPath: joinPaths("{builtinPath}", "prisma"),
|
|
31
|
+
prismaPostgres: options?.prismaPostgres ? {
|
|
32
|
+
projectId: this.config.name,
|
|
33
|
+
region: "us-east-1"
|
|
34
|
+
} : void 0
|
|
35
|
+
}) };
|
|
36
|
+
},
|
|
37
|
+
async configResolved() {
|
|
38
|
+
this.dependencies["@prisma/client"] = "latest";
|
|
39
|
+
this.config.prisma.configFile = replacePathTokens(this, this.config.prisma.configFile);
|
|
40
|
+
if (!this.config.prisma.schema) throw new Error(`Prisma schema path is not defined. Please specify a valid path in the plugin configuration.`);
|
|
41
|
+
this.config.prisma.schema = replacePathTokens(this, this.config.prisma.schema);
|
|
42
|
+
if (this.config.prisma.prismaPostgres) {
|
|
43
|
+
let serviceToken = process.env.PRISMA_SERVICE_TOKEN;
|
|
44
|
+
if (!serviceToken) {
|
|
45
|
+
serviceToken = options.serviceToken;
|
|
46
|
+
if (serviceToken) this.warn("If possible, please use the `PRISMA_SERVICE_TOKEN` environment variable instead of using the `serviceToken` option directly. The `serviceToken` option will work; however, this is a less secure method of configuration.");
|
|
47
|
+
else throw new Error("Unable to determine the Prisma service token. Please set the `PRISMA_SERVICE_TOKEN` environment variable.");
|
|
48
|
+
}
|
|
49
|
+
const client$1 = createClient(createConfig({
|
|
50
|
+
baseUrl: "https://api.prisma.io",
|
|
51
|
+
throwOnError: true,
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: `Bearer ${serviceToken}`,
|
|
54
|
+
"User-Agent": "powerlines/1.0"
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
this.prisma.api = new PrismaClient({ client: client$1 });
|
|
58
|
+
await this.prisma.api.createDatabase({
|
|
59
|
+
path: { projectId: this.config.prisma.prismaPostgres.projectId },
|
|
60
|
+
body: {
|
|
61
|
+
isDefault: false,
|
|
62
|
+
name: this.config.prisma.prismaPostgres.databaseName || `${this.config.prisma.prismaPostgres.region}.${this.config.mode}.${this.config.name}`,
|
|
63
|
+
region: this.config.prisma.prismaPostgres.region
|
|
64
|
+
}
|
|
65
|
+
}).then((response) => response.data.data);
|
|
66
|
+
}
|
|
67
|
+
if (!this.config.prisma.outputPath) throw new Error(`Prisma generated path is not defined. Please specify a valid path in the plugin configuration.`);
|
|
68
|
+
this.config.prisma.outputPath = replacePathTokens(this, this.config.prisma.outputPath);
|
|
69
|
+
this.prisma ??= {};
|
|
70
|
+
if (!existsSync(this.config.prisma.schema)) this.prisma.schema ??= {
|
|
71
|
+
generators: [],
|
|
72
|
+
datasources: [],
|
|
73
|
+
warnings: []
|
|
74
|
+
};
|
|
75
|
+
else this.prisma.schema = await getSchema({ datamodel: this.config.prisma.schema });
|
|
76
|
+
const generator = this.prisma.schema.generators.find((gen) => gen.provider.value === "prisma-client-js");
|
|
77
|
+
if (!generator) this.prisma.schema.generators.push({
|
|
78
|
+
name: "prisma-client-js",
|
|
79
|
+
provider: {
|
|
80
|
+
value: "prisma-client-js",
|
|
81
|
+
fromEnvVar: null
|
|
82
|
+
},
|
|
83
|
+
output: {
|
|
84
|
+
value: this.config.prisma.outputPath,
|
|
85
|
+
fromEnvVar: null
|
|
86
|
+
},
|
|
87
|
+
config: {},
|
|
88
|
+
binaryTargets: [],
|
|
89
|
+
previewFeatures: [],
|
|
90
|
+
sourceFilePath: this.config.prisma.schema
|
|
91
|
+
});
|
|
92
|
+
else generator.output ??= {
|
|
93
|
+
value: this.config.prisma.outputPath,
|
|
94
|
+
fromEnvVar: null
|
|
95
|
+
};
|
|
96
|
+
this.prisma.builder = new PrismaSchemaCreator(this);
|
|
97
|
+
},
|
|
98
|
+
async prepare() {
|
|
99
|
+
await this.prisma.builder.write();
|
|
100
|
+
const args = [
|
|
101
|
+
"generate",
|
|
102
|
+
"--schema",
|
|
103
|
+
this.config.prisma.schema
|
|
104
|
+
];
|
|
105
|
+
if (!this.config.prisma.prismaPath) {
|
|
106
|
+
const isPrismaListed = await isPackageListed("prisma", this.config.projectRoot);
|
|
107
|
+
args.unshift(isPrismaListed ? replacePath(this.config.sourceRoot, this.config.projectRoot) : this.config.sourceRoot);
|
|
108
|
+
const result = await executePackage("prisma", args, joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot));
|
|
109
|
+
if (result.failed) throw new Error(`Prisma process exited with code ${result.exitCode}.`);
|
|
110
|
+
} else {
|
|
111
|
+
args.unshift(this.config.prisma.prismaPath);
|
|
112
|
+
const result = await execute(args.join(" "), this.config.projectRoot);
|
|
113
|
+
if (result.failed) throw new Error(`Prisma process exited with code ${result.exitCode}.`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
var src_default = plugin;
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
export { PrismaClient, client, src_default as default, plugin };
|
|
@@ -1 +1,49 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_path_join = require("@stryke/path/join");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
|
|
5
|
+
//#region ../powerlines/src/plugin-utils/get-config-path.ts
|
|
6
|
+
/**
|
|
7
|
+
* Get the configuration file path for a given name.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The Powerlines context.
|
|
10
|
+
* @param name - The name of the configuration file (without extension).
|
|
11
|
+
* @returns The absolute path to the configuration file, or undefined if not found.
|
|
12
|
+
*/
|
|
13
|
+
function getConfigPath(context, name) {
|
|
14
|
+
if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`);
|
|
15
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`);
|
|
16
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`);
|
|
17
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`);
|
|
18
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`);
|
|
19
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`);
|
|
20
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`);
|
|
21
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`);
|
|
22
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`);
|
|
23
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`);
|
|
24
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`);
|
|
25
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`);
|
|
26
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`);
|
|
27
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`);
|
|
28
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`);
|
|
29
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`);
|
|
30
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yml`);
|
|
31
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yaml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yaml`);
|
|
32
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.json`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.json`);
|
|
33
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.jsonc`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);
|
|
34
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.ts`);
|
|
35
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cts`);
|
|
36
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mts`);
|
|
37
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.js`);
|
|
38
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cjs`);
|
|
39
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mjs`);
|
|
40
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.ts`);
|
|
41
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cts`);
|
|
42
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mts`);
|
|
43
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.js`);
|
|
44
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`);
|
|
45
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.getConfigPath = getConfigPath;
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
import{joinPaths
|
|
1
|
+
import { joinPaths } from "@stryke/path/join";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/plugin-utils/get-config-path.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get the configuration file path for a given name.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The Powerlines context.
|
|
9
|
+
* @param name - The name of the configuration file (without extension).
|
|
10
|
+
* @returns The absolute path to the configuration file, or undefined if not found.
|
|
11
|
+
*/
|
|
12
|
+
function getConfigPath(context, name) {
|
|
13
|
+
if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`);
|
|
14
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`);
|
|
15
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`);
|
|
16
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`);
|
|
17
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`);
|
|
18
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`);
|
|
19
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`);
|
|
20
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`);
|
|
21
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`);
|
|
22
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`);
|
|
23
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`);
|
|
24
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`);
|
|
25
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`);
|
|
26
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`);
|
|
27
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`);
|
|
28
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`);
|
|
29
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yml`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yml`);
|
|
30
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yaml`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yaml`);
|
|
31
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.json`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.json`);
|
|
32
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.jsonc`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);
|
|
33
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.ts`);
|
|
34
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cts`);
|
|
35
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mts`);
|
|
36
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.js`);
|
|
37
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cjs`);
|
|
38
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mjs`);
|
|
39
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.ts`);
|
|
40
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cts`);
|
|
41
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mts`);
|
|
42
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.js`);
|
|
43
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`);
|
|
44
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { getConfigPath };
|