Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import aliases from external file #4

Closed
Avivhdr opened this issue Aug 10, 2021 · 3 comments
Closed

Import aliases from external file #4

Avivhdr opened this issue Aug 10, 2021 · 3 comments

Comments

@Avivhdr
Copy link

Avivhdr commented Aug 10, 2021

Hi @gkalpak,
I'm looking for something like this for a long time.
I'm using .gitconfig for all my git aliases but I need one for npm as well.
Do you think it would be possible to create my own alias file in which I can edit the aliases by my liking?

Thank would be perfect!

@gkalpak
Copy link
Owner

gkalpak commented Aug 12, 2021

Hey, @Avivhdr!

I haven't really thought about it (since this repo has been intended for personal use 😃), but I wouldn't be opposed if there was a clean way of doing it. However, I see the following issues with loading the aliases from a local config file (off the top of my head):

  • The way this package makes the defined aliases available as executables on the user's PATH is by leveraging NPM's package.json -> bin property. This wouldn't be possible (without hacks?) with locally defined aliases afaik.
  • One of the main purposes of this package is easy installation on any system that has Node.js installed. Having the aliases defined in a local config file kind of beats the purpose (although could be partially worked around by loading the file from a remote location, such as a GitHub gist or repo).

There are ways to work around these issues, but I am not sure if the effort is worth it 😃
It might just be easier to fork this repo and publish it as your own NPM package. You could define your aliases by modifying the ALIASES variable in lib/constants.js and updating the bin field in package.json accordingly.

@Avivhdr
Copy link
Author

Avivhdr commented Aug 18, 2021

Hi @gkalpak,
I think I'll try to fork the repo and customize it to my needs!

Hopefully, I'll update you soon on how it went.

@Avivhdr Avivhdr closed this as completed Aug 18, 2021
@gkalpak
Copy link
Owner

gkalpak commented Aug 18, 2021

Awesome! Looking forward to hearing how it went.
Feel free to reach out if you have any questions/need any help. (This project has always been intended for personal use and there are a lot of rough edges 😅)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants