@mastra/deployer-cloudflare 0.1.12 → 0.1.13-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.
- package/dist/index.cjs +9 -7
- package/dist/index.js +9 -7
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var promises = require('fs/promises');
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var deployer = require('@mastra/deployer');
|
|
6
6
|
var cloudflare = require('cloudflare');
|
|
@@ -37,7 +37,7 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
37
37
|
const cfWorkerName = this.projectName;
|
|
38
38
|
const wranglerConfig = {
|
|
39
39
|
name: cfWorkerName,
|
|
40
|
-
main: "./
|
|
40
|
+
main: "./index.mjs",
|
|
41
41
|
compatibility_date: "2024-12-02",
|
|
42
42
|
compatibility_flags: ["nodejs_compat"],
|
|
43
43
|
observability: {
|
|
@@ -50,18 +50,20 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
50
50
|
if (!this.workerNamespace && this.routes) {
|
|
51
51
|
wranglerConfig.routes = this.routes;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
await promises.writeFile(path.join(outputDirectory, this.outputDir, "wrangler.json"), JSON.stringify(wranglerConfig));
|
|
54
54
|
}
|
|
55
55
|
getEntry() {
|
|
56
56
|
return `
|
|
57
|
+
import { mastra } from '#mastra';
|
|
58
|
+
import { createHonoServer } from '#server';
|
|
59
|
+
|
|
57
60
|
export default {
|
|
58
61
|
fetch: async (request, env, context) => {
|
|
62
|
+
// fixes process.env
|
|
59
63
|
Object.keys(env).forEach(key => {
|
|
60
64
|
process.env[key] = env[key]
|
|
61
65
|
})
|
|
62
66
|
|
|
63
|
-
const { mastra } = await import('#mastra')
|
|
64
|
-
const { createHonoServer } = await import('#server')
|
|
65
67
|
const app = await createHonoServer(mastra)
|
|
66
68
|
return app.fetch(request, env, context);
|
|
67
69
|
}
|
|
@@ -76,10 +78,10 @@ export default {
|
|
|
76
78
|
return this._bundle(this.getEntry(), entryFile, outputDirectory);
|
|
77
79
|
}
|
|
78
80
|
async deploy(outputDirectory) {
|
|
79
|
-
const cmd = this.workerNamespace ? `npm exec -- wrangler deploy --dispatch-namespace ${this.workerNamespace}` : "npm exec -- wrangler deploy";
|
|
81
|
+
const cmd = this.workerNamespace ? `npm exec -- wrangler@latest deploy --dispatch-namespace ${this.workerNamespace}` : "npm exec -- wrangler@latest deploy";
|
|
80
82
|
const cpLogger = deployer.createChildProcessLogger({
|
|
81
83
|
logger: this.logger,
|
|
82
|
-
root: outputDirectory
|
|
84
|
+
root: path.join(outputDirectory, this.outputDir)
|
|
83
85
|
});
|
|
84
86
|
await cpLogger({
|
|
85
87
|
cmd,
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { writeFile } from 'fs/promises';
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { Deployer, createChildProcessLogger } from '@mastra/deployer';
|
|
4
4
|
import { Cloudflare } from 'cloudflare';
|
|
@@ -35,7 +35,7 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
35
35
|
const cfWorkerName = this.projectName;
|
|
36
36
|
const wranglerConfig = {
|
|
37
37
|
name: cfWorkerName,
|
|
38
|
-
main: "./
|
|
38
|
+
main: "./index.mjs",
|
|
39
39
|
compatibility_date: "2024-12-02",
|
|
40
40
|
compatibility_flags: ["nodejs_compat"],
|
|
41
41
|
observability: {
|
|
@@ -48,18 +48,20 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
48
48
|
if (!this.workerNamespace && this.routes) {
|
|
49
49
|
wranglerConfig.routes = this.routes;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
await writeFile(join(outputDirectory, this.outputDir, "wrangler.json"), JSON.stringify(wranglerConfig));
|
|
52
52
|
}
|
|
53
53
|
getEntry() {
|
|
54
54
|
return `
|
|
55
|
+
import { mastra } from '#mastra';
|
|
56
|
+
import { createHonoServer } from '#server';
|
|
57
|
+
|
|
55
58
|
export default {
|
|
56
59
|
fetch: async (request, env, context) => {
|
|
60
|
+
// fixes process.env
|
|
57
61
|
Object.keys(env).forEach(key => {
|
|
58
62
|
process.env[key] = env[key]
|
|
59
63
|
})
|
|
60
64
|
|
|
61
|
-
const { mastra } = await import('#mastra')
|
|
62
|
-
const { createHonoServer } = await import('#server')
|
|
63
65
|
const app = await createHonoServer(mastra)
|
|
64
66
|
return app.fetch(request, env, context);
|
|
65
67
|
}
|
|
@@ -74,10 +76,10 @@ export default {
|
|
|
74
76
|
return this._bundle(this.getEntry(), entryFile, outputDirectory);
|
|
75
77
|
}
|
|
76
78
|
async deploy(outputDirectory) {
|
|
77
|
-
const cmd = this.workerNamespace ? `npm exec -- wrangler deploy --dispatch-namespace ${this.workerNamespace}` : "npm exec -- wrangler deploy";
|
|
79
|
+
const cmd = this.workerNamespace ? `npm exec -- wrangler@latest deploy --dispatch-namespace ${this.workerNamespace}` : "npm exec -- wrangler@latest deploy";
|
|
78
80
|
const cpLogger = createChildProcessLogger({
|
|
79
81
|
logger: this.logger,
|
|
80
|
-
root: outputDirectory
|
|
82
|
+
root: join(outputDirectory, this.outputDir)
|
|
81
83
|
});
|
|
82
84
|
await cpLogger({
|
|
83
85
|
cmd,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-cloudflare",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"rollup-plugin-shim": "^1.0.0",
|
|
44
44
|
"wrangler": "^3.112.0",
|
|
45
45
|
"zod": "^3.24.2",
|
|
46
|
-
"@mastra/
|
|
47
|
-
"@mastra/
|
|
46
|
+
"@mastra/deployer": "^0.2.4-alpha.1",
|
|
47
|
+
"@mastra/core": "^0.6.4-alpha.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@microsoft/api-extractor": "^7.52.1",
|