Upload JavaScript and CSS files with Customize-uploader
Overview
This article introduces how to use the Customize-uploader tool. This tool automatically uploads JavaScript and CSS files to Kintone Apps whenever changes are made in the files.
What Is Customize-Uploader?
Customize-uploader is a CLI tool that uploads JavaScript and CSS customization files into Kintone Apps.
The tool is published on npm and is available for Windows, macOS, and Linux.
The source code is available 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
Run this command to install customize-uploader globally using npm:
|
|
Create 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. 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 a CDN, input the URL of the library.
- For example: https://js.kintone.com/jquery/3.3.1/jquery.min.js
An example of a completed customize-manifest.json file is shown below.
|
|
If files are uploaded with the above customize-manifest.json file, the JavaScript and CSS Customization settings page should look like the following:
If there is only one single JavaScript file for a desktop customization, the manifest file will look as follows:
|
|
How to Upload JavaScript and CSS Files
Customize-uploader needs to specify the Kintone subdomain information when run.
There are three ways to enter the required information.
Attention
Customize-uploader must be run by a user with Administrator privileges of the target App.
Direct Specification
Enter in the 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. Enter in the 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 running commands.
|
|
Optional Features
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 via the GUI.
|
|
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.
|
|