Development

Development Guide

Use Git, Yarn, and Node.js 18 for development, matching cli/.nvmrc. Check cli/package.json and .nvmrc when switching branches. Familiarity with Node.js, MQTT, and TypeScript is recommended.

For contributions, fork the repository first and use your fork’s URL in the clone command. If you use nvm, run nvm use as shown below; otherwise, select the required Node.js version with your version manager.

# Clone the repository
git clone https://github.com/emqx/MQTTX.git

cd MQTTX/cli
nvm use
yarn install

# Compile and hot reload for development
yarn run dev

# Compile and compress to build a production version
yarn run build

When developing, you can use the yarn link command to link the MQTTX CLI to the global for easy debugging.

After a successful build, the corresponding files of the successful build will appear in the dist directory and need to be used in the Node.js environment.

If you need to package a binary executable, please refer to the following command.

# Install pkg lib
npm install pkg -g

# Build binary
pkg package.json

After a successful build, you will see the binary executable for each system in the release directory.

Contributing

Please make sure to read the Contributing Guide before making a pull request.