@mastra/deployer-netlify 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-tool-call-parts-20250630193309
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/_tsup-dts-rollup.d.cts +2 -29
- package/dist/_tsup-dts-rollup.d.ts +2 -29
- package/dist/index.cjs +25 -106
- package/dist/index.js +22 -107
- package/package.json +15 -14
|
@@ -1,36 +1,9 @@
|
|
|
1
1
|
import { Deployer } from '@mastra/deployer';
|
|
2
2
|
|
|
3
|
-
export declare function getOrCreateSite({ token, name, scope }: {
|
|
4
|
-
token: string;
|
|
5
|
-
name: string;
|
|
6
|
-
scope: string;
|
|
7
|
-
}): Promise<{
|
|
8
|
-
id: string | undefined;
|
|
9
|
-
name: string | undefined;
|
|
10
|
-
url: string | undefined;
|
|
11
|
-
adminUrl: string | undefined;
|
|
12
|
-
} | {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
ssl_url: string;
|
|
16
|
-
url: string;
|
|
17
|
-
admin_url: string;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
3
|
export declare class NetlifyDeployer extends Deployer {
|
|
21
|
-
|
|
22
|
-
protected projectName: string;
|
|
23
|
-
protected token: string;
|
|
24
|
-
constructor({ scope, projectName, token }: {
|
|
25
|
-
scope: string;
|
|
26
|
-
projectName: string;
|
|
27
|
-
token: string;
|
|
28
|
-
});
|
|
29
|
-
writeFiles({ dir }: {
|
|
30
|
-
dir: string;
|
|
31
|
-
}): void;
|
|
4
|
+
constructor();
|
|
32
5
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
33
|
-
deploy(
|
|
6
|
+
deploy(): Promise<void>;
|
|
34
7
|
prepare(outputDirectory: string): Promise<void>;
|
|
35
8
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
36
9
|
private getEntry;
|
|
@@ -1,36 +1,9 @@
|
|
|
1
1
|
import { Deployer } from '@mastra/deployer';
|
|
2
2
|
|
|
3
|
-
export declare function getOrCreateSite({ token, name, scope }: {
|
|
4
|
-
token: string;
|
|
5
|
-
name: string;
|
|
6
|
-
scope: string;
|
|
7
|
-
}): Promise<{
|
|
8
|
-
id: string | undefined;
|
|
9
|
-
name: string | undefined;
|
|
10
|
-
url: string | undefined;
|
|
11
|
-
adminUrl: string | undefined;
|
|
12
|
-
} | {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
ssl_url: string;
|
|
16
|
-
url: string;
|
|
17
|
-
admin_url: string;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
3
|
export declare class NetlifyDeployer extends Deployer {
|
|
21
|
-
|
|
22
|
-
protected projectName: string;
|
|
23
|
-
protected token: string;
|
|
24
|
-
constructor({ scope, projectName, token }: {
|
|
25
|
-
scope: string;
|
|
26
|
-
projectName: string;
|
|
27
|
-
token: string;
|
|
28
|
-
});
|
|
29
|
-
writeFiles({ dir }: {
|
|
30
|
-
dir: string;
|
|
31
|
-
}): void;
|
|
4
|
+
constructor();
|
|
32
5
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
33
|
-
deploy(
|
|
6
|
+
deploy(): Promise<void>;
|
|
34
7
|
prepare(outputDirectory: string): Promise<void>;
|
|
35
8
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
36
9
|
private getEntry;
|
package/dist/index.cjs
CHANGED
|
@@ -1,96 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fs = require('fs');
|
|
4
3
|
var path = require('path');
|
|
4
|
+
var process = require('process');
|
|
5
5
|
var deployer = require('@mastra/deployer');
|
|
6
6
|
var services = require('@mastra/deployer/services');
|
|
7
|
-
var
|
|
7
|
+
var esm = require('fs-extra/esm');
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
async function createNetlifySite({ token, name, scope }) {
|
|
13
|
-
const response = await fetch("https://api.netlify.com/api/v1/sites", {
|
|
14
|
-
method: "POST",
|
|
15
|
-
headers: {
|
|
16
|
-
Authorization: `Bearer ${token}`,
|
|
17
|
-
"Content-Type": "application/json"
|
|
18
|
-
},
|
|
19
|
-
body: JSON.stringify({
|
|
20
|
-
name,
|
|
21
|
-
account_slug: scope,
|
|
22
|
-
// Optional - if not provided, creates in user's default account
|
|
23
|
-
force_ssl: true
|
|
24
|
-
// Enable HTTPS
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
const data = await response.json();
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
console.error(JSON.stringify(data));
|
|
30
|
-
throw new Error(`Failed to create site: ${data.message || "Unknown error"}`);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
id: data.id,
|
|
34
|
-
name: data.name,
|
|
35
|
-
url: data.ssl_url || data.url,
|
|
36
|
-
adminUrl: data.admin_url
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
async function findNetlifySite({ token, name, scope }) {
|
|
40
|
-
const response = await fetch(`https://api.netlify.com/api/v1/${scope}/sites?filter=all&name=${name}`, {
|
|
41
|
-
headers: {
|
|
42
|
-
Authorization: `Bearer ${token}`,
|
|
43
|
-
"Content-Type": "application/json"
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
const data = await response.json();
|
|
47
|
-
if (!response.ok || !Array.isArray(data)) {
|
|
48
|
-
throw new Error(`Failed to search sites: ${data.message || "Unknown error"}`);
|
|
49
|
-
}
|
|
50
|
-
return data.find((site) => site.name === name);
|
|
51
|
-
}
|
|
52
|
-
async function getOrCreateSite({ token, name, scope }) {
|
|
53
|
-
let existingSite;
|
|
54
|
-
try {
|
|
55
|
-
existingSite = await findNetlifySite({ token, name, scope });
|
|
56
|
-
} catch {
|
|
57
|
-
}
|
|
58
|
-
if (existingSite) {
|
|
59
|
-
return existingSite;
|
|
60
|
-
}
|
|
61
|
-
return createNetlifySite({ token, name, scope });
|
|
62
|
-
}
|
|
11
|
+
var process__default = /*#__PURE__*/_interopDefault(process);
|
|
63
12
|
|
|
64
13
|
// src/index.ts
|
|
65
14
|
var NetlifyDeployer = class extends deployer.Deployer {
|
|
66
|
-
|
|
67
|
-
projectName;
|
|
68
|
-
token;
|
|
69
|
-
constructor({ scope, projectName, token }) {
|
|
15
|
+
constructor() {
|
|
70
16
|
super({ name: "NETLIFY" });
|
|
71
|
-
this.
|
|
72
|
-
this.projectName = projectName;
|
|
73
|
-
this.token = token;
|
|
74
|
-
}
|
|
75
|
-
writeFiles({ dir }) {
|
|
76
|
-
if (!fs.existsSync(path.join(dir, "netlify/functions/api"))) {
|
|
77
|
-
fs.mkdirSync(path.join(dir, "netlify/functions/api"), { recursive: true });
|
|
78
|
-
}
|
|
79
|
-
fs.writeFileSync(
|
|
80
|
-
path.join(dir, "netlify.toml"),
|
|
81
|
-
`[functions]
|
|
82
|
-
node_bundler = "esbuild"
|
|
83
|
-
directory = "netlify/functions"
|
|
84
|
-
|
|
85
|
-
[[redirects]]
|
|
86
|
-
force = true
|
|
87
|
-
from = "/*"
|
|
88
|
-
status = 200
|
|
89
|
-
to = "/.netlify/functions/api/:splat"
|
|
90
|
-
`
|
|
91
|
-
);
|
|
17
|
+
this.outputDir = path.join(".netlify", "v1", "functions", "api");
|
|
92
18
|
}
|
|
93
|
-
async installDependencies(outputDirectory, rootDir =
|
|
19
|
+
async installDependencies(outputDirectory, rootDir = process__default.default.cwd()) {
|
|
94
20
|
const deps = new services.DepsService(rootDir);
|
|
95
21
|
deps.__setLogger(this.logger);
|
|
96
22
|
await deps.install({
|
|
@@ -102,41 +28,34 @@ to = "/.netlify/functions/api/:splat"
|
|
|
102
28
|
}
|
|
103
29
|
});
|
|
104
30
|
}
|
|
105
|
-
async deploy(
|
|
106
|
-
|
|
107
|
-
const p2 = execa.execa(
|
|
108
|
-
"npx",
|
|
109
|
-
[
|
|
110
|
-
"netlify-cli",
|
|
111
|
-
"deploy",
|
|
112
|
-
"--site",
|
|
113
|
-
site.id,
|
|
114
|
-
"--auth",
|
|
115
|
-
this.token,
|
|
116
|
-
"--dir",
|
|
117
|
-
".",
|
|
118
|
-
"--functions",
|
|
119
|
-
"./netlify/functions"
|
|
120
|
-
],
|
|
121
|
-
{
|
|
122
|
-
cwd: path.join(outputDirectory, this.outputDir)
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
p2.stdout.pipe(process.stdout);
|
|
126
|
-
await p2;
|
|
31
|
+
async deploy() {
|
|
32
|
+
this.logger?.info("Deploying to Netlify failed. Please use the Netlify dashboard to deploy.");
|
|
127
33
|
}
|
|
128
34
|
async prepare(outputDirectory) {
|
|
129
35
|
await super.prepare(outputDirectory);
|
|
130
|
-
this.writeFiles({ dir: path.join(outputDirectory, this.outputDir) });
|
|
131
36
|
}
|
|
132
37
|
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
133
|
-
|
|
38
|
+
const result = await this._bundle(
|
|
134
39
|
this.getEntry(),
|
|
135
40
|
entryFile,
|
|
136
41
|
outputDirectory,
|
|
137
42
|
toolsPaths,
|
|
138
|
-
path.join(outputDirectory, this.outputDir
|
|
43
|
+
path.join(outputDirectory, this.outputDir)
|
|
139
44
|
);
|
|
45
|
+
await esm.writeJson(path.join(outputDirectory, ".netlify", "v1", "config.json"), {
|
|
46
|
+
redirects: [
|
|
47
|
+
{
|
|
48
|
+
force: true,
|
|
49
|
+
from: "/*",
|
|
50
|
+
to: "/.netlify/functions/api/:splat",
|
|
51
|
+
status: 200
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
await esm.move(path.join(outputDirectory, ".netlify", "v1"), path.join(process__default.default.cwd(), ".netlify", "v1"), {
|
|
56
|
+
overwrite: true
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
140
59
|
}
|
|
141
60
|
getEntry() {
|
|
142
61
|
return `
|
package/dist/index.js
CHANGED
|
@@ -1,92 +1,14 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
2
1
|
import { join } from 'path';
|
|
2
|
+
import process from 'process';
|
|
3
3
|
import { Deployer } from '@mastra/deployer';
|
|
4
4
|
import { DepsService } from '@mastra/deployer/services';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
// src/index.ts
|
|
8
|
-
|
|
9
|
-
// src/helpers.ts
|
|
10
|
-
async function createNetlifySite({ token, name, scope }) {
|
|
11
|
-
const response = await fetch("https://api.netlify.com/api/v1/sites", {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: {
|
|
14
|
-
Authorization: `Bearer ${token}`,
|
|
15
|
-
"Content-Type": "application/json"
|
|
16
|
-
},
|
|
17
|
-
body: JSON.stringify({
|
|
18
|
-
name,
|
|
19
|
-
account_slug: scope,
|
|
20
|
-
// Optional - if not provided, creates in user's default account
|
|
21
|
-
force_ssl: true
|
|
22
|
-
// Enable HTTPS
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
const data = await response.json();
|
|
26
|
-
if (!response.ok) {
|
|
27
|
-
console.error(JSON.stringify(data));
|
|
28
|
-
throw new Error(`Failed to create site: ${data.message || "Unknown error"}`);
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
id: data.id,
|
|
32
|
-
name: data.name,
|
|
33
|
-
url: data.ssl_url || data.url,
|
|
34
|
-
adminUrl: data.admin_url
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
async function findNetlifySite({ token, name, scope }) {
|
|
38
|
-
const response = await fetch(`https://api.netlify.com/api/v1/${scope}/sites?filter=all&name=${name}`, {
|
|
39
|
-
headers: {
|
|
40
|
-
Authorization: `Bearer ${token}`,
|
|
41
|
-
"Content-Type": "application/json"
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const data = await response.json();
|
|
45
|
-
if (!response.ok || !Array.isArray(data)) {
|
|
46
|
-
throw new Error(`Failed to search sites: ${data.message || "Unknown error"}`);
|
|
47
|
-
}
|
|
48
|
-
return data.find((site) => site.name === name);
|
|
49
|
-
}
|
|
50
|
-
async function getOrCreateSite({ token, name, scope }) {
|
|
51
|
-
let existingSite;
|
|
52
|
-
try {
|
|
53
|
-
existingSite = await findNetlifySite({ token, name, scope });
|
|
54
|
-
} catch {
|
|
55
|
-
}
|
|
56
|
-
if (existingSite) {
|
|
57
|
-
return existingSite;
|
|
58
|
-
}
|
|
59
|
-
return createNetlifySite({ token, name, scope });
|
|
60
|
-
}
|
|
5
|
+
import { writeJson, move } from 'fs-extra/esm';
|
|
61
6
|
|
|
62
7
|
// src/index.ts
|
|
63
8
|
var NetlifyDeployer = class extends Deployer {
|
|
64
|
-
|
|
65
|
-
projectName;
|
|
66
|
-
token;
|
|
67
|
-
constructor({ scope, projectName, token }) {
|
|
9
|
+
constructor() {
|
|
68
10
|
super({ name: "NETLIFY" });
|
|
69
|
-
this.
|
|
70
|
-
this.projectName = projectName;
|
|
71
|
-
this.token = token;
|
|
72
|
-
}
|
|
73
|
-
writeFiles({ dir }) {
|
|
74
|
-
if (!existsSync(join(dir, "netlify/functions/api"))) {
|
|
75
|
-
mkdirSync(join(dir, "netlify/functions/api"), { recursive: true });
|
|
76
|
-
}
|
|
77
|
-
writeFileSync(
|
|
78
|
-
join(dir, "netlify.toml"),
|
|
79
|
-
`[functions]
|
|
80
|
-
node_bundler = "esbuild"
|
|
81
|
-
directory = "netlify/functions"
|
|
82
|
-
|
|
83
|
-
[[redirects]]
|
|
84
|
-
force = true
|
|
85
|
-
from = "/*"
|
|
86
|
-
status = 200
|
|
87
|
-
to = "/.netlify/functions/api/:splat"
|
|
88
|
-
`
|
|
89
|
-
);
|
|
11
|
+
this.outputDir = join(".netlify", "v1", "functions", "api");
|
|
90
12
|
}
|
|
91
13
|
async installDependencies(outputDirectory, rootDir = process.cwd()) {
|
|
92
14
|
const deps = new DepsService(rootDir);
|
|
@@ -100,41 +22,34 @@ to = "/.netlify/functions/api/:splat"
|
|
|
100
22
|
}
|
|
101
23
|
});
|
|
102
24
|
}
|
|
103
|
-
async deploy(
|
|
104
|
-
|
|
105
|
-
const p2 = execa(
|
|
106
|
-
"npx",
|
|
107
|
-
[
|
|
108
|
-
"netlify-cli",
|
|
109
|
-
"deploy",
|
|
110
|
-
"--site",
|
|
111
|
-
site.id,
|
|
112
|
-
"--auth",
|
|
113
|
-
this.token,
|
|
114
|
-
"--dir",
|
|
115
|
-
".",
|
|
116
|
-
"--functions",
|
|
117
|
-
"./netlify/functions"
|
|
118
|
-
],
|
|
119
|
-
{
|
|
120
|
-
cwd: join(outputDirectory, this.outputDir)
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
p2.stdout.pipe(process.stdout);
|
|
124
|
-
await p2;
|
|
25
|
+
async deploy() {
|
|
26
|
+
this.logger?.info("Deploying to Netlify failed. Please use the Netlify dashboard to deploy.");
|
|
125
27
|
}
|
|
126
28
|
async prepare(outputDirectory) {
|
|
127
29
|
await super.prepare(outputDirectory);
|
|
128
|
-
this.writeFiles({ dir: join(outputDirectory, this.outputDir) });
|
|
129
30
|
}
|
|
130
31
|
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
131
|
-
|
|
32
|
+
const result = await this._bundle(
|
|
132
33
|
this.getEntry(),
|
|
133
34
|
entryFile,
|
|
134
35
|
outputDirectory,
|
|
135
36
|
toolsPaths,
|
|
136
|
-
join(outputDirectory, this.outputDir
|
|
37
|
+
join(outputDirectory, this.outputDir)
|
|
137
38
|
);
|
|
39
|
+
await writeJson(join(outputDirectory, ".netlify", "v1", "config.json"), {
|
|
40
|
+
redirects: [
|
|
41
|
+
{
|
|
42
|
+
force: true,
|
|
43
|
+
from: "/*",
|
|
44
|
+
to: "/.netlify/functions/api/:splat",
|
|
45
|
+
status: 200
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
await move(join(outputDirectory, ".netlify", "v1"), join(process.cwd(), ".netlify", "v1"), {
|
|
50
|
+
overwrite: true
|
|
51
|
+
});
|
|
52
|
+
return result;
|
|
138
53
|
}
|
|
139
54
|
getEntry() {
|
|
140
55
|
return `
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-netlify",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-tool-call-parts-20250630193309",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -27,23 +27,24 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@rollup/plugin-virtual": "^3.0.2",
|
|
29
29
|
"date-fns": "^4.1.0",
|
|
30
|
-
"execa": "^9.
|
|
31
|
-
"
|
|
32
|
-
"zod": "^3.
|
|
33
|
-
"@mastra/deployer": "0.0.0-
|
|
30
|
+
"execa": "^9.6.0",
|
|
31
|
+
"fs-extra": "^11.3.0",
|
|
32
|
+
"zod": "^3.25.67",
|
|
33
|
+
"@mastra/deployer": "0.0.0-tool-call-parts-20250630193309"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@microsoft/api-extractor": "^7.52.
|
|
37
|
-
"@types/
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"@internal/lint": "0.0.0-
|
|
36
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
37
|
+
"@types/fs-extra": "^11.0.4",
|
|
38
|
+
"@types/node": "^20.19.0",
|
|
39
|
+
"eslint": "^9.29.0",
|
|
40
|
+
"tsup": "^8.5.0",
|
|
41
|
+
"typescript": "^5.8.3",
|
|
42
|
+
"vitest": "^3.2.3",
|
|
43
|
+
"@internal/lint": "0.0.0-tool-call-parts-20250630193309",
|
|
44
|
+
"@mastra/core": "0.0.0-tool-call-parts-20250630193309"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
|
-
"@mastra/core": "
|
|
47
|
+
"@mastra/core": "0.0.0-tool-call-parts-20250630193309"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|