@madebyseed/seed-cli-tools 1.4.2 → 1.5.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.
package/lib/gulpfile.js CHANGED
@@ -23,7 +23,7 @@ gulp.task("build", gulp.series("clean", gulp.parallel("build:js", "build:vendor-
23
23
  * @static
24
24
  */
25
25
 
26
- gulp.task("zip", gulp.series("build", "compress"));
26
+ gulp.task("zip", gulp.series("build", "shopify:package:dist", "copy:zip"));
27
27
  /**
28
28
  * Syncronizes the development theme settings with our src folder theme settings
29
29
  *
@@ -54,7 +54,12 @@ gulp.task("watch:css", function () {
54
54
  chokidar.watch(assets, {
55
55
  ignoreInitial: true
56
56
  }).on("all", function (event, path) {
57
- messages.logFileEvent(event, path);
57
+ var isCssFile = /.\.css$/.test(path); // Don't log event twice
58
+
59
+ if (isCssFile) {
60
+ messages.logFileEvent(event, path);
61
+ }
62
+
58
63
  processCss();
59
64
  });
60
65
  });
@@ -6,8 +6,6 @@ var gulpif = require("gulp-if");
6
6
 
7
7
  var del = require("del");
8
8
 
9
- var zip = require("gulp-zip");
10
-
11
9
  var size = require("gulp-size");
12
10
 
13
11
  var plumber = require("gulp-plumber");
@@ -48,22 +46,7 @@ function copyFiles(files, srcOptions, dest) {
48
46
 
49
47
 
50
48
  gulp.task("clean", function () {
51
- return del(["upload", "dist", "tmp"]);
52
- });
53
- /**
54
- * Compress theme and build a shopify-compatible `.zip` file for uploading to store
55
- *
56
- * @function compress
57
- * @memberof slate-cli.tasks.deploy
58
- * @static
59
- */
60
-
61
- gulp.task("compress", function () {
62
- var distFiles = "".concat(config.dist.root, "**/*");
63
- return gulp.src([distFiles]).pipe(plumber(utils.errorHandler)).pipe(zip("".concat(config.packageJson.name, ".zip") || "theme.zip")).pipe(size({
64
- showFiles: true,
65
- pretty: true
66
- })).pipe(gulp.dest("./upload/"));
49
+ return del(["upload", "dist", "tmp", "src/*.zip", "*.zip"]);
67
50
  });
68
51
  /**
69
52
  * Duplicates /src directory into a /tmp directory
@@ -92,4 +75,16 @@ gulp.task("sync-settings:tmp:src", function () {
92
75
  return copyFiles(themeSettingsAssets, {
93
76
  base: config.tmp.root
94
77
  }, config.src.root);
78
+ });
79
+ /**
80
+ * Copies zip from dist to src
81
+ * @function copy:zip
82
+ * @memberof seed-cli.tasks.sync-settings
83
+ * @static
84
+ */
85
+
86
+ gulp.task("copy:zip", function () {
87
+ return copyFiles(config.dist.zip, {
88
+ base: config.dist.root
89
+ }, config.themeRoot, true);
95
90
  });
@@ -54,7 +54,7 @@ try {
54
54
 
55
55
 
56
56
  var config = {
57
- environment: argv.environment === "undefined" ? "development" : argv.environment,
57
+ environment: argv.environment === "undefined" || !argv.environment ? "development" : argv.environment,
58
58
  optimize: !argv["skip-optimizations"],
59
59
  nodelete: !argv["delete"],
60
60
  themeRoot: themeRoot,
@@ -77,7 +77,8 @@ var config = {
77
77
  sections: "src/sections/*",
78
78
  locales: "src/locales/*",
79
79
  config: "src/config/*",
80
- layout: "src/layout/*"
80
+ layout: "src/layout/*",
81
+ zip: "src/**/*.zip"
81
82
  },
82
83
  tmp: {
83
84
  root: "tmp/",
@@ -94,7 +95,8 @@ var config = {
94
95
  sections: "tmp/sections/*",
95
96
  locales: "tmp/locales/*",
96
97
  config: "tmp/config/*",
97
- layout: "tmp/layout/*"
98
+ layout: "tmp/layout/*",
99
+ zip: "tmp/**/*.zip"
98
100
  },
99
101
  dist: {
100
102
  root: "dist/",
@@ -103,7 +105,8 @@ var config = {
103
105
  sections: "dist/sections/",
104
106
  layout: "dist/layout/",
105
107
  templates: "dist/templates/",
106
- locales: "dist/locales/"
108
+ locales: "dist/locales/",
109
+ zip: "dist/*.zip"
107
110
  },
108
111
  roots: {
109
112
  js: "src/scripts/*.{js,js.liquid}",
@@ -107,6 +107,18 @@ gulp.task("shopify:push:dist", function () {
107
107
  messages.logChildProcess("'shopify theme push".concat(config.nodelete ? ' --nodelete' : '', "' on dist folder..."));
108
108
  return shopifyCLI.push(getThemeID(config.themeRoot, config.environment), config.nodelete);
109
109
  });
110
+ /**
111
+ * Initiates 'shopify theme package' on the dist folder, creating a zip.
112
+ *
113
+ * @function shopify:package:dist
114
+ * @memberof seed-cli.tasks.zip
115
+ * @static
116
+ */
117
+
118
+ gulp.task("shopify:package:dist", function () {
119
+ messages.logChildProcess("shopify theme package on dist folder...");
120
+ return shopifyCLI["package"]();
121
+ });
110
122
  /**
111
123
  * Takes the output of shopify cli serve, extracts dev theme ID and persists
112
124
  * in seed.config.js
package/lib/utils.js CHANGED
@@ -105,7 +105,7 @@ var shopifyCLI = {
105
105
  * @memberof seed-cli.shopifyCLI
106
106
  * @param {string} themeId - shopify theme id to push into
107
107
  * @param {boolean} [nodelete = true] - run command with --no-delete flag
108
- * @returns {object} - node's ChildProcess
108
+ * @returns {ChildProcess} - node's ChildProcess
109
109
  */
110
110
  push: function push() {
111
111
  var themeId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
@@ -119,6 +119,21 @@ var shopifyCLI = {
119
119
  stdio: "inherit",
120
120
  shell: true
121
121
  });
122
+ },
123
+
124
+ /**
125
+ * shopify theme package
126
+ *
127
+ * @memberof seed-cli.shopifyCLI
128
+ * @returns {ChildProcess}
129
+ */
130
+ "package": function _package() {
131
+ return (0, _crossSpawn["default"])("shopify theme", ["package"], {
132
+ cwd: _config["default"].themeRoot + "/dist",
133
+ env: process.env,
134
+ stdio: "inherit",
135
+ shell: true
136
+ });
122
137
  }
123
138
  };
124
139
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madebyseed/seed-cli-tools",
3
- "version": "1.4.2",
3
+ "version": "1.5.1",
4
4
  "description": "Seed CLI Tools",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -42,7 +42,6 @@
42
42
  "gulp-sass": "^5.0.0",
43
43
  "gulp-size": "^4.0.1",
44
44
  "gulp-uglify": "^3.0.2",
45
- "gulp-zip": "^5.1.0",
46
45
  "postcss": "^8.3.6",
47
46
  "postcss-import": "^14.0.2",
48
47
  "postcss-pxtorem": "^6.0.0",
@@ -52,5 +51,5 @@
52
51
  "vinyl-paths": "^3.0.1",
53
52
  "yargs": "^17.0.1"
54
53
  },
55
- "gitHead": "05ac45bc95da549aeb56d6e641b949d98fd480c6"
54
+ "gitHead": "4d7b75ed265d6bf4df7d0a578641239991f24248"
56
55
  }
package/src/gulpfile.js CHANGED
@@ -32,7 +32,7 @@ gulp.task(
32
32
  * @memberof slate-cli.tasks
33
33
  * @static
34
34
  */
35
- gulp.task("zip", gulp.series("build", "compress"));
35
+ gulp.task("zip", gulp.series("build", "shopify:package:dist", "copy:zip"));
36
36
 
37
37
  /**
38
38
  * Syncronizes the development theme settings with our src folder theme settings
@@ -62,7 +62,12 @@ gulp.task("build:css", () => {
62
62
  */
63
63
  gulp.task("watch:css", () => {
64
64
  chokidar.watch(assets, { ignoreInitial: true }).on("all", (event, path) => {
65
- messages.logFileEvent(event, path);
65
+ const isCssFile = /.\.css$/.test(path);
66
+ // Don't log event twice
67
+ if (isCssFile) {
68
+ messages.logFileEvent(event, path);
69
+ }
70
+
66
71
  processCss();
67
72
  });
68
73
  });
@@ -1,7 +1,6 @@
1
1
  const gulp = require("gulp");
2
2
  const gulpif = require("gulp-if");
3
3
  const del = require("del");
4
- const zip = require("gulp-zip");
5
4
  const size = require("gulp-size");
6
5
  const plumber = require("gulp-plumber");
7
6
 
@@ -46,24 +45,7 @@ function copyFiles(files, srcOptions, dest, log = false) {
46
45
  * @static
47
46
  */
48
47
  gulp.task("clean", () => {
49
- return del(["upload", "dist", "tmp"]);
50
- });
51
-
52
- /**
53
- * Compress theme and build a shopify-compatible `.zip` file for uploading to store
54
- *
55
- * @function compress
56
- * @memberof slate-cli.tasks.deploy
57
- * @static
58
- */
59
- gulp.task("compress", () => {
60
- const distFiles = `${config.dist.root}**/*`;
61
-
62
- return gulp.src([distFiles])
63
- .pipe(plumber(utils.errorHandler))
64
- .pipe(zip(`${config.packageJson.name}.zip` || "theme.zip"))
65
- .pipe(size({ showFiles: true, pretty: true }))
66
- .pipe(gulp.dest("./upload/"));
48
+ return del(["upload", "dist", "tmp", "src/*.zip", "*.zip"]);
67
49
  });
68
50
 
69
51
  /**
@@ -93,3 +75,18 @@ gulp.task("sync-settings:tmp:src", () => {
93
75
  config.src.root
94
76
  );
95
77
  });
78
+
79
+ /**
80
+ * Copies zip from dist to src
81
+ * @function copy:zip
82
+ * @memberof seed-cli.tasks.sync-settings
83
+ * @static
84
+ */
85
+ gulp.task("copy:zip", () => {
86
+ return copyFiles(
87
+ config.dist.zip,
88
+ { base: config.dist.root },
89
+ config.themeRoot,
90
+ true
91
+ )
92
+ })
@@ -45,7 +45,7 @@ try {
45
45
  * @prop {Object} plugins - configuration objects passed to various plugins used in the task interface
46
46
  */
47
47
  const config = {
48
- environment: argv.environment === "undefined" ? "development" : argv.environment,
48
+ environment: (argv.environment === "undefined" || !argv.environment) ? "development" : argv.environment,
49
49
  optimize: !argv["skip-optimizations"],
50
50
  nodelete: !argv["delete"],
51
51
  themeRoot,
@@ -73,6 +73,7 @@ const config = {
73
73
  locales: "src/locales/*",
74
74
  config: "src/config/*",
75
75
  layout: "src/layout/*",
76
+ zip: "src/**/*.zip"
76
77
  },
77
78
 
78
79
  tmp: {
@@ -91,6 +92,7 @@ const config = {
91
92
  locales: "tmp/locales/*",
92
93
  config: "tmp/config/*",
93
94
  layout: "tmp/layout/*",
95
+ zip: "tmp/**/*.zip"
94
96
  },
95
97
 
96
98
  dist: {
@@ -101,6 +103,7 @@ const config = {
101
103
  layout: "dist/layout/",
102
104
  templates: "dist/templates/",
103
105
  locales: "dist/locales/",
106
+ zip: "dist/*.zip"
104
107
  },
105
108
 
106
109
  roots: {
@@ -113,6 +113,18 @@ gulp.task("shopify:push:dist", () => {
113
113
  return shopifyCLI.push(getThemeID(config.themeRoot, config.environment), config.nodelete);
114
114
  });
115
115
 
116
+ /**
117
+ * Initiates 'shopify theme package' on the dist folder, creating a zip.
118
+ *
119
+ * @function shopify:package:dist
120
+ * @memberof seed-cli.tasks.zip
121
+ * @static
122
+ */
123
+ gulp.task("shopify:package:dist", () => {
124
+ messages.logChildProcess("shopify theme package on dist folder...")
125
+ return shopifyCLI.package();
126
+ })
127
+
116
128
  /**
117
129
  * Takes the output of shopify cli serve, extracts dev theme ID and persists
118
130
  * in seed.config.js
package/src/utils.js CHANGED
@@ -76,7 +76,7 @@ export const shopifyCLI = {
76
76
  * @memberof seed-cli.shopifyCLI
77
77
  * @param {string} themeId - shopify theme id to push into
78
78
  * @param {boolean} [nodelete = true] - run command with --no-delete flag
79
- * @returns {object} - node's ChildProcess
79
+ * @returns {ChildProcess} - node's ChildProcess
80
80
  */
81
81
  push: (themeId = null, nodelete = true) => {
82
82
  let args = ["push"];
@@ -91,6 +91,21 @@ export const shopifyCLI = {
91
91
  shell: true,
92
92
  });
93
93
  },
94
+
95
+ /**
96
+ * shopify theme package
97
+ *
98
+ * @memberof seed-cli.shopifyCLI
99
+ * @returns {ChildProcess}
100
+ */
101
+ package: () => {
102
+ return spawn("shopify theme", ["package"], {
103
+ cwd: config.themeRoot + "/dist",
104
+ env: process.env,
105
+ stdio: "inherit",
106
+ shell: true,
107
+ });
108
+ }
94
109
  };
95
110
 
96
111
  /**