path-comment-updater
v1.0.4
Published
Updates file path comments in source files
Downloads
5
Readme
path-comment-updater
A utility to update file path comments at the top of source files. Useful for maintaining accurate file path comments after moving files around in your codebase.
Installation
npm install -g path-comment-updater
# or
yarn global add path-comment-updaterUsage
Command Line
# Update all TypeScript files in current directory
path-comment-updater
# Specify include patterns
path-comment-updater --include "src/**/*.ts" "src/**/*.tsx"
# Exclude specific patterns
update-path-comments --exclude "**/*.test.ts" "**/node_modules/**"
# Dry run to preview changes
update-path-comments --dry-run
# Enable verbose logging
update-path-comments --verbose
# Specify comment style
update-path-comments --comment-style multiProgrammatic Usage
import { PathCommentUpdater } from "path-comment-updater";
const updater = new PathCommentUpdater({
baseDir: process.cwd(),
dryRun: false,
commentStyle: "auto",
verbose: true,
});
const updates = await updater.updateFiles(
["src/**/*.ts"], // include patterns
["**/node_modules/**"] // exclude patterns
);
console.log(`Updated ${updates.length} files`);Options
--include: Glob patterns to include files (default:["**/*.{ts,js,tsx,jsx}"])--exclude: Glob patterns to exclude files (default:["**/node_modules/**", "**/dist/**"])--dry-run: Show what would be changed without making changes--comment-style: Comment style to use (single,multi, orauto)--base-dir: Base directory for resolving relative paths--verbose: Enable verbose logging
License
MIT
