Git Product home page Git Product logo

alias-hq's Introduction

Alias HQ

tests

The end-to-end solution for configuring, refactoring, maintaining and using path aliases

Alias HQ logo

Abstract

Path "aliases" are @identifiers that simplify unwieldy or lengthy file imports.

Using them in your projects makes your code easier to read and maintain:

// from this
import { fooify } from '../../../core/services/foo' 

// to this
import { fooify } from '@services/foo' 

They are widely supported in the JavaScript ecosystem, however:

  • libraries have incompatible formats so require separate configurations
  • maintaining duplicate configurations is fiddly and error-prone
  • migrating source code is laborious and long-winded

TL;DR

If you are thinking about using aliases:

If you are already using aliases:

You can configure and migrate any project in less than a minute by:

  • installing the package
  • running the CLI
  • following the prompts

Overview

Alias HQ is configured using your project's ts/jsconfig.json:

{
  "baseUrl": "src",
  "paths": {
    "@packages/*": [ "../packages/*" ],
    "@/*": [ "/*" ],
    "@app/*": [ "/app/*" ],
    "@services/*": [ "/app/services/*" ],
    ...
  }
}

Note that you do not have to use TypeScript or VS Code to use Alias HQ.

The API makes sure your IDE, framework and toolchain are always in sync:

// webpack.config.js
config.resolve.alias = hq.get('webpack')

// jest.config.js
config.moduleNameMapper = hq.get('jest')

// etc...

The CLI makes sure your code is always up-to-date:

? What do you want to do?
  - Configure paths
  - Setup integrations
❯ - Update source code
  - Help
  - Exit

Getting started

Install via your package manager of choice:

npm i --save-dev alias-hq
yarn add -D alias-hq

To jump in without much reading:

For step-by-step instructions:

For a short video:

Wanna support the project?

alias-hq's People

Contributors

davestewart avatar gormonn avatar pankajpatel avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.