1

In my .env I have the following variable:

SHOPIFY_STORE_URL=mystore.myshopify.com

Now I want to use this variable in a npm script:

  "scripts": {
    "shopify-login": "shopify login --store=SHOPIFY_STORE_URL",
  },

so $ npm run shopify-login should execute $ shopify login --store=mystore.myshopify.com

How can I achieve this?

Cenasa
  • 461
  • 4
  • 23

1 Answers1

0

When you are on a linux/mac operating system - this should work:

# .env
SHOPIFY_STORE_URL=mystore.myshopify.com

my test case:

  "scripts": {
    "shopify-login": "source .env && echo $SHOPIFY_STORE_URL"
  }

your test case:

  "scripts": {
    "shopify-login": "source .env && shopify login --store=$SHOPIFY_STORE_URL",
  },
madflow
  • 6,725
  • 1
  • 33
  • 44