- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Hello, and thank you for this wonderful project!
I'm just a junior dev trying to figure out how to set up codemods for our company's design system. I'd been playing around with setting up a script in our package which would use the jsCodeshift executable to run the transforms I'd written, but then I found hypermod and thought that could potentially save me from myself and I could instruct consumers to run something like:
npx @hypermod/cli --packages @myob/myob-widgets@9.0.0 ./src
However, our package @myob/myob-widgets
is a private package, so I'm imagining that's why I'm getting the following error:
Error: Unable to locate package from Hypermod Community or NPM.
Make sure the package name "@myob/myob-widgets" is correct and try again.
Am I right in thinking that it won't work because @myob/myob-widgets
is a private package? And are my options therefore to either (a) create a separate public NPM package with transforms which hypermod would be able to access, or (b) try to set up a script myself to run the transforms with jsCodeshift in our private package.
Thanks for your help, and my apologies if this question is in the wrong place / wildly off the mark
Activity
danieldelcore commentedon Oct 22, 2023
Hey @alistairwilliamtaylor 👋 Thanks for raising an issue! I should really create a page for this on the site.
It should be possible to use hypermod for private packages, you might need to use either the
--registry
and/or--registryToken
flags to point the CLI to your private npm registry.https://www.codeshiftcommunity.com/docs/cli#--registry
https://www.codeshiftcommunity.com/docs/cli#--registrytoken
Assuming developers within your company are using the correct
.npmrc
configuration, the--registry
URL should be sufficient 🤔. Could you give it a go and let me know if that solves your problem?alistairwilliamtaylor commentedon Oct 22, 2023
Oh thank you so much for getting back to me about this - I'll give it a go in the next few days and let you know
danieldelcore commentedon Oct 22, 2023
Wonderful, feel free to reach out whenever! I'd love to make sure you guys can use hypermod successfully! 🙏
alistairwilliamtaylor commentedon Oct 24, 2023
Thanks Daniel!
I've been having a go over the past few days, but sadly no success yet.
I might potentially have a bit of a lead, though? I initially tried just with
--registry
but haven't had any luck with that, so tried providing--registryToken
as well. This produced a somewhat different result, because the CLI would get to:And then the cursor just hangs and hangs on that - it never produces an error message, but it also doesn't work. I tried providing a bogus registry and/or bogus registry token and it fails immediately if either of them is wrong, which leads me to believe that when it hangs it is a somewhat encouraging sign?
I'm happy to keep playing around with this, please feel free to let me know if you have any suggestions about things I could try
danieldelcore commentedon Oct 25, 2023
Ah really interesting, I wonder why it's hanging like that 🤔 Does the npm package have a large bundlesize? It could be hanging while it downloads and maybe fail silently. Could you share some logs if there are any?
alistairwilliamtaylor commentedon Oct 26, 2023
Initially I was cancelling the command because it was hanging for so long, but if I leave it for 5-6 minutes I eventually get:
danieldelcore commentedon Oct 27, 2023
Ah I see, the package loader we use has some drawbacks. I suspect the bundlesize is too large which is causing it to run out of memory. I have implemented a more robust loader behind the [
--experimentalLoader](https://github.com/hypermod-io/hypermod-community/blob/2b9179a34efcd9d1edcdbead5b1fd6c839f72d75/packages/cli/src/index.ts#L70C5-L70C5) flag. It should be able to handle larger packages but doesn't yet have support for
--registryToken` 😭 I'll have to update it and see if that fixes your issue.Is the package you're deploying you're codemods with quite large?
alistairwilliamtaylor commentedon Oct 30, 2023
Yeah it is quite large - it has all of our components for the design system in it. Sorry about that! I'm not opposed to creating a separate package for the hypermod codemods for now, so that I can start playing around more with hypermod. I'll try to have a go this week.
Thanks for all of your support with this! 😄
danieldelcore commentedon Oct 31, 2023
No worries at all! Feel free to reach out if you run into any more issues, I'd be more than happy to help!
Yeah, a standalone package in this case would be the best way to go!
I recommend having a look at this guide: https://www.codeshiftcommunity.com/docs/external-packages 😄