@weborigami/netlify-deploy
v0.0.16
Published
This package provides a function that will upload anything (an Origami site, static files, files defined in a data object, etc.) directly to [Netlify](https://netlify.com).
Readme
This package provides a function that will upload anything (an Origami site, static files, files defined in a data object, etc.) directly to Netlify.
This can be faster and significantly less hassle than trying to link a Netlify project to a GitHub repository and get your project to build on one of Netlify's server. You can test your project on your local machine and, once you've got it the way you want, directly update your site on Netlify where it will be available a few seconds later.
This is like the Manual Deploy feature of the Netlify CLI, which allows you to upload local files (a build folder, for example) directly to Netlify.
The primary difference here is that this package can upload virtual files defined in an Origami .ori file or by other means without requiring a separate build step (although you could also have a build step).
The instructions below assume you are uploading a site defined in src/site.ori.
Installing
Add the @weborigami/netlify-deploy package as a dependency in your project's package.json, then
$ npm installNetlify setup
You will need a few things:
- A Netlify account. They offer a good free tier which is usually fine for personal projects.
- A Netlify project to deploy to. The project will have a project name and a project ID (also called a site ID).
- A Netlify personal access token (see below)
The following instructions guide you through all three of these steps. (The instructions were last updated in February 2026. Netlify's documentation and user interface may have changed since then.)
Create a Netlify project
The easiest way to create a new Netlify project is to upload an initial set of files to the Netlify Drop page.
- If your Origami site is defined in
src/site.ori, then you could build the site to create an output folder (e.g.,build). Alternatively, create an empty folder with any test file in it; anything should do. - Drag that folder onto the Netlify Drop page. Netlify will create and deploy a new project for you with a generated name like
fanciful-sprocket-749123. - In the Netlify Projects area, open your new project.
- On the Project configuration tab, give your project a meaningful name. For this example, we'll use
alice-andrews-blog. - On the same tab, you'll also see a Netlify project ID, a string of characters that looks like
69cd69f789-a780-b327-89cb078afe8b.
The rest of this process arranges things so that you can deploy further updates to your site.
Create a file to hold deployment options
To deploy your site with Origami’s netlify-deploy package, you will need to pass it some configuration options. A convenient way to do that is to put those options in a file.
- Create a file called, for example,
deploy.ori. - Paste in the following template text, substituting your project name (e.g.,
alice-andrews-blog) and Netlify project ID (e.g.,69cd69f789-a780-b327-89cb078afe8b):
// Deploys https://<your project name here>.netlify.app
package:@weborigami/netlify-deploy({
netlifyProjectId: "<your project ID here>"
site: src/site.ori
token: token.json
})If your site is defined in a file other than src/site.ori, update the site field to point to it. You’ll create token.json in the next step.
The final deploy.ori file will look like this example:
// Deploys https://alice-andrews-blog.netlify.app
package:@weborigami/netlify-deploy({
netlifyProjectId: "69cd69f789-a780-b327-89cb078afe8b"
site: src/site.ori
token: token.json
})Get a Netlify personal access token
From Netlify you will need to obtain a “personal access token”: a little string of text that the netlify-deploy package will use to prove to Netlify that you’ve given it permission to update your site.
- If you use git, create a file (or open the existing file) called
.gitignore, then addtoken.jsonon a line by itself and save this file. This step is important so that you don’t accidentally add this personal access token to source control where others might see it. - In the Netlify site, select your account (your avatar), then User Settings.
- Select Applications.
- Under “Personal access tokens”, click New access token.
- Enter any text to describe your token (“Token for deploying blog”, say). Set the expiration date for some length of time, e.g., a year, after which you will need to update the token.
- Click Generate token.
- Netlify will display the token, which will look something like
ajnDlk6sdHIEUYfgiaklaj3n32dsilwn_lfdsijn. - Copy the token to the clipboard now. For security reasons, after you close this page, Netlify won’t display this token again.
- Create a file called
token.json. - Inside the
token.jsonfile, paste in your token and surround it with quotes so that it looks like
"ajnDlk6sdHIEUYfgiaklaj3n32dsilwn_lfdsijn"This arrangement gives you a local copy of this token and makes that token available to the deployment step, but prevents the token from being checked into source control.
If you have more than one Netlify project, you can reuse your personal access token across multiple projects.
Create a deployment script
The final step is to add a deploy script to your package.json that calls the netlify-deploy extension, passing in the configuration options in deploy.yaml.
Your package.json will look something like:
{
"name": "alice-andrews-blog",
"version": "0.0.1",
"type": "module",
"dependencies": {
"@weborigami/origami": "0.6.9",
"@weborigami/netlify-deploy": "0.0.16"
},
"scripts": {
"deploy": "ori deploy.ori/"
}
}For the @weborigami/origami and @weborigami/netlify-deploy version numbers, use the latest versions of those projects.
With that, if you run
$ npm run deploythe deployment process will:
- Compare the site resources defined in
src/site.oriwith the resources currently on Netlify. - Upload any files that have changed.
If the process completes successfully, you’ll see one of two things:
- A count of how many files were uploaded.
- Or a statement that the site is up to date. This message is intentionally ambiguous: it means that either nothing changed in the site, or that your
site.oriwas the same as an earlier state. In the latter case, Netlify will revert your site to that earlier state without the need for any uploads.
