janniks / basetag

βšΎοΈβ€‚A better way to import local NodeJS modules
MIT License
37 stars 3 forks source link

Move to CLI/bin approach #22

Closed janniks closed 3 years ago

janniks commented 3 years ago

@coolaj86 I released a preview as 2.0.0-beta

Can be tested via npx with the -p package specifier:

npx -p basetag@2.0.0-beta basetag
npx -p basetag@2.0.0-beta basetag link
npx -p basetag@2.0.0-beta basetag link
janniks commented 3 years ago

Unfortunately, the postinstall tag only works for packages that are being installed. i.e. when we use postinstall in projects that are supposed to be used with basetag (e.g. project-alice), that postinstall script is not executed whenever dependencies are installed via npm install for projects-allice. But rather when somebody installs project-alice as a dependency...

I found an alternative though:

I will try to integrate this into the basetag link command this week.

coolaj86 commented 3 years ago

Unfortunately, the postinstall tag only works for packages that are being installed.

If I have { "postinstall": "npx basetag" } in my own package.json, and it works as expected. Every time I run npm install, npx basetag runs after, putting the link back in place.

coolaj86 commented 3 years ago

I haven't tried this out yet, but it looks like .hooks/postinstall is equivalent to package.json.scripts.postinstall from the description.

janniks commented 3 years ago

Interesting, I thought I tried that earlier. I could swear it doesn't work. Will try again tomorrow

janniks commented 3 years ago

Can you somehow provide me with an example that works? I have tried a bunch of times now and it doesn't seem to work for me... Using npm v6.14.11

According to 1, 2, 3 this doesn't work but rather the .hooks have to be used...

coolaj86 commented 3 years ago

For reference, we continued and resolved this conversation in https://github.com/janniks/basetag/pull/21

I see that #21 was merged into https://github.com/janniks/basetag/tree/add-bin-structure, but that's not yet in master. Is that waiting for something?

janniks commented 3 years ago

Thanks for the ping and sorry for taking so long. I'll look into this tomorrow β€” haven't had a lot of spare time in the last two weeks, but I should be somewhat free now.

I'll add one more small fix and push a new version tomorrow

janniks commented 3 years ago

I think this looks decent... 😬

I've added

janniks commented 3 years ago

Deployed via v2.0.0 β€” @coolaj86 would love to hear your feedback, I think everything should work πŸ‘€