TDesign Publish CLI
tdesign-publish-cli is a command-line interface tool designed to streamline the release process for JavaScript projects, particularly those adhering to Conventional Commits. It automates the generation of changelogs based on Git commit history, leveraging `standard-changelog`. Furthermore, it can create formatted messages for enterprise communication platforms like WeChat Work (WeCom) robots, supporting both release log notifications and instant recognition messages. The current stable version is `0.0.12`, indicating it's still in early development, and its release cadence is likely irregular as features are added and refined. Its key differentiator is the integrated robot message generation tailored for Chinese enterprise platforms, which goes beyond standard changelog tools.
Common errors
-
Error: Command 'changelog' requires a valid git repository with commit history.
cause The command was run in a directory that is not a git repository or has no commit history.fixInitialize a git repository (`git init`), make some commits, and ensure you are in the project's root directory. -
Changelog generation failed: No commits found since last tag.
cause There are no new commits matching the Conventional Commits specification since the last Git tag, or no tags exist.fixEnsure you have recent commits that follow Conventional Commits and/or create a new Git tag (`git tag v1.0.0 && git push --tags`) to mark a release point. -
Error: robotMsg.json not found or empty after 'robot' command.
cause The `robot` command failed to generate content, possibly due to missing changelog data, incorrect input, or permissions issues.fixVerify that `CHANGELOG.md` exists and contains content if generating release messages. Check terminal output for any errors during `tdesign-publish-cli robot` execution. Ensure proper write permissions in the project root.
Warnings
- gotcha This CLI strictly relies on Git commit messages following the Conventional Commits specification. If your commit history does not adhere to this standard, the generated changelog will be incomplete or malformed.
- gotcha The robot message generation creates a `robotMsg.json` file in the project root. This file contains sensitive webhook content or message details. Ensure it's handled securely and not committed to public repositories inadvertently if it contains proprietary information.
- breaking As a pre-1.0.0 package (current version 0.0.12), breaking changes can occur frequently without major version bumps, impacting API stability and command options.
Install
-
npm install tdesign-publish-cli -
yarn add tdesign-publish-cli -
pnpm add tdesign-publish-cli
Imports
- tdesign-publish-cli changelog
node tdesign-publish-cli changelog
npx tdesign-publish-cli changelog
- tdesign-publish-cli robot
npx tdesign-publish-cli robot
- tdesign-publish-cli help
tdesign-publish-cli --help
npx tdesign-publish-cli help changelog
Quickstart
npm i -D tdesign-publish-cli
# Ensure your project uses Conventional Commits, e.g., via commitlint and husky
# For initial changelog generation, ensure you have git tags (e.g., v1.0.0)
# Generate CHANGELOG.md
npx tdesign-publish-cli changelog
# Generate a robot message for a release (reads from CHANGELOG.md)
npx tdesign-publish-cli robot
# After running 'robot', a robotMsg.json file will be created.
# Example for sending the message using curl (replace with your webhook URL):
# cat robotMsg.json | curl -X POST -H 'Content-Type: application/json' -d @- "${PROCESS_ENV_WECOM_WEBHOOK_URL ?? ''}"