-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add automatic Alias HQ registration for Node #48
Conversation
560cffd
to
bc5846d
Compare
@davestewart what about this? |
Hey, thanks for your PR. It seems from the code you added, that this code could all be local to your project: {
"scripts": {
"dev": "ts-node -r ./config/alias-hq.js src/main.ts"
},
} // config/alias-hq.js
require('alias-hq').get('module-alias') If so, I think it should just be an update to the Implementation doc, rather than a package update. Can you confirm? |
@davestewart would be convenient to have it included in the npm package. Is there a reason not to include it? |
@davestewart works exactly as you describe. Actually is the same thing that
I think it's a must to have feature and in my opinion, it must be included in the package as @andidev says. |
Hi both, and thanks for your input and thoughts. The problem is, for this PR you're pleading for a "special case" for Node (though, good to know about the require flag!). Where all the other integrations (WebPack, Rollup, Jest, etc) are expected to write their own config, you're asking that Node have its integration bundled with Alias (in the root, as well!) so you can just require a file. The purist / maintainer part of me is torn; Alias HQ is a general package, so:
Maybe there are workarounds:
The other options are:
I just want to explore this before making a decision. Waiting for your feedback :) |
IMO because node is not a random bundler, library, it can have special treatment. It doesn't have to live in the root, but what if you create a package export for it to mimic it? 🤔 Post install hooks are a bad practice since they don't play nice with different module resolutions such as the ones used by pnpm and yarn's pnp. |
@donferi - nice! I didn't know about the I've updated it to work that way. @diegoulloao - do you want to test it all works at your end? |
Me neither. I agree this is the way to go. Great. |
Note that – for some reason the automated coverage testing is failing. I think it's something to do with the I can always ignore the actions and merge regardless. |
@davestewart sorry the delay. I just tested in my local and it's working fine. We can proceed! great job 🚀 |
I have only one question: Why |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks fine! jest tests passing.
Good question, and one I to'ed and fro'ed on... In the TS Node project
The word "register" is mentioned 25 times on the main page! As Alias HQ has no concept of services, and this is actually just an implementation detail in Module Alias, it didn't really make sense to use the verb "register"; it's actually just running / executing / initialising / <choose your verb here!> Alias HQ so I went with something generic. I had also considered:
The thing is, I think only Node will run like this; the rest of the integrations / plugins must return their content, so the multiple exports, i.e. Sound reasonable? |
That was what I thought.
Very good point I didn't notice 👌🏻 Definitely |
I check with another project (locally) that the tweaks (package exports) don't break anything, then in lieu of getting these f-ing Actions to work, probably just force the merge then we high five each other and kick back with Negronis. I have a Webinar I need to prepare for tomorrow though, so it will probably be Saturday when I get on this again :) |
Negronis, I need to try that one 🤔 Ok, sounds like a plan. Good luck with the Webinar speech 😎 |
@davestewart, so is all okay for you? |
🚀 |
feat: register script
From #46
Provides a script to easily register paths from any package script just like module-alias:
E.g.
Also is possible to use with nodemon.
Changelog:
docs/integrations.md
- instructions updated for Nodepackage.json
-v5.3.2
->v5.4.0
Added
register.js
new