Miss any of our Open RFC calls?Watch the recordings here! »

ts-migrate-server

0.1.7 • Public • Published

ts-migrate-server

ts-migrate-server is a package that contains the main migration runner and spawns a TSServer process. ts-migrate-server is designed around Airbnb projects. Use at your own risk.

Install

Install ts-migrate-server using npm:

npm install --save-dev ts-migrate-server

Or yarn:

yarn add --dev ts-migrate-server

Usage

import path from 'path';
import { forkTSServer, migrate, MigrateConfig } from 'ts-migrate-server';
 
// get input files folder
const inputDir = path.resolve(__dirname, 'input');
 
// initialize typescript server
const server = forkTSServer();
process.on('exit', () => {
  server.kill();
});
 
// create new migration config. You can add your plugins there
const config = new MigrateConfig();
 
// run migration
const exitCode = await migrate({ rootDir: inputDir, config, server });
 
// kill server
server.kill();
process.exit(exitCode);

FAQ

How can I use ts-migrate-server?

You can take a look at basic usage example. Another resource would be source code of the ts-migrate cli.

Why not just use codemods?

You actually can use codemods in your plugins! ts-migrate-server provides more standartalized API around TypeScript compiler usage and allows us to use the benefits of the TypeScript Server protocol.

I have an issue with a specific plugin, what should I do?

Please file an issue here.

Contributing

See the Contributors Guide.

Install

npm i ts-migrate-server

DownloadsWeekly Downloads

3,618

Version

0.1.7

License

MIT

Unpacked Size

82.6 kB

Total Files

39

Last publish

Collaborators

  • avatar
  • avatar