@mastra/deployer-netlify 0.10.5 → 0.10.6-alpha.0
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 +1 -18
- package/dist/_tsup-dts-rollup.d.ts +1 -18
- package/dist/index.cjs +2 -78
- package/dist/index.js +2 -78
- package/package.json +7 -8
|
@@ -1,22 +1,5 @@
|
|
|
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
4
|
protected scope: string;
|
|
22
5
|
protected projectName: string;
|
|
@@ -30,7 +13,7 @@ export declare class NetlifyDeployer extends Deployer {
|
|
|
30
13
|
dir: string;
|
|
31
14
|
}): void;
|
|
32
15
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
33
|
-
deploy(
|
|
16
|
+
deploy(): Promise<void>;
|
|
34
17
|
prepare(outputDirectory: string): Promise<void>;
|
|
35
18
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
36
19
|
private getEntry;
|
|
@@ -1,22 +1,5 @@
|
|
|
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
4
|
protected scope: string;
|
|
22
5
|
protected projectName: string;
|
|
@@ -30,7 +13,7 @@ export declare class NetlifyDeployer extends Deployer {
|
|
|
30
13
|
dir: string;
|
|
31
14
|
}): void;
|
|
32
15
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
33
|
-
deploy(
|
|
16
|
+
deploy(): Promise<void>;
|
|
34
17
|
prepare(outputDirectory: string): Promise<void>;
|
|
35
18
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
36
19
|
private getEntry;
|
package/dist/index.cjs
CHANGED
|
@@ -4,62 +4,6 @@ var fs = require('fs');
|
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var deployer = require('@mastra/deployer');
|
|
6
6
|
var services = require('@mastra/deployer/services');
|
|
7
|
-
var execa = require('execa');
|
|
8
|
-
|
|
9
|
-
// src/index.ts
|
|
10
|
-
|
|
11
|
-
// src/helpers.ts
|
|
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
|
-
}
|
|
63
7
|
|
|
64
8
|
// src/index.ts
|
|
65
9
|
var NetlifyDeployer = class extends deployer.Deployer {
|
|
@@ -102,28 +46,8 @@ to = "/.netlify/functions/api/:splat"
|
|
|
102
46
|
}
|
|
103
47
|
});
|
|
104
48
|
}
|
|
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;
|
|
49
|
+
async deploy() {
|
|
50
|
+
this.logger?.info("Deploying to Netlify failed. Please use the Netlify dashboard to deploy.");
|
|
127
51
|
}
|
|
128
52
|
async prepare(outputDirectory) {
|
|
129
53
|
await super.prepare(outputDirectory);
|
package/dist/index.js
CHANGED
|
@@ -2,62 +2,6 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { Deployer } from '@mastra/deployer';
|
|
4
4
|
import { DepsService } from '@mastra/deployer/services';
|
|
5
|
-
import { execa } from 'execa';
|
|
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
|
-
}
|
|
61
5
|
|
|
62
6
|
// src/index.ts
|
|
63
7
|
var NetlifyDeployer = class extends Deployer {
|
|
@@ -100,28 +44,8 @@ to = "/.netlify/functions/api/:splat"
|
|
|
100
44
|
}
|
|
101
45
|
});
|
|
102
46
|
}
|
|
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;
|
|
47
|
+
async deploy() {
|
|
48
|
+
this.logger?.info("Deploying to Netlify failed. Please use the Netlify dashboard to deploy.");
|
|
125
49
|
}
|
|
126
50
|
async prepare(outputDirectory) {
|
|
127
51
|
await super.prepare(outputDirectory);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-netlify",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -28,18 +28,17 @@
|
|
|
28
28
|
"@rollup/plugin-virtual": "^3.0.2",
|
|
29
29
|
"date-fns": "^4.1.0",
|
|
30
30
|
"execa": "^9.6.0",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"@mastra/deployer": "^0.10.5"
|
|
31
|
+
"zod": "^3.25.57",
|
|
32
|
+
"@mastra/deployer": "^0.10.6-alpha.0"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
35
|
"@microsoft/api-extractor": "^7.52.8",
|
|
37
|
-
"@types/node": "^20.
|
|
36
|
+
"@types/node": "^20.19.0",
|
|
38
37
|
"eslint": "^9.28.0",
|
|
39
38
|
"tsup": "^8.5.0",
|
|
40
|
-
"typescript": "^5.8.
|
|
41
|
-
"vitest": "^3.2.
|
|
42
|
-
"@mastra/core": "0.10.
|
|
39
|
+
"typescript": "^5.8.3",
|
|
40
|
+
"vitest": "^3.2.3",
|
|
41
|
+
"@mastra/core": "0.10.6-alpha.0",
|
|
43
42
|
"@internal/lint": "0.0.12"
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|