Skip to content

Commit

Permalink
Feat register script
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoulloao committed Apr 13, 2022
1 parent d3de862 commit 560cffd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
30 changes: 30 additions & 0 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,36 @@ Setup is simple; add the following line in your application's main file, before
require('alias-hq').get('module-alias')
```

Also is possible to register your paths from any package script just like [module-alias](https://www.npmjs.com/package/module-alias):

```json
{
"scripts": {
"dev": "ts-node -r alias-hq/register src/index.ts"
},
}
```

For the `dist` app, update your `package.json` like:

```json
{
"scripts": {
"start": "node -r alias-hq/register src/index.js"
},
}
```

If you are using nodemon:

```json
{
"scripts": {
"dev": "nodemon --exec ts-node -r alias-hq/register src/index.ts",
},
}
```

## JSON-only

For libraries or setups that require JSON, you can use the [CLI](cli/cli.md):
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alias-hq",
"version": "5.3.2",
"version": "5.4.0",
"description": "The end-to-end solution for configuring, refactoring, maintaining and using path aliases",
"main": "src/index.js",
"bin": "bin/alias-hq",
Expand Down
11 changes: 11 additions & 0 deletions register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
*
* Alias-hq: Register
* @description provides a script to easily register paths from any package script
*
* Usage: ts-node -r alias-hq/register src/index
* with nodemon: nodemon --exec ts-node -r alias-hq/register src/index
*
*/

require('./src/index').get('module-alias')

0 comments on commit 560cffd

Please sign in to comment.