Create Plug-in Templates 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
.
Check the engines property in
package.json
for the Node.js version requirements.
For example, if the following property is stated, version 10 or more is required.
|
|
Installation
An example of global installation of create-plugin using npm:
|
|
Basic usage
Entering the following command will create a directory named dir_name.
Rename the directory by replacing dir_name with the desired text.
|
|
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. For more information on each file, refer to the following article:
Plug-in Development Specifications
Contents of the generated plug-in
The template generated 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.
Plug-in settings page
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:
- Create a plug-in template with create-plugin
- Use the plug-in uploader to upload the plug-in to a Kintone environment
- 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
For questions on how to use the create-plugin tool, post a question in the
Kintone Developer Forum
.
For reporting bugs and other issues, post it as a GitHub Issue in the
js-sdk repository
.
Modification, redistribution, and commercial use of the source code is subject to the license agreement.