2

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
  • 531
  • 9
  • 27

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
  • 7,718
  • 3
  • 39
  • 54