UT Tools for Build and Release Automation
ut-tools is a suite of command-line interface (CLI) scripts designed for continuous integration, continuous delivery, and general automation tasks within JavaScript projects. It provides a pre-configured set of utilities for common CI/CD workflows, including generating changelogs (`ut-changelog`), running tests (`ut-test`), checking code coverage (`ut-cover`), linting JavaScript and CSS files (`ut-lint`, `ut-lint-js`, `ut-lint-css`), and automating release processes (`ut-release`, `ut-release-lerna`). Currently at version 7.13.2, the package has shifted its primary installation model since version 7, requiring global installation rather than being added to `devDependencies` to optimize `npm install` performance. It is intended for direct use within `package.json` scripts or as standalone CLI commands, not as a library for programmatic import.
Common errors
-
Error: Command 'ut-lint' not found
cause The `ut-tools` package was not installed globally, or the global `node_modules` bin directory is not in your system's PATH.fixEnsure `ut-tools` is installed globally by running `npm install -g ut-tools`. Verify your system's PATH includes the global npm bin directory. -
ESLint: Cannot read config file: '/enter the installation path here/ut-tools/eslint/.eslintrc.js'
cause The `eslint.options.overrideConfigFile` setting in VSCode uses an incorrect or unresolvable path to the `ut-tools` ESLint configuration.fixFind the correct global installation path of `ut-tools` (e.g., `npm root -g`) and update your VSCode settings with the precise path to the `.eslintrc.js` file. -
npm install takes a long time, even for small projects.
cause Prior to v7, `ut-tools` was often listed as a `devDependency`. Since v7, it is designed for global installation, and local installation adds unnecessary overhead.fixRemove `ut-tools` from your `devDependencies` in `package.json` and ensure it is installed globally (`npm install -g ut-tools`).
Warnings
- breaking Since version 7, ut-tools must be installed globally (`npm install -g ut-tools`) rather than as a `devDependencies` entry. Installing it locally will not provide the expected CLI commands and may slow down `npm install` processes.
- gotcha Configuring VSCode ESLint to use ut-tools's predefined rules requires specific workspace or user settings. Incorrect paths will result in VSCode not applying the linting rules or reporting errors.
- gotcha ut-tools is designed as a collection of command-line utilities and is not intended for programmatic `import` or `require()` within JavaScript or TypeScript application code. Attempting to import symbols directly will fail.
Install
-
npm install ut-tools -
yarn add ut-tools -
pnpm add ut-tools
Imports
- ut-changelog
import { changelog } from 'ut-tools'ut-changelog
- ut-lint
const lint = require('ut-tools/lint');ut-lint
- ut-release
import { release } from 'ut-tools';ut-release
Quickstart
npm install -g ut-tools
// Add to your project's package.json scripts
// Example: package.json
/*
{
"name": "my-project",
"version": "1.0.0",
"scripts": {
"lint": "ut-lint",
"test": "ut-test",
"release": "ut-release"
}
}
*/
// Then run from your project directory
npm run lint