- Notifications
You must be signed in to change notification settings - Fork15
The end-to-end solution for configuring, refactoring, maintaining and using path aliases
License
davestewart/alias-hq
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The end-to-end solution for configuring, refactoring, maintaining and using path aliases
Path "aliases" are special identifiers (starting with@
or~
) that point to specific folders.
Using them in your codebase makes your imports easier to read and maintain:
// from thisimport{fooify}from'../../../core/services/foo'// to thisimport{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
Alias HQ is build-time tool which:
- uses
ts/jsconfig.json
as the single source of configuration - provides one-liner integrations to popular bundlers, frameworks and libraries
- has a CLI for quick configuration, and even source code migration
Begin byconfiguring aliases in your project'sts/jsconfig.json
:
{"compilerOptions": {"baseUrl":"src","paths": {"@packages/*": ["../packages/*" ],"@/*": ["/*" ],"@app/*": ["/app/*" ],"@services/*": ["/app/services/*" ] } }}
Use theAPI to sync your toolchain, frameworks, even your IDE:
// webpack.config.jsconfig.resolve.alias=hq.get('webpack')// jest.config.jsconfig.moduleNameMapper=hq.get('jest')// etc...
Use theCLI to migrate or maintain your source code:
? What do you want to do? - Configure paths - Setup integrations❯ - Update source code - Help - Exit
For a list of all supported frameworks, see theintegrations doc.
If you arealready using aliases:
- The Alias APIsimplifies your tooling with a singleconfig file andone-liner integrations
If you arethinking about using aliases:
- The Alias CLImigrates your project byconfiguring your paths andrewriting your imports
You canconfigure and migrate any project in less than a minute by:
- installing the package
- running the CLI
- following the prompts
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?
- Tweet orretweet about it :)
About
The end-to-end solution for configuring, refactoring, maintaining and using path aliases
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors9
Uh oh!
There was an error while loading.Please reload this page.