Creating a plug-in template using create-plugin

Introduction

This article introduces "create-plugin", a plug-in development tool designed to make the development of Kintone plug-ins easier.

What is create-plugin?

Create-plugin is a CLI tool that allows users to create templates of Kintone plug-ins through interactive dialogue in the command prompt or terminal.
The tool is published on npm and is available for Windows, macOS, and Linux. Find the source code on GitHub.
* Node.js version 6 or later is needed to use this tool.

Installation

An example of global installation of create-plugin using npm:

 

Basic usage

Entering the following command will create a directory named "dir_name". The name of the directory can be changed to anything by replacing "dir_name" with a different name.

 

 

In this article, a template is created with the directory name "Sample_Plugin".

 

A directory named "Sample_Plugin" will be created. Plug-in template files and directories are included in the src directory of this directory.

*package-lock.json is a file that is generated when installed with npm5 or later.

Details

Details of the templates

The generated templates (src directories) have the following structure. Please see Steps for plug-in development for further information on each file.

 

image5.png

Contents of the generated plug-in

The template that was created from create-plugin contains a sample code that allows optional text to be displayed at the top of the record list page.
The displayed text can be changed from the settings page of the plug-in.

 

Image_4.png

 

Plug-in settings page

 

Image_3.png

Optional Features

Create-plugin also has other useful functions besides creating templates.

Source code check using ESLint

JavaScript source code can be checked using ESLint.

 

Automatic packaging and upload

Running the following command directly to the plug-in will create a zip file of the plug-in.

 

If "Use @kintone/plugin-uploader" is chosen when running create-plugin, plugin-uploader will run.
*Plugin-uploader must be run by a user with admin rights for Kintone.

 

After running the command, the monitoring mode will be activated. Modifying the source code while in monitoring mode will automatically package the plug-in, and upload the changes to the related Kintone subdomain.
*To stop monitoring, cancel the command with "ctrl + c".

Finally

Using create-plugin with plugin-uploader creates a very powerful combination of tools that performs plug-in template creation, error checking, packaging, and uploading.

To fully utilize this too, follow this flow:

  1. Create a plug-in template with create-plugin
  2. Use the plug-in uploader to upload the plug-in to a Kintone environment
  3. Use the monitoring mode so that every change made to the plug-in source files will be automatically uploaded and applied to the plug-in within the Kintone subdomain

This allows for speedy and efficient plug-in development. 

Important Notes

Please note that tech support is not available for the create-plugin tool.
For questions on how to use the create-plugin tool, post a question in the Kintone Developer Community. For reporting bugs and other issues, post it as a GitHub Issue in the create-plugin repository. Modification, redistribution, and commercial use of the source code is subject to the license agreement.

Was this article helpful?
0 out of 0 found this helpful
Do you have any questions or issues related to this article?
Please share your views with us in the Community forums!