0.12.0 • Published 5 years ago
shopctl v0.12.0
shopctl
CLI to manage Shopify stores.
Installation
npm install -g shopctlGetting Started
Set the required environment variables:
SHOPIFY_SHOP_NAME=my-shop-name SHOPIFY_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SHOPIFY_PASSWORD=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXEnvironment variables may be defined in a
.envfile in the root directory of your project.In the root directory of your project, add a file named
shopctl.jsonwith content of the following form:project-root/shopctl.json:{ "products": [ "products/shoes.json", "products/hats.json", "products/shirts.json" ] }Add each product type definition file listed in
shopctl.jsonin the form as follows:project-root/products/shoes.json:{ "type": "Shoe", "dataPath": "shoes.csv", "specifications": [{ "key": "size", "label": "Size" }, { "key": "color", "label": "Color" }], "title": "{{name}}, {{size}}, {{color}}" }dataPathdefines the path of the products data file (see next step) relative to this file.shopctluses Mustache to generate the product title. Thetitlestring defined in the product type definition file may therefore be written using Mustache template syntax.{{ tags }}in the template may reference the column names defined in the product data file.
Add the products data file for each product type:
project-root/products/shoes.csv:shopifyId,brand,name, size, color ,33969,Asics, DynaFlyte 4, 10, Blue ,33983,Adidas,Ultaboost 20, 11, Red ,40127,New Balance,Fresh Foam Beacon V2, 12, GreyThe
shopifyIdcolumn may be left blank and will be populated byshopctlonce the product is added to the store.
The project is now all set up and ready to be used by shopctl from the project root directory:
shopctl help
shopctl products count
shopctl products pushDevelopment
Build and watch:
npm startIn a separate terminal, run the CLI:
npm link shopctl help