@shopify/slate-env
Advanced tools
Comparing version 1.0.0-alpha.19 to 1.0.0-alpha.20
@@ -7,3 +7,3 @@ /* eslint-disable no-process-env */ | ||
const slateEnv = require('../index'); | ||
const config = require('../config'); | ||
const config = require('../slate-env.config'); | ||
@@ -287,10 +287,14 @@ const envPath = path.resolve(config.envRootDir, config.envDefaultFileName); | ||
test('the store URL environment variable is not a .myshopify.com URL', () => { | ||
setVars( | ||
Object.assign({}, TEST_ENV, { | ||
[config.envStoreVar]: 'someValue', | ||
}), | ||
test('the store URL environment variable is not a .myshopify.com or myshopify.io URL', () => { | ||
['shop1.myshopify.com', 'shop1.myshopify.io', 'shop1'].forEach( | ||
value => { | ||
setVars( | ||
Object.assign({}, TEST_ENV, { | ||
[config.envStoreVar]: value, | ||
}), | ||
); | ||
const result = slateEnv.validate(); | ||
expect(result.errors).toHaveLength(value === 'shop1' ? 1 : 0); | ||
}, | ||
); | ||
const result = slateEnv.validate(); | ||
expect(result.errors).toHaveLength(1); | ||
}); | ||
@@ -297,0 +301,0 @@ |
@@ -6,3 +6,3 @@ /* eslint-disable no-process-env */ | ||
const dotenv = require('dotenv'); | ||
const config = require('./config'); | ||
const config = require('./slate-env.config'); | ||
@@ -101,5 +101,8 @@ const SLATE_ENV_VARS = [ | ||
errors.push(new Error(`${config.envStoreVar} must not be empty`)); | ||
} else if (store.indexOf('.myshopify.com') < 1) { | ||
} else if ( | ||
store.indexOf('.myshopify.com') < 1 && | ||
store.indexOf('.myshopify.io') < 1 | ||
) { | ||
errors.push( | ||
new Error(`${config.envStoreVar} must not be a valid .myshopify.com URL`), | ||
new Error(`${config.envStoreVar} must be a valid .myshopify.com URL`), | ||
); | ||
@@ -106,0 +109,0 @@ } |
{ | ||
"name": "@shopify/slate-env", | ||
"version": "1.0.0-alpha.19", | ||
"description": "Creates and reads environment variable files for Slate", | ||
"version": "1.0.0-alpha.20", | ||
"description": "Manages the environment variables which are needed by Slate to interact with Shopify servers.", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/shopify/slate.git" | ||
}, | ||
"repository": "https://github.com/Shopify/slate/tree/1.x/packages/slate-env", | ||
"author": "Shopify Inc.", | ||
@@ -17,3 +14,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@shopify/slate-config": "^1.0.0-alpha.19", | ||
"@shopify/slate-config": "^1.0.0-alpha.20", | ||
"dotenv": "^4.0.0" | ||
@@ -20,0 +17,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
#@shopify/slate-env | ||
# @shopify/slate-env | ||
@@ -10,3 +10,3 @@ Manages the environment variables which are needed by Slate to interact with Shopify servers. Can create and run `.env` files used to store Slate environment variables for development. | ||
``` | ||
$ slate-tools start --env production | ||
$ slate-tools start --env=production | ||
``` | ||
@@ -19,21 +19,49 @@ | ||
```bash | ||
# This file contains the information needed for Shopify to authenticate | ||
# requests and edit/update your remote theme files. | ||
# | ||
# 1. Set up a private app (https://help.shopify.com/api/guides/api-credentials#generate-private-app-credentials) | ||
# with "Read and write" permissions for "Theme templates and theme assets". | ||
# 2. Replace the required variables for each environment below. | ||
# | ||
# password, theme_id, and store variables are required. | ||
# | ||
# Ignore Files accepts multiple patterns, seperated with ':' | ||
# | ||
# For more information on this config file: | ||
# Configuration variables | http://shopify.github.io/themekit/configuration/ | ||
# Ignore patterns | http://shopify.github.io/themekit/ignores/ | ||
# The API password generated from a Private App | ||
SLATE_PASSWORD= | ||
SLATE_PASSWORD= | ||
# The ID of the theme you wish to upload files too. | ||
SLATE_THEME_ID= | ||
# The myshopify.com URL to your Shopify store. | ||
SLATE_STORE= | ||
# A list of file patterns to ignore, with each list item seperated by ':' | ||
SLATE_IGNORE_FILES= | ||
``` | ||
# Store / Environment Configuration Tips | ||
Knowing what to put in your `.env` isn't always straightforward. This guide aims to clarify what data is needed, and where to get it. | ||
_Note: [ThemeKit](http://shopify.github.io/themekit/) is the tool that powers Slate deploys. See it's | ||
[configuration variables documentation](http://shopify.github.io/themekit/configuration/) for more details._ | ||
### Finding your SLATE_THEME_ID | ||
\_**warning:** some commands ([`start`](https://github.com/Shopify/slate-cli#start), [`deploy`](https://github.com/Shopify/slate-cli#deploy)) will overwrite the existing code on this `SLATE_THEME_ID` with your local project's content. | ||
To avoid losing work, we suggest you go to [/admin/themes](https://my-store.myshopify.com/admin/themes) and duplicate | ||
an existing theme to work from. | ||
Go to your store's [/admin/themes.xml](https://my-store.myshopify.com/admin/themes.xml), | ||
and copy the `id` for the theme you would like to update: | ||
![https://screenshot.click/17-02-w0fw2-zczky.png](https://screenshot.click/17-02-w0fw2-zczky.png) | ||
![https://screenshot.click/17-04-mng8o-k9da8.png](https://screenshot.click/17-04-mng8o-k9da8.png) | ||
_alternatively, you can set the `SLATE_THEME_ID` to **"live"** to update the published theme_ | ||
### Generating your SLATE_PASSWORD | ||
Navigate to your store's private apps page ([/admin/apps/private](https://my-store.myshopify.com/admin/apps/private)). | ||
![https://screenshot.click/17-06-j9e9m-n2jxa.png](https://screenshot.click/17-06-j9e9m-n2jxa.png) | ||
Create a new private app and copy the password: | ||
![https://screenshot.click/17-07-u19kf-rx53b.png](https://screenshot.click/17-07-u19kf-rx53b.png) | ||
Assign the private app permissions to "Read and Write" for theme templates and theme assets: | ||
![https://screenshot.click/17-09-owv1p-5lugl.png](https://screenshot.click/17-09-owv1p-5lugl.png) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20726
527
66
22