Shopify/shopify-cli-extensions

Extension templates produce NPM scripts that don’t work when called directly

lemonmade opened this issue · 0 comments

A new extension has two build scripts: build and develop. The typical expectation in a Node project is that these scripts can be run directly, for example, by running npm run build or yarn develop. However, that is not the case for these scripts — only the Shopify CLI can realistically call them properly, as there is a specifically-formatted input they are expecting.

I am not really sure what to recommend here. It was my understanding that we wanted to expose the build/ develop commands so developers could replace our commands in cases where their extension has special needs. This is theoretically possible, but the introduction of a completely opaque input type passed between the Shopify CLI and the @shopify/shopify-cli-extensions binary makes it so this is not really practical for most developers.

As a minor added annoyance, the template puts the @shopify/shopify-cli-extensions package in with a version of latest. This is generally frowned upon in Node projects, as it makes package installation update commands potentially introduce breaking changes. The default npm behavior is to add dependencies with a tilde (e.g., ^0.2.0), and in general I think CLIs installing dependencies should match this default.