@mastra/deployer-vercel 0.0.1-alpha.26 → 0.0.1-alpha.3
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 +0 -185
- package/dist/deployer-vercel.cjs.development.js +9 -7
- package/dist/deployer-vercel.cjs.development.js.map +1 -1
- package/dist/deployer-vercel.cjs.production.min.js +1 -1
- package/dist/deployer-vercel.cjs.production.min.js.map +1 -1
- package/dist/deployer-vercel.esm.js +9 -7
- package/dist/deployer-vercel.esm.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +19 -10
- package/src/index.ts +4 -0
- package/tsconfig.json +6 -1
- package/vitest.config.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,190 +1,5 @@
|
|
|
1
1
|
# @mastra/deployer-vercel
|
|
2
2
|
|
|
3
|
-
## 0.0.1-alpha.26
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [685108a]
|
|
8
|
-
- Updated dependencies [685108a]
|
|
9
|
-
- @mastra/deployer@0.0.1-alpha.22
|
|
10
|
-
- @mastra/core@0.1.27-alpha.78
|
|
11
|
-
|
|
12
|
-
## 0.0.1-alpha.25
|
|
13
|
-
|
|
14
|
-
### Patch Changes
|
|
15
|
-
|
|
16
|
-
- 2b75edf: mastra deployers tsup bundling
|
|
17
|
-
- Updated dependencies [8105fae]
|
|
18
|
-
- Updated dependencies [cfb966f]
|
|
19
|
-
- @mastra/core@0.1.27-alpha.77
|
|
20
|
-
- @mastra/deployer@0.0.1-alpha.21
|
|
21
|
-
|
|
22
|
-
## 0.0.1-alpha.24
|
|
23
|
-
|
|
24
|
-
### Patch Changes
|
|
25
|
-
|
|
26
|
-
- Updated dependencies [ae7bf94]
|
|
27
|
-
- Updated dependencies [ae7bf94]
|
|
28
|
-
- @mastra/deployer@0.0.1-alpha.20
|
|
29
|
-
- @mastra/core@0.1.27-alpha.76
|
|
30
|
-
|
|
31
|
-
## 0.0.1-alpha.23
|
|
32
|
-
|
|
33
|
-
### Patch Changes
|
|
34
|
-
|
|
35
|
-
- Updated dependencies [23dcb23]
|
|
36
|
-
- Updated dependencies [7064554]
|
|
37
|
-
- @mastra/core@0.1.27-alpha.75
|
|
38
|
-
- @mastra/deployer@0.0.1-alpha.19
|
|
39
|
-
|
|
40
|
-
## 0.0.1-alpha.22
|
|
41
|
-
|
|
42
|
-
### Patch Changes
|
|
43
|
-
|
|
44
|
-
- Updated dependencies [7b87567]
|
|
45
|
-
- @mastra/core@0.1.27-alpha.74
|
|
46
|
-
- @mastra/deployer@0.0.1-alpha.18
|
|
47
|
-
|
|
48
|
-
## 0.0.1-alpha.21
|
|
49
|
-
|
|
50
|
-
### Patch Changes
|
|
51
|
-
|
|
52
|
-
- Updated dependencies [3427b95]
|
|
53
|
-
- @mastra/core@0.1.27-alpha.73
|
|
54
|
-
- @mastra/deployer@0.0.1-alpha.17
|
|
55
|
-
|
|
56
|
-
## 0.0.1-alpha.20
|
|
57
|
-
|
|
58
|
-
### Patch Changes
|
|
59
|
-
|
|
60
|
-
- Updated dependencies [e4d4ede]
|
|
61
|
-
- Updated dependencies [06b2c0a]
|
|
62
|
-
- @mastra/core@0.1.27-alpha.72
|
|
63
|
-
- @mastra/deployer@0.0.1-alpha.16
|
|
64
|
-
|
|
65
|
-
## 0.0.1-alpha.19
|
|
66
|
-
|
|
67
|
-
### Patch Changes
|
|
68
|
-
|
|
69
|
-
- Updated dependencies [d9c8dd0]
|
|
70
|
-
- @mastra/deployer@0.0.1-alpha.15
|
|
71
|
-
- @mastra/core@0.1.27-alpha.71
|
|
72
|
-
|
|
73
|
-
## 0.0.1-alpha.18
|
|
74
|
-
|
|
75
|
-
### Patch Changes
|
|
76
|
-
|
|
77
|
-
- Updated dependencies [ad2cd74]
|
|
78
|
-
- @mastra/deployer@0.0.1-alpha.14
|
|
79
|
-
|
|
80
|
-
## 0.0.1-alpha.17
|
|
81
|
-
|
|
82
|
-
### Patch Changes
|
|
83
|
-
|
|
84
|
-
- Updated dependencies [a1774e7]
|
|
85
|
-
- @mastra/deployer@0.0.1-alpha.13
|
|
86
|
-
|
|
87
|
-
## 0.0.1-alpha.16
|
|
88
|
-
|
|
89
|
-
### Patch Changes
|
|
90
|
-
|
|
91
|
-
- Updated dependencies [28dceab]
|
|
92
|
-
- @mastra/deployer@0.0.1-alpha.12
|
|
93
|
-
|
|
94
|
-
## 0.0.1-alpha.15
|
|
95
|
-
|
|
96
|
-
### Patch Changes
|
|
97
|
-
|
|
98
|
-
- bdaf834: publish packages
|
|
99
|
-
- Updated dependencies [bdaf834]
|
|
100
|
-
- @mastra/deployer@0.0.1-alpha.11
|
|
101
|
-
|
|
102
|
-
## 0.0.1-alpha.14
|
|
103
|
-
|
|
104
|
-
### Patch Changes
|
|
105
|
-
|
|
106
|
-
- Updated dependencies [dd6d87f]
|
|
107
|
-
- Updated dependencies [04434b6]
|
|
108
|
-
- @mastra/core@0.1.27-alpha.70
|
|
109
|
-
- @mastra/deployer@0.0.1-alpha.10
|
|
110
|
-
|
|
111
|
-
## 0.0.1-alpha.13
|
|
112
|
-
|
|
113
|
-
### Patch Changes
|
|
114
|
-
|
|
115
|
-
- Updated dependencies [9066f95]
|
|
116
|
-
- @mastra/deployer@0.0.1-alpha.9
|
|
117
|
-
|
|
118
|
-
## 0.0.1-alpha.12
|
|
119
|
-
|
|
120
|
-
### Patch Changes
|
|
121
|
-
|
|
122
|
-
- 0d5a03d: Vector store modules
|
|
123
|
-
|
|
124
|
-
## 0.0.1-alpha.11
|
|
125
|
-
|
|
126
|
-
### Patch Changes
|
|
127
|
-
|
|
128
|
-
- Updated dependencies [b425845]
|
|
129
|
-
- @mastra/deployer@0.0.1-alpha.8
|
|
130
|
-
|
|
131
|
-
## 0.0.1-alpha.10
|
|
132
|
-
|
|
133
|
-
### Patch Changes
|
|
134
|
-
|
|
135
|
-
- Updated dependencies [1944807]
|
|
136
|
-
- Updated dependencies [9ade36e]
|
|
137
|
-
- @mastra/deployer@0.0.1-alpha.7
|
|
138
|
-
- @mastra/core@0.1.27-alpha.69
|
|
139
|
-
|
|
140
|
-
## 0.0.1-alpha.9
|
|
141
|
-
|
|
142
|
-
### Patch Changes
|
|
143
|
-
|
|
144
|
-
- Updated dependencies [291fe57]
|
|
145
|
-
- Updated dependencies [1a41fbf]
|
|
146
|
-
- @mastra/deployer@0.0.1-alpha.6
|
|
147
|
-
|
|
148
|
-
## 0.0.1-alpha.8
|
|
149
|
-
|
|
150
|
-
### Patch Changes
|
|
151
|
-
|
|
152
|
-
- Updated dependencies [0be7181]
|
|
153
|
-
- Updated dependencies [0be7181]
|
|
154
|
-
- @mastra/core@0.1.27-alpha.68
|
|
155
|
-
- @mastra/deployer@0.0.1-alpha.5
|
|
156
|
-
|
|
157
|
-
## 0.0.1-alpha.7
|
|
158
|
-
|
|
159
|
-
### Patch Changes
|
|
160
|
-
|
|
161
|
-
- Updated dependencies [7babd5c]
|
|
162
|
-
- @mastra/deployer@0.0.1-alpha.4
|
|
163
|
-
|
|
164
|
-
## 0.0.1-alpha.6
|
|
165
|
-
|
|
166
|
-
### Patch Changes
|
|
167
|
-
|
|
168
|
-
- Updated dependencies [c8ff2f5]
|
|
169
|
-
- Updated dependencies [a291824]
|
|
170
|
-
- @mastra/core@0.1.27-alpha.67
|
|
171
|
-
- @mastra/deployer@0.0.1-alpha.3
|
|
172
|
-
|
|
173
|
-
## 0.0.1-alpha.5
|
|
174
|
-
|
|
175
|
-
### Patch Changes
|
|
176
|
-
|
|
177
|
-
- 88600bc: Deployer fixes
|
|
178
|
-
|
|
179
|
-
## 0.0.1-alpha.4
|
|
180
|
-
|
|
181
|
-
### Patch Changes
|
|
182
|
-
|
|
183
|
-
- a9b5ddf: Publish new versions
|
|
184
|
-
- Updated dependencies [a9b5ddf]
|
|
185
|
-
- Updated dependencies [72c280b]
|
|
186
|
-
- @mastra/deployer@0.0.1-alpha.2
|
|
187
|
-
|
|
188
3
|
## 0.0.1-alpha.0
|
|
189
4
|
|
|
190
5
|
### Patch Changes
|
|
@@ -537,12 +537,14 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
537
537
|
envVars.push.apply(envVars, vars);
|
|
538
538
|
}
|
|
539
539
|
// Create the command array with base arguments
|
|
540
|
-
commandArgs = ['--scope', this.scope, '--cwd', dir, 'deploy', '--token', token, '--yes'].concat(this.projectName ? ['--name', this.projectName] : []); // Add env vars to initial deployment
|
|
540
|
+
commandArgs = ['--debug', '--scope', this.scope, '--cwd', dir, 'deploy', '--token', token, '--yes'].concat(this.projectName ? ['--name', this.projectName] : []); // Add env vars to initial deployment
|
|
541
541
|
for (_i = 0, _envVars = envVars; _i < _envVars.length; _i++) {
|
|
542
542
|
envVar = _envVars[_i];
|
|
543
543
|
commandArgs.push('--env', envVar);
|
|
544
544
|
}
|
|
545
545
|
// Run the Vercel deploy command
|
|
546
|
+
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
547
|
+
console.log("vercel " + commandArgs.join(' '));
|
|
546
548
|
child_process__namespace.execSync("vercel " + commandArgs.join(' '), {
|
|
547
549
|
cwd: dir,
|
|
548
550
|
env: _extends({}, this.env, {
|
|
@@ -552,21 +554,21 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
552
554
|
});
|
|
553
555
|
console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
|
|
554
556
|
if (!(envVars.length > 0)) {
|
|
555
|
-
_context2.next =
|
|
557
|
+
_context2.next = 14;
|
|
556
558
|
break;
|
|
557
559
|
}
|
|
558
|
-
_context2.next =
|
|
560
|
+
_context2.next = 12;
|
|
559
561
|
return this.syncEnv({
|
|
560
562
|
scope: this.scope,
|
|
561
563
|
dir: dir,
|
|
562
564
|
token: token
|
|
563
565
|
});
|
|
564
|
-
case
|
|
565
|
-
_context2.next =
|
|
566
|
+
case 12:
|
|
567
|
+
_context2.next = 15;
|
|
566
568
|
break;
|
|
567
|
-
case 13:
|
|
568
|
-
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
569
569
|
case 14:
|
|
570
|
+
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
571
|
+
case 15:
|
|
570
572
|
case "end":
|
|
571
573
|
return _context2.stop();
|
|
572
574
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployer-vercel.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport * as child_process from 'child_process';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface EnvVar {\n key: string;\n value: string;\n target: ('production' | 'preview' | 'development')[];\n type: 'plain' | 'secret';\n}\n\ninterface VercelError {\n message: string;\n code: string;\n}\n\nexport class VercelDeployer extends MastraDeployer {\n constructor({ scope, env, projectName }: { env?: Record<string, any>; scope: string; projectName: string }) {\n super({ scope, env, projectName });\n }\n writeFiles({ dir }: { dir: string }): void {\n this.writeIndex({ dir });\n\n writeFileSync(\n join(dir, 'vercel.json'),\n JSON.stringify(\n {\n version: 2,\n installCommand: 'npm install --omit=dev',\n builds: [\n {\n src: 'index.mjs',\n use: '@vercel/node',\n config: { includeFiles: ['**'] },\n },\n ],\n routes: [\n {\n src: '/(.*)',\n dest: 'index.mjs',\n },\n ],\n },\n null,\n 2,\n ),\n );\n }\n\n private getProjectId({ dir }: { dir: string }): string {\n const projectJsonPath = join(dir, '.vercel', 'project.json');\n try {\n const projectJson = JSON.parse(readFileSync(projectJsonPath, 'utf-8'));\n return projectJson.projectId;\n } catch (error) {\n throw new Error('Could not find project ID. Make sure the project has been deployed first.');\n }\n }\n\n async syncEnv({ scope, dir, token }: { token: string; dir: string; scope: string }) {\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n console.log('Syncing environment variables...');\n\n // Transform env vars into the format expected by Vercel API\n const vercelEnvVars: EnvVar[] = envVars.map(envVar => {\n const [key, value] = envVar.split('=');\n if (!key || !value) {\n throw new Error(`Invalid environment variable format: ${envVar}`);\n }\n return {\n key,\n value,\n target: ['production', 'preview', 'development'],\n type: 'plain',\n };\n });\n\n try {\n const projectId = this.getProjectId({ dir });\n\n const response = await fetch(`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${scope}&upsert=true`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(vercelEnvVars),\n });\n\n if (!response.ok) {\n const error = (await response.json()) as VercelError;\n throw new Error(`Failed to sync environment variables: ${error.message}`);\n }\n\n console.log('✓ Successfully synced environment variables');\n } catch (error) {\n if (error instanceof Error) {\n console.error('Failed to sync environment variables:', error.message);\n } else {\n console.error('Failed to sync environment variables:', error);\n }\n throw error;\n }\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n // Get env vars for initial deployment\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n // Create the command array with base arguments\n const commandArgs = [\n '--scope',\n this.scope as string,\n '--cwd',\n dir,\n 'deploy',\n '--token',\n token,\n '--yes',\n ...(this.projectName ? ['--name', this.projectName] : []),\n ];\n\n // Add env vars to initial deployment\n for (const envVar of envVars) {\n commandArgs.push('--env', envVar);\n }\n\n // Run the Vercel deploy command\n child_process.execSync(`vercel ${commandArgs.join(' ')}`, {\n cwd: dir,\n env: {\n ...this.env,\n PATH: process.env.PATH,\n },\n stdio: 'inherit',\n });\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n\n if (envVars.length > 0) {\n // Sync environment variables for future deployments\n await this.syncEnv({ scope: this.scope, dir, token });\n } else {\n console.log('\\nAdd your ENV vars to .env or your vercel dashboard.\\n');\n }\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, 'index.mjs'),\n `\n import { handle } from 'hono/vercel'\n import { app } from './hono.mjs';\n export const GET = handle(app);\n export const POST = handle(app);\n `,\n );\n }\n}\n"],"names":["VercelDeployer","_MastraDeployer","_ref","scope","env","projectName","call","_inheritsLoose","_proto","prototype","writeFiles","_ref2","dir","writeIndex","writeFileSync","join","JSON","stringify","version","installCommand","builds","src","use","config","includeFiles","routes","dest","getProjectId","_ref3","projectJsonPath","projectJson","parse","readFileSync","projectId","error","Error","syncEnv","_syncEnv","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","envFiles","envVars","_iterator","_step","file","vars","vercelEnvVars","response","wrap","_callee$","_context","prev","next","getEnvFiles","_createForOfIteratorHelperLoose","done","value","parseEnvFile","push","apply","console","log","map","envVar","_envVar$split","split","key","target","type","fetch","method","headers","Authorization","body","sent","ok","json","message","t0","stop","_x","arguments","deploy","_deploy","_callee2","_ref5","_iterator2","_step2","commandArgs","_i","_envVars","_callee2$","_context2","concat","length","child_process","execSync","cwd","_extends","PATH","process","stdio","_x2","_ref6","MastraDeployer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBaA,IAAAA,cAAe,0BAAAC,eAAA,EAAA;EAC1B,SAAAD,cAAAA,CAAAE,IAAA,EAA0G;AAAA,IAAA,I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AAA,EAAA,OAAAZ,cAAA,CAAA;AAAA,CAAA,CA1JiC4G,mBAAc;;;;"}
|
|
1
|
+
{"version":3,"file":"deployer-vercel.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport * as child_process from 'child_process';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface EnvVar {\n key: string;\n value: string;\n target: ('production' | 'preview' | 'development')[];\n type: 'plain' | 'secret';\n}\n\ninterface VercelError {\n message: string;\n code: string;\n}\n\nexport class VercelDeployer extends MastraDeployer {\n constructor({ scope, env, projectName }: { env?: Record<string, any>; scope: string; projectName: string }) {\n super({ scope, env, projectName });\n }\n writeFiles({ dir }: { dir: string }): void {\n this.writeIndex({ dir });\n\n writeFileSync(\n join(dir, 'vercel.json'),\n JSON.stringify(\n {\n version: 2,\n installCommand: 'npm install --omit=dev',\n builds: [\n {\n src: 'index.mjs',\n use: '@vercel/node',\n config: { includeFiles: ['**'] },\n },\n ],\n routes: [\n {\n src: '/(.*)',\n dest: 'index.mjs',\n },\n ],\n },\n null,\n 2,\n ),\n );\n }\n\n private getProjectId({ dir }: { dir: string }): string {\n const projectJsonPath = join(dir, '.vercel', 'project.json');\n try {\n const projectJson = JSON.parse(readFileSync(projectJsonPath, 'utf-8'));\n return projectJson.projectId;\n } catch (error) {\n throw new Error('Could not find project ID. Make sure the project has been deployed first.');\n }\n }\n\n async syncEnv({ scope, dir, token }: { token: string; dir: string; scope: string }) {\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n console.log('Syncing environment variables...');\n\n // Transform env vars into the format expected by Vercel API\n const vercelEnvVars: EnvVar[] = envVars.map(envVar => {\n const [key, value] = envVar.split('=');\n if (!key || !value) {\n throw new Error(`Invalid environment variable format: ${envVar}`);\n }\n return {\n key,\n value,\n target: ['production', 'preview', 'development'],\n type: 'plain',\n };\n });\n\n try {\n const projectId = this.getProjectId({ dir });\n\n const response = await fetch(`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${scope}&upsert=true`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(vercelEnvVars),\n });\n\n if (!response.ok) {\n const error = (await response.json()) as VercelError;\n throw new Error(`Failed to sync environment variables: ${error.message}`);\n }\n\n console.log('✓ Successfully synced environment variables');\n } catch (error) {\n if (error instanceof Error) {\n console.error('Failed to sync environment variables:', error.message);\n } else {\n console.error('Failed to sync environment variables:', error);\n }\n throw error;\n }\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n // Get env vars for initial deployment\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n // Create the command array with base arguments\n const commandArgs = [\n '--debug',\n '--scope',\n this.scope as string,\n '--cwd',\n dir,\n 'deploy',\n '--token',\n token,\n '--yes',\n ...(this.projectName ? ['--name', this.projectName] : []),\n ];\n\n // Add env vars to initial deployment\n for (const envVar of envVars) {\n commandArgs.push('--env', envVar);\n }\n\n // Run the Vercel deploy command\n // console.log('Running command:', 'vercel', commandArgs.join(' '));\n console.log(`vercel ${commandArgs.join(' ')}`);\n\n child_process.execSync(`vercel ${commandArgs.join(' ')}`, {\n cwd: dir,\n env: {\n ...this.env,\n PATH: process.env.PATH,\n },\n stdio: 'inherit',\n });\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n\n if (envVars.length > 0) {\n // Sync environment variables for future deployments\n await this.syncEnv({ scope: this.scope, dir, token });\n } else {\n console.log('\\nAdd your ENV vars to .env or your vercel dashboard.\\n');\n }\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, 'index.mjs'),\n `\n import { handle } from 'hono/vercel'\n import { app } from './hono.mjs';\n export const GET = handle(app);\n export const POST = handle(app);\n `,\n );\n }\n}\n"],"names":["VercelDeployer","_MastraDeployer","_ref","scope","env","projectName","call","_inheritsLoose","_proto","prototype","writeFiles","_ref2","dir","writeIndex","writeFileSync","join","JSON","stringify","version","installCommand","builds","src","use","config","includeFiles","routes","dest","getProjectId","_ref3","projectJsonPath","projectJson","parse","readFileSync","projectId","error","Error","syncEnv","_syncEnv","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","envFiles","envVars","_iterator","_step","file","vars","vercelEnvVars","response","wrap","_callee$","_context","prev","next","getEnvFiles","_createForOfIteratorHelperLoose","done","value","parseEnvFile","push","apply","console","log","map","envVar","_envVar$split","split","key","target","type","fetch","method","headers","Authorization","body","sent","ok","json","message","t0","stop","_x","arguments","deploy","_deploy","_callee2","_ref5","_iterator2","_step2","commandArgs","_i","_envVars","_callee2$","_context2","concat","length","child_process","execSync","cwd","_extends","PATH","process","stdio","_x2","_ref6","MastraDeployer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBaA,IAAAA,cAAe,0BAAAC,eAAA,EAAA;EAC1B,SAAAD,cAAAA,CAAAE,IAAA,EAA0G;AAAA,IAAA,IAA5FC,KAAK,GAAAD,IAAA,CAALC,KAAK;MAAEC,GAAG,GAAAF,IAAA,CAAHE,G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8NAMf,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAZ,cAAA,CAAA;AAAA,CAAA,CA9JiC4G,mBAAc;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@mastra/core"),e=require("child_process"),r=require("fs"),n=require("path");function o(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,e}var i=o(e);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,s,"next",t)}function s(t){c(i,n,o,a,s,"throw",t)}a(void 0)}))}}function u(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){return l=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l.apply(null,arguments)}function f(){f=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof g?e:g).prototype),a=new N(n||[]);return o(i,"_invoke",{value:S(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function w(){}function b(){}var j={};u(j,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(I([])));E&&E!==r&&n.call(E,a)&&(j=E);var O=b.prototype=g.prototype=Object.create(j);function L(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,c){var s=h(t[o],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=_(c,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(e,r,n);if("normal"===u.type){if(o=n.done?d:v,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=d,n.method="throw",n.arg=u.arg)}}}function _(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(O,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=u(b,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(k.prototype),u(k.prototype,c,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),u(O,s,"Generator"),u(O,a,(function(){return this})),u(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(F),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),F(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;F(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}exports.VercelDeployer=function(t){function e(e){return t.call(this,{scope:e.scope,env:e.env,projectName:e.projectName})||this}var o,a;a=t,(o=e).prototype=Object.create(a.prototype),o.prototype.constructor=o,h(o,a);var c=e.prototype;return c.writeFiles=function(t){var e=t.dir;this.writeIndex({dir:e}),r.writeFileSync(n.join(e,"vercel.json"),JSON.stringify({version:2,installCommand:"npm install --omit=dev",builds:[{src:"index.mjs",use:"@vercel/node",config:{includeFiles:["**"]}}],routes:[{src:"/(.*)",dest:"index.mjs"}]},null,2))},c.getProjectId=function(t){var e=n.join(t.dir,".vercel","project.json");try{return JSON.parse(r.readFileSync(e,"utf-8")).projectId}catch(t){throw new Error("Could not find project ID. Make sure the project has been deployed first.")}},c.syncEnv=function(){var t=s(f().mark((function t(e){var r,n,o,i,a,c,s,l,h,p,v;return f().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=e.scope,n=e.dir,o=e.token,i=this.getEnvFiles(),a=[],c=u(i);!(s=c()).done;)l=this.parseEnvFile(s.value),a.push.apply(a,l);return console.log("Syncing environment variables..."),h=a.map((function(t){var e=t.split("="),r=e[0],n=e[1];if(!r||!n)throw new Error("Invalid environment variable format: "+t);return{key:r,value:n,target:["production","preview","development"],type:"plain"}})),t.prev=6,p=this.getProjectId({dir:n}),t.next=10,fetch("https://api.vercel.com/v10/projects/"+p+"/env?teamId="+r+"&upsert=true",{method:"POST",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},body:JSON.stringify(h)});case 10:if((v=t.sent).ok){t.next=16;break}return t.next=14,v.json();case 14:throw new Error("Failed to sync environment variables: "+t.sent.message);case 16:console.log("✓ Successfully synced environment variables"),t.next=23;break;case 19:throw t.prev=19,t.t0=t.catch(6),t.t0 instanceof Error?console.error("Failed to sync environment variables:",t.t0.message):console.error("Failed to sync environment variables:",t.t0),t.t0;case 23:case"end":return t.stop()}}),t,this,[[6,19]])})));return function(e){return t.apply(this,arguments)}}(),c.deploy=function(){var t=s(f().mark((function t(e){var r,n,o,a,c,s,h,p,v,y;return f().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=e.dir,n=e.token,o=this.getEnvFiles(),a=[],c=u(o);!(s=c()).done;)h=this.parseEnvFile(s.value),a.push.apply(a,h);for(p=["--scope",this.scope,"--cwd",r,"deploy","--token",n,"--yes"].concat(this.projectName?["--name",this.projectName]:[]),v=0,y=a;v<y.length;v++)p.push("--env",y[v]);if(i.execSync("vercel "+p.join(" "),{cwd:r,env:l({},this.env,{PATH:process.env.PATH}),stdio:"inherit"}),console.log("Deployment started on Vercel. You can wait for it to finish or exit this command."),!(a.length>0)){t.next=13;break}return t.next=11,this.syncEnv({scope:this.scope,dir:r,token:n});case 11:t.next=14;break;case 13:console.log("\nAdd your ENV vars to .env or your vercel dashboard.\n");case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),c.writeIndex=function(t){r.writeFileSync(n.join(t.dir,"index.mjs"),"\n import { handle } from 'hono/vercel'\n import { app } from './hono.mjs';\n export const GET = handle(app);\n export const POST = handle(app);\n ")},e}(t.MastraDeployer);
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@mastra/core"),e=require("child_process"),r=require("fs"),n=require("path");function o(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,e}var i=o(e);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,s,"next",t)}function s(t){c(i,n,o,a,s,"throw",t)}a(void 0)}))}}function u(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){return l=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l.apply(null,arguments)}function f(){f=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof g?e:g).prototype),a=new N(n||[]);return o(i,"_invoke",{value:S(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function w(){}function b(){}var j={};u(j,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(I([])));E&&E!==r&&n.call(E,a)&&(j=E);var O=b.prototype=g.prototype=Object.create(j);function L(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,c){var s=h(t[o],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=_(c,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(e,r,n);if("normal"===u.type){if(o=n.done?d:v,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=d,n.method="throw",n.arg=u.arg)}}}function _(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(O,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=u(b,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(k.prototype),u(k.prototype,c,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),u(O,s,"Generator"),u(O,a,(function(){return this})),u(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(F),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),F(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;F(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}exports.VercelDeployer=function(t){function e(e){return t.call(this,{scope:e.scope,env:e.env,projectName:e.projectName})||this}var o,a;a=t,(o=e).prototype=Object.create(a.prototype),o.prototype.constructor=o,h(o,a);var c=e.prototype;return c.writeFiles=function(t){var e=t.dir;this.writeIndex({dir:e}),r.writeFileSync(n.join(e,"vercel.json"),JSON.stringify({version:2,installCommand:"npm install --omit=dev",builds:[{src:"index.mjs",use:"@vercel/node",config:{includeFiles:["**"]}}],routes:[{src:"/(.*)",dest:"index.mjs"}]},null,2))},c.getProjectId=function(t){var e=n.join(t.dir,".vercel","project.json");try{return JSON.parse(r.readFileSync(e,"utf-8")).projectId}catch(t){throw new Error("Could not find project ID. Make sure the project has been deployed first.")}},c.syncEnv=function(){var t=s(f().mark((function t(e){var r,n,o,i,a,c,s,l,h,p,v;return f().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=e.scope,n=e.dir,o=e.token,i=this.getEnvFiles(),a=[],c=u(i);!(s=c()).done;)l=this.parseEnvFile(s.value),a.push.apply(a,l);return console.log("Syncing environment variables..."),h=a.map((function(t){var e=t.split("="),r=e[0],n=e[1];if(!r||!n)throw new Error("Invalid environment variable format: "+t);return{key:r,value:n,target:["production","preview","development"],type:"plain"}})),t.prev=6,p=this.getProjectId({dir:n}),t.next=10,fetch("https://api.vercel.com/v10/projects/"+p+"/env?teamId="+r+"&upsert=true",{method:"POST",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},body:JSON.stringify(h)});case 10:if((v=t.sent).ok){t.next=16;break}return t.next=14,v.json();case 14:throw new Error("Failed to sync environment variables: "+t.sent.message);case 16:console.log("✓ Successfully synced environment variables"),t.next=23;break;case 19:throw t.prev=19,t.t0=t.catch(6),t.t0 instanceof Error?console.error("Failed to sync environment variables:",t.t0.message):console.error("Failed to sync environment variables:",t.t0),t.t0;case 23:case"end":return t.stop()}}),t,this,[[6,19]])})));return function(e){return t.apply(this,arguments)}}(),c.deploy=function(){var t=s(f().mark((function t(e){var r,n,o,a,c,s,h,p,v,y;return f().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=e.dir,n=e.token,o=this.getEnvFiles(),a=[],c=u(o);!(s=c()).done;)h=this.parseEnvFile(s.value),a.push.apply(a,h);for(p=["--debug","--scope",this.scope,"--cwd",r,"deploy","--token",n,"--yes"].concat(this.projectName?["--name",this.projectName]:[]),v=0,y=a;v<y.length;v++)p.push("--env",y[v]);if(console.log("vercel "+p.join(" ")),i.execSync("vercel "+p.join(" "),{cwd:r,env:l({},this.env,{PATH:process.env.PATH}),stdio:"inherit"}),console.log("Deployment started on Vercel. You can wait for it to finish or exit this command."),!(a.length>0)){t.next=14;break}return t.next=12,this.syncEnv({scope:this.scope,dir:r,token:n});case 12:t.next=15;break;case 14:console.log("\nAdd your ENV vars to .env or your vercel dashboard.\n");case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),c.writeIndex=function(t){r.writeFileSync(n.join(t.dir,"index.mjs"),"\n import { handle } from 'hono/vercel'\n import { app } from './hono.mjs';\n export const GET = handle(app);\n export const POST = handle(app);\n ")},e}(t.MastraDeployer);
|
|
2
2
|
//# sourceMappingURL=deployer-vercel.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployer-vercel.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport * as child_process from 'child_process';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface EnvVar {\n key: string;\n value: string;\n target: ('production' | 'preview' | 'development')[];\n type: 'plain' | 'secret';\n}\n\ninterface VercelError {\n message: string;\n code: string;\n}\n\nexport class VercelDeployer extends MastraDeployer {\n constructor({ scope, env, projectName }: { env?: Record<string, any>; scope: string; projectName: string }) {\n super({ scope, env, projectName });\n }\n writeFiles({ dir }: { dir: string }): void {\n this.writeIndex({ dir });\n\n writeFileSync(\n join(dir, 'vercel.json'),\n JSON.stringify(\n {\n version: 2,\n installCommand: 'npm install --omit=dev',\n builds: [\n {\n src: 'index.mjs',\n use: '@vercel/node',\n config: { includeFiles: ['**'] },\n },\n ],\n routes: [\n {\n src: '/(.*)',\n dest: 'index.mjs',\n },\n ],\n },\n null,\n 2,\n ),\n );\n }\n\n private getProjectId({ dir }: { dir: string }): string {\n const projectJsonPath = join(dir, '.vercel', 'project.json');\n try {\n const projectJson = JSON.parse(readFileSync(projectJsonPath, 'utf-8'));\n return projectJson.projectId;\n } catch (error) {\n throw new Error('Could not find project ID. Make sure the project has been deployed first.');\n }\n }\n\n async syncEnv({ scope, dir, token }: { token: string; dir: string; scope: string }) {\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n console.log('Syncing environment variables...');\n\n // Transform env vars into the format expected by Vercel API\n const vercelEnvVars: EnvVar[] = envVars.map(envVar => {\n const [key, value] = envVar.split('=');\n if (!key || !value) {\n throw new Error(`Invalid environment variable format: ${envVar}`);\n }\n return {\n key,\n value,\n target: ['production', 'preview', 'development'],\n type: 'plain',\n };\n });\n\n try {\n const projectId = this.getProjectId({ dir });\n\n const response = await fetch(`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${scope}&upsert=true`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(vercelEnvVars),\n });\n\n if (!response.ok) {\n const error = (await response.json()) as VercelError;\n throw new Error(`Failed to sync environment variables: ${error.message}`);\n }\n\n console.log('✓ Successfully synced environment variables');\n } catch (error) {\n if (error instanceof Error) {\n console.error('Failed to sync environment variables:', error.message);\n } else {\n console.error('Failed to sync environment variables:', error);\n }\n throw error;\n }\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n // Get env vars for initial deployment\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n // Create the command array with base arguments\n const commandArgs = [\n '--scope',\n this.scope as string,\n '--cwd',\n dir,\n 'deploy',\n '--token',\n token,\n '--yes',\n ...(this.projectName ? ['--name', this.projectName] : []),\n ];\n\n // Add env vars to initial deployment\n for (const envVar of envVars) {\n commandArgs.push('--env', envVar);\n }\n\n // Run the Vercel deploy command\n child_process.execSync(`vercel ${commandArgs.join(' ')}`, {\n cwd: dir,\n env: {\n ...this.env,\n PATH: process.env.PATH,\n },\n stdio: 'inherit',\n });\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n\n if (envVars.length > 0) {\n // Sync environment variables for future deployments\n await this.syncEnv({ scope: this.scope, dir, token });\n } else {\n console.log('\\nAdd your ENV vars to .env or your vercel dashboard.\\n');\n }\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, 'index.mjs'),\n `\n import { handle } from 'hono/vercel'\n import { app } from './hono.mjs';\n export const GET = handle(app);\n export const POST = handle(app);\n `,\n );\n }\n}\n"],"names":["_MastraDeployer","VercelDeployer","_ref","call","this","scope","env","projectName","_proto","prototype","writeFiles","_ref2","dir","writeIndex","writeFileSync","join","JSON","stringify","version","installCommand","builds","src","use","config","includeFiles","routes","dest","getProjectId","_ref3","projectJsonPath","parse","readFileSync","projectId","error","Error","syncEnv","_syncEnv","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","envFiles","envVars","_iterator","_step","vars","vercelEnvVars","response","wrap","_context","prev","next","getEnvFiles","_createForOfIteratorHelperLoose","done","parseEnvFile","value","push","apply","console","log","map","envVar","_envVar$split","split","key","target","type","fetch","method","headers","Authorization","body","sent","ok","json","message","t0","stop","_x","arguments","deploy","_deploy","_callee2","_ref5","_iterator2","_step2","commandArgs","_i","_envVars","_context2","concat","length","child_process","execSync","cwd","_extends","PATH","process","stdio","_x2","_ref6","MastraDeployer"],"mappings":"mtQAiB4BA,GAC1B,SAAAC,EAAAC,GAAqC,OACnCF,EAAAG,KAAMC,KAAA,CAAEC,MADSH,EAALG,MACGC,IADOJ,EAAHI,IACCC,YADeL,EAAXK,eACUH,IACpC,WAACJ,KAAAC,yEAAA,IAAAO,EAAAP,EAAAQ,
|
|
1
|
+
{"version":3,"file":"deployer-vercel.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport * as child_process from 'child_process';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface EnvVar {\n key: string;\n value: string;\n target: ('production' | 'preview' | 'development')[];\n type: 'plain' | 'secret';\n}\n\ninterface VercelError {\n message: string;\n code: string;\n}\n\nexport class VercelDeployer extends MastraDeployer {\n constructor({ scope, env, projectName }: { env?: Record<string, any>; scope: string; projectName: string }) {\n super({ scope, env, projectName });\n }\n writeFiles({ dir }: { dir: string }): void {\n this.writeIndex({ dir });\n\n writeFileSync(\n join(dir, 'vercel.json'),\n JSON.stringify(\n {\n version: 2,\n installCommand: 'npm install --omit=dev',\n builds: [\n {\n src: 'index.mjs',\n use: '@vercel/node',\n config: { includeFiles: ['**'] },\n },\n ],\n routes: [\n {\n src: '/(.*)',\n dest: 'index.mjs',\n },\n ],\n },\n null,\n 2,\n ),\n );\n }\n\n private getProjectId({ dir }: { dir: string }): string {\n const projectJsonPath = join(dir, '.vercel', 'project.json');\n try {\n const projectJson = JSON.parse(readFileSync(projectJsonPath, 'utf-8'));\n return projectJson.projectId;\n } catch (error) {\n throw new Error('Could not find project ID. Make sure the project has been deployed first.');\n }\n }\n\n async syncEnv({ scope, dir, token }: { token: string; dir: string; scope: string }) {\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n console.log('Syncing environment variables...');\n\n // Transform env vars into the format expected by Vercel API\n const vercelEnvVars: EnvVar[] = envVars.map(envVar => {\n const [key, value] = envVar.split('=');\n if (!key || !value) {\n throw new Error(`Invalid environment variable format: ${envVar}`);\n }\n return {\n key,\n value,\n target: ['production', 'preview', 'development'],\n type: 'plain',\n };\n });\n\n try {\n const projectId = this.getProjectId({ dir });\n\n const response = await fetch(`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${scope}&upsert=true`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(vercelEnvVars),\n });\n\n if (!response.ok) {\n const error = (await response.json()) as VercelError;\n throw new Error(`Failed to sync environment variables: ${error.message}`);\n }\n\n console.log('✓ Successfully synced environment variables');\n } catch (error) {\n if (error instanceof Error) {\n console.error('Failed to sync environment variables:', error.message);\n } else {\n console.error('Failed to sync environment variables:', error);\n }\n throw error;\n }\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n // Get env vars for initial deployment\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n // Create the command array with base arguments\n const commandArgs = [\n '--debug',\n '--scope',\n this.scope as string,\n '--cwd',\n dir,\n 'deploy',\n '--token',\n token,\n '--yes',\n ...(this.projectName ? ['--name', this.projectName] : []),\n ];\n\n // Add env vars to initial deployment\n for (const envVar of envVars) {\n commandArgs.push('--env', envVar);\n }\n\n // Run the Vercel deploy command\n // console.log('Running command:', 'vercel', commandArgs.join(' '));\n console.log(`vercel ${commandArgs.join(' ')}`);\n\n child_process.execSync(`vercel ${commandArgs.join(' ')}`, {\n cwd: dir,\n env: {\n ...this.env,\n PATH: process.env.PATH,\n },\n stdio: 'inherit',\n });\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n\n if (envVars.length > 0) {\n // Sync environment variables for future deployments\n await this.syncEnv({ scope: this.scope, dir, token });\n } else {\n console.log('\\nAdd your ENV vars to .env or your vercel dashboard.\\n');\n }\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, 'index.mjs'),\n `\n import { handle } from 'hono/vercel'\n import { app } from './hono.mjs';\n export const GET = handle(app);\n export const POST = handle(app);\n `,\n );\n }\n}\n"],"names":["_MastraDeployer","VercelDeployer","_ref","call","this","scope","env","projectName","_proto","prototype","writeFiles","_ref2","dir","writeIndex","writeFileSync","join","JSON","stringify","version","installCommand","builds","src","use","config","includeFiles","routes","dest","getProjectId","_ref3","projectJsonPath","parse","readFileSync","projectId","error","Error","syncEnv","_syncEnv","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","envFiles","envVars","_iterator","_step","vars","vercelEnvVars","response","wrap","_context","prev","next","getEnvFiles","_createForOfIteratorHelperLoose","done","parseEnvFile","value","push","apply","console","log","map","envVar","_envVar$split","split","key","target","type","fetch","method","headers","Authorization","body","sent","ok","json","message","t0","stop","_x","arguments","deploy","_deploy","_callee2","_ref5","_iterator2","_step2","commandArgs","_i","_envVars","_context2","concat","length","child_process","execSync","cwd","_extends","PATH","process","stdio","_x2","_ref6","MastraDeployer"],"mappings":"mtQAiB4BA,GAC1B,SAAAC,EAAAC,GAAqC,OACnCF,EAAAG,KAAMC,KAAA,CAAEC,MADSH,EAALG,MACGC,IADOJ,EAAHI,IACCC,YADeL,EAAXK,eACUH,IACpC,WAACJ,KAAAC,yEAAA,IAAAO,EAAAP,EAAAQ,UA2JA,OA3JAD,EACDE,WAAA,SAAUC,GAAyB,IAAtBC,EAAGD,EAAHC,IACXR,KAAKS,WAAW,CAAED,IAAAA,IAElBE,EAAaA,cACXC,EAAIA,KAACH,EAAK,eACVI,KAAKC,UACH,CACEC,QAAS,EACTC,eAAgB,yBAChBC,OAAQ,CACN,CACEC,IAAK,YACLC,IAAK,eACLC,OAAQ,CAAEC,aAA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A,SACA,UACA8B,EACA,SAAOmD,OACHzF,KAAKG,YAAc,CAAC,SAAUH,KAAKG,aAAe,IAIxDmF,EAAA,EAAAC,EAAqB/C,EAAO8C,EAAAC,EAAAG,OAAAJ,IAC1BD,EAAY9B,KAAK,QADFgC,EAAAD,IAiBgF,GAXjG7B,QAAQC,IAAc2B,UAAAA,EAAY1E,KAAK,MAEvCgF,EAAcC,SAAmBP,UAAAA,EAAY1E,KAAK,KAAQ,CACxDkF,IAAKrF,EACLN,IAAG4F,EACE,GAAA9F,KAAKE,IAAG,CACX6F,KAAMC,QAAQ9F,IAAI6F,OAEpBE,MAAO,YAGTxC,QAAQC,IAAI,uFAERlB,EAAQkD,OAAS,GAAC,CAAAF,EAAAvC,KAAA,GAAA,KAAA,CAAA,OAAAuC,EAAAvC,KAAA,GAEdjD,KAAK+B,QAAQ,CAAE9B,MAAOD,KAAKC,MAAOO,IAAAA,EAAK8B,MAAAA,IAAQ,KAAA,GAAAkD,EAAAvC,KAAA,GAAA,MAAA,KAAA,GAErDQ,QAAQC,IAAI,2DAA2D,KAAA,GAAA,IAAA,MAAA,OAAA8B,EAAAZ,OAAA,GAAAK,EAAAjF,KAE1E,KAlDW,OAkDX,SAlDWkG,GAAA,OAAAlB,EAAAxB,MAAAxD,KAAA8E,UAAA,CAAA,CAAA,GAAA1E,EAoDZK,WAAA,SAAU0F,GACRzF,EAAAA,cACEC,EAAAA,KAFYwF,EAAH3F,IAEC,4OAQbX,CAAA,EA9JiCuG,EAAcA"}
|
|
@@ -514,12 +514,14 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
514
514
|
envVars.push.apply(envVars, vars);
|
|
515
515
|
}
|
|
516
516
|
// Create the command array with base arguments
|
|
517
|
-
commandArgs = ['--scope', this.scope, '--cwd', dir, 'deploy', '--token', token, '--yes'].concat(this.projectName ? ['--name', this.projectName] : []); // Add env vars to initial deployment
|
|
517
|
+
commandArgs = ['--debug', '--scope', this.scope, '--cwd', dir, 'deploy', '--token', token, '--yes'].concat(this.projectName ? ['--name', this.projectName] : []); // Add env vars to initial deployment
|
|
518
518
|
for (_i = 0, _envVars = envVars; _i < _envVars.length; _i++) {
|
|
519
519
|
envVar = _envVars[_i];
|
|
520
520
|
commandArgs.push('--env', envVar);
|
|
521
521
|
}
|
|
522
522
|
// Run the Vercel deploy command
|
|
523
|
+
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
524
|
+
console.log("vercel " + commandArgs.join(' '));
|
|
523
525
|
child_process.execSync("vercel " + commandArgs.join(' '), {
|
|
524
526
|
cwd: dir,
|
|
525
527
|
env: _extends({}, this.env, {
|
|
@@ -529,21 +531,21 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
529
531
|
});
|
|
530
532
|
console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
|
|
531
533
|
if (!(envVars.length > 0)) {
|
|
532
|
-
_context2.next =
|
|
534
|
+
_context2.next = 14;
|
|
533
535
|
break;
|
|
534
536
|
}
|
|
535
|
-
_context2.next =
|
|
537
|
+
_context2.next = 12;
|
|
536
538
|
return this.syncEnv({
|
|
537
539
|
scope: this.scope,
|
|
538
540
|
dir: dir,
|
|
539
541
|
token: token
|
|
540
542
|
});
|
|
541
|
-
case
|
|
542
|
-
_context2.next =
|
|
543
|
+
case 12:
|
|
544
|
+
_context2.next = 15;
|
|
543
545
|
break;
|
|
544
|
-
case 13:
|
|
545
|
-
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
546
546
|
case 14:
|
|
547
|
+
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
548
|
+
case 15:
|
|
547
549
|
case "end":
|
|
548
550
|
return _context2.stop();
|
|
549
551
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployer-vercel.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport * as child_process from 'child_process';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface EnvVar {\n key: string;\n value: string;\n target: ('production' | 'preview' | 'development')[];\n type: 'plain' | 'secret';\n}\n\ninterface VercelError {\n message: string;\n code: string;\n}\n\nexport class VercelDeployer extends MastraDeployer {\n constructor({ scope, env, projectName }: { env?: Record<string, any>; scope: string; projectName: string }) {\n super({ scope, env, projectName });\n }\n writeFiles({ dir }: { dir: string }): void {\n this.writeIndex({ dir });\n\n writeFileSync(\n join(dir, 'vercel.json'),\n JSON.stringify(\n {\n version: 2,\n installCommand: 'npm install --omit=dev',\n builds: [\n {\n src: 'index.mjs',\n use: '@vercel/node',\n config: { includeFiles: ['**'] },\n },\n ],\n routes: [\n {\n src: '/(.*)',\n dest: 'index.mjs',\n },\n ],\n },\n null,\n 2,\n ),\n );\n }\n\n private getProjectId({ dir }: { dir: string }): string {\n const projectJsonPath = join(dir, '.vercel', 'project.json');\n try {\n const projectJson = JSON.parse(readFileSync(projectJsonPath, 'utf-8'));\n return projectJson.projectId;\n } catch (error) {\n throw new Error('Could not find project ID. Make sure the project has been deployed first.');\n }\n }\n\n async syncEnv({ scope, dir, token }: { token: string; dir: string; scope: string }) {\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n console.log('Syncing environment variables...');\n\n // Transform env vars into the format expected by Vercel API\n const vercelEnvVars: EnvVar[] = envVars.map(envVar => {\n const [key, value] = envVar.split('=');\n if (!key || !value) {\n throw new Error(`Invalid environment variable format: ${envVar}`);\n }\n return {\n key,\n value,\n target: ['production', 'preview', 'development'],\n type: 'plain',\n };\n });\n\n try {\n const projectId = this.getProjectId({ dir });\n\n const response = await fetch(`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${scope}&upsert=true`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(vercelEnvVars),\n });\n\n if (!response.ok) {\n const error = (await response.json()) as VercelError;\n throw new Error(`Failed to sync environment variables: ${error.message}`);\n }\n\n console.log('✓ Successfully synced environment variables');\n } catch (error) {\n if (error instanceof Error) {\n console.error('Failed to sync environment variables:', error.message);\n } else {\n console.error('Failed to sync environment variables:', error);\n }\n throw error;\n }\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n // Get env vars for initial deployment\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n // Create the command array with base arguments\n const commandArgs = [\n '--scope',\n this.scope as string,\n '--cwd',\n dir,\n 'deploy',\n '--token',\n token,\n '--yes',\n ...(this.projectName ? ['--name', this.projectName] : []),\n ];\n\n // Add env vars to initial deployment\n for (const envVar of envVars) {\n commandArgs.push('--env', envVar);\n }\n\n // Run the Vercel deploy command\n child_process.execSync(`vercel ${commandArgs.join(' ')}`, {\n cwd: dir,\n env: {\n ...this.env,\n PATH: process.env.PATH,\n },\n stdio: 'inherit',\n });\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n\n if (envVars.length > 0) {\n // Sync environment variables for future deployments\n await this.syncEnv({ scope: this.scope, dir, token });\n } else {\n console.log('\\nAdd your ENV vars to .env or your vercel dashboard.\\n');\n }\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, 'index.mjs'),\n `\n import { handle } from 'hono/vercel'\n import { app } from './hono.mjs';\n export const GET = handle(app);\n export const POST = handle(app);\n `,\n );\n }\n}\n"],"names":["VercelDeployer","_MastraDeployer","_ref","scope","env","projectName","call","_inheritsLoose","_proto","prototype","writeFiles","_ref2","dir","writeIndex","writeFileSync","join","JSON","stringify","version","installCommand","builds","src","use","config","includeFiles","routes","dest","getProjectId","_ref3","projectJsonPath","projectJson","parse","readFileSync","projectId","error","Error","syncEnv","_syncEnv","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","envFiles","envVars","_iterator","_step","file","vars","vercelEnvVars","response","wrap","_callee$","_context","prev","next","getEnvFiles","_createForOfIteratorHelperLoose","done","value","parseEnvFile","push","apply","console","log","map","envVar","_envVar$split","split","key","target","type","fetch","method","headers","Authorization","body","sent","ok","json","message","t0","stop","_x","arguments","deploy","_deploy","_callee2","_ref5","_iterator2","_step2","commandArgs","_i","_envVars","_callee2$","_context2","concat","length","child_process","execSync","cwd","_extends","PATH","process","stdio","_x2","_ref6","MastraDeployer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBaA,IAAAA,cAAe,0BAAAC,eAAA,EAAA;EAC1B,SAAAD,cAAAA,CAAAE,IAAA,EAA0G;AAAA,IAAA,IAA5FC,KAAK,GAAAD,IAAA,CAALC,KAAK;MAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;MAAEC,WAAW,GAAAH,IAAA,CAAXG,WAAW,CAAA;IAAA,OACnCJ,eAAA,CAAAK,IAAA,CAAM,IAAA,EAAA;AAAEH,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,WAAW,EAAXA,WAAAA;AAAa,KAAA,CAAC,IAAA,IAAA,CAAA;AACpC,GAAA;EAACE,cAAA,CAAAP,cAAA,EAAAC,eAAA,CAAA,CAAA;AAAA,EAA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AAG;AAAE+B,cAAAA,KAAK,EAALA,KAAAA;AAAK,aAAE,CAAC,CAAA;AAAA,UAAA,KAAA,EAAA;AAAAqD,YAAAA,SAAA,CAAAxC,IAAA,GAAA,EAAA,CAAA;AAAA,YAAA,MAAA;AAAA,UAAA,KAAA,EAAA;AAErDQ,YAAAA,OAAO,CAACC,GAAG,CAAC,yDAAyD,CAAC,CAAA;AAAC,UAAA,KAAA,EAAA,CAAA;AAAA,UAAA,KAAA,KAAA;YAAA,OAAA+B,SAAA,CAAAb,IAAA,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA,EAAAK,QAAA,EAAA,IAAA,CAAA,CAAA;KAE1E,CAAA,CAAA,CAAA;IAAA,SA9CKF,MAAMA,CAAAoB,GAAA,EAAA;AAAA,MAAA,OAAAnB,OAAA,CAAAxB,KAAA,CAAA,IAAA,EAAAsB,SAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAAA,OAANC,MAAM,CAAA;AAAA,GAAA,EAAA,CAAA;AAAA9E,EAAAA,MAAA,CAgDZK,UAAU,GAAV,SAAAA,UAAUA,CAAA8F,KAAA,EAAyB;AAAA,IAAA,IAAtB/F,GAAG,GAAA+F,KAAA,CAAH/F,GAAG,CAAA;IACdE,aAAa,CACXC,IAAI,CAACH,GAAG,EAAE,WAAW,CAAC,8NAMf,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAZ,cAAA,CAAA;AAAA,CAAA,CA1JiC4G,cAAc;;;;"}
|
|
1
|
+
{"version":3,"file":"deployer-vercel.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport * as child_process from 'child_process';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface EnvVar {\n key: string;\n value: string;\n target: ('production' | 'preview' | 'development')[];\n type: 'plain' | 'secret';\n}\n\ninterface VercelError {\n message: string;\n code: string;\n}\n\nexport class VercelDeployer extends MastraDeployer {\n constructor({ scope, env, projectName }: { env?: Record<string, any>; scope: string; projectName: string }) {\n super({ scope, env, projectName });\n }\n writeFiles({ dir }: { dir: string }): void {\n this.writeIndex({ dir });\n\n writeFileSync(\n join(dir, 'vercel.json'),\n JSON.stringify(\n {\n version: 2,\n installCommand: 'npm install --omit=dev',\n builds: [\n {\n src: 'index.mjs',\n use: '@vercel/node',\n config: { includeFiles: ['**'] },\n },\n ],\n routes: [\n {\n src: '/(.*)',\n dest: 'index.mjs',\n },\n ],\n },\n null,\n 2,\n ),\n );\n }\n\n private getProjectId({ dir }: { dir: string }): string {\n const projectJsonPath = join(dir, '.vercel', 'project.json');\n try {\n const projectJson = JSON.parse(readFileSync(projectJsonPath, 'utf-8'));\n return projectJson.projectId;\n } catch (error) {\n throw new Error('Could not find project ID. Make sure the project has been deployed first.');\n }\n }\n\n async syncEnv({ scope, dir, token }: { token: string; dir: string; scope: string }) {\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n console.log('Syncing environment variables...');\n\n // Transform env vars into the format expected by Vercel API\n const vercelEnvVars: EnvVar[] = envVars.map(envVar => {\n const [key, value] = envVar.split('=');\n if (!key || !value) {\n throw new Error(`Invalid environment variable format: ${envVar}`);\n }\n return {\n key,\n value,\n target: ['production', 'preview', 'development'],\n type: 'plain',\n };\n });\n\n try {\n const projectId = this.getProjectId({ dir });\n\n const response = await fetch(`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${scope}&upsert=true`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(vercelEnvVars),\n });\n\n if (!response.ok) {\n const error = (await response.json()) as VercelError;\n throw new Error(`Failed to sync environment variables: ${error.message}`);\n }\n\n console.log('✓ Successfully synced environment variables');\n } catch (error) {\n if (error instanceof Error) {\n console.error('Failed to sync environment variables:', error.message);\n } else {\n console.error('Failed to sync environment variables:', error);\n }\n throw error;\n }\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n // Get env vars for initial deployment\n const envFiles = this.getEnvFiles();\n const envVars: string[] = [];\n\n for (const file of envFiles) {\n const vars = this.parseEnvFile(file);\n envVars.push(...vars);\n }\n\n // Create the command array with base arguments\n const commandArgs = [\n '--debug',\n '--scope',\n this.scope as string,\n '--cwd',\n dir,\n 'deploy',\n '--token',\n token,\n '--yes',\n ...(this.projectName ? ['--name', this.projectName] : []),\n ];\n\n // Add env vars to initial deployment\n for (const envVar of envVars) {\n commandArgs.push('--env', envVar);\n }\n\n // Run the Vercel deploy command\n // console.log('Running command:', 'vercel', commandArgs.join(' '));\n console.log(`vercel ${commandArgs.join(' ')}`);\n\n child_process.execSync(`vercel ${commandArgs.join(' ')}`, {\n cwd: dir,\n env: {\n ...this.env,\n PATH: process.env.PATH,\n },\n stdio: 'inherit',\n });\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n\n if (envVars.length > 0) {\n // Sync environment variables for future deployments\n await this.syncEnv({ scope: this.scope, dir, token });\n } else {\n console.log('\\nAdd your ENV vars to .env or your vercel dashboard.\\n');\n }\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, 'index.mjs'),\n `\n import { handle } from 'hono/vercel'\n import { app } from './hono.mjs';\n export const GET = handle(app);\n export const POST = handle(app);\n `,\n );\n }\n}\n"],"names":["VercelDeployer","_MastraDeployer","_ref","scope","env","projectName","call","_inheritsLoose","_proto","prototype","writeFiles","_ref2","dir","writeIndex","writeFileSync","join","JSON","stringify","version","installCommand","builds","src","use","config","includeFiles","routes","dest","getProjectId","_ref3","projectJsonPath","projectJson","parse","readFileSync","projectId","error","Error","syncEnv","_syncEnv","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","envFiles","envVars","_iterator","_step","file","vars","vercelEnvVars","response","wrap","_callee$","_context","prev","next","getEnvFiles","_createForOfIteratorHelperLoose","done","value","parseEnvFile","push","apply","console","log","map","envVar","_envVar$split","split","key","target","type","fetch","method","headers","Authorization","body","sent","ok","json","message","t0","stop","_x","arguments","deploy","_deploy","_callee2","_ref5","_iterator2","_step2","commandArgs","_i","_envVars","_callee2$","_context2","concat","length","child_process","execSync","cwd","_extends","PATH","process","stdio","_x2","_ref6","MastraDeployer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBaA,IAAAA,cAAe,0BAAAC,eAAA,EAAA;EAC1B,SAAAD,cAAAA,CAAAE,IAAA,EAA0G;AAAA,IAAA,IAA5FC,KAAK,GAAAD,IAAA,CAALC,KAAK;MAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;MAAEC,WAAW,GAAAH,IAAA,CAAXG,WAAW,CAAA;IAAA,OACnCJ,eAAA,CAAAK,IAAA,CAAM,IAAA,EAAA;AAAEH,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,WAAW,EAAXA,WAAAA;AAAa,KAAA,CAAC,IAAA,IAAA,CAAA;AACpC,GAAA;EAACE,cAAA,CAAAP,cAAA,EAAAC,eAAA,CAAA,CAAA;AAAA,EAAA,IAAAO,MAAA,GAAAR,cAAA,CAAAS,SAAA,CAAA;AAAAD,EAAAA,MAAA,CACDE,UAAU,GAAV,SAAAA,UAAUA,CAAAC,K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AA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoD3E,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAW3C"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-vercel",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/deployer-vercel.esm.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
|
-
"
|
|
11
|
-
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/deployer-vercel.esm.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
12
19
|
},
|
|
13
20
|
"./package.json": "./package.json"
|
|
14
21
|
},
|
|
@@ -16,21 +23,23 @@
|
|
|
16
23
|
"author": "",
|
|
17
24
|
"license": "ISC",
|
|
18
25
|
"dependencies": {
|
|
19
|
-
"@mastra/core": "0.1.27-alpha.
|
|
20
|
-
"@mastra/deployer": "0.0.1-alpha.
|
|
26
|
+
"@mastra/core": "0.1.27-alpha.66",
|
|
27
|
+
"@mastra/deployer": "0.0.1-alpha.1"
|
|
21
28
|
},
|
|
22
29
|
"devDependencies": {
|
|
23
30
|
"@babel/preset-env": "^7.26.0",
|
|
24
31
|
"@babel/preset-typescript": "^7.26.0",
|
|
25
32
|
"@tsconfig/recommended": "^1.0.7",
|
|
33
|
+
"@types/jsdom": "^21.1.7",
|
|
26
34
|
"@types/node": "^22.9.0",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"vitest": "^
|
|
35
|
+
"@types/pg": "^8.11.10",
|
|
36
|
+
"dts-cli": "^2.0.5",
|
|
37
|
+
"vitest": "^2.1.8",
|
|
38
|
+
"vercel": "^39.3.0"
|
|
30
39
|
},
|
|
31
40
|
"scripts": {
|
|
32
|
-
"build": "
|
|
33
|
-
"dev": "
|
|
41
|
+
"build": "dts build",
|
|
42
|
+
"build:dev": "dts watch",
|
|
34
43
|
"test": "vitest run"
|
|
35
44
|
}
|
|
36
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -123,6 +123,7 @@ export class VercelDeployer extends MastraDeployer {
|
|
|
123
123
|
|
|
124
124
|
// Create the command array with base arguments
|
|
125
125
|
const commandArgs = [
|
|
126
|
+
'--debug',
|
|
126
127
|
'--scope',
|
|
127
128
|
this.scope as string,
|
|
128
129
|
'--cwd',
|
|
@@ -140,6 +141,9 @@ export class VercelDeployer extends MastraDeployer {
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
// Run the Vercel deploy command
|
|
144
|
+
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
145
|
+
console.log(`vercel ${commandArgs.join(' ')}`);
|
|
146
|
+
|
|
143
147
|
child_process.execSync(`vercel ${commandArgs.join(' ')}`, {
|
|
144
148
|
cwd: dir,
|
|
145
149
|
env: {
|
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig.
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"moduleResolution": "bundler",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"rootDir": "./src"
|
|
7
|
+
},
|
|
3
8
|
"include": ["src/**/*"],
|
|
4
9
|
"exclude": ["node_modules", "**/*.test.ts"]
|
|
5
10
|
}
|