npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mts-migrator

v2.1.11

Published

js to ts migration engine — converts commonjs to esm, infers types from ast analysis, extracts jsdoc annotations, and refines types with the typescript compiler

Downloads

1,139

Readme

A js → ts code migrator,

In the world of misunderstanding, To be As accurate as possible

converts javascript files to typescript — handles module system conversion (commonjs → esm), infers types from ast analysis, extracts jsdoc annotations, refines types with the typescript compiler, and optionally runs eslint --fix.

js → ts migrator by Laxenta INC.

I also have devloped A Wallpaper Engine in Rust/Tauri! Colorwall

Install

you can use it directly via pnpm dlx or npx without installing:

pnpm dlx mts-migrator
# or
npx mts-migrator

OR install globally (recommended for frequent cli usage):

pnpm add -g mts-migrator
# or
npm i -g mts-migrator

----------------------------------- Cli usage, All commands are listed --------------------------------

when you run mts (or pnpm mts / npx mts-migrator) without a target, it will prompt you if you want to run it on all folders in your current directory. if you specify a folder name, it will recursively search for a folder with that name so you don't have to specify the exact path!

> IF YOU WANT TO USE TO MIGRATE YOUR FOLDER, JUST COPY THIS COMMAND:

# run interactively (will prompt for confirmation)
pnpm mts
# Or Migrate (to typescript) a specific folder by name (recursively searches for "components named folder")
pnpm mts components
# HELP COMMAND!
pnpm mts --help
# use --target explicitly
pnpm mts --target utils
# preview changes without writing
pnpm mts src --dry-run
# skip ts-morph type refinement
pnpm mts src --no-refine
# skip `eslint --fix` post-processing  
pnpm mts src --no-lint

```bash
# show help
pnpm mts --help

what it does

.js file → parse (babel) → convert modules → inject types → generate .ts
         → refine types (ts-morph) → eslint --fix → done

module conversion

  • const fs = require('fs')import fs from 'fs'
  • const { x } = require('y')import { x } from 'y'
  • require('dotenv').config()import 'dotenv/config'
  • module.exports = { x, y }export { x, y }
  • exports.x = yexport { y as x }
  • strips .js/.jsx from relative imports
  • deduplicates imports from the same source

type inference

  • literals: "hello"string, 42number, trueboolean
  • constructors: new Map()Map<any, any>, new Date()Date
  • known apis: Math.floor()number, process.env.Xstring | undefined
  • arrays: [1, 2, 3]number[]
  • binary ops: a + bnumber or any, a === bboolean
  • jsdoc: @param {string} namename: string

type refinement (ts-morph)

after the initial babel pass, ts-morph uses the typescript compiler to replace any annotations with actually-inferred types where possible.

eslint integration

if eslint is installed in your project, mts will run eslint --fix on the migrated files automatically. if not, it skips silently.

programmatic api

import { migrateCode, codeToAST, injectTypes, convertModuleSystem } from 'mts-migrator';

// quick: convert a code string
const { code, errors } = migrateCode('const x = require("fs");');

// granular: use individual steps
const { ast } = codeToAST(jsCode);
convertModuleSystem(ast);
injectTypes(ast);
const tsCode = astToCode(ast);

features

  • backups: original files are backed up before migration
  • dry run: preview what would change without writing
  • error recovery: non-fatal parse errors don't block migration
  • migration report: json report with per-file status
  • config skip: automatically skips config files (webpack, babel, eslint, etc.)

what it doesn't do

  • fix logic bugs in your code
  • handle flow types (use flow-to-ts for that)
  • replace manually-written type annotations
  • guarantee zero any in output (but it tries hard)

license

AGPL-3.0


made with <3 by laxenta inc