@madebyseed/seed-cli-tools 1.9.4 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,8 +11,6 @@ var _debug = _interopRequireDefault(require("debug"));
11
11
 
12
12
  var _config = _interopRequireDefault(require("../config"));
13
13
 
14
- var _utils = require("../utils");
15
-
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
15
 
18
16
  var logger = (0, _debug["default"])("seed-tools:deploy");
@@ -22,7 +20,6 @@ function _default(program) {
22
20
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
21
  logger("--gulpfile ".concat(_config["default"].gulpFile));
24
22
  logger("--cwd ".concat(_config["default"].themeRoot));
25
- if (!(0, _utils.login)(options.store)) return;
26
23
  var args = [options.dev ? "deploy" : "deploy:no-sync", "--environment", options.env, "--store", options.store];
27
24
  if (options.skipOptimizations) args.push("--skip-optimizations");
28
25
  if (options["delete"]) args.push("--delete");
@@ -11,8 +11,6 @@ var _debug = _interopRequireDefault(require("debug"));
11
11
 
12
12
  var _config = _interopRequireDefault(require("../config"));
13
13
 
14
- var _utils = require("../utils");
15
-
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
15
 
18
16
  var logger = (0, _debug["default"])("seed-tools:deploy");
@@ -22,7 +20,6 @@ function _default(program) {
22
20
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
21
  logger("--gulpfile ".concat(_config["default"].gulpFile));
24
22
  logger("--cwd ".concat(_config["default"].themeRoot));
25
- if (!(0, _utils.login)(options.store)) return;
26
23
  var args = [options.all ? "pull" : "pull:settings", "--environment", options.env, "--store", options.store];
27
24
  if (options.all) args.push("--all");
28
25
  if (options["delete"]) args.push("--delete");
@@ -11,8 +11,6 @@ var _debug = _interopRequireDefault(require("debug"));
11
11
 
12
12
  var _config = _interopRequireDefault(require("../config"));
13
13
 
14
- var _utils = require("../utils");
15
-
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
15
 
18
16
  var logger = (0, _debug["default"])("seed-tools:watch");
@@ -22,10 +20,15 @@ function _default(program) {
22
20
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
21
  logger("--gulpfile ".concat(_config["default"].gulpFile));
24
22
  logger("--cwd ".concat(_config["default"].themeRoot));
25
- if (!(0, _utils.login)(options.store)) return;
26
23
  var gulpArgs = ["watch", "--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot, "--environment", options.env];
27
24
  if (!options.optimize) gulpArgs.push("--skip-optimizations");
28
- process.env.NODE_ENV = options.optimize ? 'production' : 'development';
25
+
26
+ if (options.store) {
27
+ gulpArgs.push("--store");
28
+ gulpArgs.push(options.store);
29
+ }
30
+
31
+ process.env.NODE_ENV = options.optimize ? "production" : "development";
29
32
  (0, _crossSpawn["default"])(_config["default"].gulp, gulpArgs, {
30
33
  detached: false,
31
34
  stdio: "inherit"
package/lib/gulpfile.js CHANGED
@@ -79,7 +79,7 @@ gulp.task("pull", gulp.series("shopify:pull:origin:src"));
79
79
 
80
80
  gulp.task("pull:settings", gulp.series("generate:tmp", "shopify:pull:origin:tmp", "sync-settings:tmp:src", "clean"));
81
81
  /**
82
- * Syncronizes src folder theme settings with local development theme settings,
82
+ * Synchronizes src folder theme settings with local development theme settings,
83
83
  * then proceeds to do a full (re)build and push files into specified theme
84
84
  * environment theme using shopify theme push, by default with the --no-delete flag
85
85
  *
@@ -8,7 +8,8 @@ var _require = require("../utils"),
8
8
  logChildProcessOutput = _require.logChildProcessOutput,
9
9
  getDevThemeID = _require.getDevThemeID,
10
10
  setDevThemeID = _require.setDevThemeID,
11
- getThemeID = _require.getThemeID;
11
+ getThemeID = _require.getThemeID,
12
+ getStoreName = _require.getStoreName;
12
13
 
13
14
  var config = require("./includes/config");
14
15
 
@@ -26,8 +27,9 @@ var store = config.store;
26
27
  */
27
28
 
28
29
  gulp.task("shopify:serve:dist", function () {
29
- messages.logChildProcess("'shopify theme serve' on dist...");
30
- var childProcess = shopifyCLI.serve({
30
+ var domain = getStoreName(config.themeRoot, store);
31
+ messages.logChildProcess("'shopify theme dev --store ".concat(domain, "' on dist..."));
32
+ var childProcess = shopifyCLI.serve(domain, {
31
33
  stdio: ["inherit", "pipe", "inherit"]
32
34
  });
33
35
  childProcess.stdout.setEncoding("utf8");
@@ -44,14 +46,15 @@ gulp.task("shopify:serve:dist", function () {
44
46
  */
45
47
 
46
48
  gulp.task("shopify:pull:dev", function (done) {
47
- messages.logChildProcess("'shopify theme pull' on development theme...");
49
+ var domain = getStoreName(config.themeRoot, store);
50
+ messages.logChildProcess("'shopify theme pull --store ".concat(domain, "' on development theme..."));
48
51
  var devThemeId = getDevThemeID(config.themeRoot);
49
52
 
50
53
  if (!devThemeId || devThemeId === 'false') {
51
54
  return done();
52
55
  }
53
56
 
54
- return shopifyCLI.pull(devThemeId);
57
+ return shopifyCLI.pull(domain, devThemeId);
55
58
  });
56
59
  /**
57
60
  * Pulls theme files from the development theme specified in seed config into tmp
@@ -62,14 +65,15 @@ gulp.task("shopify:pull:dev", function (done) {
62
65
  */
63
66
 
64
67
  gulp.task("shopify:pull:dev:tmp", function (done) {
65
- messages.logChildProcess("'shopify theme pull' on tmp folder...");
68
+ var domain = getStoreName(config.themeRoot, store);
69
+ messages.logChildProcess("'shopify theme pull --store ".concat(domain, "' on tmp folder..."));
66
70
  var devThemeId = getDevThemeID(config.themeRoot);
67
71
 
68
72
  if (!devThemeId || devThemeId === 'false') {
69
73
  return done();
70
74
  }
71
75
 
72
- return shopifyCLI.pull(devThemeId, config.tmp.root);
76
+ return shopifyCLI.pull(domain, devThemeId, config.tmp.root);
73
77
  });
74
78
  /**
75
79
  * Pulls theme files from the seed config theme environment into tmp
@@ -80,8 +84,9 @@ gulp.task("shopify:pull:dev:tmp", function (done) {
80
84
  */
81
85
 
82
86
  gulp.task("shopify:pull:origin:tmp", function () {
83
- messages.logChildProcess("'shopify theme pull ".concat(environment).concat(config.nodelete ? ' --nodelete' : '', "' into tmp..."));
84
- return shopifyCLI.pull(getThemeID(config.themeRoot, environment, store), config.tmp.root);
87
+ var domain = getStoreName(config.themeRoot, store);
88
+ messages.logChildProcess("'shopify theme pull --store ".concat(domain, " ").concat(environment).concat(config.nodelete ? ' --nodelete' : '', "' into tmp..."));
89
+ return shopifyCLI.pull(domain, getThemeID(config.themeRoot, environment, store), config.tmp.root);
85
90
  });
86
91
  /**
87
92
  * Pulls theme files from the seed config theme environment into src
@@ -92,8 +97,9 @@ gulp.task("shopify:pull:origin:tmp", function () {
92
97
  */
93
98
 
94
99
  gulp.task("shopify:pull:origin:src", function () {
95
- messages.logChildProcess("'shopify theme pull ".concat(environment).concat(config.nodelete ? ' --nodelete' : '', "' into src..."));
96
- return shopifyCLI.pull(getThemeID(config.themeRoot, environment, store), config.tmp.src, config.nodelete);
100
+ var domain = getStoreName(config.themeRoot, store);
101
+ messages.logChildProcess("'shopify theme pull --store ".concat(domain, " ").concat(environment).concat(config.nodelete ? ' --nodelete' : '', "' into src..."));
102
+ return shopifyCLI.pull(domain, getThemeID(config.themeRoot, environment, store), config.tmp.src, config.nodelete);
97
103
  });
98
104
  /**
99
105
  * Initiates shopify's cli command 'shopify theme push' on the dist folder,
@@ -105,8 +111,9 @@ gulp.task("shopify:pull:origin:src", function () {
105
111
  */
106
112
 
107
113
  gulp.task("shopify:push:dist", function () {
108
- messages.logChildProcess("'shopify theme push".concat(config.nodelete ? ' --nodelete' : '', "' on dist folder..."));
109
- return shopifyCLI.push(getThemeID(config.themeRoot, config.environment, store), config.nodelete);
114
+ var domain = getStoreName(config.themeRoot, store);
115
+ messages.logChildProcess("'shopify theme push --store ".concat(domain).concat(config.nodelete ? ' --nodelete' : '', "' on dist folder..."));
116
+ return shopifyCLI.push(domain, getThemeID(config.themeRoot, config.environment, store), config.nodelete);
110
117
  });
111
118
  /**
112
119
  * Initiates 'shopify theme package' on the dist folder, creating a zip.
@@ -117,8 +124,9 @@ gulp.task("shopify:push:dist", function () {
117
124
  */
118
125
 
119
126
  gulp.task("shopify:package:dist", function () {
127
+ var domain = getStoreName(config.themeRoot, store);
120
128
  messages.logChildProcess("shopify theme package on dist folder...");
121
- return shopifyCLI["package"]();
129
+ return shopifyCLI["package"](domain);
122
130
  });
123
131
  /**
124
132
  * Takes the output of shopify cli serve, extracts dev theme ID and persists
package/lib/utils.js CHANGED
@@ -50,7 +50,7 @@ var shopifyCLI = {
50
50
  * @returns {object} - spawnSync object or, node's <ChildProcess> object if async
51
51
  */
52
52
  login: function login(store) {
53
- var args = ["login", "--store", store];
53
+ var args = ["switch", "--store", store];
54
54
  var options = {
55
55
  env: process.env,
56
56
  stdio: "inherit",
@@ -66,10 +66,9 @@ var shopifyCLI = {
66
66
  * @param {object} options - node spawn options
67
67
  * @returns {object} - node's ChildProcess
68
68
  */
69
- serve: function serve() {
70
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
71
- return (0, _crossSpawn["default"])("shopify theme", ["serve"], _objectSpread({
72
- cwd: _config["default"].themeRoot + "/dist",
69
+ serve: function serve(store) {
70
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
71
+ return (0, _crossSpawn["default"])("shopify theme", ["dev", "--store", store, "--path", "dist"], _objectSpread({
73
72
  env: process.env,
74
73
  stdio: "inherit",
75
74
  shell: true
@@ -85,13 +84,13 @@ var shopifyCLI = {
85
84
  * @param {boolean} [nodelete = true] - run command with --no-delete flag
86
85
  * @returns {object} - node's ChildProcess
87
86
  */
88
- pull: function pull() {
89
- var themeId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
90
- var dir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "./src";
91
- var nodelete = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
92
- var args = ["pull"];
93
- if (themeId) args = args.concat(["--theme", themeId, dir]);
94
- if (nodelete) args.push('--nodelete');
87
+ pull: function pull(store) {
88
+ var themeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
89
+ var dir = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "./src";
90
+ var nodelete = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
91
+ var args = ["pull", "--store", store];
92
+ if (themeId) args = args.concat(["--theme", themeId, "--path", dir]);
93
+ if (nodelete) args.push("--nodelete");
95
94
  return (0, _crossSpawn["default"])("shopify theme", args, {
96
95
  env: process.env,
97
96
  stdio: "inherit",
@@ -107,14 +106,13 @@ var shopifyCLI = {
107
106
  * @param {boolean} [nodelete = true] - run command with --no-delete flag
108
107
  * @returns {ChildProcess} - node's ChildProcess
109
108
  */
110
- push: function push() {
111
- var themeId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
112
- var nodelete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
113
- var args = ["push"];
109
+ push: function push(store) {
110
+ var themeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
111
+ var nodelete = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
112
+ var args = ["push", "--store", store, "--path", "dist"];
114
113
  if (themeId) args = args.concat(["--theme", themeId]);
115
- if (nodelete) args.push('--nodelete');
114
+ if (nodelete) args.push("--nodelete");
116
115
  return (0, _crossSpawn["default"])("shopify theme", args, {
117
- cwd: _config["default"].themeRoot + "/dist",
118
116
  env: process.env,
119
117
  stdio: "inherit",
120
118
  shell: true
@@ -123,13 +121,12 @@ var shopifyCLI = {
123
121
 
124
122
  /**
125
123
  * shopify theme package
126
- *
124
+ *
127
125
  * @memberof seed-cli.shopifyCLI
128
- * @returns {ChildProcess}
126
+ * @returns {ChildProcess}
129
127
  */
130
128
  "package": function _package() {
131
- return (0, _crossSpawn["default"])("shopify theme", ["package"], {
132
- cwd: _config["default"].themeRoot + "/dist",
129
+ return (0, _crossSpawn["default"])("shopify theme", ["package", "--path", "dist"], {
133
130
  env: process.env,
134
131
  stdio: "inherit",
135
132
  shell: true
@@ -222,7 +219,7 @@ function setDevThemeID(themeID) {
222
219
  (0, _fs.writeFileSync)(_config["default"].seedConfig, data.join(_config["default"].seedConfigDelimiter));
223
220
  }
224
221
  /**
225
- * Logs into seed config shopify store while logging useful messages
222
+ * Logs into seed config shopify store while logging useful messages
226
223
  * and handling errors.
227
224
  * @returns {boolean} whether login was succesful or not
228
225
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madebyseed/seed-cli-tools",
3
- "version": "1.9.4",
3
+ "version": "2.0.1",
4
4
  "description": "Seed CLI Tools",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -56,5 +56,5 @@
56
56
  "webpack-stream": "^7.0.0",
57
57
  "yargs": "^17.0.1"
58
58
  },
59
- "gitHead": "c48c747d439cfff485b3589a7e48e25c41c32648"
59
+ "gitHead": "5cfc7c6e6d19d0757e8ea6fcbe4ecd1191c8379f"
60
60
  }
@@ -1,7 +1,6 @@
1
1
  import spawn from "cross-spawn";
2
2
  import debug from "debug";
3
3
  import config from "../config";
4
- import { login } from "../utils";
5
4
 
6
5
  const logger = debug("seed-tools:deploy");
7
6
 
@@ -40,7 +39,6 @@ export default function (program) {
40
39
  logger(`--gulpfile ${config.gulpFile}`);
41
40
  logger(`--cwd ${config.themeRoot}`);
42
41
 
43
- if (!login(options.store)) return;
44
42
 
45
43
  const args = [
46
44
  options.dev ? "deploy" : "deploy:no-sync",
@@ -1,7 +1,6 @@
1
1
  import spawn from "cross-spawn";
2
2
  import debug from "debug";
3
3
  import config from "../config";
4
- import { login } from "../utils";
5
4
 
6
5
  const logger = debug("seed-tools:deploy");
7
6
 
@@ -30,7 +29,6 @@ export default function (program) {
30
29
  .action((options = {}) => {
31
30
  logger(`--gulpfile ${config.gulpFile}`);
32
31
  logger(`--cwd ${config.themeRoot}`);
33
- if (!login(options.store)) return;
34
32
 
35
33
  const args = [
36
34
  options.all ? "pull" : "pull:settings",
@@ -1,7 +1,6 @@
1
1
  import spawn from "cross-spawn";
2
2
  import debug from "debug";
3
3
  import config from "../config";
4
- import { login } from "../utils";
5
4
 
6
5
  const logger = debug("seed-tools:watch");
7
6
 
@@ -27,8 +26,6 @@ export default function (program) {
27
26
  logger(`--gulpfile ${config.gulpFile}`);
28
27
  logger(`--cwd ${config.themeRoot}`);
29
28
 
30
- if (!login(options.store)) return;
31
-
32
29
  const gulpArgs = [
33
30
  "watch",
34
31
  "--gulpfile",
@@ -39,10 +36,14 @@ export default function (program) {
39
36
  options.env,
40
37
  ];
41
38
 
42
- if (!options.optimize)
43
- gulpArgs.push("--skip-optimizations");
44
-
45
- process.env.NODE_ENV = options.optimize ? 'production' : 'development';
39
+ if (!options.optimize) gulpArgs.push("--skip-optimizations");
40
+
41
+ if (options.store) {
42
+ gulpArgs.push("--store");
43
+ gulpArgs.push(options.store);
44
+ }
45
+
46
+ process.env.NODE_ENV = options.optimize ? "production" : "development";
46
47
 
47
48
  spawn(config.gulp, gulpArgs, {
48
49
  detached: false,
package/src/gulpfile.js CHANGED
@@ -101,7 +101,7 @@ gulp.task(
101
101
 
102
102
 
103
103
  /**
104
- * Syncronizes src folder theme settings with local development theme settings,
104
+ * Synchronizes src folder theme settings with local development theme settings,
105
105
  * then proceeds to do a full (re)build and push files into specified theme
106
106
  * environment theme using shopify theme push, by default with the --no-delete flag
107
107
  *
@@ -7,13 +7,13 @@ const {
7
7
  getDevThemeID,
8
8
  setDevThemeID,
9
9
  getThemeID,
10
+ getStoreName,
10
11
  } = require("../utils");
11
12
  const config = require("./includes/config");
12
13
  const messages = require("./includes/messages")
13
14
  const environment = config.environment.split(/\s*,\s*|\s+/)[0];
14
15
  const store = config.store;
15
16
 
16
-
17
17
  /**
18
18
  * Initiates shopify's cli command 'shopify theme serve' on the dist folder,
19
19
  * watching files and uploading them to development store
@@ -23,8 +23,9 @@ const store = config.store;
23
23
  * @static
24
24
  */
25
25
  gulp.task("shopify:serve:dist", () => {
26
- messages.logChildProcess("'shopify theme serve' on dist...");
27
- const childProcess = shopifyCLI.serve({
26
+ const domain = getStoreName(config.themeRoot, store);
27
+ messages.logChildProcess(`'shopify theme dev --store ${domain}' on dist...`);
28
+ const childProcess = shopifyCLI.serve(domain, {
28
29
  stdio: ["inherit", "pipe", "inherit"],
29
30
  });
30
31
  childProcess.stdout.setEncoding("utf8");
@@ -41,13 +42,14 @@ gulp.task("shopify:serve:dist", () => {
41
42
  * @static
42
43
  */
43
44
  gulp.task("shopify:pull:dev", (done) => {
44
- messages.logChildProcess("'shopify theme pull' on development theme...");
45
+ const domain = getStoreName(config.themeRoot, store);
46
+ messages.logChildProcess(`'shopify theme pull --store ${domain}' on development theme...`);
45
47
  const devThemeId = getDevThemeID(config.themeRoot);
46
48
  if (!devThemeId || devThemeId === 'false') {
47
49
  return done();
48
50
  }
49
51
 
50
- return shopifyCLI.pull(devThemeId);
52
+ return shopifyCLI.pull(domain, devThemeId);
51
53
  });
52
54
 
53
55
  /**
@@ -58,13 +60,17 @@ gulp.task("shopify:pull:dev", (done) => {
58
60
  * @static
59
61
  */
60
62
  gulp.task("shopify:pull:dev:tmp", (done) => {
61
- messages.logChildProcess("'shopify theme pull' on tmp folder...");
63
+ const domain = getStoreName(config.themeRoot, store);
64
+ messages.logChildProcess(
65
+ `'shopify theme pull --store ${domain}' on tmp folder...`
66
+ );
62
67
  const devThemeId = getDevThemeID(config.themeRoot);
63
68
  if (!devThemeId || devThemeId === 'false') {
64
69
  return done();
65
70
  }
66
71
 
67
72
  return shopifyCLI.pull(
73
+ domain,
68
74
  devThemeId,
69
75
  config.tmp.root
70
76
  );
@@ -78,8 +84,10 @@ gulp.task("shopify:pull:dev:tmp", (done) => {
78
84
  * @static
79
85
  */
80
86
  gulp.task("shopify:pull:origin:tmp", () => {
81
- messages.logChildProcess(`'shopify theme pull ${environment}${config.nodelete ? ' --nodelete' : ''}' into tmp...`);
87
+ const domain = getStoreName(config.themeRoot, store);
88
+ messages.logChildProcess(`'shopify theme pull --store ${domain} ${environment}${config.nodelete ? ' --nodelete' : ''}' into tmp...`);
82
89
  return shopifyCLI.pull(
90
+ domain,
83
91
  getThemeID(config.themeRoot, environment, store),
84
92
  config.tmp.root
85
93
  );
@@ -93,8 +101,10 @@ gulp.task("shopify:pull:origin:tmp", () => {
93
101
  * @static
94
102
  */
95
103
  gulp.task("shopify:pull:origin:src", () => {
96
- messages.logChildProcess(`'shopify theme pull ${environment}${config.nodelete ? ' --nodelete' : ''}' into src...`);
104
+ const domain = getStoreName(config.themeRoot, store);
105
+ messages.logChildProcess(`'shopify theme pull --store ${domain} ${environment}${config.nodelete ? ' --nodelete' : ''}' into src...`);
97
106
  return shopifyCLI.pull(
107
+ domain,
98
108
  getThemeID(config.themeRoot, environment, store),
99
109
  config.tmp.src,
100
110
  config.nodelete
@@ -110,8 +120,9 @@ gulp.task("shopify:pull:origin:src", () => {
110
120
  * @static
111
121
  */
112
122
  gulp.task("shopify:push:dist", () => {
113
- messages.logChildProcess(`'shopify theme push${config.nodelete ? ' --nodelete' : ''}' on dist folder...`);
114
- return shopifyCLI.push(getThemeID(config.themeRoot, config.environment, store), config.nodelete);
123
+ const domain = getStoreName(config.themeRoot, store);
124
+ messages.logChildProcess(`'shopify theme push --store ${domain}${config.nodelete ? ' --nodelete' : ''}' on dist folder...`);
125
+ return shopifyCLI.push(domain, getThemeID(config.themeRoot, config.environment, store), config.nodelete);
115
126
  });
116
127
 
117
128
  /**
@@ -122,8 +133,9 @@ gulp.task("shopify:push:dist", () => {
122
133
  * @static
123
134
  */
124
135
  gulp.task("shopify:package:dist", () => {
136
+ const domain = getStoreName(config.themeRoot, store);
125
137
  messages.logChildProcess("shopify theme package on dist folder...")
126
- return shopifyCLI.package();
138
+ return shopifyCLI.package(domain);
127
139
  })
128
140
 
129
141
  /**
package/src/utils.js CHANGED
@@ -21,7 +21,7 @@ export const shopifyCLI = {
21
21
  * @returns {object} - spawnSync object or, node's <ChildProcess> object if async
22
22
  */
23
23
  login: (store) => {
24
- const args = ["login", "--store", store];
24
+ const args = ["switch", "--store", store];
25
25
  const options = {
26
26
  env: process.env,
27
27
  stdio: "inherit",
@@ -38,9 +38,8 @@ export const shopifyCLI = {
38
38
  * @param {object} options - node spawn options
39
39
  * @returns {object} - node's ChildProcess
40
40
  */
41
- serve: (options = {}) => {
42
- return spawn("shopify theme", ["serve"], {
43
- cwd: config.themeRoot + "/dist",
41
+ serve: (store, options = {}) => {
42
+ return spawn("shopify theme", ["dev", "--store", store, "--path", "dist"], {
44
43
  env: process.env,
45
44
  stdio: "inherit",
46
45
  shell: true,
@@ -57,11 +56,11 @@ export const shopifyCLI = {
57
56
  * @param {boolean} [nodelete = true] - run command with --no-delete flag
58
57
  * @returns {object} - node's ChildProcess
59
58
  */
60
- pull: (themeId = null, dir = "./src", nodelete = true) => {
61
- let args = ["pull"];
62
- if (themeId) args = args.concat(["--theme", themeId, dir]);
59
+ pull: (store, themeId = null, dir = "./src", nodelete = true) => {
60
+ let args = ["pull", "--store", store];
61
+ if (themeId) args = args.concat(["--theme", themeId, "--path", dir]);
63
62
 
64
- if (nodelete) args.push('--nodelete')
63
+ if (nodelete) args.push("--nodelete");
65
64
 
66
65
  return spawn("shopify theme", args, {
67
66
  env: process.env,
@@ -78,14 +77,13 @@ export const shopifyCLI = {
78
77
  * @param {boolean} [nodelete = true] - run command with --no-delete flag
79
78
  * @returns {ChildProcess} - node's ChildProcess
80
79
  */
81
- push: (themeId = null, nodelete = true) => {
82
- let args = ["push"];
80
+ push: (store, themeId = null, nodelete = true) => {
81
+ let args = ["push", "--store", store, "--path", "dist"];
83
82
  if (themeId) args = args.concat(["--theme", themeId]);
84
83
 
85
- if (nodelete) args.push('--nodelete')
84
+ if (nodelete) args.push("--nodelete");
86
85
 
87
86
  return spawn("shopify theme", args, {
88
- cwd: config.themeRoot + "/dist",
89
87
  env: process.env,
90
88
  stdio: "inherit",
91
89
  shell: true,
@@ -94,18 +92,17 @@ export const shopifyCLI = {
94
92
 
95
93
  /**
96
94
  * shopify theme package
97
- *
95
+ *
98
96
  * @memberof seed-cli.shopifyCLI
99
- * @returns {ChildProcess}
97
+ * @returns {ChildProcess}
100
98
  */
101
99
  package: () => {
102
- return spawn("shopify theme", ["package"], {
103
- cwd: config.themeRoot + "/dist",
100
+ return spawn("shopify theme", ["package", "--path", "dist"], {
104
101
  env: process.env,
105
102
  stdio: "inherit",
106
103
  shell: true,
107
104
  });
108
- }
105
+ },
109
106
  };
110
107
 
111
108
  /**
@@ -123,9 +120,9 @@ export function getSeedConfig(themeRoot) {
123
120
  * @param {string} themeRoot - the path to theme root dir
124
121
  */
125
122
  export function getStoreName(themeRoot, store) {
126
- return store ?
127
- getSeedConfig(themeRoot).stores[store].domain :
128
- getSeedConfig(themeRoot).store;
123
+ return store
124
+ ? getSeedConfig(themeRoot).stores[store].domain
125
+ : getSeedConfig(themeRoot).store;
129
126
  }
130
127
 
131
128
  /**
@@ -136,9 +133,9 @@ export function getStoreName(themeRoot, store) {
136
133
  * @returns {string} themeID
137
134
  */
138
135
  export function getThemeID(themeRoot, environment, store) {
139
- return store ?
140
- getSeedConfig(themeRoot).stores[store].themes[environment] :
141
- getSeedConfig(themeRoot).themes[environment];
136
+ return store
137
+ ? getSeedConfig(themeRoot).stores[store].themes[environment]
138
+ : getSeedConfig(themeRoot).themes[environment];
142
139
  }
143
140
 
144
141
  /**
@@ -187,9 +184,8 @@ export function setDevThemeID(themeID) {
187
184
  writeFileSync(config.seedConfig, data.join(config.seedConfigDelimiter));
188
185
  }
189
186
 
190
-
191
187
  /**
192
- * Logs into seed config shopify store while logging useful messages
188
+ * Logs into seed config shopify store while logging useful messages
193
189
  * and handling errors.
194
190
  * @returns {boolean} whether login was succesful or not
195
191
  */
@@ -200,13 +196,15 @@ export function login(store) {
200
196
  storeErrorMessage(store);
201
197
  return false;
202
198
  }
203
-
204
- console.log(`Logging into ${yellow(domain)} with Shopify CLI...`)
199
+
200
+ console.log(`Logging into ${yellow(domain)} with Shopify CLI...`);
205
201
  const loginProcess = shopifyCLI.login(domain);
206
202
  if (loginProcess.error) {
207
203
  console.log("");
208
204
  console.log(
209
- red(` ${figures.cross} Failed logging into ${domain}, are you sure you're using the correct account?`)
205
+ red(
206
+ ` ${figures.cross} Failed logging into ${domain}, are you sure you're using the correct account?`
207
+ )
210
208
  );
211
209
  console.log("");
212
210
  return false;
@@ -215,16 +213,13 @@ export function login(store) {
215
213
  return true;
216
214
  }
217
215
 
218
-
219
216
  /**
220
217
  * Outputs error message if there's no store field in seed config
221
218
  */
222
219
  export function storeErrorMessage(store) {
223
220
  if (store) {
224
221
  console.log("");
225
- console.log(
226
- red(` The store ${store} does not exist in seed.config.js`)
227
- );
222
+ console.log(red(` The store ${store} does not exist in seed.config.js`));
228
223
  console.log(
229
224
  " Check to see if you spelled the store correctly on seed config and when running the command."
230
225
  );
@@ -232,12 +227,13 @@ export function storeErrorMessage(store) {
232
227
  } else {
233
228
  console.log("");
234
229
  console.log(
235
- red(` ${figures.cross} no store field in seed.config.js. Did you forget the --store <store> argument?`)
230
+ red(
231
+ ` ${figures.cross} no store field in seed.config.js. Did you forget the --store <store> argument?`
232
+ )
236
233
  );
237
234
  console.log(
238
235
  " If this is a multi-store project, please specify which store to watch, else add 'store: <store.myshopify.com>' to your project seed.config.js"
239
236
  );
240
237
  console.log("");
241
238
  }
242
-
243
239
  }