aliasify-imports
v1.0.1
Published
A codemod that swaps relative imports for aliases — your go-to buddy for project refactoring!
Downloads
21
Maintainers
Readme
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
// 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';