@madebyseed/seed-cli-tools 1.4.1 → 1.5.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.
- package/lib/gulpfile.js +1 -1
- package/lib/tasks/build-css.js +7 -2
- package/lib/tasks/build-utils.js +13 -18
- package/lib/tasks/includes/config.js +7 -4
- package/lib/tasks/shopify-cli.js +13 -0
- package/lib/utils.js +16 -1
- package/package.json +2 -3
- package/src/gulpfile.js +1 -1
- package/src/tasks/build-css.js +7 -1
- package/src/tasks/build-utils.js +16 -19
- package/src/tasks/includes/config.js +4 -1
- package/src/tasks/shopify-cli.js +13 -0
- package/src/utils.js +16 -1
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", "
|
|
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
|
*
|
package/lib/tasks/build-css.js
CHANGED
|
@@ -18,7 +18,7 @@ var messages = require("./includes/messages.js");
|
|
|
18
18
|
|
|
19
19
|
var tailwindConfig = require(path.join(config.themeRoot, config.tailwindConfig));
|
|
20
20
|
|
|
21
|
-
var assets = tailwindConfig.mode === "jit" ? [config.src.css, config.src.sections, config.src.layout, config.src.snippets, config.src.assets, config.src.js, config.tailwindConfig] : [config.src.css, config.tailwindConfig];
|
|
21
|
+
var assets = tailwindConfig.mode === "jit" ? [config.src.css, config.src.sections, config.src.layout, config.src.snippets, config.src.assets, config.src.js, config.src.icons, config.tailwindConfig] : [config.src.css, config.tailwindConfig];
|
|
22
22
|
/**
|
|
23
23
|
* Concatenate css via gulp-cssimport and copys to the `/dist` folder
|
|
24
24
|
*
|
|
@@ -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
|
-
|
|
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
|
});
|
package/lib/tasks/build-utils.js
CHANGED
|
@@ -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}",
|
package/lib/tasks/shopify-cli.js
CHANGED
|
@@ -14,6 +14,7 @@ var config = require("./includes/config");
|
|
|
14
14
|
|
|
15
15
|
var messages = require("./includes/messages");
|
|
16
16
|
|
|
17
|
+
console.log(config);
|
|
17
18
|
var environment = config.environment.split(/\s*,\s*|\s+/)[0];
|
|
18
19
|
/**
|
|
19
20
|
* Initiates shopify's cli command 'shopify theme serve' on the dist folder,
|
|
@@ -107,6 +108,18 @@ gulp.task("shopify:push:dist", function () {
|
|
|
107
108
|
messages.logChildProcess("'shopify theme push".concat(config.nodelete ? ' --nodelete' : '', "' on dist folder..."));
|
|
108
109
|
return shopifyCLI.push(getThemeID(config.themeRoot, config.environment), config.nodelete);
|
|
109
110
|
});
|
|
111
|
+
/**
|
|
112
|
+
* Initiates 'shopify theme package' on the dist folder, creating a zip.
|
|
113
|
+
*
|
|
114
|
+
* @function shopify:package:dist
|
|
115
|
+
* @memberof seed-cli.tasks.zip
|
|
116
|
+
* @static
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
gulp.task("shopify:package:dist", function () {
|
|
120
|
+
messages.logChildProcess("shopify theme package on dist folder...");
|
|
121
|
+
return shopifyCLI["package"]();
|
|
122
|
+
});
|
|
110
123
|
/**
|
|
111
124
|
* Takes the output of shopify cli serve, extracts dev theme ID and persists
|
|
112
125
|
* 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 {
|
|
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.
|
|
3
|
+
"version": "1.5.0",
|
|
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": "
|
|
54
|
+
"gitHead": "f2f4b486718b60c024221276f6f52c7435ea2c87"
|
|
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", "
|
|
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
|
package/src/tasks/build-css.js
CHANGED
|
@@ -21,6 +21,7 @@ const assets =
|
|
|
21
21
|
config.src.snippets,
|
|
22
22
|
config.src.assets,
|
|
23
23
|
config.src.js,
|
|
24
|
+
config.src.icons,
|
|
24
25
|
config.tailwindConfig,
|
|
25
26
|
]
|
|
26
27
|
: [config.src.css, config.tailwindConfig];
|
|
@@ -61,7 +62,12 @@ gulp.task("build:css", () => {
|
|
|
61
62
|
*/
|
|
62
63
|
gulp.task("watch:css", () => {
|
|
63
64
|
chokidar.watch(assets, { ignoreInitial: true }).on("all", (event, path) => {
|
|
64
|
-
|
|
65
|
+
const isCssFile = /.\.css$/.test(path);
|
|
66
|
+
// Don't log event twice
|
|
67
|
+
if (isCssFile) {
|
|
68
|
+
messages.logFileEvent(event, path);
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
processCss();
|
|
66
72
|
});
|
|
67
73
|
});
|
package/src/tasks/build-utils.js
CHANGED
|
@@ -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: {
|
package/src/tasks/shopify-cli.js
CHANGED
|
@@ -10,6 +10,7 @@ const {
|
|
|
10
10
|
} = require("../utils");
|
|
11
11
|
const config = require("./includes/config");
|
|
12
12
|
const messages = require("./includes/messages")
|
|
13
|
+
console.log(config);
|
|
13
14
|
const environment = config.environment.split(/\s*,\s*|\s+/)[0];
|
|
14
15
|
|
|
15
16
|
|
|
@@ -113,6 +114,18 @@ gulp.task("shopify:push:dist", () => {
|
|
|
113
114
|
return shopifyCLI.push(getThemeID(config.themeRoot, config.environment), config.nodelete);
|
|
114
115
|
});
|
|
115
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Initiates 'shopify theme package' on the dist folder, creating a zip.
|
|
119
|
+
*
|
|
120
|
+
* @function shopify:package:dist
|
|
121
|
+
* @memberof seed-cli.tasks.zip
|
|
122
|
+
* @static
|
|
123
|
+
*/
|
|
124
|
+
gulp.task("shopify:package:dist", () => {
|
|
125
|
+
messages.logChildProcess("shopify theme package on dist folder...")
|
|
126
|
+
return shopifyCLI.package();
|
|
127
|
+
})
|
|
128
|
+
|
|
116
129
|
/**
|
|
117
130
|
* Takes the output of shopify cli serve, extracts dev theme ID and persists
|
|
118
131
|
* 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 {
|
|
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
|
/**
|