@prisma/cli-init 0.6.2 → 0.7.0
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/index.js +34 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2737,7 +2737,7 @@ var ServerState = class {
|
|
|
2737
2737
|
this._shadowDatabasePort = options.shadowDatabasePort ?? NO_PORT;
|
|
2738
2738
|
}
|
|
2739
2739
|
static async createExclusively(options) {
|
|
2740
|
-
const serverState = options?.dryRun !== true && options?.persistenceMode
|
|
2740
|
+
const serverState = options?.dryRun !== true && options?.persistenceMode === "stateful" ? new StatefulServerState(options) : new StatelessServerState(options);
|
|
2741
2741
|
await serverState[PRIVATE_INITIALIZE_SYMBOL]();
|
|
2742
2742
|
return serverState;
|
|
2743
2743
|
}
|
|
@@ -2805,10 +2805,10 @@ var StatelessServerState = class extends ServerState {
|
|
|
2805
2805
|
constructor(options) {
|
|
2806
2806
|
super({
|
|
2807
2807
|
...options,
|
|
2808
|
-
databasePort: options?.databasePort
|
|
2808
|
+
databasePort: options?.databasePort,
|
|
2809
2809
|
persistenceMode: "stateless",
|
|
2810
|
-
port: options?.port
|
|
2811
|
-
shadowDatabasePort: options?.shadowDatabasePort
|
|
2810
|
+
port: options?.port,
|
|
2811
|
+
shadowDatabasePort: options?.shadowDatabasePort
|
|
2812
2812
|
});
|
|
2813
2813
|
}
|
|
2814
2814
|
get databaseDumpPath() {
|
|
@@ -2818,6 +2818,31 @@ var StatelessServerState = class extends ServerState {
|
|
|
2818
2818
|
return "memory://";
|
|
2819
2819
|
}
|
|
2820
2820
|
async [PRIVATE_INITIALIZE_SYMBOL]() {
|
|
2821
|
+
let servers;
|
|
2822
|
+
try {
|
|
2823
|
+
servers = await ServerState.scan({ debug: this.debug, onlyMetadata: true });
|
|
2824
|
+
} catch (error) {
|
|
2825
|
+
if (this.debug) {
|
|
2826
|
+
console.warn(
|
|
2827
|
+
`[State] failed to scan for existing servers, assuming filesystem does not exist or other reasons.`,
|
|
2828
|
+
error
|
|
2829
|
+
);
|
|
2830
|
+
}
|
|
2831
|
+
servers = [];
|
|
2832
|
+
}
|
|
2833
|
+
const ports = await pickPorts({
|
|
2834
|
+
debug: this.debug,
|
|
2835
|
+
name: this.dryRun ? this.name : "",
|
|
2836
|
+
requestedPorts: {
|
|
2837
|
+
databasePort: this.databasePort,
|
|
2838
|
+
port: this.port,
|
|
2839
|
+
shadowDatabasePort: this.shadowDatabasePort
|
|
2840
|
+
},
|
|
2841
|
+
servers
|
|
2842
|
+
});
|
|
2843
|
+
this._databasePort = ports.databasePort;
|
|
2844
|
+
this._port = ports.port;
|
|
2845
|
+
this._shadowDatabasePort = ports.shadowDatabasePort;
|
|
2821
2846
|
}
|
|
2822
2847
|
async close() {
|
|
2823
2848
|
}
|
|
@@ -3565,16 +3590,18 @@ model User {
|
|
|
3565
3590
|
var defaultEnv = async (url2, debug3 = false, comments = true) => {
|
|
3566
3591
|
if (url2 === void 0) {
|
|
3567
3592
|
let created = false;
|
|
3568
|
-
const state = await ServerState.fromServerDump({ debug: debug3 }) || (created = true, await ServerState.createExclusively({ persistenceMode: "stateful"
|
|
3593
|
+
const state = await ServerState.fromServerDump({ debug: debug3 }) || (created = true, await ServerState.createExclusively({ debug: debug3, persistenceMode: "stateful" }));
|
|
3569
3594
|
if (created) {
|
|
3570
3595
|
await state.close();
|
|
3571
3596
|
}
|
|
3572
3597
|
const server = await startPrismaDevServer({
|
|
3573
3598
|
databasePort: state.databasePort,
|
|
3599
|
+
debug: debug3,
|
|
3574
3600
|
dryRun: true,
|
|
3601
|
+
name: state.name,
|
|
3602
|
+
persistenceMode: "stateful",
|
|
3575
3603
|
port: state.port,
|
|
3576
|
-
shadowDatabasePort: state.shadowDatabasePort
|
|
3577
|
-
debug: debug3
|
|
3604
|
+
shadowDatabasePort: state.shadowDatabasePort
|
|
3578
3605
|
});
|
|
3579
3606
|
url2 = server.ppg.url;
|
|
3580
3607
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli-init",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Init CLI for Prisma",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"tsup": "8.0.2",
|
|
37
37
|
"typescript": "5.8.3",
|
|
38
38
|
"vitest": "3.1.3",
|
|
39
|
-
"@prisma/dev": "0.16.
|
|
39
|
+
"@prisma/dev": "0.16.1"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@inquirer/prompts": "7.3.3",
|