@theholocron/holocron-plugin-vercel 3.58.1 → 3.60.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/index.d.mts +2 -2
- package/dist/index.mjs +11 -10
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ declare class VercelDeployment implements Deployment {
|
|
|
13
13
|
readonly key: "deployment";
|
|
14
14
|
readonly providerName = "vercel";
|
|
15
15
|
private readonly defaultFramework;
|
|
16
|
-
constructor(client: VercelClient$1, opts?: DeploymentOptions);
|
|
16
|
+
constructor(client: () => VercelClient$1, opts?: DeploymentOptions);
|
|
17
17
|
listProjects(): Promise<DeploymentProject[]>;
|
|
18
18
|
ensureProject(input: {
|
|
19
19
|
name: string;
|
|
@@ -67,7 +67,7 @@ interface VercelPluginOptions extends ResolveTokenInput {
|
|
|
67
67
|
}
|
|
68
68
|
interface PluginContext {
|
|
69
69
|
options: VercelPluginOptions;
|
|
70
|
-
client: VercelClient;
|
|
70
|
+
client: () => VercelClient;
|
|
71
71
|
}
|
|
72
72
|
declare function createContext(options?: VercelPluginOptions): PluginContext;
|
|
73
73
|
declare function deployment(ctx: PluginContext): Deployment;
|
package/dist/index.mjs
CHANGED
|
@@ -19,13 +19,13 @@ var VercelDeployment = class {
|
|
|
19
19
|
this.defaultFramework = opts.defaultFramework ?? "nextjs";
|
|
20
20
|
}
|
|
21
21
|
async listProjects() {
|
|
22
|
-
const { projects } = await this.client.projects.list();
|
|
22
|
+
const { projects } = await this.client().projects.list();
|
|
23
23
|
return projects.map(mapProject);
|
|
24
24
|
}
|
|
25
25
|
async ensureProject(input) {
|
|
26
26
|
const existing = await this.getProjectByName(input.name);
|
|
27
27
|
if (existing) return existing;
|
|
28
|
-
return mapProject(await this.client.projects.create({
|
|
28
|
+
return mapProject(await this.client().projects.create({
|
|
29
29
|
name: input.name,
|
|
30
30
|
framework: input.framework ?? this.defaultFramework,
|
|
31
31
|
repo: input.repo,
|
|
@@ -33,23 +33,23 @@ var VercelDeployment = class {
|
|
|
33
33
|
}));
|
|
34
34
|
}
|
|
35
35
|
async updateProjectSettings(projectId, settings) {
|
|
36
|
-
return mapProject(await this.client.projects.update(projectId, {
|
|
36
|
+
return mapProject(await this.client().projects.update(projectId, {
|
|
37
37
|
previewDeploymentsDisabled: settings.previewDeploymentsDisabled,
|
|
38
38
|
gitProviderOptions: settings.gitProviderCreateDeployments !== void 0 ? { createDeployments: settings.gitProviderCreateDeployments } : void 0
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
41
|
async listEnvVars(projectId, target) {
|
|
42
|
-
const { envs } = await this.client.env.list(projectId);
|
|
42
|
+
const { envs } = await this.client().env.list(projectId);
|
|
43
43
|
return envs.filter((e) => e.target.includes(target)).map((e) => e.key);
|
|
44
44
|
}
|
|
45
45
|
async setEnvVar(projectId, target, name, value) {
|
|
46
|
-
await this.client.env.set(projectId, target, name, value);
|
|
46
|
+
await this.client().env.set(projectId, target, name, value);
|
|
47
47
|
}
|
|
48
48
|
async triggerDeployment(input) {
|
|
49
|
-
const project = await this.client.projects.get(input.projectId);
|
|
49
|
+
const project = await this.client().projects.get(input.projectId);
|
|
50
50
|
const repoId = project.link?.repoId;
|
|
51
51
|
if (!repoId) throw new ProviderApiError(`Vercel project "${project.name}" has no linked GitHub repo — cannot trigger a deployment. Link the repo first.`, 400, void 0);
|
|
52
|
-
return mapDeployment(await this.client.deployments.trigger({
|
|
52
|
+
return mapDeployment(await this.client().deployments.trigger({
|
|
53
53
|
projectName: project.name,
|
|
54
54
|
branch: input.branch,
|
|
55
55
|
repoId,
|
|
@@ -57,12 +57,12 @@ var VercelDeployment = class {
|
|
|
57
57
|
}), input.branch);
|
|
58
58
|
}
|
|
59
59
|
async getDeployment(deploymentId) {
|
|
60
|
-
const raw = await this.client.deployments.get(deploymentId);
|
|
60
|
+
const raw = await this.client().deployments.get(deploymentId);
|
|
61
61
|
return mapDeployment(raw, raw.meta?.githubCommitRef ?? null);
|
|
62
62
|
}
|
|
63
63
|
async getProjectByName(name) {
|
|
64
64
|
try {
|
|
65
|
-
return mapProject(await this.client.projects.get(name));
|
|
65
|
+
return mapProject(await this.client().projects.get(name));
|
|
66
66
|
} catch (err) {
|
|
67
67
|
if (err instanceof ProviderApiError && err.status === 404) return null;
|
|
68
68
|
throw err;
|
|
@@ -128,9 +128,10 @@ async function verifyToken(token, opts = {}) {
|
|
|
128
128
|
//#endregion
|
|
129
129
|
//#region src/index.ts
|
|
130
130
|
function createContext(options = {}) {
|
|
131
|
+
let client;
|
|
131
132
|
return {
|
|
132
133
|
options,
|
|
133
|
-
client: createVercelClient({
|
|
134
|
+
client: () => client ??= createVercelClient({
|
|
134
135
|
token: resolveToken(options),
|
|
135
136
|
teamId: options.teamId,
|
|
136
137
|
baseUrl: options.baseUrl,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-vercel",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.60.0",
|
|
4
4
|
"description": "Holocron plugin for Vercel. Implements the deployment capability against the Vercel REST API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deployment",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"tsx": "4.23.12",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"vitest": "^4.1.11",
|
|
48
|
-
"@theholocron/cli": "3.
|
|
48
|
+
"@theholocron/cli": "3.60.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@theholocron/vercel-client": "^1.14.2",
|
|
52
|
-
"@theholocron/cli": "3.
|
|
52
|
+
"@theholocron/cli": "3.60.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@theholocron/vercel-client": {}
|