配置
文件
🌐 Files
配置值存储在 JSON 文件中。Ionic CLI 维护一个全局配置文件,通常位于 ~/.ionic/config.json,以及项目配置文件,通常位于项目根目录下,名为 ionic.config.json。
🌐 Configuration values are stored in JSON files. The Ionic CLI maintains a global configuration file, usually located at ~/.ionic/config.json, and project configuration files, usually at the project's root directory as ionic.config.json.
CLI 提供用于从项目配置文件和全局 CLI 配置文件设置和打印配置值的命令。请参阅 ionic config --help 或查看文档以了解 ionic config get 和 ionic config set 的用法 。
🌐 The CLI provides commands for setting and printing config values from project config files and the global CLI config file. See ionic config --help or see the documentation for usage of ionic config get and ionic config set.
项目配置文件
🌐 Project Configuration File
每个 Ionic 项目都有一个项目配置文件,通常位于项目的根目录。以下是一个带注释的 ionic.config.json 文件。
🌐 Each Ionic project has a project configuration file, usually at the project's root directory. The following is an annotated ionic.config.json file.
{
// The human-readable name of the app.
"name": "My App",
// The project type of the app. The CLI uses this value to determine which
// commands and command options are available, what to output for help
// documentation, and what to use for web asset builds and the dev server.
"type": "angular",
// The App ID for Appflow.
"id": "abc123",
// Configuration object for integrations such as Cordova and Capacitor.
"integrations": {
"cordova": {
...
}
},
// Hook configuration--see the Hooks section below for details.
"hooks": {
...
}
}
环境变量
🌐 Environment Variables
CLI 将查找以下环境变量:
🌐 The CLI will look for the following environment variables:
IONIC_CONFIG_DIRECTORY:全局 CLI 配置的目录。默认为~/.ionic。IONIC_HTTP_PROXY:为代理所有 CLI 请求设置一个 URL。请参阅 使用代理。IONIC_TOKEN:自动使用 Appflow 进行身份验证。
标志
🌐 Flags
CLI 标志是改变 CLI 命令行为的全局选项。
🌐 CLI flags are global options that alter the behavior of a CLI command.
--help:不要运行该命令,而是查看其帮助页面。--verbose:显示所有日志消息以进行调试。--quiet:只显示WARN和ERROR日志消息。--no-interactive:关闭交互提示和花哨输出。如果检测到 CI 或非 TTY 终端,CLI 会自动变为非交互模式。--confirm:开启确认提示的自动确认。注意:CLI 在执行可能有害的操作前会提示。自动确认可能会产生意想不到的结果。