@mastra/deployer-vercel 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-transpile-packages-20250724123433
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/LICENSE.md +11 -42
- package/dist/_tsup-dts-rollup.d.cts +2 -12
- package/dist/_tsup-dts-rollup.d.ts +2 -12
- package/dist/index.cjs +39 -142
- package/dist/index.js +40 -124
- package/package.json +13 -13
package/LICENSE.md
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Apache License 2.0
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
17
|
-
|
|
18
|
-
**Patents**
|
|
19
|
-
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
20
|
-
|
|
21
|
-
**Notices**
|
|
22
|
-
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
23
|
-
|
|
24
|
-
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
25
|
-
|
|
26
|
-
**No Other Rights**
|
|
27
|
-
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
28
|
-
|
|
29
|
-
**Termination**
|
|
30
|
-
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
31
|
-
|
|
32
|
-
**No Liability**
|
|
33
|
-
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
34
|
-
|
|
35
|
-
**Definitions**
|
|
36
|
-
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
|
|
37
|
-
|
|
38
|
-
_you_ refers to the individual or entity agreeing to these terms.
|
|
39
|
-
|
|
40
|
-
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
41
|
-
|
|
42
|
-
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
43
|
-
|
|
44
|
-
_use_ means anything you do with the software requiring one of your licenses.
|
|
45
|
-
|
|
46
|
-
_trademark_ means trademarks, service marks, and similar rights.
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { Deployer } from '@mastra/deployer';
|
|
2
2
|
|
|
3
3
|
export declare class VercelDeployer extends Deployer {
|
|
4
|
-
|
|
5
|
-
private projectName;
|
|
6
|
-
private token;
|
|
7
|
-
constructor({ teamSlug, projectName, token }: {
|
|
8
|
-
teamSlug: string;
|
|
9
|
-
projectName: string;
|
|
10
|
-
token: string;
|
|
11
|
-
});
|
|
12
|
-
private getProjectId;
|
|
13
|
-
private getTeamId;
|
|
14
|
-
private syncEnv;
|
|
4
|
+
constructor();
|
|
15
5
|
prepare(outputDirectory: string): Promise<void>;
|
|
16
6
|
private getEntry;
|
|
17
7
|
private writeVercelJSON;
|
|
18
8
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
19
|
-
deploy(
|
|
9
|
+
deploy(): Promise<void>;
|
|
20
10
|
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
21
11
|
}
|
|
22
12
|
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { Deployer } from '@mastra/deployer';
|
|
2
2
|
|
|
3
3
|
export declare class VercelDeployer extends Deployer {
|
|
4
|
-
|
|
5
|
-
private projectName;
|
|
6
|
-
private token;
|
|
7
|
-
constructor({ teamSlug, projectName, token }: {
|
|
8
|
-
teamSlug: string;
|
|
9
|
-
projectName: string;
|
|
10
|
-
token: string;
|
|
11
|
-
});
|
|
12
|
-
private getProjectId;
|
|
13
|
-
private getTeamId;
|
|
14
|
-
private syncEnv;
|
|
4
|
+
constructor();
|
|
15
5
|
prepare(outputDirectory: string): Promise<void>;
|
|
16
6
|
private getEntry;
|
|
17
7
|
private writeVercelJSON;
|
|
18
8
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
19
|
-
deploy(
|
|
9
|
+
deploy(): Promise<void>;
|
|
20
10
|
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
21
11
|
}
|
|
22
12
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,113 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var child_process = require('child_process');
|
|
4
3
|
var fs = require('fs');
|
|
5
4
|
var path = require('path');
|
|
6
5
|
var process = require('process');
|
|
7
6
|
var deployer = require('@mastra/deployer');
|
|
7
|
+
var esm = require('fs-extra/esm');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
|
-
function _interopNamespace(e) {
|
|
12
|
-
if (e && e.__esModule) return e;
|
|
13
|
-
var n = Object.create(null);
|
|
14
|
-
if (e) {
|
|
15
|
-
Object.keys(e).forEach(function (k) {
|
|
16
|
-
if (k !== 'default') {
|
|
17
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return e[k]; }
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
n.default = e;
|
|
26
|
-
return Object.freeze(n);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var child_process__namespace = /*#__PURE__*/_interopNamespace(child_process);
|
|
30
11
|
var process__default = /*#__PURE__*/_interopDefault(process);
|
|
31
12
|
|
|
32
13
|
// src/index.ts
|
|
33
14
|
var VercelDeployer = class extends deployer.Deployer {
|
|
34
|
-
|
|
35
|
-
projectName;
|
|
36
|
-
token;
|
|
37
|
-
constructor({ teamSlug, projectName, token }) {
|
|
15
|
+
constructor() {
|
|
38
16
|
super({ name: "VERCEL" });
|
|
39
|
-
this.
|
|
40
|
-
this.projectName = projectName;
|
|
41
|
-
this.token = token;
|
|
42
|
-
}
|
|
43
|
-
getProjectId({ dir }) {
|
|
44
|
-
const projectJsonPath = path.join(dir, "output", ".vercel", "project.json");
|
|
45
|
-
try {
|
|
46
|
-
const projectJson = JSON.parse(fs.readFileSync(projectJsonPath, "utf-8"));
|
|
47
|
-
return projectJson.projectId;
|
|
48
|
-
} catch {
|
|
49
|
-
throw new Error("Could not find project ID. Make sure the project has been deployed first.");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async getTeamId() {
|
|
53
|
-
const response = await fetch(`https://api.vercel.com/v2/teams`, {
|
|
54
|
-
headers: {
|
|
55
|
-
Authorization: `Bearer ${this.token}`
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const res = await response.json();
|
|
59
|
-
const teams = res.teams;
|
|
60
|
-
return teams.find((team) => team.slug === this.teamSlug)?.id;
|
|
61
|
-
}
|
|
62
|
-
async syncEnv(envVars, { outputDirectory }) {
|
|
63
|
-
console.log("Syncing environment variables...");
|
|
64
|
-
const vercelEnvVars = Array.from(envVars.entries()).map(([key, value]) => {
|
|
65
|
-
if (!key || !value) {
|
|
66
|
-
throw new Error(`Invalid environment variable format: ${key || value}`);
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
key,
|
|
70
|
-
value,
|
|
71
|
-
target: ["production", "preview", "development"],
|
|
72
|
-
type: "plain"
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
try {
|
|
76
|
-
const projectId = this.getProjectId({ dir: outputDirectory });
|
|
77
|
-
const teamId = await this.getTeamId();
|
|
78
|
-
const response = await fetch(
|
|
79
|
-
`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${teamId}&upsert=true`,
|
|
80
|
-
{
|
|
81
|
-
method: "POST",
|
|
82
|
-
headers: {
|
|
83
|
-
Authorization: `Bearer ${this.token}`,
|
|
84
|
-
"Content-Type": "application/json"
|
|
85
|
-
},
|
|
86
|
-
body: JSON.stringify(vercelEnvVars)
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
if (!response.ok) {
|
|
90
|
-
const error = await response.json();
|
|
91
|
-
throw new Error(`Failed to sync environment variables: ${error.message}`);
|
|
92
|
-
}
|
|
93
|
-
console.log("\u2713 Successfully synced environment variables");
|
|
94
|
-
} catch (error) {
|
|
95
|
-
if (error instanceof Error) {
|
|
96
|
-
console.error("Failed to sync environment variables:", error.message);
|
|
97
|
-
} else {
|
|
98
|
-
console.error("Failed to sync environment variables:", error);
|
|
99
|
-
}
|
|
100
|
-
throw error;
|
|
101
|
-
}
|
|
17
|
+
this.outputDir = path.join(".vercel", "output", "functions", "index.func");
|
|
102
18
|
}
|
|
103
19
|
async prepare(outputDirectory) {
|
|
104
20
|
await super.prepare(outputDirectory);
|
|
21
|
+
this.writeVercelJSON(path.join(outputDirectory, this.outputDir, "..", ".."));
|
|
105
22
|
}
|
|
106
23
|
getEntry() {
|
|
107
24
|
return `
|
|
108
25
|
import { handle } from 'hono/vercel'
|
|
109
26
|
import { mastra } from '#mastra';
|
|
110
|
-
import { createHonoServer } from '#server';
|
|
27
|
+
import { createHonoServer, getToolExports } from '#server';
|
|
28
|
+
import { tools } from '#tools';
|
|
111
29
|
import { evaluate } from '@mastra/core/eval';
|
|
112
30
|
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
113
31
|
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
@@ -151,7 +69,7 @@ registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
|
151
69
|
}
|
|
152
70
|
});
|
|
153
71
|
|
|
154
|
-
const app = await createHonoServer(mastra);
|
|
72
|
+
const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
|
|
155
73
|
|
|
156
74
|
export const GET = handle(app);
|
|
157
75
|
export const POST = handle(app);
|
|
@@ -161,72 +79,51 @@ export const OPTIONS = handle(app);
|
|
|
161
79
|
export const HEAD = handle(app);
|
|
162
80
|
`;
|
|
163
81
|
}
|
|
164
|
-
writeVercelJSON(outputDirectory
|
|
82
|
+
writeVercelJSON(outputDirectory) {
|
|
165
83
|
fs.writeFileSync(
|
|
166
|
-
path.join(outputDirectory,
|
|
84
|
+
path.join(outputDirectory, "config.json"),
|
|
85
|
+
JSON.stringify({
|
|
86
|
+
version: 3,
|
|
87
|
+
routes: [
|
|
88
|
+
{
|
|
89
|
+
src: "/(.*)",
|
|
90
|
+
dest: "/"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
97
|
+
const result = await this._bundle(
|
|
98
|
+
this.getEntry(),
|
|
99
|
+
entryFile,
|
|
100
|
+
outputDirectory,
|
|
101
|
+
toolsPaths,
|
|
102
|
+
path.join(outputDirectory, this.outputDir)
|
|
103
|
+
);
|
|
104
|
+
const nodeVersion = process__default.default.version?.split(".")?.[0]?.replace("v", "") ?? "22";
|
|
105
|
+
fs.writeFileSync(
|
|
106
|
+
path.join(outputDirectory, this.outputDir, ".vc-config.json"),
|
|
167
107
|
JSON.stringify(
|
|
168
108
|
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
src: "index.mjs",
|
|
174
|
-
use: "@vercel/node",
|
|
175
|
-
config: { includeFiles: files }
|
|
176
|
-
}
|
|
177
|
-
],
|
|
178
|
-
routes: [
|
|
179
|
-
{
|
|
180
|
-
src: "/(.*)",
|
|
181
|
-
dest: "index.mjs"
|
|
182
|
-
}
|
|
183
|
-
]
|
|
109
|
+
handler: "index.mjs",
|
|
110
|
+
launcherType: "Nodejs",
|
|
111
|
+
runtime: `nodejs${nodeVersion}.x`,
|
|
112
|
+
shouldAddHelpers: true
|
|
184
113
|
},
|
|
185
114
|
null,
|
|
186
115
|
2
|
|
187
116
|
)
|
|
188
117
|
);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
|
|
192
|
-
const files = fs.readdirSync(path.join(outputDirectory, this.outputDir), {
|
|
193
|
-
recursive: true
|
|
118
|
+
await esm.move(path.join(outputDirectory, ".vercel", "output"), path.join(process__default.default.cwd(), ".vercel", "output"), {
|
|
119
|
+
overwrite: true
|
|
194
120
|
});
|
|
195
|
-
const filesWithoutNodeModules = files.filter(
|
|
196
|
-
(file) => typeof file === "string" && !file.startsWith("node_modules")
|
|
197
|
-
);
|
|
198
|
-
this.writeVercelJSON(outputDirectory, filesWithoutNodeModules);
|
|
199
121
|
return result;
|
|
200
122
|
}
|
|
201
|
-
async deploy(
|
|
202
|
-
|
|
203
|
-
const commandArgs = [
|
|
204
|
-
"--scope",
|
|
205
|
-
this.teamSlug,
|
|
206
|
-
"--cwd",
|
|
207
|
-
path.join(outputDirectory, this.outputDir),
|
|
208
|
-
"--token",
|
|
209
|
-
this.token,
|
|
210
|
-
"deploy",
|
|
211
|
-
"--yes",
|
|
212
|
-
...this.projectName ? ["--name", this.projectName] : []
|
|
213
|
-
];
|
|
214
|
-
child_process__namespace.execSync(`npx vercel ${commandArgs.join(" ")}`, {
|
|
215
|
-
cwd: path.join(outputDirectory, this.outputDir),
|
|
216
|
-
env: {
|
|
217
|
-
PATH: process__default.default.env.PATH
|
|
218
|
-
},
|
|
219
|
-
stdio: "inherit"
|
|
220
|
-
});
|
|
221
|
-
this.logger.info("Deployment started on Vercel. You can wait for it to finish or exit this command.");
|
|
222
|
-
if (envVars.size > 0) {
|
|
223
|
-
await this.syncEnv(envVars, { outputDirectory });
|
|
224
|
-
} else {
|
|
225
|
-
this.logger.info("\nAdd your ENV vars to .env or your vercel dashboard.\n");
|
|
226
|
-
}
|
|
123
|
+
async deploy() {
|
|
124
|
+
this.logger?.info("Deploying to Vercel is deprecated. Please use the Vercel dashboard to deploy.");
|
|
227
125
|
}
|
|
228
126
|
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
229
|
-
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
230
127
|
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
231
128
|
const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
|
|
232
129
|
if (hasLibsql) {
|
package/dist/index.js
CHANGED
|
@@ -1,88 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { readFileSync, writeFileSync, readdirSync } from 'fs';
|
|
1
|
+
import { writeFileSync } from 'fs';
|
|
3
2
|
import { join } from 'path';
|
|
4
3
|
import process from 'process';
|
|
5
4
|
import { Deployer } from '@mastra/deployer';
|
|
5
|
+
import { move } from 'fs-extra/esm';
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
var VercelDeployer = class extends Deployer {
|
|
9
|
-
|
|
10
|
-
projectName;
|
|
11
|
-
token;
|
|
12
|
-
constructor({ teamSlug, projectName, token }) {
|
|
9
|
+
constructor() {
|
|
13
10
|
super({ name: "VERCEL" });
|
|
14
|
-
this.
|
|
15
|
-
this.projectName = projectName;
|
|
16
|
-
this.token = token;
|
|
17
|
-
}
|
|
18
|
-
getProjectId({ dir }) {
|
|
19
|
-
const projectJsonPath = join(dir, "output", ".vercel", "project.json");
|
|
20
|
-
try {
|
|
21
|
-
const projectJson = JSON.parse(readFileSync(projectJsonPath, "utf-8"));
|
|
22
|
-
return projectJson.projectId;
|
|
23
|
-
} catch {
|
|
24
|
-
throw new Error("Could not find project ID. Make sure the project has been deployed first.");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async getTeamId() {
|
|
28
|
-
const response = await fetch(`https://api.vercel.com/v2/teams`, {
|
|
29
|
-
headers: {
|
|
30
|
-
Authorization: `Bearer ${this.token}`
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
const res = await response.json();
|
|
34
|
-
const teams = res.teams;
|
|
35
|
-
return teams.find((team) => team.slug === this.teamSlug)?.id;
|
|
36
|
-
}
|
|
37
|
-
async syncEnv(envVars, { outputDirectory }) {
|
|
38
|
-
console.log("Syncing environment variables...");
|
|
39
|
-
const vercelEnvVars = Array.from(envVars.entries()).map(([key, value]) => {
|
|
40
|
-
if (!key || !value) {
|
|
41
|
-
throw new Error(`Invalid environment variable format: ${key || value}`);
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
key,
|
|
45
|
-
value,
|
|
46
|
-
target: ["production", "preview", "development"],
|
|
47
|
-
type: "plain"
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
try {
|
|
51
|
-
const projectId = this.getProjectId({ dir: outputDirectory });
|
|
52
|
-
const teamId = await this.getTeamId();
|
|
53
|
-
const response = await fetch(
|
|
54
|
-
`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${teamId}&upsert=true`,
|
|
55
|
-
{
|
|
56
|
-
method: "POST",
|
|
57
|
-
headers: {
|
|
58
|
-
Authorization: `Bearer ${this.token}`,
|
|
59
|
-
"Content-Type": "application/json"
|
|
60
|
-
},
|
|
61
|
-
body: JSON.stringify(vercelEnvVars)
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
if (!response.ok) {
|
|
65
|
-
const error = await response.json();
|
|
66
|
-
throw new Error(`Failed to sync environment variables: ${error.message}`);
|
|
67
|
-
}
|
|
68
|
-
console.log("\u2713 Successfully synced environment variables");
|
|
69
|
-
} catch (error) {
|
|
70
|
-
if (error instanceof Error) {
|
|
71
|
-
console.error("Failed to sync environment variables:", error.message);
|
|
72
|
-
} else {
|
|
73
|
-
console.error("Failed to sync environment variables:", error);
|
|
74
|
-
}
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
11
|
+
this.outputDir = join(".vercel", "output", "functions", "index.func");
|
|
77
12
|
}
|
|
78
13
|
async prepare(outputDirectory) {
|
|
79
14
|
await super.prepare(outputDirectory);
|
|
15
|
+
this.writeVercelJSON(join(outputDirectory, this.outputDir, "..", ".."));
|
|
80
16
|
}
|
|
81
17
|
getEntry() {
|
|
82
18
|
return `
|
|
83
19
|
import { handle } from 'hono/vercel'
|
|
84
20
|
import { mastra } from '#mastra';
|
|
85
|
-
import { createHonoServer } from '#server';
|
|
21
|
+
import { createHonoServer, getToolExports } from '#server';
|
|
22
|
+
import { tools } from '#tools';
|
|
86
23
|
import { evaluate } from '@mastra/core/eval';
|
|
87
24
|
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
88
25
|
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
@@ -126,7 +63,7 @@ registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
|
126
63
|
}
|
|
127
64
|
});
|
|
128
65
|
|
|
129
|
-
const app = await createHonoServer(mastra);
|
|
66
|
+
const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
|
|
130
67
|
|
|
131
68
|
export const GET = handle(app);
|
|
132
69
|
export const POST = handle(app);
|
|
@@ -136,72 +73,51 @@ export const OPTIONS = handle(app);
|
|
|
136
73
|
export const HEAD = handle(app);
|
|
137
74
|
`;
|
|
138
75
|
}
|
|
139
|
-
writeVercelJSON(outputDirectory
|
|
76
|
+
writeVercelJSON(outputDirectory) {
|
|
140
77
|
writeFileSync(
|
|
141
|
-
join(outputDirectory,
|
|
78
|
+
join(outputDirectory, "config.json"),
|
|
79
|
+
JSON.stringify({
|
|
80
|
+
version: 3,
|
|
81
|
+
routes: [
|
|
82
|
+
{
|
|
83
|
+
src: "/(.*)",
|
|
84
|
+
dest: "/"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
91
|
+
const result = await this._bundle(
|
|
92
|
+
this.getEntry(),
|
|
93
|
+
entryFile,
|
|
94
|
+
outputDirectory,
|
|
95
|
+
toolsPaths,
|
|
96
|
+
join(outputDirectory, this.outputDir)
|
|
97
|
+
);
|
|
98
|
+
const nodeVersion = process.version?.split(".")?.[0]?.replace("v", "") ?? "22";
|
|
99
|
+
writeFileSync(
|
|
100
|
+
join(outputDirectory, this.outputDir, ".vc-config.json"),
|
|
142
101
|
JSON.stringify(
|
|
143
102
|
{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
src: "index.mjs",
|
|
149
|
-
use: "@vercel/node",
|
|
150
|
-
config: { includeFiles: files }
|
|
151
|
-
}
|
|
152
|
-
],
|
|
153
|
-
routes: [
|
|
154
|
-
{
|
|
155
|
-
src: "/(.*)",
|
|
156
|
-
dest: "index.mjs"
|
|
157
|
-
}
|
|
158
|
-
]
|
|
103
|
+
handler: "index.mjs",
|
|
104
|
+
launcherType: "Nodejs",
|
|
105
|
+
runtime: `nodejs${nodeVersion}.x`,
|
|
106
|
+
shouldAddHelpers: true
|
|
159
107
|
},
|
|
160
108
|
null,
|
|
161
109
|
2
|
|
162
110
|
)
|
|
163
111
|
);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
|
|
167
|
-
const files = readdirSync(join(outputDirectory, this.outputDir), {
|
|
168
|
-
recursive: true
|
|
112
|
+
await move(join(outputDirectory, ".vercel", "output"), join(process.cwd(), ".vercel", "output"), {
|
|
113
|
+
overwrite: true
|
|
169
114
|
});
|
|
170
|
-
const filesWithoutNodeModules = files.filter(
|
|
171
|
-
(file) => typeof file === "string" && !file.startsWith("node_modules")
|
|
172
|
-
);
|
|
173
|
-
this.writeVercelJSON(outputDirectory, filesWithoutNodeModules);
|
|
174
115
|
return result;
|
|
175
116
|
}
|
|
176
|
-
async deploy(
|
|
177
|
-
|
|
178
|
-
const commandArgs = [
|
|
179
|
-
"--scope",
|
|
180
|
-
this.teamSlug,
|
|
181
|
-
"--cwd",
|
|
182
|
-
join(outputDirectory, this.outputDir),
|
|
183
|
-
"--token",
|
|
184
|
-
this.token,
|
|
185
|
-
"deploy",
|
|
186
|
-
"--yes",
|
|
187
|
-
...this.projectName ? ["--name", this.projectName] : []
|
|
188
|
-
];
|
|
189
|
-
child_process.execSync(`npx vercel ${commandArgs.join(" ")}`, {
|
|
190
|
-
cwd: join(outputDirectory, this.outputDir),
|
|
191
|
-
env: {
|
|
192
|
-
PATH: process.env.PATH
|
|
193
|
-
},
|
|
194
|
-
stdio: "inherit"
|
|
195
|
-
});
|
|
196
|
-
this.logger.info("Deployment started on Vercel. You can wait for it to finish or exit this command.");
|
|
197
|
-
if (envVars.size > 0) {
|
|
198
|
-
await this.syncEnv(envVars, { outputDirectory });
|
|
199
|
-
} else {
|
|
200
|
-
this.logger.info("\nAdd your ENV vars to .env or your vercel dashboard.\n");
|
|
201
|
-
}
|
|
117
|
+
async deploy() {
|
|
118
|
+
this.logger?.info("Deploying to Vercel is deprecated. Please use the Vercel dashboard to deploy.");
|
|
202
119
|
}
|
|
203
120
|
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
204
|
-
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
205
121
|
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
206
122
|
const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
|
|
207
123
|
if (hasLibsql) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-vercel",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-transpile-packages-20250724123433",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -23,25 +23,25 @@
|
|
|
23
23
|
},
|
|
24
24
|
"keywords": [],
|
|
25
25
|
"author": "",
|
|
26
|
-
"license": "
|
|
26
|
+
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@rollup/plugin-virtual": "^3.0.2",
|
|
29
29
|
"fs-extra": "^11.3.0",
|
|
30
|
-
"@mastra/deployer": "0.0.0-
|
|
30
|
+
"@mastra/deployer": "0.0.0-transpile-packages-20250724123433"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@microsoft/api-extractor": "^7.52.
|
|
34
|
-
"@types/
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"vitest": "^3.
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
33
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
34
|
+
"@types/fs-extra": "^11.0.4",
|
|
35
|
+
"@types/node": "^20.19.0",
|
|
36
|
+
"eslint": "^9.30.1",
|
|
37
|
+
"tsup": "^8.5.0",
|
|
38
|
+
"typescript": "^5.8.3",
|
|
39
|
+
"vitest": "^3.2.4",
|
|
40
|
+
"@internal/lint": "0.0.0-transpile-packages-20250724123433",
|
|
41
|
+
"@mastra/core": "0.0.0-transpile-packages-20250724123433"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@mastra/core": "
|
|
44
|
+
"@mastra/core": "0.0.0-transpile-packages-20250724123433"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|