This article introduces "plugin-packer", a plug-in development tool designed to make the development of Kintone plug-ins easier.
What is plugin-packer?
Plugin-packer is a CLI tool that packages the plug-in directory to generate plug-in zip files.
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.
An example of global installation of plugin-packer using npm:
First, arrange the plug-in files as shown in the image below.
The contents and locations of the files are described in the article, Steps for Plug-in Development.
Run the following command to package the files (suppose that the src file lies under the sample_project directory):
Initially, the file tree including the plug-in files should be in this structure:
Run the following command to package the files within the src file into a plug-in:
The file tree should now be updated into the following structure:
After running the command, a plugin.zip file and a secret key are generated.
This plugin.zip file can be installed into a Kintone domain.
Packaging for the second time
When running the command to package the files for the second time, specify the secret key using the --ppk option.
Specifying the output directory and file name of the zip file
The output directory and file name of the plug-in zip file can be specified using the --out option.
If the --out option is not specified, a zip file named "plugin.zip" is created under the same directory where the src file is located.
A plug-in zip file can be created automatically at specific timings by monitoring directory changes using --watch.
To stop monitoring, cancel the command with "Ctrl + c".
The plugin zip file is created/updated at the following times with the --watch command:
- When the --watch command is first enabled
- When a file inside the monitored folder is opened
- When a file inside the monitored folder is saved
If the plug-in zip file already exists, the file will be updated instead of creating duplicates. If the .ppk file (the file created along with the plugin zip file) is deleted while the --watch command is enabled, the plug-in zip file will not be created/updated. In this case, restart the --watch command.
Plugin-packer is also available on the web. Zip all the directories under the src file into one file, and drag and drop the zip file into the browser to package it.
For questions on how to use the plugin-packer tool, post a question in the Kintone Developer Community. For reporting bugs and other issues, post it as a GitHub Issue in the plugin-packer repository. Modification, redistribution, and commercial use of the source code is subject to the license agreement.