@madebyseed/seed-cli-tools 1.0.1 → 1.2.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.
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ var gulp = require("gulp");
4
+
5
+ var _require = require("../utils"),
6
+ shopifyCLI = _require.shopifyCLI,
7
+ extractThemeId = _require.extractThemeId,
8
+ logChildProcessOutput = _require.logChildProcessOutput,
9
+ getDevThemeID = _require.getDevThemeID,
10
+ setDevThemeID = _require.setDevThemeID,
11
+ getThemeID = _require.getThemeID;
12
+
13
+ var config = require("./includes/config");
14
+
15
+ var messages = require("./includes/messages");
16
+ /**
17
+ * Initiates shopify's cli command 'shopify theme serve' on the dist folder,
18
+ * watching files and uploading them to development store
19
+ *
20
+ * @function shopify:serve:dist
21
+ * @memberof seed-cli.tasks.watch
22
+ * @static
23
+ */
24
+
25
+
26
+ gulp.task("shopify:serve:dist", function () {
27
+ messages.logChildProcess("'shopify theme serve' on dist...");
28
+ var childProcess = shopifyCLI.serve({
29
+ stdio: ["inherit", "pipe", "inherit"]
30
+ });
31
+ childProcess.stdout.setEncoding("utf8");
32
+ logChildProcessOutput(childProcess);
33
+ persistDevThemeID(childProcess);
34
+ return childProcess;
35
+ });
36
+ /**
37
+ * Pulls theme files from the development theme specified in seed config into src
38
+ *
39
+ * @function shopify:pull:dev
40
+ * @memberof seed-cli.tasks.deploy
41
+ * @static
42
+ */
43
+
44
+ gulp.task("shopify:pull:dev", function (done) {
45
+ messages.logChildProcess("'shopify theme pull' on development theme...");
46
+ var devThemeId = getDevThemeID(config.themeRoot);
47
+
48
+ if (!devThemeId) {
49
+ return done();
50
+ }
51
+
52
+ return shopifyCLI.pull(devThemeId);
53
+ });
54
+ /**
55
+ * Pulls theme files from the development theme specified in seed config into tmp
56
+ *
57
+ * @function shopify:pull:dev:tmp
58
+ * @memberof seed-cli.tasks.deploy
59
+ * @static
60
+ */
61
+
62
+ gulp.task("shopify:pull:dev:tmp", function (done) {
63
+ messages.logChildProcess("'shopify theme pull' on tmp folder...");
64
+ var devThemeId = getDevThemeID(config.themeRoot);
65
+
66
+ if (!devThemeId) {
67
+ return done();
68
+ }
69
+
70
+ return shopifyCLI.pull(devThemeId, config.tmp.root);
71
+ });
72
+ /**
73
+ * Initiates shopify's cli command 'shopify theme push' on the dist folder,
74
+ * pushing it to stores theme
75
+ *
76
+ * @function deploy:dist
77
+ * @memberof seed-cli.tasks.deploy
78
+ * @static
79
+ */
80
+
81
+ gulp.task("shopify:push:dist", function () {
82
+ messages.logChildProcess("'shopify theme push' on dist folder...");
83
+ return shopifyCLI.push(getThemeID(config.themeRoot, config.environment));
84
+ });
85
+ /**
86
+ * Takes the output of shopify cli serve, extracts dev theme ID and persists
87
+ * in seed.config.js
88
+ *
89
+ * @param {child_process} serveProcess shopify cli serve spawned child process
90
+ */
91
+
92
+ function persistDevThemeID(serveProcess) {
93
+ serveProcess.stdout.on("data", function (data) {
94
+ var devThemeId = extractThemeId(data.toString());
95
+ var currentDevThemeId = getDevThemeID(config.themeRoot); // If we already have latest dev theme ID, we got nothing left to do
96
+
97
+ if (devThemeId === currentDevThemeId) return; // Else, write dev theme ID into seed.config.js
98
+
99
+ setDevThemeID(devThemeId);
100
+ });
101
+ }
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
2
 
3
- // const { yellow } = require('chalk');
4
- var gulp = require('gulp'); // const runSequence = require('gulp4-run-sequence');
5
- // const _ = require('lodash');
6
- // const debug = require('debug')('seed-tools:watchers');
7
- // const chokidar = require('chokidar');
8
- // const fs = require('fs');
9
- // const themekit = require('@shopify/themekit');
10
- // const Promise = require('bluebird');
11
- // const config = require('./includes/config.js');
3
+ var gulp = require("gulp");
12
4
 
5
+ var config = require("./includes/config");
13
6
 
14
- var utils = require('./includes/utilities.js'); // const messages = require('./includes/messages.js');
15
- // const cache = utils.createEventCache();
16
- // const environment = config.environment.split(/\s*,\s*|\s+/)[0];
7
+ var chokidar = require("chokidar");
17
8
 
9
+ var utils = require("./includes/utilities");
10
+
11
+ var messages = require("./includes/messages.js");
12
+
13
+ var environment = config.environment.split(/\s*,\s*|\s+/)[0];
14
+ var cache = utils.createEventCache();
18
15
  /**
19
16
  * Aggregate task watching for file changes in `src` and
20
17
  * building/cleaning/updating `dist` accordingly. *Made up of individual tasks
@@ -25,20 +22,26 @@ var utils = require('./includes/utilities.js'); // const messages = require('./i
25
22
  * @static
26
23
  */
27
24
 
28
-
29
- gulp.task('watch:src', function () {
30
- return gulp.parallel('watch:css', 'watch:js', 'watch:assets', 'watch:svg')();
25
+ gulp.task("watch:src", function () {
26
+ return gulp.parallel("watch:css", "watch:js", "watch:assets", "watch:svg")();
31
27
  });
32
28
  /**
33
- * Initiates shopify's cli command 'shopify theme serve' on the dist folder,
34
- * watching files and uploading them to development store
35
- *
29
+ * Watches for changes in the `./dist` folder and passes event data to the
30
+ * `cache` via {@link pushToCache}.
36
31
  * @function watch:dist
37
32
  * @memberof seed-cli.tasks.watch
38
33
  * @static
39
34
  */
40
35
 
41
- gulp.task('watch:dist', function () {
42
- console.log("Running Shopify theme serve...");
43
- return utils.serveDist();
36
+ gulp.task("watch:dist", function () {
37
+ var watcher = chokidar.watch(["./"], {
38
+ cwd: config.dist.root,
39
+ ignored: /(^|[/\\])\../,
40
+ ignoreInitial: true
41
+ });
42
+ watcher.on("all", function (event, path) {
43
+ messages.logFileEvent(event, path);
44
+ cache.addEvent(event, path);
45
+ messages.deployTo(environment);
46
+ });
44
47
  });
package/lib/utils.js CHANGED
@@ -5,16 +5,29 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getSeedConfig = getSeedConfig;
7
7
  exports.getStoreName = getStoreName;
8
+ exports.getThemeID = getThemeID;
9
+ exports.getDevThemeID = getDevThemeID;
10
+ exports.extractThemeId = extractThemeId;
11
+ exports.logChildProcessOutput = logChildProcessOutput;
12
+ exports.setDevThemeID = setDevThemeID;
8
13
  exports.shopifyCLI = void 0;
9
14
 
10
15
  var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
11
16
 
12
17
  var _path = require("path");
13
18
 
19
+ var _fs = require("fs");
20
+
14
21
  var _config = _interopRequireDefault(require("./config"));
15
22
 
16
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
24
 
25
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
26
+
27
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
28
+
29
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
30
+
18
31
  /**
19
32
  * Wrappers for Shopify CLI commands
20
33
  *
@@ -25,33 +38,52 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
25
38
  var shopifyCLI = {
26
39
  /**
27
40
  * shopify login
28
- *
41
+ *
29
42
  * @memberof seed-cli.shopifyCLI
30
43
  * @param {string} store - store's myshopify domain name
31
44
  * @param {boolean} async - login asynchronously
32
- *
45
+ *
33
46
  * @returns {object} - spawnSync object or, node's <ChildProcess> object if async
34
47
  */
35
48
  login: function login(store) {
36
49
  var async = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
37
- var args = ['login', '--store', store];
50
+ var args = ["login", "--store", store];
38
51
  var options = {
39
52
  env: process.env,
40
53
  stdio: "inherit",
41
54
  shell: true
42
55
  };
43
- if (async) return (0, _crossSpawn["default"])('shopify', args, options);else return _crossSpawn["default"].sync('shopify', args, options);
56
+ if (async) return (0, _crossSpawn["default"])("shopify", args, options);else return _crossSpawn["default"].sync("shopify", args, options);
44
57
  },
45
58
 
46
59
  /**
47
60
  * shopify theme serve
48
- *
61
+ *
49
62
  * @memberof seed-cli.shopifyCLI
50
63
  * @returns {object} - node's ChildProcess
51
64
  */
52
65
  serve: function serve() {
53
- return (0, _crossSpawn["default"])('shopify theme', ['serve'], {
54
- cwd: _config["default"].themeRoot + '/dist',
66
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
67
+ return (0, _crossSpawn["default"])("shopify theme", ["serve"], _objectSpread({
68
+ cwd: _config["default"].themeRoot + "/dist",
69
+ env: process.env,
70
+ stdio: "inherit",
71
+ shell: true
72
+ }, options));
73
+ },
74
+
75
+ /**
76
+ * shopify theme push
77
+ *
78
+ * @memberof seed-cli.shopifyCLI
79
+ * @returns {object} - node's ChildProcess
80
+ */
81
+ pull: function pull() {
82
+ var themeId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
83
+ var dir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "./src";
84
+ var args = ["pull"];
85
+ if (themeId) args = args.concat(["--themeid", themeId, dir]);
86
+ return (0, _crossSpawn["default"])("shopify theme", args, {
55
87
  env: process.env,
56
88
  stdio: "inherit",
57
89
  shell: true
@@ -60,13 +92,16 @@ var shopifyCLI = {
60
92
 
61
93
  /**
62
94
  * shopify theme push
63
- *
95
+ *
64
96
  * @memberof seed-cli.shopifyCLI
65
97
  * @returns {object} - node's ChildProcess
66
98
  */
67
99
  push: function push() {
68
- return (0, _crossSpawn["default"])('shopify theme', ['push'], {
69
- cwd: _config["default"].themeRoot + '/dist',
100
+ var themeId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
101
+ var args = ["push", "--nodelete"];
102
+ if (themeId) args = args.concat(["--themeid", themeId]);
103
+ return (0, _crossSpawn["default"])("shopify theme", args, {
104
+ cwd: _config["default"].themeRoot + "/dist",
70
105
  env: process.env,
71
106
  stdio: "inherit",
72
107
  shell: true
@@ -75,22 +110,86 @@ var shopifyCLI = {
75
110
  };
76
111
  /**
77
112
  * Get seed.config.js from project root dir
78
- *
113
+ *
79
114
  * @param {string} themeRoot - the path to theme root dir
80
115
  */
81
116
 
82
117
  exports.shopifyCLI = shopifyCLI;
83
118
 
84
119
  function getSeedConfig(themeRoot) {
85
- return require((0, _path.join)(themeRoot, 'seed.config.js'));
120
+ return require((0, _path.join)(themeRoot, "seed.config.js"));
86
121
  }
87
122
  /**
88
- * Get store name from seed.config.js
89
- *
123
+ * Get store name from seed.config.js
124
+ *
90
125
  * @param {string} themeRoot - the path to theme root dir
91
126
  */
92
127
 
93
128
 
94
129
  function getStoreName(themeRoot) {
95
130
  return getSeedConfig(themeRoot).store;
131
+ }
132
+ /**
133
+ * Get theme ID from seed.config.js
134
+ *
135
+ * @param {string} themeRoot - the path to theme root dir
136
+ * @param {string} environment - theme name/environment
137
+ * @returns {string} themeID
138
+ */
139
+
140
+
141
+ function getThemeID(themeRoot, environment) {
142
+ return getSeedConfig(themeRoot).themes[environment];
143
+ }
144
+ /**
145
+ * Get dev theme ID from seed.config.js
146
+ *
147
+ * @param {string} themeRoot - the path to theme root dir
148
+ * @returns {string} - development store theme ID
149
+ */
150
+
151
+
152
+ function getDevThemeID(themeRoot) {
153
+ return getSeedConfig(themeRoot).developmentThemeId;
154
+ }
155
+ /**
156
+ * Given a string, finds the first themeID and returns it, if no themeID found
157
+ * returns false.
158
+ *
159
+ * @param {string} string - string to extract theme id from
160
+ * @return {string|boolean} - themeID or false if not found
161
+ */
162
+
163
+
164
+ function extractThemeId(string) {
165
+ var regex = /\d{12}/;
166
+ var match = string.match(regex);
167
+ return match && match.length ? match[0] : false;
168
+ }
169
+ /**
170
+ * Logs out to terminal the output of a piped child process
171
+ *
172
+ * @param {child_process} serveProcess shopify cli serve spawned child process
173
+ */
174
+
175
+
176
+ function logChildProcessOutput(process) {
177
+ process.stdout.on("data", function (data) {
178
+ console.log(data);
179
+ });
180
+ }
181
+ /**
182
+ * Writes the development theme ID as a key to seed config file
183
+ *
184
+ * @param {string} themeID - development theme ID
185
+ */
186
+
187
+
188
+ function setDevThemeID(themeID) {
189
+ var data = (0, _fs.readFileSync)(_config["default"].seedConfig, {
190
+ encoding: "utf8"
191
+ });
192
+ data = data.split(_config["default"].seedConfigDelimiter);
193
+ data[1] = "\n developmentThemeId: '".concat(themeID, "'") + "\n};";
194
+ (0, _fs.writeFileSync)(_config["default"].seedConfig, data.join(_config["default"].seedConfigDelimiter));
96
195
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madebyseed/seed-cli-tools",
3
- "version": "1.0.1",
3
+ "version": "1.2.1",
4
4
  "description": "Seed CLI Tools",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,12 +22,12 @@
22
22
  "eslint": "^7.31.0"
23
23
  },
24
24
  "dependencies": {
25
- "@shopify/themekit": "^1.1.9",
26
25
  "autoprefixer": "^10.3.1",
27
26
  "bluebird": "^3.7.2",
28
27
  "chalk": "^4.1.1",
29
28
  "chokidar": "^3.5.2",
30
29
  "cross-spawn": "^7.0.3",
30
+ "cssnano": "^5.0.8",
31
31
  "debug": "^4.3.2",
32
32
  "del": "^6.0.0",
33
33
  "fancy-log": "^1.3.3",
@@ -37,6 +37,7 @@
37
37
  "gulp-cheerio": "^1.0.0",
38
38
  "gulp-cssimport": "^7.0.0",
39
39
  "gulp-ext-replace": "^0.3.0",
40
+ "gulp-if": "^3.0.0",
40
41
  "gulp-include": "^2.4.1",
41
42
  "gulp-plumber": "^1.2.1",
42
43
  "gulp-postcss": "^9.0.0",
@@ -45,7 +46,6 @@
45
46
  "gulp-svgmin": "^4.0.1",
46
47
  "gulp-uglify": "^3.0.2",
47
48
  "gulp-zip": "^5.1.0",
48
- "gulp4-run-sequence": "^1.0.1",
49
49
  "postcss": "^8.3.6",
50
50
  "require-directory": "^2.1.1",
51
51
  "sass": "^1.36.0",
@@ -53,5 +53,5 @@
53
53
  "vinyl-paths": "^3.0.1",
54
54
  "yargs": "^17.0.1"
55
55
  },
56
- "gitHead": "8291c0aded1f2512ae06efb8843ce5dae5f953a6"
56
+ "gitHead": "fc7df55c50463311a7eadbf0131e68c448064337"
57
57
  }
@@ -1,25 +1,42 @@
1
- import spawn from 'cross-spawn';
2
- import debug from 'debug';
3
- import config from '../config';
1
+ import spawn from "cross-spawn";
2
+ import debug from "debug";
3
+ import config from "../config";
4
4
 
5
- const logger = debug('slate-tools:deploy');
5
+ const logger = debug("seed-tools:deploy");
6
6
 
7
- export default function(program) {
7
+ export default function (program) {
8
8
  program
9
- .command('deploy')
10
- .alias('d')
11
- .description('Runs a full deploy of your theme\'s code to a Shopify store specified in config.yml. Existing files will be overwritten.')
12
- .option('-e, --env <environment>[,<environment>...]', 'Shopify store(s) to deploy code to (specified in config.yml - default: development)', 'development')
13
- .option('-m, --manual', 'outputs the compiled theme files to <theme>/upload/<theme>.zip for manual deployment')
9
+ .command("deploy")
10
+ .alias("d")
11
+ .description(
12
+ "Runs a full deploy of your theme's code to a Shopify store specified in seed.config.js. This runs shopify theme push with the --nodelete flag, so that files aren't deleted."
13
+ )
14
+ .option(
15
+ "-e, --env <environment>[,<environment>...]",
16
+ "Shopify store(s) to deploy code to (specified in seed.config.js)",
17
+ "development"
18
+ )
19
+ .option(
20
+ "-s, --skip-optimizations",
21
+ "Skips asset optimization steps such as compression, minification and purging.",
22
+ false
23
+ )
14
24
  .action((options = {}) => {
15
25
  logger(`--gulpfile ${config.gulpFile}`);
16
26
  logger(`--cwd ${config.themeRoot}`);
17
27
 
18
- const args = ['deploy', '--environment', options.env];
28
+ const args = ["deploy", "--environment", options.env];
19
29
 
20
- spawn(config.gulp, args.concat(['--gulpfile', config.gulpFile, '--cwd', config.themeRoot]), {
21
- detached: false,
22
- stdio: 'inherit',
23
- });
30
+ if (options.skipOptimizations) args.push("--skip-optimization");
31
+ else process.env.NODE_ENV = "production";
32
+
33
+ spawn(
34
+ config.gulp,
35
+ args.concat(["--gulpfile", config.gulpFile, "--cwd", config.themeRoot]),
36
+ {
37
+ detached: false,
38
+ stdio: "inherit",
39
+ }
40
+ );
24
41
  });
25
42
  }
@@ -15,6 +15,11 @@ export default function (program) {
15
15
  "Watches files for code changes and immediately deploys updates to dev theme as they occur. " +
16
16
  "This uses shopify theme serve under the hood."
17
17
  )
18
+ .option(
19
+ "-o, --optimize",
20
+ "Optimizes assets by compressing, minifying and purging.",
21
+ false
22
+ )
18
23
  .action((options = {}) => {
19
24
  logger(`--gulpfile ${config.gulpFile}`);
20
25
  logger(`--cwd ${config.themeRoot}`);
@@ -54,6 +59,11 @@ export default function (program) {
54
59
  options.env,
55
60
  ];
56
61
 
62
+ if (!options.optimize)
63
+ gulpArgs.push("--skip-optimization");
64
+
65
+ process.env.NODE_ENV = options.optimize ? 'production' : 'development';
66
+
57
67
  spawn(config.gulp, gulpArgs, {
58
68
  detached: false,
59
69
  stdio: "inherit",
@@ -0,0 +1,27 @@
1
+ import spawn from "cross-spawn";
2
+ import debug from "debug";
3
+ import config from "../config";
4
+
5
+ const logger = debug("seed-tools:zip");
6
+
7
+ export default function (program) {
8
+ program
9
+ .command("zip")
10
+ .alias("z")
11
+ .description(
12
+ "Rebuilds the theme's source files and compresses the output. The compressed file is written to <theme>/upload/<theme>.zip (can be used for manual upload)."
13
+ )
14
+ .action(() => {
15
+ logger(`--gulpfile ${config.gulpFile}`);
16
+ logger(`--cwd ${config.themeRoot}`);
17
+
18
+ spawn(
19
+ config.gulp,
20
+ ["zip", "--gulpfile", config.gulpFile, "--cwd", config.themeRoot],
21
+ {
22
+ detached: false,
23
+ stdio: "inherit",
24
+ }
25
+ );
26
+ });
27
+ }
package/src/config.js CHANGED
@@ -17,6 +17,8 @@ const config = {
17
17
  gulpFile: join(currentDirectory, "gulpfile.js"),
18
18
  gulp: existsSync(defaultGulpPath) ? defaultGulpPath : legacyGulpPath,
19
19
  themeRoot,
20
+ seedConfig: join(themeRoot, "seed.config.js"),
21
+ seedConfigDelimiter: "/** === delimiter */",
20
22
  };
21
23
 
22
24
  export default config;
package/src/gulpfile.js CHANGED
@@ -1,19 +1,28 @@
1
- const gulp = require('gulp');
2
- // const argv = require('yargs').argv;
3
- const runSequence = require('gulp4-run-sequence');
1
+ const gulp = require("gulp");
4
2
 
5
3
  // imports gulp tasks from the `tasks` directory
6
- require('require-directory')(module, './tasks');
4
+ require("require-directory")(module, "./tasks");
7
5
 
8
- gulp.task('build', gulp.series(
9
- 'clean',
10
- gulp.parallel('build:js', 'build:vendor-js', 'build:css', 'build:assets', 'build:svg')
11
- ))
12
-
13
- gulp.task('build:zip', gulp.series(
14
- 'clean',
15
- gulp.parallel('build:js', 'build:vendor-js', 'build:css', 'build:assets', 'build:svg')
16
- ))
6
+ /**
7
+ * Does a full clean/rebuild of your theme
8
+ *
9
+ * @function watch
10
+ * @memberof slate-cli.tasks.watch
11
+ * @static
12
+ */
13
+ gulp.task(
14
+ "build",
15
+ gulp.series(
16
+ "clean",
17
+ gulp.parallel(
18
+ "build:js",
19
+ "build:vendor-js",
20
+ "build:css",
21
+ "build:assets",
22
+ "build:svg"
23
+ )
24
+ )
25
+ );
17
26
 
18
27
  /**
19
28
  * Does a full clean/rebuild of your theme and creates a `.zip` compatible with
@@ -23,25 +32,36 @@ gulp.task('build:zip', gulp.series(
23
32
  * @memberof slate-cli.tasks
24
33
  * @static
25
34
  */
26
- gulp.task('zip', (done) => {
27
- runSequence('build:zip', 'compress', done);
28
- });
35
+ gulp.task("zip", gulp.series("build", "compress"));
29
36
 
37
+ /**
38
+ * Syncronizes the development theme settings with our src folder theme settings
39
+ *
40
+ * @function sync-settings
41
+ * @memberof seed-cli.tasks.deploy
42
+ * @static
43
+ */
44
+ gulp.task(
45
+ "sync-settings",
46
+ gulp.series("generate:tmp", "shopify:pull:dev:tmp", "sync-settings:tmp:src")
47
+ );
30
48
 
31
49
  /**
32
50
  * Simple wrapper around src & dist watchers
33
51
  *
34
52
  * @summary Monitor your codebase for file changes and take the appropriate
35
- * action
53
+ * action
36
54
  * @function watch
37
55
  * @memberof slate-cli.tasks.watch
38
56
  * @static
39
57
  */
40
- gulp.task('watch', gulp.series(
41
- 'build',
42
- gulp.parallel('watch:src', 'watch:dist')
43
- ));
44
-
58
+ gulp.task(
59
+ "watch",
60
+ gulp.series(
61
+ "build",
62
+ gulp.parallel("watch:src", "watch:dist", "shopify:serve:dist")
63
+ )
64
+ );
45
65
 
46
66
  /**
47
67
  * Does a full (re)build followed by a full deploy, cleaning existing files on
@@ -50,12 +70,8 @@ gulp.task('watch', gulp.series(
50
70
  *
51
71
  * @summary Deploy your built files to the Shopify Store set in
52
72
  * `slate-cli.config`
53
- * @function deploy:manual
73
+ * @function deploy
54
74
  * @memberof slate-cli.tasks.deploy
55
75
  * @static
56
76
  */
57
- gulp.task('deploy', gulp.series(
58
- 'build',
59
- 'deploy:dist'
60
- ));
61
-
77
+ gulp.task("deploy", gulp.series("sync-settings", "build", "shopify:push:dist"));
@@ -7,7 +7,6 @@ const chokidar = require('chokidar');
7
7
 
8
8
 
9
9
  const config = require('./includes/config.js');
10
- // const utils = require('./includes/utilities.js');
11
10
  const messages = require('./includes/messages.js');
12
11
 
13
12
 
@@ -1,4 +1,5 @@
1
1
  const gulp = require('gulp');
2
+ const gulpif = require('gulp-if');
2
3
  const uglify = require('gulp-uglify');
3
4
  const include = require('gulp-include');
4
5
  const plumber = require('gulp-plumber');
@@ -6,13 +7,13 @@ const chokidar = require('chokidar');
6
7
 
7
8
  const config = require('./includes/config.js');
8
9
  const messages = require('./includes/messages.js');
9
- // const utils = require('./includes/utilities.js');
10
10
 
11
11
  function processThemeJs() {
12
12
  messages.logProcessFiles('build:js');
13
13
  return gulp.src([config.roots.js, `!${config.roots.vendorJs}`])
14
14
  .pipe(plumber())
15
15
  .pipe(include())
16
+ .pipe(gulpif(config.optimize, uglify()))
16
17
  .pipe(gulp.dest(config.dist.assets));
17
18
  }
18
19