@elementor/wp-lite-env

中文文档
0.0.20发布于 2024/12/25ISCTypeScriptESM + CJS近 30 天下载 7976

A simple, lightweight, docker-based WordPress environment

原始使用文档
文档目录6 节
  1. Installation
  2. Creating a configuration file
  3. Usage
  4. Starting a new WordPress environment
  5. Stopping a WordPress environment
  6. Starting a new WordPress environment

wp-lite-env

A simple, lightweight, docker-based WordPress environment

Usage

Installation

To install the package, run the following command:

npm install -g @elementor/wp-lite-env

If you want to install the package for a specific project, run the following command:

npm install --save-dev @elementor/wp-lite-env

Creating a configuration file

The configuration file is a JSON file that contains the configuration for the WordPress environment.

FieldTypeDefaultDescription
"core"string|nullnullThe WordPress installation to use. If null is specified, the latest production release of WordPress will be used.
"phpVersion"string|nullnullThe PHP version to use. If null is specified, the latest version of PHP that is compatible with the latest production release of WordPress will be used.
"plugins"Object{}A set of plugins to install and activate in the environment. The entries are a key-value pair in the format of :
"themes"Object{}A set of themes to install in the environment. The entries are a key-value pair in the format of :
"config"Object{}Mapping of wp-config.php constants to their desired values.
"mappings"Object"{}"Mapping of WordPress directories to local directories to be mounted in the WordPress instance.

The following is an example of a configuration file:

{
  "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
  }
}

Usage

Starting a new WordPress environment

To start a new WordPress environment, run the following command:

npx wp-lite-env start config=<path to configuration file> -- port=<port>

For example:

npx wp-lite-env start config=./tests/.wp-lite-env.json -- port=1234

Stopping a WordPress environment

To stop a running WordPress environment, run the following command:

npx wp-lite-env start config=<path to configuration file> -- port=<port used by the WordPress environment>

For example:

npx wp-lite-env stop config=./tests/.wp-lite-env.json -- port=1234

Starting a new WordPress environment

The WordPress CLI is available for use on the server. To use it, run the following command:

npx wp-lite-env cli config=<path to configuration file> -- port=<port used by the WordPress environment> command="<CLI command>"

For example:

npx wp-lite-env cli config=./tests/.wp-lite-env.json -- port=1234 command="ls -la /var/www/html"

Contributors

This package is developed and maintained by the Elementor team. With that being said, we want to thank the @wordpress/env team, this package is heavily inspired by their wonderful work.

版本与发布记录

@elementor/wp-lite-env 共发布 15 个版本,首次发布于 2024/11/20;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.0.20latest2024/12/251.9 年前
0.0.192024/12/151.9 年前
0.0.182024/12/111.9 年前
0.0.172024/12/101.9 年前
0.0.162024/11/262 年前
0.0.152024/11/262 年前

关于 @elementor/wp-lite-env 的常见问题

@elementor/wp-lite-env 是什么?

A simple, lightweight, docker-based WordPress environment

如何安装 @elementor/wp-lite-env?

在项目目录运行 npm install @elementor/wp-lite-env,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 wp-lite-env,可以用 npx wp-lite-env 直接运行。

@elementor/wp-lite-env 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@elementor/wp-lite-env 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@elementor/wp-lite-env 可以商用吗?

@elementor/wp-lite-env 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@elementor/wp-lite-env 的下载量有多少?

根据 npm 官方下载统计,@elementor/wp-lite-env 在 2026/10/14 – 2026/11/12 这 30 天内被下载 7,976 次,日均约 266 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@elementor/wp-lite-env 还在维护吗?

最新版本 0.0.20 发布于 2024/12/25(1.9 年前);至今共发布 15 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/11/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。