Introduction
This article introduces a command line tool for uploading JavaScript and CSS files to Kintone. Customize-uploader allows the user to automatically upload JS and CSS files to a Kintone App when a change is made in the file.
What is customize-uploader?
Customize-uploader is a CLI tool that can upload JavaScript/CSS files for customization into a Kintone App.
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
Execute this command to install customize-uploader globally using npm:
Creating the manifest file
A manifest file needs to be created to use customize-uploader. It should contain the App ID of the App to upload the customization files to, as well as paths to the customization files themselves. Place the manifest file in the same hierarchy as the files to be uploaded, and update the manifest file with the following information.
- app: App ID of the App to upload the files to
- scope: Scope of customization ("ALL" || "ADMIN" || "NONE")
- desktop: JavaScript and CSS files for PC ("js": [] || "css": [])
- mobile: JavaScript and CSS files for mobile ("js": [] || "css": [])
When using a library from the Kintone CDN, input the URL of the library.
・ex: https://js.kintone.com/jquery/3.3.1/jquery.min.js
An example of a completed customize-manifest.json file is shown below.
When set with the above customize-manifest.json file, the JavaScript and CSS Customization settings page will look like the following:
As another example, if there is only a single JavaScript file for a desktop customization, the manifest file will look as follows:
Basic usage
This section will explain how to use customize-uploader for uploading JavaScript and CSS customization files to a Kintone App.
Customize-uploader needs to specify the Kintone subdomain information when run.
There are three ways to enter the required information.
* Customize-uploader must be run by a user with administrator privileges of the applicable App.
Direct specification
Enter subdomain information, login name, and password as options in addition to the manifest file.
Interactive specification
Specifying only the manifest file will prompt an interactive question and answer feature to enter domain information, login name, and password.
Specification using environment variables
Environment variables can be used by setting the Kintone subdomain, login name, password etc. as environment variables beforehand. This is useful when it is important for passwords and other sensitive information to not be displayed on the screen when executing commands.
Optional features
There are options in addition to the subdomain and login information that can also be used.
File monitoring
A file can be uploaded automatically onto Kintone each time a change is made by monitoring file updates with the --watch option. Using this option prevents the need to continually re-upload customization files by hand when changes are being made to the code often.
* To stop monitoring, cancel the command with ctrl + c.
Guest space
Customization files can be uploaded to an App in a Guest Space using the --guest-space-id option.
Language preference
The display language on the command line can be specified using the --lang option. Currently, either English (en) or Japanese (ja) can be specified.
Proxy settings
When using a proxy server, proxy information can be entered using the --proxy option.
Sub-commands
init
A customize-manifest.json file is generated using the init subcommand.
import
Import App customization information into the customize-manifest.json file using the import subcommand.
Finally
With the customize-uploader, files for customizations can be uploaded using only the command line.
Additionally with the --watch option, changes to customization files are immediately reflected in the App without needing to use file management tools such as Dropbox.
Note that tech support is not available for the customize-uploader tool.
For questions or comments about the customize-uploader tool, post a topic in the Kintone Developer Program Community. Modification, redistribution, and commercial use of the source code are subject to the license agreement.