@madebyseed/seed-cli-tools 1.8.0 → 1.9.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/commands/build.js +31 -0
- package/lib/commands/deploy.js +5 -5
- package/lib/commands/pull.js +5 -5
- package/lib/gulpfile.js +2 -2
- package/lib/tasks/build-css.js +6 -2
- package/lib/tasks/includes/config.js +1 -0
- package/lib/tasks/shopify-cli.js +6 -5
- package/lib/utils.js +12 -12
- package/package.json +4 -3
- package/src/commands/build.js +39 -0
- package/src/commands/deploy.js +15 -9
- package/src/commands/pull.js +11 -9
- package/src/gulpfile.js +2 -2
- package/src/tasks/build-css.js +2 -2
- package/src/tasks/includes/config.js +1 -0
- package/src/tasks/shopify-cli.js +6 -5
- package/src/utils.js +16 -12
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = _default;
|
|
7
|
+
|
|
8
|
+
var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
|
|
9
|
+
|
|
10
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
11
|
+
|
|
12
|
+
var _config = _interopRequireDefault(require("../config"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
var logger = (0, _debug["default"])("seed-tools:deploy");
|
|
17
|
+
|
|
18
|
+
function _default(program) {
|
|
19
|
+
program.command("build").alias("b").description("Builds ./src files into dist folder").option("-s, --skip-optimizations", "Skips asset optimization steps such as compression, minification and purging.", false).action(function () {
|
|
20
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
|
+
logger("--gulpfile ".concat(_config["default"].gulpFile));
|
|
22
|
+
logger("--cwd ".concat(_config["default"].themeRoot));
|
|
23
|
+
var args = ["build"];
|
|
24
|
+
if (options.skipOptimizations) args.push('--skip-optimizations');
|
|
25
|
+
if (!options.skipOptimizations) process.env.NODE_ENV = "production";
|
|
26
|
+
(0, _crossSpawn["default"])(_config["default"].gulp, args.concat(["--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot]), {
|
|
27
|
+
detached: false,
|
|
28
|
+
stdio: "inherit"
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
package/lib/commands/deploy.js
CHANGED
|
@@ -18,14 +18,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
18
18
|
var logger = (0, _debug["default"])("seed-tools:deploy");
|
|
19
19
|
|
|
20
20
|
function _default(program) {
|
|
21
|
-
program.command("deploy").alias("d").description("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.").option("-e, --env <environment>
|
|
21
|
+
program.command("deploy").alias("d").description("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.").option("-e, --env <environment>", "Shopify theme to deploy code to (specified in seed.config.js)", "development").option("-st, --store <store>", "Shopify store(s) to deploy code to (specified in seed.config.js)").option("-n, --no-dev", "Skips pulling theme settings from local development theme", false).option("-s, --skip-optimizations", "Skips asset optimization steps such as compression, minification and purging.", false).option("-d, --delete", "By default seed deploy runs 'shopify theme push --nodelete'. With this option it will leave out the --no-delete flag, allowind files to be delete in store theme.", false).action(function () {
|
|
22
22
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
23
|
logger("--gulpfile ".concat(_config["default"].gulpFile));
|
|
24
24
|
logger("--cwd ".concat(_config["default"].themeRoot));
|
|
25
|
-
if (!(0, _utils.login)()) return;
|
|
26
|
-
var args = [options.dev ? "deploy" : "deploy:no-sync", "--environment", options.env];
|
|
27
|
-
if (options.skipOptimizations) args.push(
|
|
28
|
-
if (options["delete"]) args.push(
|
|
25
|
+
if (!(0, _utils.login)(options.store)) return;
|
|
26
|
+
var args = [options.dev ? "deploy" : "deploy:no-sync", "--environment", options.env, "--store", options.store];
|
|
27
|
+
if (options.skipOptimizations) args.push("--skip-optimizations");
|
|
28
|
+
if (options["delete"]) args.push("--delete");
|
|
29
29
|
if (!options.skipOptimizations) process.env.NODE_ENV = "production";
|
|
30
30
|
(0, _crossSpawn["default"])(_config["default"].gulp, args.concat(["--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot]), {
|
|
31
31
|
detached: false,
|
package/lib/commands/pull.js
CHANGED
|
@@ -18,14 +18,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
18
18
|
var logger = (0, _debug["default"])("seed-tools:deploy");
|
|
19
19
|
|
|
20
20
|
function _default(program) {
|
|
21
|
-
program.command("pull").alias("p").description("Pulls the specified theme into your src folder. By default, it only pulls theme settings, if you want to pull all files use the --all flag.").option("-e, --env <environment>[,<environment>...]", "Shopify store(s) to deploy code to (specified in seed.config.js)", "development").option("-a, --all", "Pulls all files from specified theme", false).option("-d, --delete", "By default seed pull doesn't delete any files in you src folder, with this options it will delete any files that diverge from the pulled theme.", false).action(function () {
|
|
21
|
+
program.command("pull").alias("p").description("Pulls the specified theme into your src folder. By default, it only pulls theme settings, if you want to pull all files use the --all flag.").option("-e, --env <environment>[,<environment>...]", "Shopify store(s) to deploy code to (specified in seed.config.js)", "development").option("-st, --store <store>", "Shopify store(s) to deploy code to (specified in seed.config.js)").option("-a, --all", "Pulls all files from specified theme", false).option("-d, --delete", "By default seed pull doesn't delete any files in you src folder, with this options it will delete any files that diverge from the pulled theme.", false).action(function () {
|
|
22
22
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
23
|
logger("--gulpfile ".concat(_config["default"].gulpFile));
|
|
24
24
|
logger("--cwd ".concat(_config["default"].themeRoot));
|
|
25
|
-
if (!(0, _utils.login)()) return;
|
|
26
|
-
var args = [options.all ? "pull" : "pull:settings", "--environment", options.env];
|
|
27
|
-
if (options.all) args.push(
|
|
28
|
-
if (options["delete"]) args.push(
|
|
25
|
+
if (!(0, _utils.login)(options.store)) return;
|
|
26
|
+
var args = [options.all ? "pull" : "pull:settings", "--environment", options.env, "--store", options.store];
|
|
27
|
+
if (options.all) args.push("--all");
|
|
28
|
+
if (options["delete"]) args.push("--delete");
|
|
29
29
|
(0, _crossSpawn["default"])(_config["default"].gulp, args.concat(["--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot]), {
|
|
30
30
|
detached: false,
|
|
31
31
|
stdio: "inherit"
|
package/lib/gulpfile.js
CHANGED
|
@@ -77,7 +77,7 @@ gulp.task("pull", gulp.series("shopify:pull:origin:src"));
|
|
|
77
77
|
* @static
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
|
-
gulp.task("pull:settings", gulp.series("generate:tmp", "shopify:pull:origin:tmp", "sync-settings:tmp:src"));
|
|
80
|
+
gulp.task("pull:settings", gulp.series("generate:tmp", "shopify:pull:origin:tmp", "sync-settings:tmp:src", "clean"));
|
|
81
81
|
/**
|
|
82
82
|
* Syncronizes 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
|
|
@@ -90,7 +90,7 @@ gulp.task("pull:settings", gulp.series("generate:tmp", "shopify:pull:origin:tmp"
|
|
|
90
90
|
* @static
|
|
91
91
|
*/
|
|
92
92
|
|
|
93
|
-
gulp.task("deploy", gulp.series("sync-settings", "build", "shopify:push:dist"));
|
|
93
|
+
gulp.task("deploy", gulp.series("sync-settings", "build", "shopify:push:dist", "clean"));
|
|
94
94
|
/**
|
|
95
95
|
* Does a full (re)build and push dist files into specified theme environment,
|
|
96
96
|
* theme using shopify theme push, by default with the --no-delete flag
|
package/lib/tasks/build-css.js
CHANGED
|
@@ -29,7 +29,9 @@ var assets = config.usesTailwind || tailwindConfig.mode === "jit" ? [config.src.
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
function processCss() {
|
|
32
|
-
return gulp.src(config.roots.css
|
|
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));
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* Process sass files
|
|
@@ -41,7 +43,9 @@ function processCss() {
|
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
function processSass() {
|
|
44
|
-
return gulp.src(config.roots.scss
|
|
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));
|
|
45
49
|
}
|
|
46
50
|
/**
|
|
47
51
|
* Concatenate css via gulp-cssimport
|
|
@@ -51,6 +51,7 @@ try {
|
|
|
51
51
|
|
|
52
52
|
var config = {
|
|
53
53
|
environment: argv.environment === "undefined" || !argv.environment ? "development" : argv.environment,
|
|
54
|
+
store: argv.store === "undefined" || !argv.store ? null : argv.store,
|
|
54
55
|
optimize: !argv["skip-optimizations"],
|
|
55
56
|
nodelete: !argv["delete"],
|
|
56
57
|
themeRoot: themeRoot,
|
package/lib/tasks/shopify-cli.js
CHANGED
|
@@ -15,6 +15,7 @@ var config = require("./includes/config");
|
|
|
15
15
|
var messages = require("./includes/messages");
|
|
16
16
|
|
|
17
17
|
var environment = config.environment.split(/\s*,\s*|\s+/)[0];
|
|
18
|
+
var store = config.store;
|
|
18
19
|
/**
|
|
19
20
|
* Initiates shopify's cli command 'shopify theme serve' on the dist folder,
|
|
20
21
|
* watching files and uploading them to development store
|
|
@@ -71,7 +72,7 @@ gulp.task("shopify:pull:dev:tmp", function (done) {
|
|
|
71
72
|
return shopifyCLI.pull(devThemeId, config.tmp.root);
|
|
72
73
|
});
|
|
73
74
|
/**
|
|
74
|
-
* Pulls theme files from the seed config theme
|
|
75
|
+
* Pulls theme files from the seed config theme environment into tmp
|
|
75
76
|
*
|
|
76
77
|
* @function shopify:pull:origin:tmp
|
|
77
78
|
* @memberof seed-cli.tasks.deploy
|
|
@@ -80,10 +81,10 @@ gulp.task("shopify:pull:dev:tmp", function (done) {
|
|
|
80
81
|
|
|
81
82
|
gulp.task("shopify:pull:origin:tmp", function () {
|
|
82
83
|
messages.logChildProcess("'shopify theme pull ".concat(environment).concat(config.nodelete ? ' --nodelete' : '', "' into tmp..."));
|
|
83
|
-
return shopifyCLI.pull(getThemeID(config.themeRoot, environment), config.tmp.root);
|
|
84
|
+
return shopifyCLI.pull(getThemeID(config.themeRoot, environment, store), config.tmp.root);
|
|
84
85
|
});
|
|
85
86
|
/**
|
|
86
|
-
* Pulls theme files from the seed config theme
|
|
87
|
+
* Pulls theme files from the seed config theme environment into src
|
|
87
88
|
*
|
|
88
89
|
* @function shopify:pull:origin:src
|
|
89
90
|
* @memberof seed-cli.tasks.deploy
|
|
@@ -92,7 +93,7 @@ gulp.task("shopify:pull:origin:tmp", function () {
|
|
|
92
93
|
|
|
93
94
|
gulp.task("shopify:pull:origin:src", function () {
|
|
94
95
|
messages.logChildProcess("'shopify theme pull ".concat(environment).concat(config.nodelete ? ' --nodelete' : '', "' into src..."));
|
|
95
|
-
return shopifyCLI.pull(getThemeID(config.themeRoot, environment), config.tmp.src, config.nodelete);
|
|
96
|
+
return shopifyCLI.pull(getThemeID(config.themeRoot, environment, store), config.tmp.src, config.nodelete);
|
|
96
97
|
});
|
|
97
98
|
/**
|
|
98
99
|
* Initiates shopify's cli command 'shopify theme push' on the dist folder,
|
|
@@ -105,7 +106,7 @@ gulp.task("shopify:pull:origin:src", function () {
|
|
|
105
106
|
|
|
106
107
|
gulp.task("shopify:push:dist", function () {
|
|
107
108
|
messages.logChildProcess("'shopify theme push".concat(config.nodelete ? ' --nodelete' : '', "' on dist folder..."));
|
|
108
|
-
return shopifyCLI.push(getThemeID(config.themeRoot, config.environment), config.nodelete);
|
|
109
|
+
return shopifyCLI.push(getThemeID(config.themeRoot, config.environment, store), config.nodelete);
|
|
109
110
|
});
|
|
110
111
|
/**
|
|
111
112
|
* Initiates 'shopify theme package' on the dist folder, creating a zip.
|
package/lib/utils.js
CHANGED
|
@@ -90,7 +90,7 @@ var shopifyCLI = {
|
|
|
90
90
|
var dir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "./src";
|
|
91
91
|
var nodelete = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
92
92
|
var args = ["pull"];
|
|
93
|
-
if (themeId) args = args.concat(["--
|
|
93
|
+
if (themeId) args = args.concat(["--theme", themeId, dir]);
|
|
94
94
|
if (nodelete) args.push('--nodelete');
|
|
95
95
|
return (0, _crossSpawn["default"])("shopify theme", args, {
|
|
96
96
|
env: process.env,
|
|
@@ -111,7 +111,7 @@ var shopifyCLI = {
|
|
|
111
111
|
var themeId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
112
112
|
var nodelete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
113
113
|
var args = ["push"];
|
|
114
|
-
if (themeId) args = args.concat(["--
|
|
114
|
+
if (themeId) args = args.concat(["--theme", themeId]);
|
|
115
115
|
if (nodelete) args.push('--nodelete');
|
|
116
116
|
return (0, _crossSpawn["default"])("shopify theme", args, {
|
|
117
117
|
cwd: _config["default"].themeRoot + "/dist",
|
|
@@ -154,8 +154,8 @@ function getSeedConfig(themeRoot) {
|
|
|
154
154
|
*/
|
|
155
155
|
|
|
156
156
|
|
|
157
|
-
function getStoreName(themeRoot) {
|
|
158
|
-
return getSeedConfig(themeRoot).store;
|
|
157
|
+
function getStoreName(themeRoot, store) {
|
|
158
|
+
return store ? getSeedConfig(themeRoot).stores[store].domain : getSeedConfig(themeRoot).store;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Get theme ID from seed.config.js
|
|
@@ -166,8 +166,8 @@ function getStoreName(themeRoot) {
|
|
|
166
166
|
*/
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
function getThemeID(themeRoot, environment) {
|
|
170
|
-
return getSeedConfig(themeRoot).themes[environment];
|
|
169
|
+
function getThemeID(themeRoot, environment, store) {
|
|
170
|
+
return store ? getSeedConfig(themeRoot).stores[store].themes[environment] : getSeedConfig(themeRoot).themes[environment];
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Get dev theme ID from seed.config.js
|
|
@@ -228,20 +228,20 @@ function setDevThemeID(themeID) {
|
|
|
228
228
|
*/
|
|
229
229
|
|
|
230
230
|
|
|
231
|
-
function login() {
|
|
232
|
-
var
|
|
231
|
+
function login(store) {
|
|
232
|
+
var domain = getStoreName(_config["default"].themeRoot, store);
|
|
233
233
|
|
|
234
|
-
if (!
|
|
234
|
+
if (!domain) {
|
|
235
235
|
storeErrorMessage();
|
|
236
236
|
return false;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
console.log("Logging into ".concat((0, _chalk.yellow)(
|
|
240
|
-
var loginProcess = shopifyCLI.login(
|
|
239
|
+
console.log("Logging into ".concat((0, _chalk.yellow)(domain), " with Shopify CLI..."));
|
|
240
|
+
var loginProcess = shopifyCLI.login(domain);
|
|
241
241
|
|
|
242
242
|
if (loginProcess.error) {
|
|
243
243
|
console.log("");
|
|
244
|
-
console.log((0, _chalk.red)(" ".concat(_figures["default"].cross, " Failed logging into ").concat(
|
|
244
|
+
console.log((0, _chalk.red)(" ".concat(_figures["default"].cross, " Failed logging into ").concat(domain, ", are you sure you're using the correct account?")));
|
|
245
245
|
console.log("");
|
|
246
246
|
return false;
|
|
247
247
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madebyseed/seed-cli-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Seed CLI Tools",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -42,18 +42,19 @@
|
|
|
42
42
|
"gulp-sass": "^5.0.0",
|
|
43
43
|
"gulp-size": "^4.0.1",
|
|
44
44
|
"gulp-uglify": "^3.0.2",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
45
46
|
"postcss": "^8.3.6",
|
|
46
47
|
"postcss-import": "^14.0.2",
|
|
47
48
|
"postcss-pxtorem": "^6.0.0",
|
|
48
49
|
"postcss-reporter": "^7.0.5",
|
|
49
50
|
"require-directory": "^2.1.1",
|
|
50
51
|
"sass": "^1.36.0",
|
|
51
|
-
"tailwindcss": "^
|
|
52
|
+
"tailwindcss": "^3.1.4",
|
|
52
53
|
"uglify-js": "^3.15.3",
|
|
53
54
|
"vinyl-paths": "^3.0.1",
|
|
54
55
|
"webpack": "^5.72.1",
|
|
55
56
|
"webpack-stream": "^7.0.0",
|
|
56
57
|
"yargs": "^17.0.1"
|
|
57
58
|
},
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "83c7894195faa0356e5c0c666ffbbb9e57eaf93a"
|
|
59
60
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import spawn from "cross-spawn";
|
|
2
|
+
import debug from "debug";
|
|
3
|
+
import config from "../config";
|
|
4
|
+
|
|
5
|
+
const logger = debug("seed-tools:deploy");
|
|
6
|
+
|
|
7
|
+
export default function (program) {
|
|
8
|
+
program
|
|
9
|
+
.command("build")
|
|
10
|
+
.alias("b")
|
|
11
|
+
.description(
|
|
12
|
+
"Builds ./src files into dist folder"
|
|
13
|
+
)
|
|
14
|
+
.option(
|
|
15
|
+
"-s, --skip-optimizations",
|
|
16
|
+
"Skips asset optimization steps such as compression, minification and purging.",
|
|
17
|
+
false
|
|
18
|
+
)
|
|
19
|
+
.action((options = {}) => {
|
|
20
|
+
logger(`--gulpfile ${config.gulpFile}`);
|
|
21
|
+
logger(`--cwd ${config.themeRoot}`);
|
|
22
|
+
|
|
23
|
+
const args = ["build"];
|
|
24
|
+
|
|
25
|
+
if (options.skipOptimizations) args.push('--skip-optimizations')
|
|
26
|
+
|
|
27
|
+
if (!options.skipOptimizations)
|
|
28
|
+
process.env.NODE_ENV = "production";
|
|
29
|
+
|
|
30
|
+
spawn(
|
|
31
|
+
config.gulp,
|
|
32
|
+
args.concat(["--gulpfile", config.gulpFile, "--cwd", config.themeRoot]),
|
|
33
|
+
{
|
|
34
|
+
detached: false,
|
|
35
|
+
stdio: "inherit",
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
}
|
package/src/commands/deploy.js
CHANGED
|
@@ -13,10 +13,14 @@ export default function (program) {
|
|
|
13
13
|
"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."
|
|
14
14
|
)
|
|
15
15
|
.option(
|
|
16
|
-
"-e, --env <environment>
|
|
17
|
-
"Shopify
|
|
16
|
+
"-e, --env <environment>",
|
|
17
|
+
"Shopify theme to deploy code to (specified in seed.config.js)",
|
|
18
18
|
"development"
|
|
19
19
|
)
|
|
20
|
+
.option(
|
|
21
|
+
"-st, --store <store>",
|
|
22
|
+
"Shopify store(s) to deploy code to (specified in seed.config.js)"
|
|
23
|
+
)
|
|
20
24
|
.option(
|
|
21
25
|
"-n, --no-dev",
|
|
22
26
|
"Skips pulling theme settings from local development theme",
|
|
@@ -36,18 +40,20 @@ export default function (program) {
|
|
|
36
40
|
logger(`--gulpfile ${config.gulpFile}`);
|
|
37
41
|
logger(`--cwd ${config.themeRoot}`);
|
|
38
42
|
|
|
39
|
-
if (!login()) return;
|
|
43
|
+
if (!login(options.store)) return;
|
|
40
44
|
|
|
41
45
|
const args = [
|
|
42
|
-
options.dev ? "deploy"
|
|
43
|
-
"--environment",
|
|
46
|
+
options.dev ? "deploy" : "deploy:no-sync",
|
|
47
|
+
"--environment",
|
|
48
|
+
options.env,
|
|
49
|
+
"--store",
|
|
50
|
+
options.store
|
|
44
51
|
];
|
|
45
52
|
|
|
46
|
-
if (options.skipOptimizations) args.push(
|
|
47
|
-
if (options.delete) args.push(
|
|
53
|
+
if (options.skipOptimizations) args.push("--skip-optimizations");
|
|
54
|
+
if (options.delete) args.push("--delete");
|
|
48
55
|
|
|
49
|
-
if (!options.skipOptimizations)
|
|
50
|
-
process.env.NODE_ENV = "production";
|
|
56
|
+
if (!options.skipOptimizations) process.env.NODE_ENV = "production";
|
|
51
57
|
|
|
52
58
|
spawn(
|
|
53
59
|
config.gulp,
|
package/src/commands/pull.js
CHANGED
|
@@ -18,10 +18,10 @@ export default function (program) {
|
|
|
18
18
|
"development"
|
|
19
19
|
)
|
|
20
20
|
.option(
|
|
21
|
-
"-
|
|
22
|
-
"
|
|
23
|
-
false
|
|
21
|
+
"-st, --store <store>",
|
|
22
|
+
"Shopify store(s) to deploy code to (specified in seed.config.js)"
|
|
24
23
|
)
|
|
24
|
+
.option("-a, --all", "Pulls all files from specified theme", false)
|
|
25
25
|
.option(
|
|
26
26
|
"-d, --delete",
|
|
27
27
|
"By default seed pull doesn't delete any files in you src folder, with this options it will delete any files that diverge from the pulled theme.",
|
|
@@ -30,16 +30,18 @@ export default function (program) {
|
|
|
30
30
|
.action((options = {}) => {
|
|
31
31
|
logger(`--gulpfile ${config.gulpFile}`);
|
|
32
32
|
logger(`--cwd ${config.themeRoot}`);
|
|
33
|
-
if (!login()) return;
|
|
34
|
-
|
|
33
|
+
if (!login(options.store)) return;
|
|
35
34
|
|
|
36
35
|
const args = [
|
|
37
|
-
options.all ? "pull" : "pull:settings",
|
|
38
|
-
"--environment",
|
|
36
|
+
options.all ? "pull" : "pull:settings",
|
|
37
|
+
"--environment",
|
|
38
|
+
options.env,
|
|
39
|
+
"--store",
|
|
40
|
+
options.store
|
|
39
41
|
];
|
|
40
42
|
|
|
41
|
-
if (options.all) args.push(
|
|
42
|
-
if (options.delete) args.push(
|
|
43
|
+
if (options.all) args.push("--all");
|
|
44
|
+
if (options.delete) args.push("--delete");
|
|
43
45
|
|
|
44
46
|
spawn(
|
|
45
47
|
config.gulp,
|
package/src/gulpfile.js
CHANGED
|
@@ -97,7 +97,7 @@ gulp.task(
|
|
|
97
97
|
* @memberof slate-cli.tasks.deploy
|
|
98
98
|
* @static
|
|
99
99
|
*/
|
|
100
|
-
gulp.task("pull:settings", gulp.series("generate:tmp", "shopify:pull:origin:tmp", "sync-settings:tmp:src"));
|
|
100
|
+
gulp.task("pull:settings", gulp.series("generate:tmp", "shopify:pull:origin:tmp", "sync-settings:tmp:src", "clean"));
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
/**
|
|
@@ -111,7 +111,7 @@ gulp.task(
|
|
|
111
111
|
* @memberof slate-cli.tasks.deploy
|
|
112
112
|
* @static
|
|
113
113
|
*/
|
|
114
|
-
gulp.task("deploy", gulp.series("sync-settings", "build", "shopify:push:dist"));
|
|
114
|
+
gulp.task("deploy", gulp.series("sync-settings", "build", "shopify:push:dist", "clean"));
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* Does a full (re)build and push dist files into specified theme environment,
|
package/src/tasks/build-css.js
CHANGED
|
@@ -36,7 +36,7 @@ const assets =
|
|
|
36
36
|
* @private
|
|
37
37
|
*/
|
|
38
38
|
function processCss() {
|
|
39
|
-
return gulp.src(config.roots.css)
|
|
39
|
+
return gulp.src(config.roots.css, { allowEmpty: true })
|
|
40
40
|
.pipe(plumber(utils.errorHandler))
|
|
41
41
|
.pipe(postcss(config.plugins.postcss))
|
|
42
42
|
.pipe(gulp.dest(config.dist.assets))
|
|
@@ -50,7 +50,7 @@ function processCss() {
|
|
|
50
50
|
* @private
|
|
51
51
|
*/
|
|
52
52
|
function processSass() {
|
|
53
|
-
return gulp.src(config.roots.scss)
|
|
53
|
+
return gulp.src(config.roots.scss, { allowEmpty: true })
|
|
54
54
|
.pipe(plumber(utils.errorHandler))
|
|
55
55
|
.pipe(sass())
|
|
56
56
|
.pipe(postcss(config.plugins.postcss))
|
|
@@ -39,6 +39,7 @@ try {
|
|
|
39
39
|
*/
|
|
40
40
|
const config = {
|
|
41
41
|
environment: (argv.environment === "undefined" || !argv.environment) ? "development" : argv.environment,
|
|
42
|
+
store: (argv.store === "undefined" || !argv.store) ? null : argv.store,
|
|
42
43
|
optimize: !argv["skip-optimizations"],
|
|
43
44
|
nodelete: !argv["delete"],
|
|
44
45
|
themeRoot,
|
package/src/tasks/shopify-cli.js
CHANGED
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
const config = require("./includes/config");
|
|
12
12
|
const messages = require("./includes/messages")
|
|
13
13
|
const environment = config.environment.split(/\s*,\s*|\s+/)[0];
|
|
14
|
+
const store = config.store;
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -70,7 +71,7 @@ gulp.task("shopify:pull:dev:tmp", (done) => {
|
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
|
-
* Pulls theme files from the seed config theme
|
|
74
|
+
* Pulls theme files from the seed config theme environment into tmp
|
|
74
75
|
*
|
|
75
76
|
* @function shopify:pull:origin:tmp
|
|
76
77
|
* @memberof seed-cli.tasks.deploy
|
|
@@ -79,13 +80,13 @@ gulp.task("shopify:pull:dev:tmp", (done) => {
|
|
|
79
80
|
gulp.task("shopify:pull:origin:tmp", () => {
|
|
80
81
|
messages.logChildProcess(`'shopify theme pull ${environment}${config.nodelete ? ' --nodelete' : ''}' into tmp...`);
|
|
81
82
|
return shopifyCLI.pull(
|
|
82
|
-
getThemeID(config.themeRoot, environment),
|
|
83
|
+
getThemeID(config.themeRoot, environment, store),
|
|
83
84
|
config.tmp.root
|
|
84
85
|
);
|
|
85
86
|
});
|
|
86
87
|
|
|
87
88
|
/**
|
|
88
|
-
* Pulls theme files from the seed config theme
|
|
89
|
+
* Pulls theme files from the seed config theme environment into src
|
|
89
90
|
*
|
|
90
91
|
* @function shopify:pull:origin:src
|
|
91
92
|
* @memberof seed-cli.tasks.deploy
|
|
@@ -94,7 +95,7 @@ gulp.task("shopify:pull:origin:tmp", () => {
|
|
|
94
95
|
gulp.task("shopify:pull:origin:src", () => {
|
|
95
96
|
messages.logChildProcess(`'shopify theme pull ${environment}${config.nodelete ? ' --nodelete' : ''}' into src...`);
|
|
96
97
|
return shopifyCLI.pull(
|
|
97
|
-
getThemeID(config.themeRoot, environment),
|
|
98
|
+
getThemeID(config.themeRoot, environment, store),
|
|
98
99
|
config.tmp.src,
|
|
99
100
|
config.nodelete
|
|
100
101
|
);
|
|
@@ -110,7 +111,7 @@ gulp.task("shopify:pull:origin:src", () => {
|
|
|
110
111
|
*/
|
|
111
112
|
gulp.task("shopify:push:dist", () => {
|
|
112
113
|
messages.logChildProcess(`'shopify theme push${config.nodelete ? ' --nodelete' : ''}' on dist folder...`);
|
|
113
|
-
return shopifyCLI.push(getThemeID(config.themeRoot, config.environment), config.nodelete);
|
|
114
|
+
return shopifyCLI.push(getThemeID(config.themeRoot, config.environment, store), config.nodelete);
|
|
114
115
|
});
|
|
115
116
|
|
|
116
117
|
/**
|
package/src/utils.js
CHANGED
|
@@ -59,7 +59,7 @@ export const shopifyCLI = {
|
|
|
59
59
|
*/
|
|
60
60
|
pull: (themeId = null, dir = "./src", nodelete = true) => {
|
|
61
61
|
let args = ["pull"];
|
|
62
|
-
if (themeId) args = args.concat(["--
|
|
62
|
+
if (themeId) args = args.concat(["--theme", themeId, dir]);
|
|
63
63
|
|
|
64
64
|
if (nodelete) args.push('--nodelete')
|
|
65
65
|
|
|
@@ -80,7 +80,7 @@ export const shopifyCLI = {
|
|
|
80
80
|
*/
|
|
81
81
|
push: (themeId = null, nodelete = true) => {
|
|
82
82
|
let args = ["push"];
|
|
83
|
-
if (themeId) args = args.concat(["--
|
|
83
|
+
if (themeId) args = args.concat(["--theme", themeId]);
|
|
84
84
|
|
|
85
85
|
if (nodelete) args.push('--nodelete')
|
|
86
86
|
|
|
@@ -122,8 +122,10 @@ export function getSeedConfig(themeRoot) {
|
|
|
122
122
|
*
|
|
123
123
|
* @param {string} themeRoot - the path to theme root dir
|
|
124
124
|
*/
|
|
125
|
-
export function getStoreName(themeRoot) {
|
|
126
|
-
return
|
|
125
|
+
export function getStoreName(themeRoot, store) {
|
|
126
|
+
return store ?
|
|
127
|
+
getSeedConfig(themeRoot).stores[store].domain :
|
|
128
|
+
getSeedConfig(themeRoot).store;
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
/**
|
|
@@ -133,8 +135,10 @@ export function getStoreName(themeRoot) {
|
|
|
133
135
|
* @param {string} environment - theme name/environment
|
|
134
136
|
* @returns {string} themeID
|
|
135
137
|
*/
|
|
136
|
-
export function getThemeID(themeRoot, environment) {
|
|
137
|
-
return
|
|
138
|
+
export function getThemeID(themeRoot, environment, store) {
|
|
139
|
+
return store ?
|
|
140
|
+
getSeedConfig(themeRoot).stores[store].themes[environment] :
|
|
141
|
+
getSeedConfig(themeRoot).themes[environment];
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
/**
|
|
@@ -189,20 +193,20 @@ export function setDevThemeID(themeID) {
|
|
|
189
193
|
* and handling errors.
|
|
190
194
|
* @returns {boolean} whether login was succesful or not
|
|
191
195
|
*/
|
|
192
|
-
export function login() {
|
|
193
|
-
const
|
|
196
|
+
export function login(store) {
|
|
197
|
+
const domain = getStoreName(config.themeRoot, store);
|
|
194
198
|
|
|
195
|
-
if (!
|
|
199
|
+
if (!domain) {
|
|
196
200
|
storeErrorMessage();
|
|
197
201
|
return false;
|
|
198
202
|
}
|
|
199
203
|
|
|
200
|
-
console.log(`Logging into ${yellow(
|
|
201
|
-
const loginProcess = shopifyCLI.login(
|
|
204
|
+
console.log(`Logging into ${yellow(domain)} with Shopify CLI...`)
|
|
205
|
+
const loginProcess = shopifyCLI.login(domain);
|
|
202
206
|
if (loginProcess.error) {
|
|
203
207
|
console.log("");
|
|
204
208
|
console.log(
|
|
205
|
-
red(` ${figures.cross} Failed logging into ${
|
|
209
|
+
red(` ${figures.cross} Failed logging into ${domain}, are you sure you're using the correct account?`)
|
|
206
210
|
);
|
|
207
211
|
console.log("");
|
|
208
212
|
return false;
|