/netlify-plugin-datocms

A netlify build plugin to create environments on datocms for deploy previews

Primary LanguageJavaScriptMIT LicenseMIT

Netlify Status

Template repository to create new Netlify Build plugins.

The main Build plugins documentation can be found here.

Initialization

To create a repository with a new Netlify Build plugin, click on the "Use this template" button on top of the page.

The repository name should start with netlify-plugin-, for example netlify-plugin-gatsby.

Clone the repository locally.

Inside the new repository directory, run the following command.

npm run init

Some questions will be asked. Make sure the plugin's name matches the repository name.

Among other things, this will replace this README.md with the plugin's user documentation. Development documentation will still be available in the CONTRIBUTING.md.

Finally, create a Netlify Site with the repository. This will automatically run your Build plugins in Netlify Build on every git push, as a smoke test.

You can also add a Netlify status badge.

Usage

The plugin's logic should be added to ./src/index.js. Comments in that file will guide you through the creation of a Build plugin.

Development tasks

The following development tasks are available. Please check the package.json scripts property for more information.

npm run build

Runs a Netlify Build locally with the current plugin. This can be used for debugging and manual tests.

The local Build configuration file is netlify.toml and can be modified.

npm run ava

Runs unit tests.

npm run lint

Lints and prettifies source files.

npm test

Runs both unit tests and linting.

npm run release

Publishes this plugin to npm.