Skip to content

andriyor/default2namedExport

Repository files navigation

default2namedExport

Install

npm i -g d2n 

CLI

d2n src/index.ts --project-files='{src,test}/**/*.{tsx,ts,js}' --work-on='src/components/form/**/*.{tsx,ts,js}'

API

import { migrateToNamedExport } from 'd2n';

migrateToNamedExport({
  projectFiles: '{src,test}/**/*.{tsx,ts,js}',
  workOn: 'src/components/form/**/*.{tsx,ts,js}',
})

TODO

  • Import from file with export default under different name
  • Index file with export { default } from './module';
  • Index file with multiple export { default as method } from './module';
  • Import from index file under different name
  • Handle mixed imports import COmponent, { Props } from './component';
  • Partial migrate by glob pattern
  • Handle jest.mock with default property
  • Handle jest.mock without default property
  • Handle lazy/dynamic import
  • Ignore files which will be required
  • Run as CLI
  • Publish npm package
  • Run "Convert 'require' to 'import'"
  • Save previous imports with alias

About

Convert default export to named export

Topics

Resources

Stars

Watchers

Forks