@madebyseed/seed-cli-tools 1.9.3 → 2.0.0

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,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 gulpArgs = ["watch", "--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot, "--environment", options.env];
27
24
  if (!options.optimize) gulpArgs.push("--skip-optimizations");
28
25
  process.env.NODE_ENV = options.optimize ? 'production' : 'development';
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
  *
@@ -29,9 +29,11 @@ var assets = config.usesTailwind || tailwindConfig.mode === "jit" ? [config.src.
29
29
  */
30
30
 
31
31
  function processCss() {
32
- return gulp.src(config.roots.css, {
33
- allowEmpty: true
34
- }).pipe(plumber(utils.errorHandler)).pipe(postcss(config.plugins.postcss)).pipe(gulp.dest(config.dist.assets));
32
+ return new Promise(function (resolve, reject) {
33
+ gulp.src(config.roots.css, {
34
+ allowEmpty: true
35
+ }).pipe(plumber(utils.errorHandler)).pipe(postcss(config.plugins.postcss)).pipe(gulp.dest(config.dist.assets)).on('finish', resolve).on('error', reject);
36
+ });
35
37
  }
36
38
  /**
37
39
  * Process sass files
@@ -43,9 +45,11 @@ function processCss() {
43
45
 
44
46
 
45
47
  function processSass() {
46
- return gulp.src(config.roots.scss, {
47
- allowEmpty: true
48
- }).pipe(plumber(utils.errorHandler)).pipe(sass()).pipe(postcss(config.plugins.postcss)).pipe(gulp.dest(config.dist.assets));
48
+ return new Promise(function (resolve, reject) {
49
+ gulp.src(config.roots.scss, {
50
+ allowEmpty: true
51
+ }).pipe(plumber(utils.errorHandler)).pipe(sass()).pipe(postcss(config.plugins.postcss)).pipe(gulp.dest(config.dist.assets)).on('finish', resolve).on('error', reject);
52
+ });
49
53
  }
50
54
  /**
51
55
  * Concatenate css via gulp-cssimport
@@ -144,13 +144,6 @@ if (config.usesTailwind) {
144
144
  }
145
145
 
146
146
  config.plugins.postcss.push(require('autoprefixer'));
147
-
148
- if (config.optimize) {
149
- config.plugins.postcss.push(cssnano({
150
- preset: "default"
151
- }));
152
- }
153
-
154
147
  config.plugins.postcss.push(pxtorem({
155
148
  rootValue: 16,
156
149
  unitPrecision: 5,
@@ -160,6 +153,13 @@ config.plugins.postcss.push(pxtorem({
160
153
  mediaQuery: true,
161
154
  exclude: /node_modules/i
162
155
  }));
156
+
157
+ if (config.optimize) {
158
+ config.plugins.postcss.push(cssnano({
159
+ preset: "default"
160
+ }));
161
+ }
162
+
163
163
  config.plugins.postcss.push(reporter({
164
164
  clearReportedMessages: true
165
165
  }));
@@ -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.3",
3
+ "version": "2.0.0",
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": "80b3e39806640fcd23dada52c0dbfb9787064b63"
59
+ "gitHead": "a8c9eb026df4d667622adaf419241b140964f5dc"
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",
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
  *
@@ -38,10 +38,15 @@ const assets =
38
38
  * @private
39
39
  */
40
40
  function processCss() {
41
- return gulp.src(config.roots.css, { allowEmpty: true })
41
+ return new Promise((resolve, reject) => {
42
+ gulp.src(config.roots.css, { allowEmpty: true })
42
43
  .pipe(plumber(utils.errorHandler))
43
44
  .pipe(postcss(config.plugins.postcss))
44
45
  .pipe(gulp.dest(config.dist.assets))
46
+ .on('finish', resolve)
47
+ .on('error', reject)
48
+ })
49
+
45
50
  }
46
51
 
47
52
  /**
@@ -52,11 +57,16 @@ function processCss() {
52
57
  * @private
53
58
  */
54
59
  function processSass() {
55
- return gulp.src(config.roots.scss, { allowEmpty: true })
60
+ return new Promise((resolve, reject) => {
61
+ gulp.src(config.roots.scss, { allowEmpty: true })
56
62
  .pipe(plumber(utils.errorHandler))
57
63
  .pipe(sass())
58
64
  .pipe(postcss(config.plugins.postcss))
59
65
  .pipe(gulp.dest(config.dist.assets))
66
+ .on('finish', resolve)
67
+ .on('error', reject)
68
+ })
69
+
60
70
  }
61
71
 
62
72
  /**
@@ -147,10 +147,6 @@ if (config.usesTailwind) {
147
147
 
148
148
  config.plugins.postcss.push(require('autoprefixer'))
149
149
 
150
- if (config.optimize) {
151
- config.plugins.postcss.push((cssnano({ preset: "default" })))
152
- }
153
-
154
150
  config.plugins.postcss.push(pxtorem({
155
151
  rootValue: 16,
156
152
  unitPrecision: 5,
@@ -161,6 +157,10 @@ config.plugins.postcss.push(pxtorem({
161
157
  exclude: /node_modules/i
162
158
  }))
163
159
 
160
+ if (config.optimize) {
161
+ config.plugins.postcss.push((cssnano({ preset: "default" })))
162
+ }
163
+
164
164
  config.plugins.postcss.push(reporter({ clearReportedMessages: true }))
165
165
 
166
166
  module.exports = config;
@@ -7,6 +7,7 @@ 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")
@@ -23,8 +24,9 @@ const store = config.store;
23
24
  * @static
24
25
  */
25
26
  gulp.task("shopify:serve:dist", () => {
26
- messages.logChildProcess("'shopify theme serve' on dist...");
27
- const childProcess = shopifyCLI.serve({
27
+ const domain = getStoreName(config.themeRoot, store);
28
+ messages.logChildProcess(`'shopify theme dev --store ${domain}' on dist...`);
29
+ const childProcess = shopifyCLI.serve(domain, {
28
30
  stdio: ["inherit", "pipe", "inherit"],
29
31
  });
30
32
  childProcess.stdout.setEncoding("utf8");
@@ -41,13 +43,14 @@ gulp.task("shopify:serve:dist", () => {
41
43
  * @static
42
44
  */
43
45
  gulp.task("shopify:pull:dev", (done) => {
44
- messages.logChildProcess("'shopify theme pull' on development theme...");
46
+ const domain = getStoreName(config.themeRoot, store);
47
+ messages.logChildProcess(`'shopify theme pull --store ${domain}' on development theme...`);
45
48
  const devThemeId = getDevThemeID(config.themeRoot);
46
49
  if (!devThemeId || devThemeId === 'false') {
47
50
  return done();
48
51
  }
49
52
 
50
- return shopifyCLI.pull(devThemeId);
53
+ return shopifyCLI.pull(domain, devThemeId);
51
54
  });
52
55
 
53
56
  /**
@@ -58,13 +61,17 @@ gulp.task("shopify:pull:dev", (done) => {
58
61
  * @static
59
62
  */
60
63
  gulp.task("shopify:pull:dev:tmp", (done) => {
61
- messages.logChildProcess("'shopify theme pull' on tmp folder...");
64
+ const domain = getStoreName(config.themeRoot, store);
65
+ messages.logChildProcess(
66
+ `'shopify theme pull --store ${domain}' on tmp folder...`
67
+ );
62
68
  const devThemeId = getDevThemeID(config.themeRoot);
63
69
  if (!devThemeId || devThemeId === 'false') {
64
70
  return done();
65
71
  }
66
72
 
67
73
  return shopifyCLI.pull(
74
+ domain,
68
75
  devThemeId,
69
76
  config.tmp.root
70
77
  );
@@ -78,8 +85,10 @@ gulp.task("shopify:pull:dev:tmp", (done) => {
78
85
  * @static
79
86
  */
80
87
  gulp.task("shopify:pull:origin:tmp", () => {
81
- messages.logChildProcess(`'shopify theme pull ${environment}${config.nodelete ? ' --nodelete' : ''}' into tmp...`);
88
+ const domain = getStoreName(config.themeRoot, store);
89
+ messages.logChildProcess(`'shopify theme pull --store ${domain} ${environment}${config.nodelete ? ' --nodelete' : ''}' into tmp...`);
82
90
  return shopifyCLI.pull(
91
+ domain,
83
92
  getThemeID(config.themeRoot, environment, store),
84
93
  config.tmp.root
85
94
  );
@@ -93,8 +102,10 @@ gulp.task("shopify:pull:origin:tmp", () => {
93
102
  * @static
94
103
  */
95
104
  gulp.task("shopify:pull:origin:src", () => {
96
- messages.logChildProcess(`'shopify theme pull ${environment}${config.nodelete ? ' --nodelete' : ''}' into src...`);
105
+ const domain = getStoreName(config.themeRoot, store);
106
+ messages.logChildProcess(`'shopify theme pull --store ${domain} ${environment}${config.nodelete ? ' --nodelete' : ''}' into src...`);
97
107
  return shopifyCLI.pull(
108
+ domain,
98
109
  getThemeID(config.themeRoot, environment, store),
99
110
  config.tmp.src,
100
111
  config.nodelete
@@ -110,8 +121,9 @@ gulp.task("shopify:pull:origin:src", () => {
110
121
  * @static
111
122
  */
112
123
  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);
124
+ const domain = getStoreName(config.themeRoot, store);
125
+ messages.logChildProcess(`'shopify theme push --store ${domain}${config.nodelete ? ' --nodelete' : ''}' on dist folder...`);
126
+ return shopifyCLI.push(domain, getThemeID(config.themeRoot, config.environment, store), config.nodelete);
115
127
  });
116
128
 
117
129
  /**
@@ -122,8 +134,9 @@ gulp.task("shopify:push:dist", () => {
122
134
  * @static
123
135
  */
124
136
  gulp.task("shopify:package:dist", () => {
137
+ const domain = getStoreName(config.themeRoot, store);
125
138
  messages.logChildProcess("shopify theme package on dist folder...")
126
- return shopifyCLI.package();
139
+ return shopifyCLI.package(domain);
127
140
  })
128
141
 
129
142
  /**
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
  }