The `tool` package, currently at version 21.0.0, provides an opinionated and configurable set of build tools primarily designed for JavaScript projects. It offers a command-line interface (`tool`) for executing various build tasks such as managing styles, scripts, and files, and also exposes a programmatic API for integration into other Node.js applications. The package relies on core utilities like `commander` for CLI parsing, `uglify-js` for minification, `glob` for file pattern matching, and `mkdirp` for directory creation. Despite its functional offering, the package was last published seven years ago (September 23, 2019) and its GitHub repository shows no commits for the past 13 years, indicating it is an abandoned project. Its last major release predates significant advancements in the JavaScript ecosystem, including widespread ESM adoption and newer Node.js LTS versions, making it potentially incompatible or insecure for modern development workflows. It has no discernible release cadence due to its inactive status.
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
The package is primarily designed as a command-line tool accessible globally via `npx` or if installed globally. Direct execution of `bin/tool` is also possible but less common.
npx tool --help
This package is CommonJS-only. It exports an object containing various build functions (e.g., `build`, `styles`, `scripts`). There is no named or default ESM export.
const tool = require('tool');
This is a named export within the CommonJS module. Destructuring is the idiomatic way to access specific functions from the exported object. Direct property access also works but is less concise.
const { build } = require('tool');
This quickstart demonstrates how to access the `tool` CLI for help and illustrates the programmatic import pattern for its CommonJS API. It shows how to check for available functions like `styles.build` and `scripts.build`, which are part of its exposed API for build tasks.
const { build, styles, scripts } = require('tool');
const path = require('path');
const fs = require('fs');
// CLI usage example: Display help
console.log('--- CLI Help ---');
const { execSync } = require('child_process');
try {
console.log(execSync('npx tool --help', { encoding: 'utf8' }));
} catch (error) {
console.error('Error running CLI help:', error.message);
}
// Programmatic usage example (simplified, assuming basic file structure)
console.log('\n--- Programmatic Usage ---');
// Mock configuration for a build task
const config = {
styles: {
src: [path.join(__dirname, 'src/styles/**/*.css')],
dest: path.join(__dirname, 'dist/css'),
minify: true
},
scripts: {
src: [path.join(__dirname, 'src/scripts/**/*.js')],
dest: path.join(__dirname, 'dist/js'),
minify: true
},
// ... other build options
};
// Create dummy source files for demonstration
fs.mkdirSync(path.join(__dirname, 'src/styles'), { recursive: true });
fs.writeFileSync(path.join(__dirname, 'src/styles/main.css'), 'body { color: red; }');
fs.mkdirSync(path.join(__dirname, 'src/scripts'), { recursive: true });
fs.writeFileSync(path.join(__dirname, 'src/scripts/app.js'), 'console.log("Hello");');
async function runBuild() {
try {
console.log('Running styles build...');
// In a real scenario, you'd pass specific options to styles()
// This is a placeholder as the exact API for styles/scripts is not fully documented in public README
// Assuming `styles` and `scripts` functions would take src/dest arguments or a config object
// The actual `tool` library's `lib/tool.js` exports functions like `styles.build`, `scripts.build` etc.
// Simplified for quickstart: calling a generic 'build' if it exists or illustrating the functions.
// Given `lib/tool.js` exports `build` as a top-level function as well,
// we'll simulate calling specific sub-commands through a generic `build` hook.
// The `tool` package actually exposes `tool.styles.build`, `tool.scripts.build` etc.
// For a quickstart, we'll assume a high-level `build` can orchestrate these.
// If not, a direct call to `styles.build` or `scripts.build` would be required.
// For this quickstart, let's assume `build` orchestrates based on a config, or call sub-functions directly.
// From `lib/tool.js`, it looks like `module.exports.styles = { build: function() { ... } }`
// So, we would actually do `styles.build()`. Let's correct this for accuracy.
console.log('Attempting to call styles.build...');
// This would require more specific setup/mocking to run fully without error,
// as the actual `styles.build` expects certain arguments or internal context.
// For demonstration, we'll just show the function call pattern.
// styles.build(config.styles.src, config.styles.dest, config.styles.minify);
// To be runnable, let's simplify and mock what `tool` might do given its dependencies
// This part requires understanding the internal logic of the 'tool' package,
// which is not exposed in a simple README.
// Let's create a minimal example that represents invoking some utility from 'tool'.
// Based on `lib/tool.js`, it exports an object `exports.styles = { build: function() {} }`
// and `exports.scripts = { build: function() {} }`.
// The top-level `build` seems to be an orchestrator.
// We cannot reliably run `tool.build` or `tool.styles.build` without knowing their
// precise arguments and internal side effects. Given it's abandoned and minimal docs,
// a simple import and logging would be more robust for a quickstart.
console.log('The `tool` object contains functions like:', Object.keys(require('tool')));
if (typeof styles.build === 'function') {
console.log('`styles.build` function is available. A real usage would involve arguments.');
// Example: styles.build(['./src/styles/*.css'], './dist/css', { minify: true });
}
if (typeof scripts.build === 'function') {
console.log('`scripts.build` function is available. A real usage would involve arguments.');
// Example: scripts.build(['./src/scripts/*.js'], './dist/js', { minify: true });
}
console.log('Build process completed (simulated).');
} catch (error) {
console.error('Error during programmatic build:', error.message);
}
}
runBuild();
tool --version
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.