Live data from Hacker News

From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

shopify.engineering

41–50 of 109 posts

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#41

I just find working with Node to be gross. Look at this: https://github.com/Shopify/cli/blob/main/package.json but wait...this too: https://github.com/Shopify/cli/blob/main/packages/app/packag... https://github.com/Shopify/cli/blob/main/packages/cli-hydrog... https://github.com/Shopify/cli/blob/main/packages/cli/packag... https://github.com/Shopify/cli/blob/main/packages/create-app... etc, etc, etc VS https://github.…

They think of it as a benefit: "Node’s module system allows having multiple versions of the same transitive package without conflicting with each other"

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#42
Regarding one of the problems they cited--If anyone is interested in deploying a stand-alone ruby CLI executable using a modern Ruby (3.1), the fork here can do that, but you need to compile the rubyc for each platform first (not used the linked ones in the readme).

https://github.com/ericbeland/ruby-packer

Also, there was an issue with the most recent X-Code, so I had to actually downgrade my local X-Code to compile rubyc.

I wonder if Shopify had known they could build the ruby CLI into stand-alone binaries (no Ruby install or Node needed) if they would have still gone the Node route? Not that I blame them for not knowing--I had to fork the motor-admin fork, and update a few things to get it working. The original ruby-packer only works with ancient Rubies.

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#43

Cool. But god, the Shopify CLI / developer experience has degraded so much in the past few years. With the newest iteration, they want a full app re-structure just to work with the CLI properly. It is absolutely brutal. Sure, before they had basically no tooling, but then they had some basic ones that everyone was basically happy with, and then they just decided to iterate too much. (saying this as a ~ 8 year long Pa…

My read on this is they just wanted to cut out Ruby and do everything in Node. That's fine as a decision, but rest of the article feels like just trying to justify it after the fact. Like someone at the top decided, now lets pretend it's a good decision. As you mentioned, if they're not OK with CLI, they could refactor in Ruby. The whole "embracing functional programming" and MVC architecture (i think Rails when i he…

> Like someone at the top decided, now lets pretend it's a good decision.

It might not even be a top thing, if they migrated internal eng from Ruby to node internally I would not be surprised if this was dev-driven either

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#44

I just find working with Node to be gross. Look at this: https://github.com/Shopify/cli/blob/main/package.json but wait...this too: https://github.com/Shopify/cli/blob/main/packages/app/packag... https://github.com/Shopify/cli/blob/main/packages/cli-hydrog... https://github.com/Shopify/cli/blob/main/packages/cli/packag... https://github.com/Shopify/cli/blob/main/packages/create-app... etc, etc, etc VS https://github.…

You are missing a few things about the Ruby based CLI:

1. dependencies for Gems are specified in the gemspec file and not the Gemfile. See https://github.com/Shopify/shopify-cli/blob/main/shopify-cli... for example. There's a few non-development dependencies.

2. since it's difficult to package up a Ruby gem for distribution, maybe dependencies were vendored directly in the codebase: https://github.com/Shopify/shopify-cli/tree/main/vendor

This isn't meant to be a comparison of the number of dependencies or anything. Just pointing out a few nuances to how the Ruby dependencies were handled.

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#45

I just find working with Node to be gross. Look at this: https://github.com/Shopify/cli/blob/main/package.json but wait...this too: https://github.com/Shopify/cli/blob/main/packages/app/packag... https://github.com/Shopify/cli/blob/main/packages/cli-hydrog... https://github.com/Shopify/cli/blob/main/packages/cli/packag... https://github.com/Shopify/cli/blob/main/packages/create-app... etc, etc, etc VS https://github.…

One reason is because ruby has a large standard library. Also people just pick what they know - there are more js devs than ruby devs. Also neither ruby nor node are a good choice for a cli, so it is kind of a moo point.

> there are more js devs than ruby devs.

Not at Shopify there ain't.

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#46
post #30

PSA: The singleton context configuration is probably the most disgusting thing I've seen in Ruby culture. Please do not bring this practice to node -- I've already witnessed this crime in shopify SDKs and stripe.

Honest question: Why is it a bad pattern? And what are some better alternatives from other ecosystems?

The singleton pattern generally tends to be hard to write tests for. Singletons are basically a global object with static methods.

The dependency injection pattern fits better. DI is basically passing around objects which conform to an interface. This way you can mock out those objects more easily.

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#47
Questionable decision making. Why not use Go when minimizing runtime dependencies is first priority? I’d probably just have cleaned up the Ruby code and used something like Ruby-Packer to create binaries. When typing is so important why not use rbs? Makes no sense to me.

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#48

Heroku did the same

If only Heroku had any customers remaining to use it

The free tier shutdown was definitely not the best marketing. Their prices are steep in a docker/kubernetes world. They could have had at least left the free tier for Ruby projects as it’s their origin.

Re: From Ruby to Node: Overhauling Shopify’s CLI for a better developer experience

#50
post #47

Questionable decision making. Why not use Go when minimizing runtime dependencies is first priority? I’d probably just have cleaned up the Ruby code and used something like Ruby-Packer to create binaries. When typing is so important why not use rbs? Makes no sense to me.

Agreed. Go is the obvious clear winner here for a CLI executable.
Post reply on HN