aliasify-imports

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i aliasify-imports

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

7.69 kB

Total Files

8

Last publish

Collaborators

  • evandrolg