Publishing plugins
This section is for legacy plugins, which have been deprecated. For the current version of the Plugin SDK, please visit the Plugin SDK documentation.
If you've created a new plugin, we strongly encourage you to share it with the community as an npm package, so that it will become available in our Plugins Explorer:
In order to properly release a plugin, you need to make sure to fill the package.json with these information:
{ "name": "datocms-plugin-foobar", "version": "0.0.1", "homepage": "https://github.com/mark/foobar#readme", "description": "Add a small description for the plugin here", "keywords": ["datocms-plugin"], "datoCmsPlugin": { "title": "Plugin title", "previewImage": "docs/preview.gif", "entryPoint": "dist/index.html", "fieldTypes": ["json"], "pluginType": "sidebar", "parameters": { "global": [ ... ], "instance": [ ... ] } }, "devDependencies": { ... }, "dependencies": { ... }}The following table describes the properties that can be set on the file:
name(required): Npm package nameversion(required): Plugin versiondescription(required): Short description of what the plugin doeskeywords(required): Plugin keywords, useful to help users find your pluginhomepage: URL of the plugin homepage, will be shown in the Plugin ExplorerdatoCmsPlugin.title(required): Plugin title`datoCmsPlugin.previewImage: Relative path to a plugin preview image (better if it's a GIF)
datoCmsPlugin.coverImage: Relative path to a cover image that will be used in the MarketplacedatoCmsPlugin.entryPoint(required): Relative path to the plugin entry pointdatoCmsPlugin.pluginType(required): The type of plugindatoCmsPlugin.fieldTypes(required): The types of field the plugin can be used withdatoCmsPlugin.parameters(required): Configuration parameters for the plugin
Make sure to follow these rules:
nameMUST be prefixed withdatocms-plugin;datoCmsPlugin.entryPoint,datoCmsPlugin.previewImageanddatoCmsPlugin.coverImagemust be files contained in the package, and need to be defined as relative paths to the package root;keywordsMUST contain thedatocms-pluginkeyword, otherwise the plugin won't be visible in the Plugin explorer;datoCmsPlugin.fieldTypesMUST contain one or more of the following values:boolean,date,date_time,float,integer,string,text,lat_lon,json,seo,link,links,video,color;datoCmsPlugin.pluginTypeMUST be one of the following values:field_editor,field_addonorsidebar;datoCmsPlugin.parametersMUST follow the syntax detailed in the Configuration parameters section of this guide.
Requiring external JS/CSS inside of your entrypoint
We'll use unpkg.com to serve the entrypoint as an iframe, so ie. if your plugin is called datocms-plugin-foobar and the entry point specified in the package.json is dist/index.html, the URL that will be loaded will be something like this:
https://unpkg.com/datocms-plugin-foobar/dist/index.htmlThis means that if the page you requires a JS file with an absolute path like /js/bundle.js then it won't work, as the final URL will be https://unpkg.com/js/bundle.js, which will be non-existent. Make sure that any external resource you require is expressed as a relative path to the HTML page!