/javascript-to-typscript

Utility to help migrate javascript apps to typescript.

Primary LanguageJavaScriptMIT LicenseMIT

DO NOT USE

This should no longer be used, you can now easily include js files with the allowJs setting in your tsconfig

Build Status Dependency Status ##javascript-to-typscript Utility to help migrate javascript apps to typescript.

Install

$ npm install javascript-to-typescript

Usage

  • from root of project
$ js-to-ts [OPTION] [PATH]

-p --startPath : starting path -f --filter : filter pattern -d --dryRun : dry run

  • All commands should be run from the root of your project
  • Running any of these commands will also install the following NPM packages
    • Typescript
    • Typings
Default options
$ js-to-ts 
BeforeAfter
                    
 src/
├── file1.js
├── file2.js
└── module/
    └── views/
        └── view1.html
    ├── file1.js
    └── file2.js
                    
                
                    
 src/
├── file1.ts
├── file2.ts
└── module
    └── views/
        └── view1.html
    ├── file1.ts
    └── file2.ts
├── tsconfig.json
└── typings.json
                     
                 

#####Specific Directory

$ js-to-ts --startPath ./src
BeforeAfter
.
 src/
├── file1.js
├── file2.js
└── module/
    └── views/
        └── view1.html
    ├── file1.js
    └── file2.js
└── utilities/
    ├── file1.js
    └── file2.js    
.
 src/
├── files1.ts
├── file2.ts
└── module
    └── views/
        └── view1.html
    ├── file1.ts
    └── file2.ts
└── utilities/
    ├── file1.js
    └── file2.js
├── tsconfig.json
└── typings.json
    

#####Additional Filter

$ js-to-ts --filter '**/file1.js'
BeforeAfter
                
 src/
├── file1.js
├── file2.js
└── module/
    └── views/
        └── view1.html
    ├── file1.js
    └── file2.js
                
            
                
 src/
├── file1.ts
├── file2.js
└── module
    └── views/
        └── view1.html
    ├── file1.ts
    └── file2.js
├── tsconfig.json
└── typings.json
                
            
Dry Run
$ js-to-ts -p ./src --dryRun
$ Files to Migrate: [
    'src/file1.js',
    'src/file2.js',
    'module/file1.js',
    'module/file2.js'
]