@mastra/deployer-vercel 0.0.1-alpha.0 → 0.0.1-alpha.1

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.
@@ -3,10 +3,29 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@mastra/core');
6
- var execa = require('execa');
6
+ var child_process = require('child_process');
7
7
  var fs = require('fs');
8
8
  var path = require('path');
9
9
 
10
+ function _interopNamespaceDefault(e) {
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return n;
25
+ }
26
+
27
+ var child_process__namespace = /*#__PURE__*/_interopNamespaceDefault(child_process);
28
+
10
29
  function _arrayLikeToArray(r, a) {
11
30
  (null == a || a > r.length) && (a = r.length);
12
31
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
@@ -54,6 +73,15 @@ function _createForOfIteratorHelperLoose(r, e) {
54
73
  }
55
74
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
56
75
  }
76
+ function _extends() {
77
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
78
+ for (var e = 1; e < arguments.length; e++) {
79
+ var t = arguments[e];
80
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
81
+ }
82
+ return n;
83
+ }, _extends.apply(null, arguments);
84
+ }
57
85
  function _inheritsLoose(t, o) {
58
86
  t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
59
87
  }
@@ -494,7 +522,7 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
494
522
  }();
495
523
  _proto.deploy = /*#__PURE__*/function () {
496
524
  var _deploy = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
497
- var dir, token, envFiles, envVars, _iterator2, _step2, file, vars, commandArgs, _i, _envVars, envVar, p2;
525
+ var dir, token, envFiles, envVars, _iterator2, _step2, file, vars, commandArgs, _i, _envVars, envVar;
498
526
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
499
527
  while (1) switch (_context2.prev = _context2.next) {
500
528
  case 0:
@@ -515,29 +543,30 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
515
543
  }
516
544
  // Run the Vercel deploy command
517
545
  // console.log('Running command:', 'vercel', commandArgs.join(' '));
518
- p2 = execa.execa('vercel', commandArgs);
519
- p2.stdout.pipe(process.stdout);
520
- p2.stderr.pipe(process.stderr);
546
+ child_process__namespace.execSync("vercel " + commandArgs + ".join(' ')", {
547
+ cwd: dir,
548
+ env: _extends({}, this.env, {
549
+ PATH: process.env.PATH
550
+ }),
551
+ stdio: 'inherit'
552
+ });
521
553
  console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
522
- _context2.next = 12;
523
- return p2;
524
- case 12:
525
554
  if (!(envVars.length > 0)) {
526
- _context2.next = 17;
555
+ _context2.next = 13;
527
556
  break;
528
557
  }
529
- _context2.next = 15;
558
+ _context2.next = 11;
530
559
  return this.syncEnv({
531
560
  scope: this.scope,
532
561
  dir: dir,
533
562
  token: token
534
563
  });
535
- case 15:
536
- _context2.next = 18;
564
+ case 11:
565
+ _context2.next = 14;
537
566
  break;
538
- case 17:
567
+ case 13:
539
568
  console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
540
- case 18:
569
+ case 14:
541
570
  case "end":
542
571
  return _context2.stop();
543
572
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deployer-vercel.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport { execa } from 'execa';\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 const p2 = execa('vercel', commandArgs);\n\n p2.stdout.pipe(process.stdout);\n p2.stderr.pipe(process.stderr);\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n await p2;\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","p2","_callee2$","_context2","concat","length","execa","stdout","pipe","process","stderr","_x2","_ref6","MastraDeployer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBaA,IAAAA,cAAe,0BAAAC,eAAA,EAAA;EAC1B,SAAAD,cAAAA,CAAAE,IAAA,EAA0G;AAAA,IAAA,IAA5FC,KAAK,GAAAD,IAAA,CAALC,KAAK;MAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;MAAEC,WAAW,GAAAH,IAAA,CAAXG,WAAW,CAAA;IAAA,OACnCJ,eAAA,CAAAK,IAAA,CAAM,IAAA,EAAA;AAAEH,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,WAAW,EAAXA,WAAAA;AAAa,KAAA,CAAC,IAAA,IAAA,CAAA;AACpC,GAAA;EAACE,cAAA,CAAAP,cAAA,EAAAC,eAAA,CAAA,CAAA;AAAA,EAAA,IAAAO,MAAA,GAAAR,cAAA,C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,CAAC,CAAA;AAAA,UAAA,KAAA,EAAA;AAAAsD,YAAAA,SAAA,CAAAzC,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,OAAAgC,SAAA,CAAAd,IAAA,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA,EAAAK,QAAA,EAAA,IAAA,CAAA,CAAA;KAE1E,CAAA,CAAA,CAAA;IAAA,SA5CKF,MAAMA,CAAAmB,GAAA,EAAA;AAAA,MAAA,OAAAlB,OAAA,CAAAxB,KAAA,CAAA,IAAA,EAAAsB,SAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAAA,OAANC,MAAM,CAAA;AAAA,GAAA,EAAA,CAAA;AAAA7E,EAAAA,MAAA,CA8CZK,UAAU,GAAV,SAAAA,UAAUA,CAAA4F,KAAA,EAAyB;AAAA,IAAA,IAAtB7F,GAAG,GAAA6F,KAAA,CAAH7F,GAAG,CAAA;IACdE,gBAAa,CACXC,SAAI,CAACH,GAAG,EAAE,WAAW,CAAC,8NAMf,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAZ,cAAA,CAAA;AAAA,CAAA,CAvJiC0G,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 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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AAA,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,SA/CKF,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,CAiDZK,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,CA1JiC2G,mBAAc;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@mastra/core"),e=require("execa"),r=require("fs"),n=require("path");function o(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 i(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 a(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,s,"next",t)}function s(t){i(a,n,o,c,s,"throw",t)}c(void 0)}))}}function c(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 o(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)?o(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 s(){s=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",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=Object.create((e&&e.prototype instanceof g?e:g).prototype),a=new P(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=f;var p="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function w(){}function b(){}var x={};l(x,a,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(I([])));E&&E!==r&&n.call(E,a)&&(x=E);var L=b.prototype=g.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(e){l(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 F(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 N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(F,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(L,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=l(b,u,"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,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(k.prototype),l(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(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"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,P.prototype={constructor:P,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(N),!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),N(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;N(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 u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}exports.VercelDeployer=function(t){function o(e){return t.call(this,{scope:e.scope,env:e.env,projectName:e.projectName})||this}var i,l;l=t,(i=o).prototype=Object.create(l.prototype),i.prototype.constructor=i,u(i,l);var f=o.prototype;return f.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))},f.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.")}},f.syncEnv=function(){var t=a(s().mark((function t(e){var r,n,o,i,a,u,l,f,h,p,v;return s().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=[],u=c(i);!(l=u()).done;)f=this.parseEnvFile(l.value),a.push.apply(a,f);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)}}(),f.deploy=function(){var t=a(s().mark((function t(r){var n,o,i,a,u,l,f,h,p,v,y;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=r.dir,o=r.token,i=this.getEnvFiles(),a=[],u=c(i);!(l=u()).done;)f=this.parseEnvFile(l.value),a.push.apply(a,f);for(h=["--scope",this.scope,"--cwd",n,"deploy","--token",o,"--yes"].concat(this.projectName?["--name",this.projectName]:[]),p=0,v=a;p<v.length;p++)h.push("--env",v[p]);return(y=e.execa("vercel",h)).stdout.pipe(process.stdout),y.stderr.pipe(process.stderr),console.log("Deployment started on Vercel. You can wait for it to finish or exit this command."),t.next=12,y;case 12:if(!(a.length>0)){t.next=17;break}return t.next=15,this.syncEnv({scope:this.scope,dir:n,token:o});case 15:t.next=18;break;case 17:console.log("\nAdd your ENV vars to .env or your vercel dashboard.\n");case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),f.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 ")},o}(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),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function u(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,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}function s(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",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=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={};s(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){s(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.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){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.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 u=_(c,n);if(u){if(u===m)continue;return u}}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 s=h(e,r,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.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=s(b,u,"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,s(t,u,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(k.prototype),s(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),s(O,u,"Generator"),s(O,a,(function(){return this})),s(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 u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)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=u(f().mark((function t(e){var r,n,o,i,a,c,u,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=s(i);!(u=c()).done;)l=this.parseEnvFile(u.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=u(f().mark((function t(e){var r,n,o,a,c,u,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=s(o);!(u=c()).done;)h=this.parseEnvFile(u.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 { execa } from 'execa';\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 const p2 = execa('vercel', commandArgs);\n\n p2.stdout.pipe(process.stdout);\n p2.stderr.pipe(process.stderr);\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n await p2;\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","p2","_context2","concat","length","execa","stdout","pipe","process","stderr","_x2","_ref6","MastraDeployer"],"mappings":"ovPAiB4BA,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,UAoJA,OApJAD,EACDE,WAAA,SAAUC,GAAyB,IAAtBC,EAAGD,EAAHC,IACXR,KAAKS,WAAW,CAAED,IAAAA,IAElBE,EAAaA,cACXC,EAAIA,KAACH,EAAK,eACVI,KAAKC,UACH,CACEC,QAAS,EACTC,OAAQ,CACN,CACEC,IAAK,YACLC,IAAK,eACLC,OAAQ,CAAEC,aAAc,CAAC,SAG7BC,OAAQ,CACN,CACEJ,IAAK,QACLK,KAAM,eAIZ,KACA,KAGLjB,EAEOkB,aAAA,SAAYC,GAAyB,IACrCC,EAAkBb,EAAIA,KADJY,EAAHf,IACa,UAAW,gBAC7C,IAEE,OADoBI,KAAKa,MAAMC,EAAYA,aAACF,EAAiB,UAC1CG,SACpB,CAAC,MAAOC,GACP,MAAM,IAAIC,MAAM,4EAClB,GACDzB,EAEK0B,QAAO,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,MAAb,SAAAC,EAAAC,GAAA,IAAAnC,EAAAO,EAAA6B,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAhB,EAAAiB,EAAA,OAAAX,IAAAY,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAIE,IAJc/C,EAAK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B,MAAAA,IAAQ,KAAA,GAAAmD,EAAAxC,KAAA,GAAA,MAAA,KAAA,GAErDQ,QAAQC,IAAI,2DAA2D,KAAA,GAAA,IAAA,MAAA,OAAA+B,EAAAb,OAAA,GAAAK,EAAAhF,KAE1E,KA5CW,OA4CX,SA5CWgG,GAAA,OAAAjB,EAAAxB,MAAAvD,KAAA6E,UAAA,CAAA,CAAA,GAAAzE,EA8CZK,WAAA,SAAUwF,GACRvF,EAAAA,cACEC,EAAAA,KAFYsF,EAAHzF,IAEC,4OAQbX,CAAA,EAvJiCqG,EAAcA"}
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 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,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,OAAQ,CACN,CACEC,IAAK,YACLC,IAAK,eACLC,OAAQ,CAAEC,aAAc,CAAC,SAG7BC,OAAQ,CACN,CACEJ,IAAK,QACLK,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AAc,CAAC,SAAUH,KAAKG,aAAe,IAIxDkF,EAAA,EAAAC,EAAqB/C,EAAO8C,EAAAC,EAAAG,OAAAJ,IAC1BD,EAAY9B,KAAK,QADFgC,EAAAD,IAegF,GATjGK,EAAcC,SAAmBP,UAAAA,EAAyB,aAAA,CACxDQ,IAAKpF,EACLN,IAAG2F,EACE,GAAA7F,KAAKE,IAAG,CACX4F,KAAMC,QAAQ7F,IAAI4F,OAEpBE,MAAO,YAGTxC,QAAQC,IAAI,uFAERlB,EAAQkD,OAAS,GAAC,CAAAF,EAAAvC,KAAA,GAAA,KAAA,CAAA,OAAAuC,EAAAvC,KAAA,GAEdhD,KAAK8B,QAAQ,CAAE7B,MAAOD,KAAKC,MAAOO,IAAAA,EAAK6B,MAAAA,IAAQ,KAAA,GAAAkD,EAAAvC,KAAA,GAAA,MAAA,KAAA,GAErDQ,QAAQC,IAAI,2DAA2D,KAAA,GAAA,IAAA,MAAA,OAAA8B,EAAAZ,OAAA,GAAAK,EAAAhF,KAE1E,KA/CW,OA+CX,SA/CWiG,GAAA,OAAAlB,EAAAxB,MAAAvD,KAAA6E,UAAA,CAAA,CAAA,GAAAzE,EAiDZK,WAAA,SAAUyF,GACRxF,EAAAA,cACEC,EAAAA,KAFYuF,EAAH1F,IAEC,4OAQbX,CAAA,EA1JiCsG,EAAcA"}
@@ -1,5 +1,5 @@
1
1
  import { MastraDeployer } from '@mastra/core';
2
- import { execa } from 'execa';
2
+ import * as child_process from 'child_process';
3
3
  import { writeFileSync, readFileSync } from 'fs';
4
4
  import { join } from 'path';
5
5
 
@@ -50,6 +50,15 @@ function _createForOfIteratorHelperLoose(r, e) {
50
50
  }
51
51
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
52
52
  }
53
+ function _extends() {
54
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
55
+ for (var e = 1; e < arguments.length; e++) {
56
+ var t = arguments[e];
57
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
58
+ }
59
+ return n;
60
+ }, _extends.apply(null, arguments);
61
+ }
53
62
  function _inheritsLoose(t, o) {
54
63
  t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
55
64
  }
@@ -490,7 +499,7 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
490
499
  }();
491
500
  _proto.deploy = /*#__PURE__*/function () {
492
501
  var _deploy = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
493
- var dir, token, envFiles, envVars, _iterator2, _step2, file, vars, commandArgs, _i, _envVars, envVar, p2;
502
+ var dir, token, envFiles, envVars, _iterator2, _step2, file, vars, commandArgs, _i, _envVars, envVar;
494
503
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
495
504
  while (1) switch (_context2.prev = _context2.next) {
496
505
  case 0:
@@ -511,29 +520,30 @@ var VercelDeployer = /*#__PURE__*/function (_MastraDeployer) {
511
520
  }
512
521
  // Run the Vercel deploy command
513
522
  // console.log('Running command:', 'vercel', commandArgs.join(' '));
514
- p2 = execa('vercel', commandArgs);
515
- p2.stdout.pipe(process.stdout);
516
- p2.stderr.pipe(process.stderr);
523
+ child_process.execSync("vercel " + commandArgs + ".join(' ')", {
524
+ cwd: dir,
525
+ env: _extends({}, this.env, {
526
+ PATH: process.env.PATH
527
+ }),
528
+ stdio: 'inherit'
529
+ });
517
530
  console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
518
- _context2.next = 12;
519
- return p2;
520
- case 12:
521
531
  if (!(envVars.length > 0)) {
522
- _context2.next = 17;
532
+ _context2.next = 13;
523
533
  break;
524
534
  }
525
- _context2.next = 15;
535
+ _context2.next = 11;
526
536
  return this.syncEnv({
527
537
  scope: this.scope,
528
538
  dir: dir,
529
539
  token: token
530
540
  });
531
- case 15:
532
- _context2.next = 18;
541
+ case 11:
542
+ _context2.next = 14;
533
543
  break;
534
- case 17:
544
+ case 13:
535
545
  console.log('\nAdd your ENV vars to .env or your vercel dashboard.\n');
536
- case 18:
546
+ case 14:
537
547
  case "end":
538
548
  return _context2.stop();
539
549
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deployer-vercel.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport { execa } from 'execa';\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 const p2 = execa('vercel', commandArgs);\n\n p2.stdout.pipe(process.stdout);\n p2.stderr.pipe(process.stderr);\n\n console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');\n await p2;\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","p2","_callee2$","_context2","concat","length","execa","stdout","pipe","process","stderr","_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,I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AAA,CAAA;AAAA,cAAA,MAAA;AAAA,aAAA;AAAAyC,YAAAA,SAAA,CAAAzC,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;AAAAsD,YAAAA,SAAA,CAAAzC,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,OAAAgC,SAAA,CAAAd,IAAA,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA,EAAAK,QAAA,EAAA,IAAA,CAAA,CAAA;KAE1E,CAAA,CAAA,CAAA;IAAA,SA5CKF,MAAMA,CAAAmB,GAAA,EAAA;AAAA,MAAA,OAAAlB,OAAA,CAAAxB,KAAA,CAAA,IAAA,EAAAsB,SAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAAA,OAANC,MAAM,CAAA;AAAA,GAAA,EAAA,CAAA;AAAA7E,EAAAA,MAAA,CA8CZK,UAAU,GAAV,SAAAA,UAAUA,CAAA4F,KAAA,EAAyB;AAAA,IAAA,IAAtB7F,GAAG,GAAA6F,KAAA,CAAH7F,GAAG,CAAA;IACdE,aAAa,CACXC,IAAI,CAACH,GAAG,EAAE,WAAW,CAAC,8NAMf,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAZ,cAAA,CAAA;AAAA,CAAA,CAvJiC0G,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 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,eAAA,CAAA,CAAA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,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiD3E,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.0",
3
+ "version": "0.0.1-alpha.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -25,9 +25,7 @@
25
25
  "dependencies": {
26
26
  "date-fns": "^4.1.0",
27
27
  "dotenv": "^16.3.1",
28
- "execa": "^9.3.1",
29
28
  "vercel": "^39.3.0",
30
- "zod": "^3.24.1",
31
29
  "@mastra/core": "0.1.27-alpha.66",
32
30
  "@mastra/deployer": "0.0.1-alpha.0"
33
31
  },
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MastraDeployer } from '@mastra/core';
2
- import { execa } from 'execa';
2
+ import * as child_process from 'child_process';
3
3
  import { readFileSync, writeFileSync } from 'fs';
4
4
  import { join } from 'path';
5
5
 
@@ -140,13 +140,16 @@ export class VercelDeployer extends MastraDeployer {
140
140
 
141
141
  // Run the Vercel deploy command
142
142
  // console.log('Running command:', 'vercel', commandArgs.join(' '));
143
- const p2 = execa('vercel', commandArgs);
144
-
145
- p2.stdout.pipe(process.stdout);
146
- p2.stderr.pipe(process.stderr);
143
+ child_process.execSync(`vercel ${commandArgs}.join(' ')`, {
144
+ cwd: dir,
145
+ env: {
146
+ ...this.env,
147
+ PATH: process.env.PATH,
148
+ },
149
+ stdio: 'inherit',
150
+ });
147
151
 
148
152
  console.log('Deployment started on Vercel. You can wait for it to finish or exit this command.');
149
- await p2;
150
153
 
151
154
  if (envVars.length > 0) {
152
155
  // Sync environment variables for future deployments