Skip to content

Netlify Plugin

@theholocron/holocron-plugin-netlify deployment

npm · GitHub

Install

pnpm add -D @theholocron/holocron-plugin-netlify

Capabilities

CapabilityToken
deploymentHOLOCRON_NETLIFY_TOKEN (netlify)
providers: {
deployment: ["netlify", {
// Needed by listProjects / ensureProject: create-site is scoped to /{account_slug}/sites
accountSlug: "my-team",
// Needed by listEnvVars / setEnvVar: the env var API is scoped to /accounts/{account_id}/env
accountId: "6ac41cd9a87355ef3d13d261",
// Custom domain `holocron setup` attaches to the site
domain: "app.example.com",
}],
}
Option Required Description
accountSlug No Account slug. Required for ensureProject (the call throws without it)
accountId No Account id, not the slug. Required for the env var methods (they throw without it). Not a secret
domain No Custom domain attached to the site by holocron setup

Create a Personal Access Token under User settings → Applications → Personal access tokens in Netlify.

Terminal window
holocron new token netlify <TOKEN>
holocron check token netlify

check token verifies the token with Netlify’s GET /user.

holocron provider netlify whoami reports who the token belongs to (GET /user), when it expires and what the plugin’s declaration says it may do. Netlify exposes no created or expiry time for a personal access token, so the expiry and age rows say the provider does not expose it. There is no holocron provider netlify token: Netlify has no API to create a personal access token with an existing one (they are made in the UI), so a new token is made by hand and handed to sync secrets.

Or via env var:

Terminal window
export HOLOCRON_NETLIFY_TOKEN=...
# Also recognized:
export NETLIFY_AUTH_TOKEN=...

Resolution order: the --token flag, HOLOCRON_NETLIFY_TOKEN, NETLIFY_AUTH_TOKEN, the OS keyring (service com.theholocron.cli, account netlify), then an error naming all four.

A thin wrapper over the sites, deploys, env and user resources of @theholocron/netlify-client.

Method Netlify call
listProjects / ensureProject sites.list / sites.create
getDeployment deploys.get
listEnvVars / setEnvVar env.list / env.set
ensureCustomDomain sites.update({ custom_domain }). Returns a CNAME record unconditionally, so idempotency relies on Dns.upsertRecord() being a safe no-op on an already-correct record

Required by the Deployment interface but not exercised by any current consumer:

  • updateProjectSettings: Netlify has no equivalent of Vercel’s git-linked project settings, so it no-ops to sites.get.
  • triggerDeployment: calls sites.triggerBuild, untested against a real git-linked Netlify site.

Not implemented:

  • deployFunction: the interface takes text-only files, and Netlify runs no install step for a raw function upload, so a function would need its real node_modules zipped alongside. Call deploys.create() on the client directly instead.
  • listPreviewDeployments and deletePreviewDeployments (both optional on the interface).
import { createPlugin } from "@theholocron/holocron-plugin-netlify";
const plugin = createPlugin({
token: process.env.HOLOCRON_NETLIFY_TOKEN,
accountSlug: "my-team",
accountId: "6ac41cd9a87355ef3d13d261",
});
const deployment = plugin.capabilities.deployment();

The full API reference is generated from the package’s TSDoc comments.