wp-lite-env (英语)
一个简单、轻量级、基于插头的WordPress环境
使用量
安装
要安装软件包,请运行以下命令:
npm install -g @elementor/wp-lite-env
如果您想要为特定工程安装软件包, 请运行以下命令 :
npm install --save-dev @elementor/wp-lite-env
创建配置文件
配置文件是JSON文件,包含WordPress环境的配置.
| 外地 | 类型 | 默认 | 说明 |
|---|---|---|---|
"core" | string|null | null | 要使用的 WordPress 安装 。 若为 null 指定,将使用 WordPress 的最新版本. |
"phpVersion" | string|null | null | 要使用的PHP版本 。 若为 null 指定,将使用与WordPress最新出品相兼容的最新PHP版本. |
"plugins" | Object | {} | 在环境中安装并激活的一套插件. 条目是按 : |
"themes" | Object | {} | 一套要安装在环境中的主题. 条目是按 : |
"config" | Object | {} | 将 wp-config.php 常数映射到其期望值. |
"mappings" | Object | "{}" | 将 WordPress 目录映射到 WordPress 实例中要挂载的本地目录 . |
以下是配置文件的例子:
{
"core": "6.7",
"phpVersion": "8.2",
"plugins": {
"elementor": "./elementor/build"
},
"themes": {
"hello-elementor": "./hello-elementor"
},
"mappings": {
"resources": "./resources"
},
"config": {
"SCRIPT_DEBUG": false,
"WP_DEBUG": false
}
}
使用量
开始一个新的 WordPress 环境
要启动新的 WordPress 环境, 请运行以下命令 :
npx wp-lite-env start config=<path to configuration file> -- port=<port>
例如:
npx wp-lite-env start config=./tests/.wp-lite-env.json -- port=1234
停止文字新闻环境
要停止运行 WordPress 环境, 请运行以下命令 :
npx wp-lite-env start config=<path to configuration file> -- port=<port used by the WordPress environment>
例如:
npx wp-lite-env stop config=./tests/.wp-lite-env.json -- port=1234
开始一个新的 WordPress 环境
WordPress CLI可供服务器使用. 要使用它,请运行以下命令:
npx wp-lite-env cli config=<path to configuration file> -- port=<port used by the WordPress environment> command="<CLI command>"
例如:
npx wp-lite-env cli config=./tests/.wp-lite-env.json -- port=1234 command="ls -la /var/www/html"
贡献者
该软件包由 元素 团队。 说到这里,我们要感谢 @ wordpress/ env (帮助) 团队,这个包 很大程度上灵感来自他们的精彩作品.