@prisma/compute-cli 0.6.0 → 0.8.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/README.md +14 -14
- package/dist/commands/deploy.d.ts +7 -2
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +36 -4
- package/dist/commands/deploy.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/deploy.ts +44 -4
package/README.md
CHANGED
|
@@ -57,20 +57,20 @@ bunx @prisma/compute-cli deploy --path ./my-app
|
|
|
57
57
|
|
|
58
58
|
Key flags:
|
|
59
59
|
|
|
60
|
-
| Flag | Description
|
|
61
|
-
| ----------------- |
|
|
62
|
-
| `--path` | App directory (default: `.`)
|
|
63
|
-
| `--project` | Project ID (prompted interactively if omitted)
|
|
64
|
-
| `--service` | Compute service ID (prompted interactively if omitted)
|
|
65
|
-
| `--entrypoint` |
|
|
66
|
-
| `--serviceName` | Name for a new compute service
|
|
67
|
-
| `--region` | Region for a new compute service
|
|
68
|
-
| `--env KEY=VALUE` | Environment variable (repeatable)
|
|
69
|
-
| `--httpPort` | HTTP port your application listens on
|
|
70
|
-
| `--skipBuild` | Deploy a pre-built artifact (requires `--entrypoint`)
|
|
71
|
-
| `--timeout` | Poll timeout in seconds (default: `120`)
|
|
72
|
-
| `--pollInterval` | Poll interval in ms (default: `1000`)
|
|
73
|
-
| `--json` | Output JSON instead of human-readable text
|
|
60
|
+
| Flag | Description |
|
|
61
|
+
| ----------------- | ---------------------------------------------------------------------------------- |
|
|
62
|
+
| `--path` | App directory (default: `.`) |
|
|
63
|
+
| `--project` | Project ID (prompted interactively if omitted) |
|
|
64
|
+
| `--service` | Compute service ID (prompted interactively if omitted) |
|
|
65
|
+
| `--entrypoint` | File to run at startup, relative to `--path` (falls back to `package.json` `main`) |
|
|
66
|
+
| `--serviceName` | Name for a new compute service |
|
|
67
|
+
| `--region` | Region for a new compute service |
|
|
68
|
+
| `--env KEY=VALUE` | Environment variable (repeatable) |
|
|
69
|
+
| `--httpPort` | HTTP port your application listens on (default: `8080`) |
|
|
70
|
+
| `--skipBuild` | Deploy a pre-built artifact (requires `--entrypoint`) |
|
|
71
|
+
| `--timeout` | Poll timeout in seconds (default: `120`) |
|
|
72
|
+
| `--pollInterval` | Poll interval in ms (default: `1000`) |
|
|
73
|
+
| `--json` | Output JSON instead of human-readable text |
|
|
74
74
|
|
|
75
75
|
Set `PRISMA_COMPUTE_SERVICE_ID` to skip the `--service` flag across all commands:
|
|
76
76
|
|
|
@@ -14,7 +14,7 @@ export declare const deployCommand: import("citty").CommandDef<{
|
|
|
14
14
|
};
|
|
15
15
|
readonly entrypoint: {
|
|
16
16
|
readonly type: "string";
|
|
17
|
-
readonly description: "
|
|
17
|
+
readonly description: "File to run at startup, relative to --path (falls back to package.json main)";
|
|
18
18
|
};
|
|
19
19
|
readonly serviceName: {
|
|
20
20
|
readonly type: "string";
|
|
@@ -24,6 +24,11 @@ export declare const deployCommand: import("citty").CommandDef<{
|
|
|
24
24
|
readonly type: "string";
|
|
25
25
|
readonly description: "Region for a new compute service";
|
|
26
26
|
};
|
|
27
|
+
readonly buildType: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly default: "auto";
|
|
30
|
+
readonly description: "Build strategy: auto, bun, or nextjs";
|
|
31
|
+
};
|
|
27
32
|
readonly skipBuild: {
|
|
28
33
|
readonly type: "boolean";
|
|
29
34
|
readonly default: false;
|
|
@@ -39,7 +44,7 @@ export declare const deployCommand: import("citty").CommandDef<{
|
|
|
39
44
|
};
|
|
40
45
|
readonly httpPort: {
|
|
41
46
|
readonly type: "string";
|
|
42
|
-
readonly description: "HTTP port your application listens on";
|
|
47
|
+
readonly description: "HTTP port your application listens on (default: 8080)";
|
|
43
48
|
};
|
|
44
49
|
readonly timeout: {
|
|
45
50
|
readonly type: "string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+JxB,CAAC"}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { BunBuild, ComputeClient, PreBuilt, } from "@prisma/compute-sdk";
|
|
2
|
+
import { AutoBuild, BunBuild, ComputeClient, NextjsBuild, PreBuilt, } from "@prisma/compute-sdk";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { createDeployInteraction } from "../lib/interaction.js";
|
|
5
5
|
import { printJsonResult } from "../lib/json-output.js";
|
|
@@ -11,12 +11,20 @@ export const deployCommand = defineCommand({
|
|
|
11
11
|
project: { type: "string", description: "Project ID" },
|
|
12
12
|
service: { type: "string", description: "Compute service ID" },
|
|
13
13
|
path: { type: "string", default: ".", description: "App directory" },
|
|
14
|
-
entrypoint: {
|
|
14
|
+
entrypoint: {
|
|
15
|
+
type: "string",
|
|
16
|
+
description: "File to run at startup, relative to --path (falls back to package.json main)",
|
|
17
|
+
},
|
|
15
18
|
serviceName: {
|
|
16
19
|
type: "string",
|
|
17
20
|
description: "Name for a new compute service",
|
|
18
21
|
},
|
|
19
22
|
region: { type: "string", description: "Region for a new compute service" },
|
|
23
|
+
buildType: {
|
|
24
|
+
type: "string",
|
|
25
|
+
default: "auto",
|
|
26
|
+
description: "Build strategy: auto, bun, or nextjs",
|
|
27
|
+
},
|
|
20
28
|
skipBuild: {
|
|
21
29
|
type: "boolean",
|
|
22
30
|
default: false,
|
|
@@ -32,7 +40,7 @@ export const deployCommand = defineCommand({
|
|
|
32
40
|
},
|
|
33
41
|
httpPort: {
|
|
34
42
|
type: "string",
|
|
35
|
-
description: "HTTP port your application listens on",
|
|
43
|
+
description: "HTTP port your application listens on (default: 8080)",
|
|
36
44
|
},
|
|
37
45
|
timeout: {
|
|
38
46
|
type: "string",
|
|
@@ -67,13 +75,37 @@ export const deployCommand = defineCommand({
|
|
|
67
75
|
const inputServiceId = resolveServiceId(args);
|
|
68
76
|
let strategy;
|
|
69
77
|
if (args.skipBuild) {
|
|
78
|
+
if (args.buildType !== "auto") {
|
|
79
|
+
throw new Error("--build-type cannot be combined with --skip-build");
|
|
80
|
+
}
|
|
70
81
|
if (!args.entrypoint) {
|
|
71
82
|
throw new Error("When --skip-build is set you must provide --entrypoint");
|
|
72
83
|
}
|
|
73
84
|
strategy = new PreBuilt({ appPath, entrypoint: args.entrypoint });
|
|
74
85
|
}
|
|
75
86
|
else {
|
|
76
|
-
|
|
87
|
+
switch (args.buildType) {
|
|
88
|
+
case "auto":
|
|
89
|
+
strategy = new AutoBuild({
|
|
90
|
+
appPath,
|
|
91
|
+
entrypoint: args.entrypoint,
|
|
92
|
+
});
|
|
93
|
+
break;
|
|
94
|
+
case "bun":
|
|
95
|
+
strategy = new BunBuild({
|
|
96
|
+
appPath,
|
|
97
|
+
entrypoint: args.entrypoint,
|
|
98
|
+
});
|
|
99
|
+
break;
|
|
100
|
+
case "nextjs":
|
|
101
|
+
if (args.entrypoint) {
|
|
102
|
+
throw new Error("--entrypoint cannot be combined with --build-type=nextjs");
|
|
103
|
+
}
|
|
104
|
+
strategy = new NextjsBuild({ appPath });
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
throw new Error(`Unknown build type: ${args.buildType}`);
|
|
108
|
+
}
|
|
77
109
|
}
|
|
78
110
|
if (args.skipPromote && args.destroyOldVersion) {
|
|
79
111
|
throw new Error("--destroy-old-version cannot be combined with --skip-promote");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC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2
|
"name": "@prisma/compute-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"repository": "prisma/project-compute",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@clack/prompts": "^1.1.0",
|
|
34
|
-
"@prisma/compute-sdk": "0.
|
|
34
|
+
"@prisma/compute-sdk": "0.8.0",
|
|
35
35
|
"@prisma/credentials-store": "^7.5.0",
|
|
36
36
|
"@prisma/management-api-sdk": "^1.23.0",
|
|
37
37
|
"citty": "^0.2.1",
|
package/src/commands/deploy.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import {
|
|
3
|
+
AutoBuild,
|
|
4
|
+
type BuildStrategy,
|
|
3
5
|
BunBuild,
|
|
4
6
|
ComputeClient,
|
|
5
7
|
type DeployResult,
|
|
8
|
+
NextjsBuild,
|
|
6
9
|
PreBuilt,
|
|
7
10
|
} from "@prisma/compute-sdk";
|
|
8
11
|
import { defineCommand } from "citty";
|
|
@@ -26,12 +29,21 @@ export const deployCommand = defineCommand({
|
|
|
26
29
|
project: { type: "string", description: "Project ID" },
|
|
27
30
|
service: { type: "string", description: "Compute service ID" },
|
|
28
31
|
path: { type: "string", default: ".", description: "App directory" },
|
|
29
|
-
entrypoint: {
|
|
32
|
+
entrypoint: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description:
|
|
35
|
+
"File to run at startup, relative to --path (falls back to package.json main)",
|
|
36
|
+
},
|
|
30
37
|
serviceName: {
|
|
31
38
|
type: "string",
|
|
32
39
|
description: "Name for a new compute service",
|
|
33
40
|
},
|
|
34
41
|
region: { type: "string", description: "Region for a new compute service" },
|
|
42
|
+
buildType: {
|
|
43
|
+
type: "string",
|
|
44
|
+
default: "auto",
|
|
45
|
+
description: "Build strategy: auto, bun, or nextjs",
|
|
46
|
+
},
|
|
35
47
|
skipBuild: {
|
|
36
48
|
type: "boolean",
|
|
37
49
|
default: false,
|
|
@@ -47,7 +59,7 @@ export const deployCommand = defineCommand({
|
|
|
47
59
|
},
|
|
48
60
|
httpPort: {
|
|
49
61
|
type: "string",
|
|
50
|
-
description: "HTTP port your application listens on",
|
|
62
|
+
description: "HTTP port your application listens on (default: 8080)",
|
|
51
63
|
},
|
|
52
64
|
timeout: {
|
|
53
65
|
type: "string",
|
|
@@ -85,8 +97,13 @@ export const deployCommand = defineCommand({
|
|
|
85
97
|
|
|
86
98
|
const inputServiceId = resolveServiceId(args);
|
|
87
99
|
|
|
88
|
-
let strategy:
|
|
100
|
+
let strategy: BuildStrategy;
|
|
89
101
|
if (args.skipBuild) {
|
|
102
|
+
if (args.buildType !== "auto") {
|
|
103
|
+
throw new Error(
|
|
104
|
+
"--build-type cannot be combined with --skip-build",
|
|
105
|
+
);
|
|
106
|
+
}
|
|
90
107
|
if (!args.entrypoint) {
|
|
91
108
|
throw new Error(
|
|
92
109
|
"When --skip-build is set you must provide --entrypoint",
|
|
@@ -94,7 +111,30 @@ export const deployCommand = defineCommand({
|
|
|
94
111
|
}
|
|
95
112
|
strategy = new PreBuilt({ appPath, entrypoint: args.entrypoint });
|
|
96
113
|
} else {
|
|
97
|
-
|
|
114
|
+
switch (args.buildType) {
|
|
115
|
+
case "auto":
|
|
116
|
+
strategy = new AutoBuild({
|
|
117
|
+
appPath,
|
|
118
|
+
entrypoint: args.entrypoint,
|
|
119
|
+
});
|
|
120
|
+
break;
|
|
121
|
+
case "bun":
|
|
122
|
+
strategy = new BunBuild({
|
|
123
|
+
appPath,
|
|
124
|
+
entrypoint: args.entrypoint,
|
|
125
|
+
});
|
|
126
|
+
break;
|
|
127
|
+
case "nextjs":
|
|
128
|
+
if (args.entrypoint) {
|
|
129
|
+
throw new Error(
|
|
130
|
+
"--entrypoint cannot be combined with --build-type=nextjs",
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
strategy = new NextjsBuild({ appPath });
|
|
134
|
+
break;
|
|
135
|
+
default:
|
|
136
|
+
throw new Error(`Unknown build type: ${args.buildType}`);
|
|
137
|
+
}
|
|
98
138
|
}
|
|
99
139
|
|
|
100
140
|
if (args.skipPromote && args.destroyOldVersion) {
|