@mastra/deployer-vercel 0.0.1-alpha.2 → 0.0.1-alpha.20
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 +132 -0
- package/dist/deployer-vercel.cjs.development.js +7 -8
- 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 +7 -8
- package/dist/deployer-vercel.esm.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/index.ts +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,137 @@
|
|
|
1
1
|
# @mastra/deployer-vercel
|
|
2
2
|
|
|
3
|
+
## 0.0.1-alpha.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e4d4ede]
|
|
8
|
+
- Updated dependencies [06b2c0a]
|
|
9
|
+
- @mastra/core@0.1.27-alpha.72
|
|
10
|
+
- @mastra/deployer@0.0.1-alpha.16
|
|
11
|
+
|
|
12
|
+
## 0.0.1-alpha.19
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [d9c8dd0]
|
|
17
|
+
- @mastra/deployer@0.0.1-alpha.15
|
|
18
|
+
- @mastra/core@0.1.27-alpha.71
|
|
19
|
+
|
|
20
|
+
## 0.0.1-alpha.18
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [ad2cd74]
|
|
25
|
+
- @mastra/deployer@0.0.1-alpha.14
|
|
26
|
+
|
|
27
|
+
## 0.0.1-alpha.17
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [a1774e7]
|
|
32
|
+
- @mastra/deployer@0.0.1-alpha.13
|
|
33
|
+
|
|
34
|
+
## 0.0.1-alpha.16
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [28dceab]
|
|
39
|
+
- @mastra/deployer@0.0.1-alpha.12
|
|
40
|
+
|
|
41
|
+
## 0.0.1-alpha.15
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- bdaf834: publish packages
|
|
46
|
+
- Updated dependencies [bdaf834]
|
|
47
|
+
- @mastra/deployer@0.0.1-alpha.11
|
|
48
|
+
|
|
49
|
+
## 0.0.1-alpha.14
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Updated dependencies [dd6d87f]
|
|
54
|
+
- Updated dependencies [04434b6]
|
|
55
|
+
- @mastra/core@0.1.27-alpha.70
|
|
56
|
+
- @mastra/deployer@0.0.1-alpha.10
|
|
57
|
+
|
|
58
|
+
## 0.0.1-alpha.13
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- Updated dependencies [9066f95]
|
|
63
|
+
- @mastra/deployer@0.0.1-alpha.9
|
|
64
|
+
|
|
65
|
+
## 0.0.1-alpha.12
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- 0d5a03d: Vector store modules
|
|
70
|
+
|
|
71
|
+
## 0.0.1-alpha.11
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [b425845]
|
|
76
|
+
- @mastra/deployer@0.0.1-alpha.8
|
|
77
|
+
|
|
78
|
+
## 0.0.1-alpha.10
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- Updated dependencies [1944807]
|
|
83
|
+
- Updated dependencies [9ade36e]
|
|
84
|
+
- @mastra/deployer@0.0.1-alpha.7
|
|
85
|
+
- @mastra/core@0.1.27-alpha.69
|
|
86
|
+
|
|
87
|
+
## 0.0.1-alpha.9
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- Updated dependencies [291fe57]
|
|
92
|
+
- Updated dependencies [1a41fbf]
|
|
93
|
+
- @mastra/deployer@0.0.1-alpha.6
|
|
94
|
+
|
|
95
|
+
## 0.0.1-alpha.8
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- Updated dependencies [0be7181]
|
|
100
|
+
- Updated dependencies [0be7181]
|
|
101
|
+
- @mastra/core@0.1.27-alpha.68
|
|
102
|
+
- @mastra/deployer@0.0.1-alpha.5
|
|
103
|
+
|
|
104
|
+
## 0.0.1-alpha.7
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- Updated dependencies [7babd5c]
|
|
109
|
+
- @mastra/deployer@0.0.1-alpha.4
|
|
110
|
+
|
|
111
|
+
## 0.0.1-alpha.6
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- Updated dependencies [c8ff2f5]
|
|
116
|
+
- Updated dependencies [a291824]
|
|
117
|
+
- @mastra/core@0.1.27-alpha.67
|
|
118
|
+
- @mastra/deployer@0.0.1-alpha.3
|
|
119
|
+
|
|
120
|
+
## 0.0.1-alpha.5
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- 88600bc: Deployer fixes
|
|
125
|
+
|
|
126
|
+
## 0.0.1-alpha.4
|
|
127
|
+
|
|
128
|
+
### Patch Changes
|
|
129
|
+
|
|
130
|
+
- a9b5ddf: Publish new versions
|
|
131
|
+
- Updated dependencies [a9b5ddf]
|
|
132
|
+
- Updated dependencies [72c280b]
|
|
133
|
+
- @mastra/deployer@0.0.1-alpha.2
|
|
134
|
+
|
|
3
135
|
## 0.0.1-alpha.0
|
|
4
136
|
|
|
5
137
|
### Patch Changes
|
|
@@ -419,6 +419,7 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
419
419
|
});
|
|
420
420
|
fs.writeFileSync(path.join(dir, 'vercel.json'), JSON.stringify({
|
|
421
421
|
version: 2,
|
|
422
|
+
installCommand: 'npm install --omit=dev',
|
|
422
423
|
builds: [{
|
|
423
424
|
src: 'index.mjs',
|
|
424
425
|
use: '@vercel/node',
|
|
@@ -542,8 +543,6 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
542
543
|
commandArgs.push('--env', envVar);
|
|
543
544
|
}
|
|
544
545
|
// Run the Vercel deploy command
|
|
545
|
-
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
546
|
-
console.log("vercel " + commandArgs.join(' '));
|
|
547
546
|
child_process__namespace.execSync("vercel " + commandArgs.join(' '), {
|
|
548
547
|
cwd: dir,
|
|
549
548
|
env: _extends({}, this.env, {
|
|
@@ -553,21 +552,21 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
553
552
|
});
|
|
554
553
|
console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
|
|
555
554
|
if (!(envVars.length > 0)) {
|
|
556
|
-
_context2.next =
|
|
555
|
+
_context2.next = 13;
|
|
557
556
|
break;
|
|
558
557
|
}
|
|
559
|
-
_context2.next =
|
|
558
|
+
_context2.next = 11;
|
|
560
559
|
return this.syncEnv({
|
|
561
560
|
scope: this.scope,
|
|
562
561
|
dir: dir,
|
|
563
562
|
token: token
|
|
564
563
|
});
|
|
565
|
-
case
|
|
566
|
-
_context2.next =
|
|
564
|
+
case 11:
|
|
565
|
+
_context2.next = 14;
|
|
567
566
|
break;
|
|
568
|
-
case
|
|
567
|
+
case 13:
|
|
569
568
|
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
570
|
-
case
|
|
569
|
+
case 14:
|
|
571
570
|
case "end":
|
|
572
571
|
return _context2.stop();
|
|
573
572
|
}
|
|
@@ -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 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 // 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","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,GA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C,IAAA,GAAA,EAAA,CAAA;AAAA,cAAA,MAAA;AAAA,aAAA;AAAAwC,YAAAA,SAAA,CAAAxC,IAAA,GAAA,EAAA,CAAA;YAAA,OAEd,IAAI,CAACpB,OAAO,CAAC;cAAEhC,KAAK,EAAE,IAAI,CAACA,KAAK;AAAES,cAAAA,GAAG,EAAHA,GAAG;AAAE8B,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,SAjDKF,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;AAAA7E,EAAAA,MAAA,CAmDZK,UAAU,GAAV,SAAAA,UAAUA,CAAA6F,KAAA,EAAyB;AAAA,IAAA,IAAtB9F,GAAG,GAAA8F,KAAA,CAAH9F,GAAG,CAAA;IACdE,gBAAa,CACXC,SAAI,CAACH,GAAG,EAAE,WAAW,CAAC,8NAMf,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAZ,cAAA,CAAA;AAAA,CAAA,CA5JiC2G,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 '--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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AEjC,KAAK,EAAE,IAAI,CAACA,KAAK;AAAES,cAAAA,GAAG,EAAHA,GAAG;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,gBAAa,CACXC,SAAI,CAACH,GAAG,EAAE,WAAW,CAAC,8NAMf,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAZ,cAAA,CAAA;AAAA,CAAA,CA1JiC4G,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,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(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);
|
|
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);
|
|
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 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
|
|
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,UAuJA,OAvJAD,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,aAAc,CAAC,SAG7BC,OAAQ,CACN,CACEJ,IAAK,QACLK,KAAM,eAIZ,KACA,KAGLlB,EAEOmB,aAAA,SAAYC,GAAyB,IACrCC,EAAkBd,EAAIA,KADJa,EAAHhB,IACa,UAAW,gBAC7C,IAEE,OADoBI,KAAKc,MAAMC,EAAYA,aAACF,EAAiB,UAC1CG,SACpB,CAAC,MAAOC,GACP,MAAM,IAAIC,MAAM,4EAClB,GACD1B,EAEK2B,QAAO,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,MAAb,SAAAC,EAAAC,GAAA,IAAApC,EAAAO,EAAA8B,EAAAC,E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AS,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,KA9CW,OA8CX,SA9CWkG,GAAA,OAAAlB,EAAAxB,MAAAxD,KAAA8E,UAAA,CAAA,CAAA,GAAA1E,EAgDZK,WAAA,SAAU0F,GACRzF,EAAAA,cACEC,EAAAA,KAFYwF,EAAH3F,IAEC,4OAQbX,CAAA,EA1JiCuG,EAAcA"}
|
|
@@ -396,6 +396,7 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
396
396
|
});
|
|
397
397
|
writeFileSync(join(dir, 'vercel.json'), JSON.stringify({
|
|
398
398
|
version: 2,
|
|
399
|
+
installCommand: 'npm install --omit=dev',
|
|
399
400
|
builds: [{
|
|
400
401
|
src: 'index.mjs',
|
|
401
402
|
use: '@vercel/node',
|
|
@@ -519,8 +520,6 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
519
520
|
commandArgs.push('--env', envVar);
|
|
520
521
|
}
|
|
521
522
|
// Run the Vercel deploy command
|
|
522
|
-
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
523
|
-
console.log("vercel " + commandArgs.join(' '));
|
|
524
523
|
child_process.execSync("vercel " + commandArgs.join(' '), {
|
|
525
524
|
cwd: dir,
|
|
526
525
|
env: _extends({}, this.env, {
|
|
@@ -530,21 +529,21 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
530
529
|
});
|
|
531
530
|
console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
|
|
532
531
|
if (!(envVars.length > 0)) {
|
|
533
|
-
_context2.next =
|
|
532
|
+
_context2.next = 13;
|
|
534
533
|
break;
|
|
535
534
|
}
|
|
536
|
-
_context2.next =
|
|
535
|
+
_context2.next = 11;
|
|
537
536
|
return this.syncEnv({
|
|
538
537
|
scope: this.scope,
|
|
539
538
|
dir: dir,
|
|
540
539
|
token: token
|
|
541
540
|
});
|
|
542
|
-
case
|
|
543
|
-
_context2.next =
|
|
541
|
+
case 11:
|
|
542
|
+
_context2.next = 14;
|
|
544
543
|
break;
|
|
545
|
-
case
|
|
544
|
+
case 13:
|
|
546
545
|
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
547
|
-
case
|
|
546
|
+
case 14:
|
|
548
547
|
case "end":
|
|
549
548
|
return _context2.stop();
|
|
550
549
|
}
|
|
@@ -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 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 // 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","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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OAAA,CAAAxB,KAAA,CAAA,IAAA,EAAAsB,SAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAAA,OAANC,MAAM,CAAA;AAAA,GAAA,EAAA,CAAA;AAAA7E,EAAAA,MAAA,CAmDZK,UAAU,GAAV,SAAAA,UAAUA,CAAA6F,KAAA,EAAyB;AAAA,IAAA,IAAtB9F,GAAG,GAAA8F,KAAA,CAAH9F,GAAG,CAAA;IACdE,aAAa,CACXC,IAAI,CAACH,GAAG,EAAE,WAAW,CAAC,8NAMf,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAZ,cAAA,CAAA;AAAA,CAAA,CA5JiC2G,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 '--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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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8F,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;;;;"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAiB9C,qBAAa,cAAe,SAAQ,cAAc;gBACpC,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE;IAG1G,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAiB9C,qBAAa,cAAe,SAAQ,cAAc;gBACpC,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE;IAG1G,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IA6B1C,OAAO,CAAC,YAAY;IAUd,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAqD5E,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAgD3E,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAW3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-vercel",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"author": "",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@mastra/core": "0.1.27-alpha.
|
|
27
|
-
"@mastra/deployer": "0.0.1-alpha.
|
|
26
|
+
"@mastra/core": "0.1.27-alpha.72",
|
|
27
|
+
"@mastra/deployer": "0.0.1-alpha.16"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/preset-env": "^7.26.0",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"@tsconfig/recommended": "^1.0.7",
|
|
33
33
|
"@types/jsdom": "^21.1.7",
|
|
34
34
|
"@types/node": "^22.9.0",
|
|
35
|
-
"@types/pg": "^8.11.10",
|
|
36
35
|
"dts-cli": "^2.0.5",
|
|
37
36
|
"vitest": "^2.1.8",
|
|
38
37
|
"vercel": "^39.3.0"
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export class VercelDeployer extends MastraDeployer {
|
|
|
27
27
|
JSON.stringify(
|
|
28
28
|
{
|
|
29
29
|
version: 2,
|
|
30
|
+
installCommand: 'npm install --omit=dev',
|
|
30
31
|
builds: [
|
|
31
32
|
{
|
|
32
33
|
src: 'index.mjs',
|
|
@@ -139,9 +140,6 @@ export class VercelDeployer extends MastraDeployer {
|
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
// Run the Vercel deploy command
|
|
142
|
-
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
143
|
-
console.log(`vercel ${commandArgs.join(' ')}`)
|
|
144
|
-
|
|
145
143
|
child_process.execSync(`vercel ${commandArgs.join(' ')}`, {
|
|
146
144
|
cwd: dir,
|
|
147
145
|
env: {
|