@mastra/deployer-vercel 0.1.19 → 0.1.20-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.
@@ -9,12 +9,12 @@ export declare class VercelDeployer extends Deployer {
9
9
  projectName: string;
10
10
  token: string;
11
11
  });
12
- writeFiles(outputDirectory: string): void;
13
12
  private getProjectId;
14
13
  private getTeamId;
15
14
  private syncEnv;
16
15
  prepare(outputDirectory: string): Promise<void>;
17
16
  private getEntry;
17
+ private writeVercelJSON;
18
18
  bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
19
19
  deploy(outputDirectory: string): Promise<void>;
20
20
  }
@@ -9,12 +9,12 @@ export declare class VercelDeployer extends Deployer {
9
9
  projectName: string;
10
10
  token: string;
11
11
  });
12
- writeFiles(outputDirectory: string): void;
13
12
  private getProjectId;
14
13
  private getTeamId;
15
14
  private syncEnv;
16
15
  prepare(outputDirectory: string): Promise<void>;
17
16
  private getEntry;
17
+ private writeVercelJSON;
18
18
  bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
19
19
  deploy(outputDirectory: string): Promise<void>;
20
20
  }
package/dist/index.cjs CHANGED
@@ -40,32 +40,6 @@ var VercelDeployer = class extends deployer.Deployer {
40
40
  this.projectName = projectName;
41
41
  this.token = token;
42
42
  }
43
- writeFiles(outputDirectory) {
44
- fs.writeFileSync(
45
- path.join(outputDirectory, this.outputDir, "vercel.json"),
46
- JSON.stringify(
47
- {
48
- version: 2,
49
- installCommand: "npm install --omit=dev",
50
- builds: [
51
- {
52
- src: "index.mjs",
53
- use: "@vercel/node",
54
- config: { includeFiles: ["**"] }
55
- }
56
- ],
57
- routes: [
58
- {
59
- src: "/(.*)",
60
- dest: "index.mjs"
61
- }
62
- ]
63
- },
64
- null,
65
- 2
66
- )
67
- );
68
- }
69
43
  getProjectId({ dir }) {
70
44
  const projectJsonPath = path.join(dir, "output", ".vercel", "project.json");
71
45
  try {
@@ -128,7 +102,6 @@ var VercelDeployer = class extends deployer.Deployer {
128
102
  }
129
103
  async prepare(outputDirectory) {
130
104
  await super.prepare(outputDirectory);
131
- await this.writeFiles(outputDirectory);
132
105
  }
133
106
  getEntry() {
134
107
  return `
@@ -189,8 +162,37 @@ export const GET = handle(app);
189
162
  export const POST = handle(app);
190
163
  `;
191
164
  }
165
+ writeVercelJSON(outputDirectory, files = ["./*"]) {
166
+ fs.writeFileSync(
167
+ path.join(outputDirectory, this.outputDir, "vercel.json"),
168
+ JSON.stringify(
169
+ {
170
+ version: 2,
171
+ installCommand: "npm install --omit=dev",
172
+ builds: [
173
+ {
174
+ src: "index.mjs",
175
+ use: "@vercel/node",
176
+ config: { includeFiles: files }
177
+ }
178
+ ],
179
+ routes: [
180
+ {
181
+ src: "/(.*)",
182
+ dest: "index.mjs"
183
+ }
184
+ ]
185
+ },
186
+ null,
187
+ 2
188
+ )
189
+ );
190
+ }
192
191
  async bundle(entryFile, outputDirectory, toolsPaths) {
193
- return this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
192
+ const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
193
+ const files = fs.readdirSync(path.join(outputDirectory, this.outputDir));
194
+ this.writeVercelJSON(outputDirectory, files);
195
+ return result;
194
196
  }
195
197
  async deploy(outputDirectory) {
196
198
  const envVars = await this.loadEnvVars();
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as child_process from 'child_process';
2
- import { writeFileSync, readFileSync } from 'fs';
2
+ import { readFileSync, writeFileSync, readdirSync } from 'fs';
3
3
  import { join } from 'path';
4
4
  import process from 'process';
5
5
  import { Deployer } from '@mastra/deployer';
@@ -15,32 +15,6 @@ var VercelDeployer = class extends Deployer {
15
15
  this.projectName = projectName;
16
16
  this.token = token;
17
17
  }
18
- writeFiles(outputDirectory) {
19
- writeFileSync(
20
- join(outputDirectory, this.outputDir, "vercel.json"),
21
- JSON.stringify(
22
- {
23
- version: 2,
24
- installCommand: "npm install --omit=dev",
25
- builds: [
26
- {
27
- src: "index.mjs",
28
- use: "@vercel/node",
29
- config: { includeFiles: ["**"] }
30
- }
31
- ],
32
- routes: [
33
- {
34
- src: "/(.*)",
35
- dest: "index.mjs"
36
- }
37
- ]
38
- },
39
- null,
40
- 2
41
- )
42
- );
43
- }
44
18
  getProjectId({ dir }) {
45
19
  const projectJsonPath = join(dir, "output", ".vercel", "project.json");
46
20
  try {
@@ -103,7 +77,6 @@ var VercelDeployer = class extends Deployer {
103
77
  }
104
78
  async prepare(outputDirectory) {
105
79
  await super.prepare(outputDirectory);
106
- await this.writeFiles(outputDirectory);
107
80
  }
108
81
  getEntry() {
109
82
  return `
@@ -164,8 +137,37 @@ export const GET = handle(app);
164
137
  export const POST = handle(app);
165
138
  `;
166
139
  }
140
+ writeVercelJSON(outputDirectory, files = ["./*"]) {
141
+ writeFileSync(
142
+ join(outputDirectory, this.outputDir, "vercel.json"),
143
+ JSON.stringify(
144
+ {
145
+ version: 2,
146
+ installCommand: "npm install --omit=dev",
147
+ builds: [
148
+ {
149
+ src: "index.mjs",
150
+ use: "@vercel/node",
151
+ config: { includeFiles: files }
152
+ }
153
+ ],
154
+ routes: [
155
+ {
156
+ src: "/(.*)",
157
+ dest: "index.mjs"
158
+ }
159
+ ]
160
+ },
161
+ null,
162
+ 2
163
+ )
164
+ );
165
+ }
167
166
  async bundle(entryFile, outputDirectory, toolsPaths) {
168
- return this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
167
+ const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
168
+ const files = readdirSync(join(outputDirectory, this.outputDir));
169
+ this.writeVercelJSON(outputDirectory, files);
170
+ return result;
169
171
  }
170
172
  async deploy(outputDirectory) {
171
173
  const envVars = await this.loadEnvVars();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-vercel",
3
- "version": "0.1.19",
3
+ "version": "0.1.20-alpha.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -27,8 +27,8 @@
27
27
  "dependencies": {
28
28
  "@rollup/plugin-virtual": "^3.0.2",
29
29
  "fs-extra": "^11.3.0",
30
- "@mastra/deployer": "^0.3.0",
31
- "@mastra/core": "^0.9.0"
30
+ "@mastra/core": "^0.9.1-alpha.1",
31
+ "@mastra/deployer": "^0.3.1-alpha.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@microsoft/api-extractor": "^7.52.1",