@ereo/deploy-vercel 0.1.6

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/README.md ADDED
@@ -0,0 +1,238 @@
1
+ # @ereo/deploy-vercel
2
+
3
+ Vercel deployment adapter for the EreoJS framework. Configure and deploy your EreoJS applications to Vercel with support for both Edge and Node.js runtimes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @ereo/deploy-vercel
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { defineConfig } from '@ereo/core';
15
+ import { vercel } from '@ereo/deploy-vercel';
16
+
17
+ export default defineConfig({
18
+ ...vercel({
19
+ edge: true,
20
+ regions: ['iad1', 'sfo1'],
21
+ }),
22
+ });
23
+ ```
24
+
25
+ ## API Reference
26
+
27
+ ### `vercel(config?)`
28
+
29
+ Generates EreoJS framework configuration for Vercel deployment.
30
+
31
+ **Parameters:**
32
+ - `config` (optional): `VercelConfig` object
33
+
34
+ **Returns:** `Partial<FrameworkConfig>` with build target set
35
+
36
+ ```typescript
37
+ import { vercel } from '@ereo/deploy-vercel';
38
+
39
+ // Default: Node.js runtime
40
+ const nodeConfig = vercel();
41
+ // Returns: { build: { target: 'node' } }
42
+
43
+ // Edge runtime
44
+ const edgeConfig = vercel({ edge: true });
45
+ // Returns: { build: { target: 'edge' } }
46
+ ```
47
+
48
+ ### `generateVercelJson(config)`
49
+
50
+ Generates a `vercel.json` configuration file as a JSON string.
51
+
52
+ **Parameters:**
53
+ - `config`: `VercelConfig` object
54
+
55
+ **Returns:** `string` - Formatted JSON configuration
56
+
57
+ ```typescript
58
+ import { generateVercelJson } from '@ereo/deploy-vercel';
59
+
60
+ // Node.js configuration
61
+ const nodeJson = generateVercelJson({});
62
+
63
+ // Edge configuration with regions
64
+ const edgeJson = generateVercelJson({
65
+ edge: true,
66
+ regions: ['iad1', 'sfo1'],
67
+ });
68
+
69
+ // Write to file
70
+ await Bun.write('vercel.json', edgeJson);
71
+ ```
72
+
73
+ **Generated JSON Structure (Edge example):**
74
+
75
+ ```json
76
+ {
77
+ "version": 2,
78
+ "builds": [
79
+ {
80
+ "src": "dist/server.js",
81
+ "use": "@vercel/edge",
82
+ "config": {
83
+ "includeFiles": ["dist/**"]
84
+ }
85
+ }
86
+ ],
87
+ "routes": [
88
+ {
89
+ "src": "/(.*)",
90
+ "dest": "dist/server.js"
91
+ }
92
+ ],
93
+ "regions": ["iad1", "sfo1"],
94
+ "functions": {
95
+ "dist/server.js": {
96
+ "runtime": "edge",
97
+ "regions": ["iad1", "sfo1"]
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ ### `generateBuildScript()`
104
+
105
+ Generates a bash build script for Vercel deployment.
106
+
107
+ **Parameters:** None
108
+
109
+ **Returns:** `string` - Bash script content
110
+
111
+ ```typescript
112
+ import { generateBuildScript } from '@ereo/deploy-vercel';
113
+
114
+ const script = generateBuildScript();
115
+ await Bun.write('build.sh', script);
116
+ ```
117
+
118
+ **Generated Script:**
119
+
120
+ ```bash
121
+ #!/bin/bash
122
+ # Vercel build script for EreoJS framework
123
+
124
+ set -e
125
+
126
+ echo "Building for Vercel..."
127
+
128
+ # Install dependencies
129
+ bun install
130
+
131
+ # Build the application
132
+ bun run build
133
+
134
+ # Copy static assets to dist
135
+ mkdir -p dist/public
136
+ cp -r public/* dist/public/ 2>/dev/null || true
137
+
138
+ echo "Build complete!"
139
+ ```
140
+
141
+ ### `VercelConfig` Interface
142
+
143
+ ```typescript
144
+ interface VercelConfig {
145
+ /** Use Vercel Edge runtime (default: false = Node.js) */
146
+ edge?: boolean;
147
+
148
+ /** Deployment regions */
149
+ regions?: string[];
150
+
151
+ /** Function timeout in seconds - Reserved for future use */
152
+ timeout?: number;
153
+
154
+ /** Memory allocation in MB - Reserved for future use */
155
+ memory?: number;
156
+
157
+ /** Environment variables - Reserved for future use */
158
+ env?: Record<string, string>;
159
+ }
160
+ ```
161
+
162
+ | Option | Type | Used By | Description |
163
+ |--------|------|---------|-------------|
164
+ | `edge` | `boolean` | `vercel()`, `generateVercelJson()` | Use Edge runtime instead of Node.js |
165
+ | `regions` | `string[]` | `generateVercelJson()` | Vercel deployment regions |
166
+ | `timeout` | `number` | Reserved | Function timeout (not yet implemented) |
167
+ | `memory` | `number` | Reserved | Memory allocation (not yet implemented) |
168
+ | `env` | `Record<string, string>` | Reserved | Environment variables (not yet implemented) |
169
+
170
+ ### Default Export
171
+
172
+ The package default export is the `vercel` function:
173
+
174
+ ```typescript
175
+ import vercel from '@ereo/deploy-vercel';
176
+ // Equivalent to: import { vercel } from '@ereo/deploy-vercel';
177
+ ```
178
+
179
+ ## Deployment
180
+
181
+ ### Using Vercel CLI
182
+
183
+ ```bash
184
+ # Build the application
185
+ bun run build
186
+
187
+ # Deploy to Vercel
188
+ vercel deploy
189
+
190
+ # Deploy to production
191
+ vercel deploy --prod
192
+ ```
193
+
194
+ ### Generate Configuration Files
195
+
196
+ ```typescript
197
+ import { generateVercelJson, generateBuildScript } from '@ereo/deploy-vercel';
198
+
199
+ // Generate vercel.json
200
+ const vercelConfig = generateVercelJson({ edge: true, regions: ['iad1'] });
201
+ await Bun.write('vercel.json', vercelConfig);
202
+
203
+ // Generate build script
204
+ const buildScript = generateBuildScript();
205
+ await Bun.write('build.sh', buildScript);
206
+ ```
207
+
208
+ ## Runtime Comparison
209
+
210
+ | Feature | Node.js Runtime | Edge Runtime |
211
+ |---------|----------------|--------------|
212
+ | Builder | `@vercel/node` | `@vercel/edge` |
213
+ | Max Timeout | 900 seconds | 30 seconds |
214
+ | Memory Range | 128-3008 MB | 1024-4096 MB |
215
+ | Node.js APIs | Full support | Limited |
216
+ | Cold Start | Slower | Faster |
217
+
218
+ ## Current Limitations
219
+
220
+ The following config options are defined in the interface but not yet implemented:
221
+
222
+ - `timeout` - Function timeout configuration
223
+ - `memory` - Memory allocation configuration
224
+ - `env` - Environment variables
225
+
226
+ These options are accepted for future compatibility but do not affect the generated output.
227
+
228
+ ## Documentation
229
+
230
+ For full documentation, visit [https://ereo.dev/docs/deploy-vercel](https://ereo.dev/docs/deploy-vercel)
231
+
232
+ ## Part of EreoJS
233
+
234
+ This package is part of the [EreoJS monorepo](https://github.com/anthropics/ereo-js).
235
+
236
+ ## License
237
+
238
+ MIT
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @ereo/deploy-vercel - Vercel deployment adapter
3
+ *
4
+ * Configures EreoJS apps for deployment to Vercel (Edge or Node runtime).
5
+ */
6
+ import type { FrameworkConfig } from '@ereo/core';
7
+ /** Vercel deployment configuration */
8
+ export interface VercelConfig {
9
+ /** Use Vercel Edge runtime (default: false = Node.js) */
10
+ edge?: boolean;
11
+ /** Deployment regions */
12
+ regions?: string[];
13
+ /** Function timeout in seconds (max: 900 for Node, 30 for Edge) */
14
+ timeout?: number;
15
+ /** Memory allocation (128MB - 3008MB for Node, 1024MB-4096MB for Edge) */
16
+ memory?: number;
17
+ /** Environment variables to set */
18
+ env?: Record<string, string>;
19
+ }
20
+ /** Generate Vercel configuration */
21
+ export declare function vercel(config?: VercelConfig): Partial<FrameworkConfig>;
22
+ /** Generate vercel.json configuration file */
23
+ export declare function generateVercelJson(config: VercelConfig): string;
24
+ /** Generate build script for Vercel */
25
+ export declare function generateBuildScript(): string;
26
+ export default vercel;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,sCAAsC;AACtC,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,oCAAoC;AACpC,wBAAgB,MAAM,CAAC,MAAM,GAAE,YAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAO1E;AAED,8CAA8C;AAC9C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA8B/D;AAED,uCAAuC;AACvC,wBAAgB,mBAAmB,IAAI,MAAM,CAoB5C;AAED,eAAe,MAAM,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,67 @@
1
+ // @bun
2
+ // src/index.ts
3
+ function vercel(config = {}) {
4
+ return {
5
+ build: {
6
+ target: config.edge ? "edge" : "node"
7
+ }
8
+ };
9
+ }
10
+ function generateVercelJson(config) {
11
+ const vercelJson = {
12
+ version: 2,
13
+ builds: [
14
+ {
15
+ src: "dist/server.js",
16
+ use: config.edge ? "@vercel/edge" : "@vercel/node",
17
+ config: {
18
+ includeFiles: ["dist/**"]
19
+ }
20
+ }
21
+ ],
22
+ routes: [
23
+ {
24
+ src: "/(.*)",
25
+ dest: "dist/server.js"
26
+ }
27
+ ],
28
+ regions: config.regions,
29
+ ...config.edge && {
30
+ functions: {
31
+ "dist/server.js": {
32
+ runtime: "edge",
33
+ regions: config.regions
34
+ }
35
+ }
36
+ }
37
+ };
38
+ return JSON.stringify(vercelJson, null, 2);
39
+ }
40
+ function generateBuildScript() {
41
+ return `#!/bin/bash
42
+ # Vercel build script for EreoJS framework
43
+
44
+ set -e
45
+
46
+ echo "Building for Vercel..."
47
+
48
+ # Install dependencies
49
+ bun install
50
+
51
+ # Build the application
52
+ bun run build
53
+
54
+ # Copy static assets to dist
55
+ mkdir -p dist/public
56
+ cp -r public/* dist/public/ 2>/dev/null || true
57
+
58
+ echo "Build complete!"
59
+ `;
60
+ }
61
+ var src_default = vercel;
62
+ export {
63
+ vercel,
64
+ generateVercelJson,
65
+ generateBuildScript,
66
+ src_default as default
67
+ };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@ereo/deploy-vercel",
3
+ "version": "0.1.6",
4
+ "license": "MIT",
5
+ "author": "Ereo Team",
6
+ "homepage": "https://ereo.dev",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ereojs/ereo.git",
10
+ "directory": "packages/deploy-vercel"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/ereojs/ereo/issues"
14
+ },
15
+ "description": "Vercel deployment adapter for EreoJS framework",
16
+ "type": "module",
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "scripts": {
29
+ "build": "bun build ./src/index.ts --outdir ./dist --target bun --external @ereo/core && bun run build:types",
30
+ "build:types": "tsc --emitDeclarationOnly --outDir dist",
31
+ "dev": "bun build ./src/index.ts --outdir ./dist --target bun --watch",
32
+ "test": "bun test",
33
+ "typecheck": "tsc --noEmit"
34
+ },
35
+ "dependencies": {
36
+ "@ereo/core": "workspace:*"
37
+ },
38
+ "devDependencies": {
39
+ "@types/bun": "^1.1.0",
40
+ "typescript": "^5.4.0"
41
+ }
42
+ }