Registry / devops / typescript-migration-report

typescript-migration-report

JSON →
library1.0.5jsnpmunverified

A developer tool to calculate the percentage of TypeScript vs. JavaScript files and lines in a codebase, helping track migration progress from JavaScript to TypeScript. Version 1.0.5 is current. It scans the project using glob patterns, logs files per type, and generates a terminal table and optional JSON report. Unlike generic code counters, it specifically focuses on TypeScript migration metrics with test file separation and CI-friendly output. The library ships TypeScript types, supports ESM via programmatic API, and requires a tsreport.config.js configuration file. Release cadence is low with no recent updates.

npm install typescript-migration-report
INSTALL
IMPORT
SIG · TYPESCRIPT-MIGRATI
T
typescript-migration-report
devopsjavascriptv1.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import tsMigrationReport from 'typescript-migration-report'
const tsMigrationReport = require('typescript-migration-report')
The package exports a default function but is also usable with require. For ESM use import.
runReport
import { runReport } from 'typescript-migration-report'
const { runReport } = require('typescript-migration-report')
Named export exists for programmatic use. CommonJS require works too.
Config
import type { Config } from 'typescript-migration-report'
import { Config } from 'typescript-migration-report' // Config is a type
Config is a TypeScript type exported for configuration typing. Use import type for type-only usage.

Install and configure typescript-migration-report with a config file, then run it via npm script to get migration stats.

// Install: npm install typescript-migration-report --save-dev // Create tsreport.config.js: module.exports = { patterns: { typescript: '**/*.{ts,tsx}', typescriptTests: '**/*.test.{ts,tsx}', javascript: '**/*.{js,jsx}', javascriptTests: '**/*.test.{js,jsx}', }, rootDir: './', exclude: ['node_modules/**', 'dist/**'], generateReport: true, logFiles: { typescript: false, javascript: false }, }; // Add script to package.json: // "ts-report": "typescript-migration-report" // Run: npm run ts-report // Output shows table with counts and TypeScript percentages.
Debug
Known issues
gotchaConfiguration file must be named 'tsreport.config.js' and placed in project root. Other file names or paths will be ignored silently.
fix
Rename config file to 'tsreport.config.js' in the project root.
affects: >=1.0.0
gotchaLibrary does not support ESM configuration (tsreport.config.mjs). Only CommonJS module.exports works.
fix
Use module.exports in tsreport.config.js instead of export default.
affects: >=1.0.0
gotchaGlob patterns are not validated; incorrect syntax (e.g., missing '**/') may cause no files to be scanned without error.
fix
Test glob patterns using the glob package directly before running the tool.
affects: >=1.0.0
deprecatedThe 'rootDir' option defaults to './' but using '.' may behave unexpectedly on some OS. Specifying full path is safer.
fix
Set rootDir to a resolved absolute path (e.g., using path.resolve('.')) to avoid ambiguity.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'typescript-migration-report'
Package not installed or not installed as devDependency.
fix
Run `npm install typescript-migration-report --save-dev`
Error: Config file not found: tsreport.config.js
Missing or misnamed configuration file in project root.
fix
Create a tsreport.config.js file in the project root with appropriate configuration.
TypeError: patterns is not iterable
Config patterns object missing or invalid format.
fix
Ensure tsreport.config.js exports an object with a patterns property containing at least 'typescript' and 'javascript' glob strings.
Empty output: no files scanned
Glob patterns do not match any files or rootDir is incorrect.
fix
Verify rootDir points to project root and patterns like '**/*.{ts,tsx}' are correct for your directory structure.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
globrequiredUsed for matching file patterns against the filesystem
Agent activity
6 hits · last 30 days
node
6
Resources
typescript-migration-report — npm install typescript-migration-report · libregistry