CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-autod

Auto generate dependencies by parsing JavaScript project files and fetching latest versions from npm registry

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

cli.mddocs/

Command Line Interface

Command-line tool for analyzing and managing dependencies with extensive configuration options and project integration features.

Capabilities

Basic Command

The autod command analyzes your project and displays/manages dependencies.

autod [options]

Basic Usage Examples:

# Analyze current directory
autod

# Analyze specific path
autod -p /path/to/project

# Write dependencies to package.json
autod -w

# Check for missing dependencies
autod --check

Core Options

# Project Analysis
-p, --path <path>           Root path to parse (default: '.')
-t, --test <paths>          Test/benchmark/example directory paths
-e, --exclude <paths>       Exclude directory paths (comma-separated)

# Registry and Versions
-r, --registry <url>        Remote registry URL
-f, --prefix <prefix>       Version prefix for dependencies (~ or ^)
-F, --devprefix <prefix>    Version prefix for devDependencies (~ or ^)

# Output and Actions
-w, --write                 Write dependencies into package.json
-i, --ignore                Ignore errors, display/write dependencies
-m, --map                   Display dependency-to-file mapping
--check                     Check for missing dependencies

Dependency Management

# Additional Dependencies
-d, --dep <modules>         Modules to add as dependencies
-D, --devdep <modules>      Modules to add as devDependencies
-k, --keep <modules>        Modules to keep unchanged in package.json
-s, --semver <deps@ver>     Auto-update modules within specified semver

# Advanced Options
-n, --notransform           Disable ES6 transformation
-P, --plugin <name>         Plugin module name

Advanced Usage Examples:

# Exclude build directories and add custom dependencies
autod -e "build,dist,tmp" -d "lodash,moment" -D "mocha,chai"

# Use specific registry with version prefixes
autod -r https://registry.npmjs.org -f ^ -F ~

# Keep certain modules unchanged and update others
autod -k "react*,@types/*" -s "lodash@^4.0.0" -w

# Display dependency mapping and ignore errors
autod -m -i

# Check for missing dependencies without updating
autod --check

Configuration File Support

Autod supports persistent configuration through .autod.conf.js or .autod.conf.json files in the project root.

// .autod.conf.js
module.exports = {
  root: '.',
  registry: 'https://registry.npmjs.org',
  exclude: ['build', 'dist', 'coverage'],
  test: ['test', 'spec', 'tests'],
  dep: ['lodash'],
  devdep: ['mocha', 'chai'],
  semver: {
    'lodash': '^4.0.0'
  },
  prefix: '^',
  devprefix: '~'
};
{
  "root": ".",
  "registry": "https://registry.npmjs.org",
  "exclude": ["build", "dist", "coverage"],
  "test": ["test", "spec", "tests"],
  "dep": ["lodash"],
  "devdep": ["mocha", "chai"],
  "semver": {
    "lodash": "^4.0.0"
  },
  "prefix": "^",
  "devprefix": "~"
}

Output Formats

Standard Analysis Output

When running autod, you'll see:

[DEPENDENCIES]

Dependencies updates
┌──────────────┬─────────────┬────────────────┐
│ Package Name │ Old Version │ Latest Version │
├──────────────┼─────────────┼────────────────┤
│ lodash       │ -           │ ^4.17.21       │
│ express      │ ^4.17.1     │ ^4.18.2        │
└──────────────┴─────────────┴────────────────┘

DevDependencies updates
┌──────────────┬─────────────┬────────────────┐
│ Package Name │ Old Version │ Latest Version │
├──────────────┼─────────────┼────────────────┤
│ mocha        │ -           │ ^10.2.0        │
└──────────────┴─────────────┴────────────────┘

Dependency Mapping Output

With -m option, you'll also see which files require each dependency:

[DEPENDENCY MAP]
  express
    app.js
    routes/index.js
  lodash
    utils/helpers.js
    lib/data-processor.js

Check Mode Output

With --check, missing dependencies are reported:

[ERROR] Missing dependencies: ["lodash", "express"]
[ERROR] Missing devDependencies: ["mocha"]

Integration Examples

CI/CD Pipeline

# Check for missing dependencies in CI
autod --check || exit 1

# Update dependencies in development
autod -w -i

Development Workflow

# Daily dependency update
autod -w -f ^ --registry https://registry.npmjs.org

# Pre-commit hook
autod --check

Custom Plugin Usage

# Use custom parser plugin
autod -P my-custom-parser --notransform

Registry Configuration

Autod determines the registry in this order:

  1. Command line -r/--registry option
  2. npm_config_registry environment variable
  3. publishConfig.registry in package.json
  4. Default: https://registry.npmjs.org

Error Handling

# Common exit codes:
# 0 - Success
# 1 - Errors found (unless -i/--ignore used)
# 1 - Missing dependencies (in --check mode)

Error Examples:

# Continue despite parse errors
autod -i -w

# Strict checking (fail on any issues)
autod --check

Version Prefix Options

# Available prefixes:
# ^ - Compatible with (default for -f)
# ~ - Reasonably close to
# (none) - Exact version

Prefix Examples:

# Use ^ for dependencies, ~ for devDependencies
autod -f ^ -F ~ -w

# Use exact versions
autod -w

docs

cli.md

index.md

programmatic-api.md

tile.json