@mastra/deployer-vercel 0.0.1-alpha.9 → 0.1.0-alpha.37
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/CHANGELOG.md +243 -0
- package/README.md +95 -0
- package/dist/index.d.ts +17 -21
- package/dist/index.js +150 -6
- package/package.json +13 -19
- package/src/index.ts +75 -63
- package/tsconfig.json +1 -6
- package/vitest.config.ts +1 -1
- package/dist/deployer-vercel.cjs.development.js +0 -588
- package/dist/deployer-vercel.cjs.development.js.map +0 -1
- package/dist/deployer-vercel.cjs.production.min.js +0 -2
- package/dist/deployer-vercel.cjs.production.min.js.map +0 -1
- package/dist/deployer-vercel.esm.js +0 -565
- package/dist/deployer-vercel.esm.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,248 @@
|
|
|
1
1
|
# @mastra/deployer-vercel
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.37
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5916f9d: Update deps from fixed to ^
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [6fa4bd2]
|
|
12
|
+
- Updated dependencies [5916f9d]
|
|
13
|
+
- Updated dependencies [e2e76de]
|
|
14
|
+
- Updated dependencies [7f24c29]
|
|
15
|
+
- Updated dependencies [67637ba]
|
|
16
|
+
- Updated dependencies [04f3171]
|
|
17
|
+
- @mastra/core@0.2.0-alpha.86
|
|
18
|
+
- @mastra/deployer@0.1.0-alpha.32
|
|
19
|
+
|
|
20
|
+
## 0.0.1-alpha.36
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [e9d1b47]
|
|
25
|
+
- Updated dependencies [c5f2d50]
|
|
26
|
+
- @mastra/core@0.2.0-alpha.85
|
|
27
|
+
- @mastra/deployer@0.0.1-alpha.31
|
|
28
|
+
|
|
29
|
+
## 0.0.1-alpha.35
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [e27fe69]
|
|
34
|
+
- @mastra/deployer@0.0.1-alpha.30
|
|
35
|
+
|
|
36
|
+
## 0.0.1-alpha.34
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- 38b7f66: Update deployer logic
|
|
41
|
+
- Updated dependencies [2f17a5f]
|
|
42
|
+
- Updated dependencies [0696eeb]
|
|
43
|
+
- Updated dependencies [cb290ee]
|
|
44
|
+
- Updated dependencies [b4d7416]
|
|
45
|
+
- Updated dependencies [38b7f66]
|
|
46
|
+
- @mastra/core@0.2.0-alpha.84
|
|
47
|
+
- @mastra/deployer@0.0.1-alpha.29
|
|
48
|
+
|
|
49
|
+
## 0.0.1-alpha.33
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- 9625602: Use mastra core splitted bundles in other packages
|
|
54
|
+
- Updated dependencies [2ab57d6]
|
|
55
|
+
- Updated dependencies [30322ce]
|
|
56
|
+
- Updated dependencies [78eec7c]
|
|
57
|
+
- Updated dependencies [9625602]
|
|
58
|
+
- Updated dependencies [8769a62]
|
|
59
|
+
- @mastra/deployer@0.0.1-alpha.28
|
|
60
|
+
- @mastra/core@0.2.0-alpha.83
|
|
61
|
+
|
|
62
|
+
## 0.0.1-alpha.32
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [73d112c]
|
|
67
|
+
- Updated dependencies [ac8c61a]
|
|
68
|
+
- @mastra/deployer@0.0.1-alpha.27
|
|
69
|
+
- @mastra/core@0.1.27-alpha.82
|
|
70
|
+
|
|
71
|
+
## 0.0.1-alpha.31
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [9fb3039]
|
|
76
|
+
- @mastra/core@0.1.27-alpha.81
|
|
77
|
+
- @mastra/deployer@0.0.1-alpha.26
|
|
78
|
+
|
|
79
|
+
## 0.0.1-alpha.30
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- 327ece7: Updates for ts versions
|
|
84
|
+
- Updated dependencies [327ece7]
|
|
85
|
+
- @mastra/core@0.1.27-alpha.80
|
|
86
|
+
- @mastra/deployer@0.0.1-alpha.25
|
|
87
|
+
|
|
88
|
+
## 0.0.1-alpha.29
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- Updated dependencies [21fe536]
|
|
93
|
+
- @mastra/core@0.1.27-alpha.79
|
|
94
|
+
- @mastra/deployer@0.0.1-alpha.24
|
|
95
|
+
|
|
96
|
+
## 0.0.1-alpha.28
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- Updated dependencies [88f18d7]
|
|
101
|
+
- @mastra/deployer@0.0.1-alpha.23
|
|
102
|
+
|
|
103
|
+
## 0.0.1-alpha.27
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- 44c7c26: Rebuild
|
|
108
|
+
|
|
109
|
+
## 0.0.1-alpha.26
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Updated dependencies [685108a]
|
|
114
|
+
- Updated dependencies [685108a]
|
|
115
|
+
- @mastra/deployer@0.0.1-alpha.22
|
|
116
|
+
- @mastra/core@0.1.27-alpha.78
|
|
117
|
+
|
|
118
|
+
## 0.0.1-alpha.25
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- 2b75edf: mastra deployers tsup bundling
|
|
123
|
+
- Updated dependencies [8105fae]
|
|
124
|
+
- Updated dependencies [cfb966f]
|
|
125
|
+
- @mastra/core@0.1.27-alpha.77
|
|
126
|
+
- @mastra/deployer@0.0.1-alpha.21
|
|
127
|
+
|
|
128
|
+
## 0.0.1-alpha.24
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- Updated dependencies [ae7bf94]
|
|
133
|
+
- Updated dependencies [ae7bf94]
|
|
134
|
+
- @mastra/deployer@0.0.1-alpha.20
|
|
135
|
+
- @mastra/core@0.1.27-alpha.76
|
|
136
|
+
|
|
137
|
+
## 0.0.1-alpha.23
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies [23dcb23]
|
|
142
|
+
- Updated dependencies [7064554]
|
|
143
|
+
- @mastra/core@0.1.27-alpha.75
|
|
144
|
+
- @mastra/deployer@0.0.1-alpha.19
|
|
145
|
+
|
|
146
|
+
## 0.0.1-alpha.22
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- Updated dependencies [7b87567]
|
|
151
|
+
- @mastra/core@0.1.27-alpha.74
|
|
152
|
+
- @mastra/deployer@0.0.1-alpha.18
|
|
153
|
+
|
|
154
|
+
## 0.0.1-alpha.21
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- Updated dependencies [3427b95]
|
|
159
|
+
- @mastra/core@0.1.27-alpha.73
|
|
160
|
+
- @mastra/deployer@0.0.1-alpha.17
|
|
161
|
+
|
|
162
|
+
## 0.0.1-alpha.20
|
|
163
|
+
|
|
164
|
+
### Patch Changes
|
|
165
|
+
|
|
166
|
+
- Updated dependencies [e4d4ede]
|
|
167
|
+
- Updated dependencies [06b2c0a]
|
|
168
|
+
- @mastra/core@0.1.27-alpha.72
|
|
169
|
+
- @mastra/deployer@0.0.1-alpha.16
|
|
170
|
+
|
|
171
|
+
## 0.0.1-alpha.19
|
|
172
|
+
|
|
173
|
+
### Patch Changes
|
|
174
|
+
|
|
175
|
+
- Updated dependencies [d9c8dd0]
|
|
176
|
+
- @mastra/deployer@0.0.1-alpha.15
|
|
177
|
+
- @mastra/core@0.1.27-alpha.71
|
|
178
|
+
|
|
179
|
+
## 0.0.1-alpha.18
|
|
180
|
+
|
|
181
|
+
### Patch Changes
|
|
182
|
+
|
|
183
|
+
- Updated dependencies [ad2cd74]
|
|
184
|
+
- @mastra/deployer@0.0.1-alpha.14
|
|
185
|
+
|
|
186
|
+
## 0.0.1-alpha.17
|
|
187
|
+
|
|
188
|
+
### Patch Changes
|
|
189
|
+
|
|
190
|
+
- Updated dependencies [a1774e7]
|
|
191
|
+
- @mastra/deployer@0.0.1-alpha.13
|
|
192
|
+
|
|
193
|
+
## 0.0.1-alpha.16
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- Updated dependencies [28dceab]
|
|
198
|
+
- @mastra/deployer@0.0.1-alpha.12
|
|
199
|
+
|
|
200
|
+
## 0.0.1-alpha.15
|
|
201
|
+
|
|
202
|
+
### Patch Changes
|
|
203
|
+
|
|
204
|
+
- bdaf834: publish packages
|
|
205
|
+
- Updated dependencies [bdaf834]
|
|
206
|
+
- @mastra/deployer@0.0.1-alpha.11
|
|
207
|
+
|
|
208
|
+
## 0.0.1-alpha.14
|
|
209
|
+
|
|
210
|
+
### Patch Changes
|
|
211
|
+
|
|
212
|
+
- Updated dependencies [dd6d87f]
|
|
213
|
+
- Updated dependencies [04434b6]
|
|
214
|
+
- @mastra/core@0.1.27-alpha.70
|
|
215
|
+
- @mastra/deployer@0.0.1-alpha.10
|
|
216
|
+
|
|
217
|
+
## 0.0.1-alpha.13
|
|
218
|
+
|
|
219
|
+
### Patch Changes
|
|
220
|
+
|
|
221
|
+
- Updated dependencies [9066f95]
|
|
222
|
+
- @mastra/deployer@0.0.1-alpha.9
|
|
223
|
+
|
|
224
|
+
## 0.0.1-alpha.12
|
|
225
|
+
|
|
226
|
+
### Patch Changes
|
|
227
|
+
|
|
228
|
+
- 0d5a03d: Vector store modules
|
|
229
|
+
|
|
230
|
+
## 0.0.1-alpha.11
|
|
231
|
+
|
|
232
|
+
### Patch Changes
|
|
233
|
+
|
|
234
|
+
- Updated dependencies [b425845]
|
|
235
|
+
- @mastra/deployer@0.0.1-alpha.8
|
|
236
|
+
|
|
237
|
+
## 0.0.1-alpha.10
|
|
238
|
+
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- Updated dependencies [1944807]
|
|
242
|
+
- Updated dependencies [9ade36e]
|
|
243
|
+
- @mastra/deployer@0.0.1-alpha.7
|
|
244
|
+
- @mastra/core@0.1.27-alpha.69
|
|
245
|
+
|
|
3
246
|
## 0.0.1-alpha.9
|
|
4
247
|
|
|
5
248
|
### Patch Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @mastra/deployer-vercel
|
|
2
|
+
|
|
3
|
+
A Vercel deployer for Mastra applications.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Deploy Mastra applications to Vercel
|
|
8
|
+
- Zero-configuration serverless deployments
|
|
9
|
+
- Automatic environment variable synchronization
|
|
10
|
+
- Support for production, preview, and development environments
|
|
11
|
+
- Instant global deployments with Edge Functions
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @mastra/deployer-vercel
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
The Vercel deployer is used as part of the Mastra framework:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { Mastra } from '@mastra/core';
|
|
25
|
+
import { VercelDeployer } from '@mastra/deployer-vercel';
|
|
26
|
+
|
|
27
|
+
const deployer = new VercelDeployer({
|
|
28
|
+
scope: 'your-team-id',
|
|
29
|
+
projectName: 'your-project-name',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const mastra = new Mastra({
|
|
33
|
+
deployer,
|
|
34
|
+
// ... other Mastra configuration options
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
### Constructor Options
|
|
41
|
+
|
|
42
|
+
- `scope` (required): Your Vercel team ID or username
|
|
43
|
+
- `projectName`: Name of your Vercel project (will be created if it doesn't exist)
|
|
44
|
+
|
|
45
|
+
## Project Structure
|
|
46
|
+
|
|
47
|
+
The deployer creates:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
your-project/
|
|
51
|
+
├── vercel.json # Deployment configuration
|
|
52
|
+
└── index.mjs # Application entry point
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### vercel.json Configuration
|
|
56
|
+
|
|
57
|
+
Default configuration:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"version": 2,
|
|
62
|
+
"installCommand": "npm install --omit=dev",
|
|
63
|
+
"builds": [
|
|
64
|
+
{
|
|
65
|
+
"src": "index.mjs",
|
|
66
|
+
"use": "@vercel/node",
|
|
67
|
+
"config": {
|
|
68
|
+
"includeFiles": ["**"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"routes": [
|
|
73
|
+
{
|
|
74
|
+
"src": "/(.*)",
|
|
75
|
+
"dest": "index.mjs"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Environment Variables
|
|
82
|
+
|
|
83
|
+
Environment variables are handled automatically through:
|
|
84
|
+
|
|
85
|
+
- `.env` files in your project
|
|
86
|
+
- Environment variables passed through the Mastra configuration
|
|
87
|
+
- Vercel's environment variable UI
|
|
88
|
+
|
|
89
|
+
## Deployment Process
|
|
90
|
+
|
|
91
|
+
The deployer:
|
|
92
|
+
|
|
93
|
+
1. Configures your project with the necessary files
|
|
94
|
+
2. Deploys to Vercel using the CLI
|
|
95
|
+
3. Synchronizes environment variables for future deployments
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Deployer } from '@mastra/deployer';
|
|
2
|
+
|
|
3
|
+
declare class VercelDeployer extends Deployer {
|
|
4
|
+
private teamId;
|
|
5
|
+
private projectName;
|
|
6
|
+
private token;
|
|
7
|
+
constructor({ teamId, projectName, token }: {
|
|
8
|
+
teamId: string;
|
|
6
9
|
projectName: string;
|
|
10
|
+
token: string;
|
|
7
11
|
});
|
|
8
|
-
writeFiles(
|
|
9
|
-
dir: string;
|
|
10
|
-
}): void;
|
|
12
|
+
writeFiles(outputDirectory: string): void;
|
|
11
13
|
private getProjectId;
|
|
12
|
-
syncEnv
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
deploy({ dir, token }: {
|
|
18
|
-
dir: string;
|
|
19
|
-
token: string;
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
writeIndex({ dir }: {
|
|
22
|
-
dir: string;
|
|
23
|
-
}): void;
|
|
14
|
+
private syncEnv;
|
|
15
|
+
prepare(outputDirectory: string): Promise<void>;
|
|
16
|
+
private getEntry;
|
|
17
|
+
bundle(mastraDir: string, outputDirectory: string): Promise<void>;
|
|
18
|
+
deploy(outputDirectory: string): Promise<void>;
|
|
24
19
|
}
|
|
25
|
-
|
|
20
|
+
|
|
21
|
+
export { VercelDeployer };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,152 @@
|
|
|
1
|
+
import { Deployer } from '@mastra/deployer';
|
|
2
|
+
import { getBundler } from '@mastra/deployer/build';
|
|
3
|
+
import virtual from '@rollup/plugin-virtual';
|
|
4
|
+
import * as child_process from 'child_process';
|
|
5
|
+
import { writeFileSync, readFileSync } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import process from 'process';
|
|
1
8
|
|
|
2
|
-
|
|
9
|
+
// src/index.ts
|
|
10
|
+
var VercelDeployer = class extends Deployer {
|
|
11
|
+
teamId;
|
|
12
|
+
projectName;
|
|
13
|
+
token;
|
|
14
|
+
constructor({ teamId, projectName, token }) {
|
|
15
|
+
super({ name: "VERCEL" });
|
|
16
|
+
this.teamId = teamId;
|
|
17
|
+
this.projectName = projectName;
|
|
18
|
+
this.token = token;
|
|
19
|
+
}
|
|
20
|
+
writeFiles(outputDirectory) {
|
|
21
|
+
writeFileSync(
|
|
22
|
+
join(outputDirectory, "vercel.json"),
|
|
23
|
+
JSON.stringify(
|
|
24
|
+
{
|
|
25
|
+
version: 2,
|
|
26
|
+
installCommand: "npm install --omit=dev",
|
|
27
|
+
builds: [
|
|
28
|
+
{
|
|
29
|
+
src: "index.mjs",
|
|
30
|
+
use: "@vercel/node",
|
|
31
|
+
config: { includeFiles: ["**"] }
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
routes: [
|
|
35
|
+
{
|
|
36
|
+
src: "/(.*)",
|
|
37
|
+
dest: "index.mjs"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
null,
|
|
42
|
+
2
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
getProjectId({ dir }) {
|
|
47
|
+
const projectJsonPath = join(dir, ".vercel", "project.json");
|
|
48
|
+
try {
|
|
49
|
+
const projectJson = JSON.parse(readFileSync(projectJsonPath, "utf-8"));
|
|
50
|
+
return projectJson.projectId;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
throw new Error("Could not find project ID. Make sure the project has been deployed first.");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async syncEnv(envVars) {
|
|
56
|
+
console.log("Syncing environment variables...");
|
|
57
|
+
const vercelEnvVars = Array.from(envVars.entries()).map(([key, value]) => {
|
|
58
|
+
if (!key || !value) {
|
|
59
|
+
throw new Error(`Invalid environment variable format: ${key || value}`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
key,
|
|
63
|
+
value,
|
|
64
|
+
target: ["production", "preview", "development"],
|
|
65
|
+
type: "plain"
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
try {
|
|
69
|
+
const projectId = this.getProjectId({ dir: process.cwd() });
|
|
70
|
+
const response = await fetch(
|
|
71
|
+
`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${this.teamId}&upsert=true`,
|
|
72
|
+
{
|
|
73
|
+
method: "POST",
|
|
74
|
+
headers: {
|
|
75
|
+
Authorization: `Bearer ${this.token}`,
|
|
76
|
+
"Content-Type": "application/json"
|
|
77
|
+
},
|
|
78
|
+
body: JSON.stringify(vercelEnvVars)
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
if (!response.ok) {
|
|
82
|
+
const error = await response.json();
|
|
83
|
+
throw new Error(`Failed to sync environment variables: ${error.message}`);
|
|
84
|
+
}
|
|
85
|
+
console.log("\u2713 Successfully synced environment variables");
|
|
86
|
+
} catch (error) {
|
|
87
|
+
if (error instanceof Error) {
|
|
88
|
+
console.error("Failed to sync environment variables:", error.message);
|
|
89
|
+
} else {
|
|
90
|
+
console.error("Failed to sync environment variables:", error);
|
|
91
|
+
}
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async prepare(outputDirectory) {
|
|
96
|
+
await super.prepare(outputDirectory);
|
|
97
|
+
await this.writeFiles(outputDirectory);
|
|
98
|
+
}
|
|
99
|
+
getEntry() {
|
|
100
|
+
return `
|
|
101
|
+
import { handle } from 'hono/vercel'
|
|
102
|
+
import { mastra } from '#mastra';
|
|
103
|
+
import { createHonoServer } from '#server';
|
|
3
104
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
105
|
+
const app = await createHonoServer(mastra);
|
|
106
|
+
|
|
107
|
+
export const GET = handle(app);
|
|
108
|
+
export const POST = handle(app);
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
111
|
+
async bundle(mastraDir, outputDirectory) {
|
|
112
|
+
const bundler = await getBundler({
|
|
113
|
+
input: "#entry",
|
|
114
|
+
plugins: [virtual({ "#entry": this.getEntry() })]
|
|
115
|
+
});
|
|
116
|
+
await bundler.write({
|
|
117
|
+
inlineDynamicImports: true,
|
|
118
|
+
file: `${outputDirectory}/index.mjs`,
|
|
119
|
+
format: "es"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async deploy(outputDirectory) {
|
|
123
|
+
const envVars = await this.loadEnvVars();
|
|
124
|
+
const commandArgs = [
|
|
125
|
+
"--scope",
|
|
126
|
+
this.teamId,
|
|
127
|
+
"--cwd",
|
|
128
|
+
outputDirectory,
|
|
129
|
+
"--token",
|
|
130
|
+
this.token,
|
|
131
|
+
"deploy",
|
|
132
|
+
"--yes",
|
|
133
|
+
...this.projectName ? ["--name", this.projectName] : []
|
|
134
|
+
];
|
|
135
|
+
child_process.execSync(`npx vercel ${commandArgs.join(" ")}`, {
|
|
136
|
+
cwd: outputDirectory,
|
|
137
|
+
env: {
|
|
138
|
+
// ...this.env,
|
|
139
|
+
PATH: process.env.PATH
|
|
140
|
+
},
|
|
141
|
+
stdio: "inherit"
|
|
142
|
+
});
|
|
143
|
+
this.logger.info("Deployment started on Vercel. You can wait for it to finish or exit this command.");
|
|
144
|
+
if (envVars.size > 0) {
|
|
145
|
+
await this.syncEnv(envVars);
|
|
146
|
+
} else {
|
|
147
|
+
this.logger.info("\nAdd your ENV vars to .env or your vercel dashboard.\n");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export { VercelDeployer };
|
package/package.json
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-vercel",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-alpha.37",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
-
"module": "dist/deployer-vercel.esm.js",
|
|
8
7
|
"types": "dist/index.d.ts",
|
|
9
8
|
"exports": {
|
|
10
9
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"default": "./dist/deployer-vercel.esm.js"
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"default": "./dist/index.js"
|
|
18
|
-
}
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
19
12
|
},
|
|
20
13
|
"./package.json": "./package.json"
|
|
21
14
|
},
|
|
@@ -23,23 +16,24 @@
|
|
|
23
16
|
"author": "",
|
|
24
17
|
"license": "ISC",
|
|
25
18
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"
|
|
19
|
+
"@rollup/plugin-virtual": "^3.0.2",
|
|
20
|
+
"fs-extra": "^11.2.0",
|
|
21
|
+
"@mastra/core": "^0.2.0-alpha.86",
|
|
22
|
+
"@mastra/deployer": "^0.1.0-alpha.32"
|
|
28
23
|
},
|
|
29
24
|
"devDependencies": {
|
|
30
25
|
"@babel/preset-env": "^7.26.0",
|
|
31
26
|
"@babel/preset-typescript": "^7.26.0",
|
|
32
27
|
"@tsconfig/recommended": "^1.0.7",
|
|
33
|
-
"@types/jsdom": "^21.1.7",
|
|
34
28
|
"@types/node": "^22.9.0",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
29
|
+
"tsup": "^8.0.1",
|
|
30
|
+
"typescript": "^5.3.3",
|
|
31
|
+
"vercel": "^39.3.0",
|
|
32
|
+
"vitest": "^3.0.4"
|
|
39
33
|
},
|
|
40
34
|
"scripts": {
|
|
41
|
-
"build": "dts
|
|
42
|
-
"
|
|
35
|
+
"build": "tsup-node src/index.ts --format esm --dts --clean --treeshake",
|
|
36
|
+
"dev": "tsup-node src/index.ts --format esm --dts --clean --treeshake --watch",
|
|
43
37
|
"test": "vitest run"
|
|
44
38
|
}
|
|
45
39
|
}
|