Package Plug-in Files using plugin-packer
Overview
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
.
Check the engines property in
package.json
for the Node.js version requirements.
For example, if the following property is stated, version 10 or higher is required.
|
|
Installation
An example of global installation of plugin-packer using npm:
|
|
Basic usage
First, arrange the plug-in files as shown in the image below.
The contents and locations of the files are described in the following article:
Plug-in Development Specifications
Run the following command to package the files (suppose that the src file lies under the sample_project directory):
|
|
Execution sample
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.
Optional features
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.
File monitoring
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.
Web version
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.
https://plugin-packer.kintone.dev/
Notes
For questions on how to use the plugin-packer tool, post a question in the Kintone Developer Forum . 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.