1.0.1 • Published 9 months ago

aliasify-imports v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

aliasify-imports · license

A codemod that swaps relative imports for aliases — your go-to buddy for project refactoring!

Installation

npm install -g aliasify-imports

Usage

Run the transformation on your source directory:

aliasify-imports --srcDir src --alias @

CLI Options

  • --alias (Default: @) - The alias to use for the import paths.
  • --srcDir (Default: src) - The source directory to use for the alias.
  • --parser (Default: 'tsx') - The parser to use
  • --extensions (Default: 'js,jsx,ts,tsx') - The file extensions to transform
  • --help - Display the help message

Example

Before

// In src/components/Header/index.js

import Logo from '../../assets/images/logo.png';
import Utils from '../../../utils/helpers';
import Footer from '../Footer';

After

// In src/components/Header/index.js

import Logo from '@/assets/images/logo.png';
import Utils from '@/utils/helpers';
import Footer from '@/components/Footer';

License

MIT

1.0.1

9 months ago

1.0.0

9 months ago