@mastra/deployer-vercel 0.0.1-alpha.18 → 0.0.1-alpha.2
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 -115
- package/dist/deployer-vercel.cjs.development.js +8 -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 +8 -7
- package/dist/deployer-vercel.esm.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,120 +1,5 @@
|
|
|
1
1
|
# @mastra/deployer-vercel
|
|
2
2
|
|
|
3
|
-
## 0.0.1-alpha.18
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [ad2cd74]
|
|
8
|
-
- @mastra/deployer@0.0.1-alpha.14
|
|
9
|
-
|
|
10
|
-
## 0.0.1-alpha.17
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- Updated dependencies [a1774e7]
|
|
15
|
-
- @mastra/deployer@0.0.1-alpha.13
|
|
16
|
-
|
|
17
|
-
## 0.0.1-alpha.16
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- Updated dependencies [28dceab]
|
|
22
|
-
- @mastra/deployer@0.0.1-alpha.12
|
|
23
|
-
|
|
24
|
-
## 0.0.1-alpha.15
|
|
25
|
-
|
|
26
|
-
### Patch Changes
|
|
27
|
-
|
|
28
|
-
- bdaf834: publish packages
|
|
29
|
-
- Updated dependencies [bdaf834]
|
|
30
|
-
- @mastra/deployer@0.0.1-alpha.11
|
|
31
|
-
|
|
32
|
-
## 0.0.1-alpha.14
|
|
33
|
-
|
|
34
|
-
### Patch Changes
|
|
35
|
-
|
|
36
|
-
- Updated dependencies [dd6d87f]
|
|
37
|
-
- Updated dependencies [04434b6]
|
|
38
|
-
- @mastra/core@0.1.27-alpha.70
|
|
39
|
-
- @mastra/deployer@0.0.1-alpha.10
|
|
40
|
-
|
|
41
|
-
## 0.0.1-alpha.13
|
|
42
|
-
|
|
43
|
-
### Patch Changes
|
|
44
|
-
|
|
45
|
-
- Updated dependencies [9066f95]
|
|
46
|
-
- @mastra/deployer@0.0.1-alpha.9
|
|
47
|
-
|
|
48
|
-
## 0.0.1-alpha.12
|
|
49
|
-
|
|
50
|
-
### Patch Changes
|
|
51
|
-
|
|
52
|
-
- 0d5a03d: Vector store modules
|
|
53
|
-
|
|
54
|
-
## 0.0.1-alpha.11
|
|
55
|
-
|
|
56
|
-
### Patch Changes
|
|
57
|
-
|
|
58
|
-
- Updated dependencies [b425845]
|
|
59
|
-
- @mastra/deployer@0.0.1-alpha.8
|
|
60
|
-
|
|
61
|
-
## 0.0.1-alpha.10
|
|
62
|
-
|
|
63
|
-
### Patch Changes
|
|
64
|
-
|
|
65
|
-
- Updated dependencies [1944807]
|
|
66
|
-
- Updated dependencies [9ade36e]
|
|
67
|
-
- @mastra/deployer@0.0.1-alpha.7
|
|
68
|
-
- @mastra/core@0.1.27-alpha.69
|
|
69
|
-
|
|
70
|
-
## 0.0.1-alpha.9
|
|
71
|
-
|
|
72
|
-
### Patch Changes
|
|
73
|
-
|
|
74
|
-
- Updated dependencies [291fe57]
|
|
75
|
-
- Updated dependencies [1a41fbf]
|
|
76
|
-
- @mastra/deployer@0.0.1-alpha.6
|
|
77
|
-
|
|
78
|
-
## 0.0.1-alpha.8
|
|
79
|
-
|
|
80
|
-
### Patch Changes
|
|
81
|
-
|
|
82
|
-
- Updated dependencies [0be7181]
|
|
83
|
-
- Updated dependencies [0be7181]
|
|
84
|
-
- @mastra/core@0.1.27-alpha.68
|
|
85
|
-
- @mastra/deployer@0.0.1-alpha.5
|
|
86
|
-
|
|
87
|
-
## 0.0.1-alpha.7
|
|
88
|
-
|
|
89
|
-
### Patch Changes
|
|
90
|
-
|
|
91
|
-
- Updated dependencies [7babd5c]
|
|
92
|
-
- @mastra/deployer@0.0.1-alpha.4
|
|
93
|
-
|
|
94
|
-
## 0.0.1-alpha.6
|
|
95
|
-
|
|
96
|
-
### Patch Changes
|
|
97
|
-
|
|
98
|
-
- Updated dependencies [c8ff2f5]
|
|
99
|
-
- Updated dependencies [a291824]
|
|
100
|
-
- @mastra/core@0.1.27-alpha.67
|
|
101
|
-
- @mastra/deployer@0.0.1-alpha.3
|
|
102
|
-
|
|
103
|
-
## 0.0.1-alpha.5
|
|
104
|
-
|
|
105
|
-
### Patch Changes
|
|
106
|
-
|
|
107
|
-
- 88600bc: Deployer fixes
|
|
108
|
-
|
|
109
|
-
## 0.0.1-alpha.4
|
|
110
|
-
|
|
111
|
-
### Patch Changes
|
|
112
|
-
|
|
113
|
-
- a9b5ddf: Publish new versions
|
|
114
|
-
- Updated dependencies [a9b5ddf]
|
|
115
|
-
- Updated dependencies [72c280b]
|
|
116
|
-
- @mastra/deployer@0.0.1-alpha.2
|
|
117
|
-
|
|
118
3
|
## 0.0.1-alpha.0
|
|
119
4
|
|
|
120
5
|
### Patch Changes
|
|
@@ -419,7 +419,6 @@ 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',
|
|
423
422
|
builds: [{
|
|
424
423
|
src: 'index.mjs',
|
|
425
424
|
use: '@vercel/node',
|
|
@@ -543,6 +542,8 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
543
542
|
commandArgs.push('--env', envVar);
|
|
544
543
|
}
|
|
545
544
|
// Run the Vercel deploy command
|
|
545
|
+
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
546
|
+
console.log("vercel " + commandArgs.join(' '));
|
|
546
547
|
child_process__namespace.execSync("vercel " + commandArgs.join(' '), {
|
|
547
548
|
cwd: dir,
|
|
548
549
|
env: _extends({}, this.env, {
|
|
@@ -552,21 +553,21 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
552
553
|
});
|
|
553
554
|
console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
|
|
554
555
|
if (!(envVars.length > 0)) {
|
|
555
|
-
_context2.next =
|
|
556
|
+
_context2.next = 14;
|
|
556
557
|
break;
|
|
557
558
|
}
|
|
558
|
-
_context2.next =
|
|
559
|
+
_context2.next = 12;
|
|
559
560
|
return this.syncEnv({
|
|
560
561
|
scope: this.scope,
|
|
561
562
|
dir: dir,
|
|
562
563
|
token: token
|
|
563
564
|
});
|
|
564
|
-
case
|
|
565
|
-
_context2.next =
|
|
565
|
+
case 12:
|
|
566
|
+
_context2.next = 15;
|
|
566
567
|
break;
|
|
567
|
-
case 13:
|
|
568
|
-
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
569
568
|
case 14:
|
|
569
|
+
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
570
|
+
case 15:
|
|
570
571
|
case "end":
|
|
571
572
|
return _context2.stop();
|
|
572
573
|
}
|
|
@@ -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":";;;;;;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A;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
|
+
{"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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,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,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);
|
|
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
|
|
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 // 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","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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"}
|
|
@@ -396,7 +396,6 @@ 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',
|
|
400
399
|
builds: [{
|
|
401
400
|
src: 'index.mjs',
|
|
402
401
|
use: '@vercel/node',
|
|
@@ -520,6 +519,8 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
520
519
|
commandArgs.push('--env', envVar);
|
|
521
520
|
}
|
|
522
521
|
// Run the Vercel deploy command
|
|
522
|
+
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
523
|
+
console.log("vercel " + commandArgs.join(' '));
|
|
523
524
|
child_process.execSync("vercel " + commandArgs.join(' '), {
|
|
524
525
|
cwd: dir,
|
|
525
526
|
env: _extends({}, this.env, {
|
|
@@ -529,21 +530,21 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
|
529
530
|
});
|
|
530
531
|
console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
|
|
531
532
|
if (!(envVars.length > 0)) {
|
|
532
|
-
_context2.next =
|
|
533
|
+
_context2.next = 14;
|
|
533
534
|
break;
|
|
534
535
|
}
|
|
535
|
-
_context2.next =
|
|
536
|
+
_context2.next = 12;
|
|
536
537
|
return this.syncEnv({
|
|
537
538
|
scope: this.scope,
|
|
538
539
|
dir: dir,
|
|
539
540
|
token: token
|
|
540
541
|
});
|
|
541
|
-
case
|
|
542
|
-
_context2.next =
|
|
542
|
+
case 12:
|
|
543
|
+
_context2.next = 15;
|
|
543
544
|
break;
|
|
544
|
-
case 13:
|
|
545
|
-
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
546
545
|
case 14:
|
|
546
|
+
console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
|
|
547
|
+
case 15:
|
|
547
548
|
case "end":
|
|
548
549
|
return _context2.stop();
|
|
549
550
|
}
|
|
@@ -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;A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MAAA;AAAA,aAAA;AAAAwC,YAAAA,SAAA,CAAAxC,IAAA,GAAA,EAAA,CAAA;YAAA,OAEd,IAAI,CAACpB,OAAO,CAAC;cAAEjC,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,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 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,GAAG;AAAEC,MAAAA,WAAW,EAAXA,WAAAA;AAAa,KAAA,CAAC,IAAA,IAAA,CAAA;AACpC,GAAA;EAACE,cAAA,CAAAP,cAAA,EAAAC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
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.2",
|
|
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.66",
|
|
27
|
+
"@mastra/deployer": "0.0.1-alpha.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/preset-env": "^7.26.0",
|
|
@@ -32,6 +32,7 @@
|
|
|
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",
|
|
35
36
|
"dts-cli": "^2.0.5",
|
|
36
37
|
"vitest": "^2.1.8",
|
|
37
38
|
"vercel": "^39.3.0"
|
package/src/index.ts
CHANGED
|
@@ -27,7 +27,6 @@ export class VercelDeployer extends MastraDeployer {
|
|
|
27
27
|
JSON.stringify(
|
|
28
28
|
{
|
|
29
29
|
version: 2,
|
|
30
|
-
installCommand: 'npm install --omit=dev',
|
|
31
30
|
builds: [
|
|
32
31
|
{
|
|
33
32
|
src: 'index.mjs',
|
|
@@ -140,6 +139,9 @@ export class VercelDeployer extends MastraDeployer {
|
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
// Run the Vercel deploy command
|
|
142
|
+
// console.log('Running command:', 'vercel', commandArgs.join(' '));
|
|
143
|
+
console.log(`vercel ${commandArgs.join(' ')}`)
|
|
144
|
+
|
|
143
145
|
child_process.execSync(`vercel ${commandArgs.join(' ')}`, {
|
|
144
146
|
cwd: dir,
|
|
145
147
|
env: {
|