aliasify-imports ·
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
import Logo from '../../assets/images/logo.png';
import Utils from '../../../utils/helpers';
import Footer from '../Footer';
After
import Logo from '@/assets/images/logo.png';
import Utils from '@/utils/helpers';
import Footer from '@/components/Footer';
License
MIT