AlleyFord / schematic

Javascript-driven, Shopify CLI-friendly, grunt/webpack/etc-friendly schema management
15 stars 1 forks source link

Output directory? #1

Closed jacobkossman closed 9 months ago

jacobkossman commented 1 year ago

Hey! This looks super cool / promising and I want to look into it further. However on first glance it doesn't seem like there's a way to specify an output directory? I'm using Shopify CLI and I'm worried about breaking themes when it uploads non-replaced schema. I'm hoping there's a way to have something like a src folder for the sections as well? Maybe I'm just overlooking something but if you could provide an example of how to use "properly" with Shopify CLI that'd be sweet. Thanks!

josho commented 1 year ago

Sure! It works directly on the theme files, so you should be able to run it from the theme's root directory. By default, it looks for schema files in src/schema. image

jacobkossman commented 1 year ago

I mean is there a way to have both the final output files, the schema config files and the schematic marked up with comments all coexist? i'm just confused as to how you can update the schema if it compiles directly in the same file?

or now i'm thinking about it: does the comment added at the bottom always stay there? and the schema is regenerated above? i haven't had a chance to install and test yet.

EDIT: nevermind: finally got around to installing and this is fantastic! i added npm-watch and it's gonna be perfect 😍

quick question though @josho: when i installed and tried to run the first time it was looking for schema-utils but it wasn't installed by npm i -D @alleyford/schematic i had to manually install. I'm gonna assume it's an issue on my end but worth a look to see if you can duplicate.

thank you so much for this, it's a literal game-changer.

josho commented 1 year ago

Oh yeah, sorry for the confusion! And yeah, it'll stick the generated schema directly below the magic comment itself in each file directly. I should make that more clear, or maybe an option, cuz it's a little scary trusting something to hack on your files directly.

And good catch on schema-utils, it's marked as a dev dependency in the repo and not a dependency. That's my bad! Will update.

Glad you dig it. It's 100% essential for any Shopify dev work I do now!