Netlify SDK command reference
The Netlify SDK includes commands that you can use to create and build your extension, as well as preview the GraphQL server for a connector, or your extension UI.
If you use the SDK to generate boilerplate files for your extension, we’ll automatically add the SDK commands to your package.json
, so you can run the standard npm run dev
and npm run build
commands along with the appropriate flags. For example, npm run dev --open
.
Alternatively, you can install the Netlify SDK and then use the commands directly with netlify-extension
or the shorthand ntli
.
Usage example
All of our docs refer to the package.json
scripts to run the SDK commands:
You can then run the scripts using npm run dev
for example, replacing npm
with your package manager.
Alternatively, you can use the commands directly in your terminal after you install the Netlify SDK locally:
Install
If you would like to use the commands in your terminal directly, install the Netlify SDK using your preferred package manager:
Commands
Make sure your project includes the appropriate scripts
When you use the SDK’s guided set-up flow to create an extension, we automatically add scripts
to your project that run the appropriate netlify-extension
commands. As a result, all of our docs instruct you to run the package.json
scripts instead of the SDK commands directly. If you skipped the guided
setup flow, we recommend that you install the Netlify SDK in your project, and manually update your package.json
to include scripts for the commands
you want to run. For example, "dev": "netlify-extension dev"
or "dev": "ntli dev"
.
build
This builds your extension. By default, it builds all components necessary for your extension to work including any connectors, build event handlers, endpoints, or extension UI.
Flags
Flag | Type | Description |
---|---|---|
-a, --all | boolean | Build all components of the extension |
-c, --connector | boolean | Build the connector component of the extension |
-b, --buildtime | boolean | Build the buildtime component of the extension |
-s, --site | boolean | Build the serverless component of the extension |
dev
This builds the exension and watches for changes.
If the extension has extension UI, use this command to preview the UI. The command builds your UI and then runs a server that serves your UI and any handlers you might have.
If you use a connector in your extension, this command also runs a local GraphQL server for your connector that makes it possible to load the GraphiQL UI and test queries locally.
Flags
Flag | Type | Description |
---|---|---|
-a, --all | boolean | Build all components of the extension |
-b, --buildtime | boolean | Build the buildtime component of the extension |
-c, --connector | boolean | Build the connector component of the extension |
-o, --open | boolean | Open the extension UI dev server in the Netlify UI |
-s, --site | boolean | Build the serverless component of the extension |
--slug | string | Override the extension slug used in the Netlify UI dev preview |
--redirect | string | A path to redirect to after the Netlify UI dev preview opens |