@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.
- package/lib/commands/deploy.js +6 -5
- package/lib/commands/watch.js +3 -1
- package/lib/commands/zip.js +27 -0
- package/lib/config.js +3 -1
- package/lib/gulpfile.js +24 -13
- package/lib/tasks/build-css.js +1 -2
- package/lib/tasks/build-js.js +4 -3
- package/lib/tasks/build-utils.js +64 -13
- package/lib/tasks/includes/config.js +66 -39
- package/lib/tasks/includes/messages.js +4 -4
- package/lib/tasks/includes/utilities.js +14 -38
- package/lib/tasks/shopify-cli.js +101 -0
- package/lib/tasks/watchers.js +24 -21
- package/lib/utils.js +113 -14
- package/package.json +4 -4
- package/src/commands/deploy.js +32 -15
- package/src/commands/watch.js +10 -0
- package/src/commands/zip.js +27 -0
- package/src/config.js +2 -0
- package/src/gulpfile.js +44 -28
- package/src/tasks/build-css.js +0 -1
- package/src/tasks/build-js.js +2 -1
- package/src/tasks/build-utils.js +72 -15
- package/src/tasks/includes/config.js +67 -41
- package/src/tasks/includes/messages.js +5 -5
- package/src/tasks/includes/utilities.js +24 -45
- package/src/tasks/shopify-cli.js +100 -0
- package/src/tasks/watchers.js +24 -29
- package/src/utils.js +99 -29
- package/lib/tasks/deploy.js +0 -19
- package/src/tasks/deploy.js +0 -15
package/lib/commands/deploy.js
CHANGED
|
@@ -13,17 +13,18 @@ var _config = _interopRequireDefault(require("../config"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
15
|
|
|
16
|
-
var logger = (0, _debug["default"])(
|
|
16
|
+
var logger = (0, _debug["default"])("seed-tools:deploy");
|
|
17
17
|
|
|
18
18
|
function _default(program) {
|
|
19
|
-
program.command(
|
|
19
|
+
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>[,<environment>...]", "Shopify store(s) to deploy code to (specified in seed.config.js)", "development").option("-s, --skip-optimizations", "Skips asset optimization steps such as compression, minification and purging.", false).action(function () {
|
|
20
20
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
21
|
logger("--gulpfile ".concat(_config["default"].gulpFile));
|
|
22
22
|
logger("--cwd ".concat(_config["default"].themeRoot));
|
|
23
|
-
var args = [
|
|
24
|
-
|
|
23
|
+
var args = ["deploy", "--environment", options.env];
|
|
24
|
+
if (options.skipOptimizations) args.push("--skip-optimization");else process.env.NODE_ENV = "production";
|
|
25
|
+
(0, _crossSpawn["default"])(_config["default"].gulp, args.concat(["--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot]), {
|
|
25
26
|
detached: false,
|
|
26
|
-
stdio:
|
|
27
|
+
stdio: "inherit"
|
|
27
28
|
});
|
|
28
29
|
});
|
|
29
30
|
}
|
package/lib/commands/watch.js
CHANGED
|
@@ -22,7 +22,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
22
22
|
var logger = (0, _debug["default"])("seed-tools:watch");
|
|
23
23
|
|
|
24
24
|
function _default(program) {
|
|
25
|
-
program.command("watch").alias("w").description("Watches files for code changes and immediately deploys updates to dev theme as they occur. " + "This uses shopify theme serve under the hood.").action(function () {
|
|
25
|
+
program.command("watch").alias("w").description("Watches files for code changes and immediately deploys updates to dev theme as they occur. " + "This uses shopify theme serve under the hood.").option("-o, --optimize", "Optimizes assets by compressing, minifying and purging.", false).action(function () {
|
|
26
26
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
27
27
|
logger("--gulpfile ".concat(_config["default"].gulpFile));
|
|
28
28
|
logger("--cwd ".concat(_config["default"].themeRoot));
|
|
@@ -48,6 +48,8 @@ function _default(program) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
var gulpArgs = ["watch", "--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot, "--environment", options.env];
|
|
51
|
+
if (!options.optimize) gulpArgs.push("--skip-optimization");
|
|
52
|
+
process.env.NODE_ENV = options.optimize ? 'production' : 'development';
|
|
51
53
|
(0, _crossSpawn["default"])(_config["default"].gulp, gulpArgs, {
|
|
52
54
|
detached: false,
|
|
53
55
|
stdio: "inherit"
|
|
@@ -0,0 +1,27 @@
|
|
|
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:zip");
|
|
17
|
+
|
|
18
|
+
function _default(program) {
|
|
19
|
+
program.command("zip").alias("z").description("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).").action(function () {
|
|
20
|
+
logger("--gulpfile ".concat(_config["default"].gulpFile));
|
|
21
|
+
logger("--cwd ".concat(_config["default"].themeRoot));
|
|
22
|
+
(0, _crossSpawn["default"])(_config["default"].gulp, ["zip", "--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot], {
|
|
23
|
+
detached: false,
|
|
24
|
+
stdio: "inherit"
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
package/lib/config.js
CHANGED
|
@@ -22,7 +22,9 @@ var legacyGulpPath = (0, _path.join)(themeRoot, (0, _path.normalize)("node_modul
|
|
|
22
22
|
var config = {
|
|
23
23
|
gulpFile: (0, _path.join)(currentDirectory, "gulpfile.js"),
|
|
24
24
|
gulp: (0, _fs.existsSync)(defaultGulpPath) ? defaultGulpPath : legacyGulpPath,
|
|
25
|
-
themeRoot: themeRoot
|
|
25
|
+
themeRoot: themeRoot,
|
|
26
|
+
seedConfig: (0, _path.join)(themeRoot, "seed.config.js"),
|
|
27
|
+
seedConfigDelimiter: "/** === delimiter */"
|
|
26
28
|
};
|
|
27
29
|
var _default = config;
|
|
28
30
|
exports["default"] = _default;
|
package/lib/gulpfile.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var gulp = require(
|
|
3
|
+
var gulp = require("gulp"); // imports gulp tasks from the `tasks` directory
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
require("require-directory")(module, "./tasks");
|
|
7
|
+
/**
|
|
8
|
+
* Does a full clean/rebuild of your theme
|
|
9
|
+
*
|
|
10
|
+
* @function watch
|
|
11
|
+
* @memberof slate-cli.tasks.watch
|
|
12
|
+
* @static
|
|
13
|
+
*/
|
|
8
14
|
|
|
9
|
-
require('require-directory')(module, './tasks');
|
|
10
15
|
|
|
11
|
-
gulp.task(
|
|
12
|
-
gulp.task('build:zip', gulp.series('clean', gulp.parallel('build:js', 'build:vendor-js', 'build:css', 'build:assets', 'build:svg')));
|
|
16
|
+
gulp.task("build", gulp.series("clean", gulp.parallel("build:js", "build:vendor-js", "build:css", "build:assets", "build:svg")));
|
|
13
17
|
/**
|
|
14
18
|
* Does a full clean/rebuild of your theme and creates a `.zip` compatible with
|
|
15
19
|
* shopify.
|
|
@@ -19,20 +23,27 @@ gulp.task('build:zip', gulp.series('clean', gulp.parallel('build:js', 'build:ven
|
|
|
19
23
|
* @static
|
|
20
24
|
*/
|
|
21
25
|
|
|
22
|
-
gulp.task(
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
gulp.task("zip", gulp.series("build", "compress"));
|
|
27
|
+
/**
|
|
28
|
+
* Syncronizes the development theme settings with our src folder theme settings
|
|
29
|
+
*
|
|
30
|
+
* @function sync-settings
|
|
31
|
+
* @memberof seed-cli.tasks.deploy
|
|
32
|
+
* @static
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
gulp.task("sync-settings", gulp.series("generate:tmp", "shopify:pull:dev:tmp", "sync-settings:tmp:src"));
|
|
25
36
|
/**
|
|
26
37
|
* Simple wrapper around src & dist watchers
|
|
27
38
|
*
|
|
28
39
|
* @summary Monitor your codebase for file changes and take the appropriate
|
|
29
|
-
*
|
|
40
|
+
* action
|
|
30
41
|
* @function watch
|
|
31
42
|
* @memberof slate-cli.tasks.watch
|
|
32
43
|
* @static
|
|
33
44
|
*/
|
|
34
45
|
|
|
35
|
-
gulp.task(
|
|
46
|
+
gulp.task("watch", gulp.series("build", gulp.parallel("watch:src", "watch:dist", "shopify:serve:dist")));
|
|
36
47
|
/**
|
|
37
48
|
* Does a full (re)build followed by a full deploy, cleaning existing files on
|
|
38
49
|
* the remote server and replacing them with the full set of files pushed to
|
|
@@ -40,9 +51,9 @@ gulp.task('watch', gulp.series('build', gulp.parallel('watch:src', 'watch:dist')
|
|
|
40
51
|
*
|
|
41
52
|
* @summary Deploy your built files to the Shopify Store set in
|
|
42
53
|
* `slate-cli.config`
|
|
43
|
-
* @function deploy
|
|
54
|
+
* @function deploy
|
|
44
55
|
* @memberof slate-cli.tasks.deploy
|
|
45
56
|
* @static
|
|
46
57
|
*/
|
|
47
58
|
|
|
48
|
-
gulp.task(
|
|
59
|
+
gulp.task("deploy", gulp.series("sync-settings", "build", "shopify:push:dist"));
|
package/lib/tasks/build-css.js
CHANGED
|
@@ -12,8 +12,7 @@ var plumber = require('gulp-plumber');
|
|
|
12
12
|
|
|
13
13
|
var chokidar = require('chokidar');
|
|
14
14
|
|
|
15
|
-
var config = require('./includes/config.js');
|
|
16
|
-
|
|
15
|
+
var config = require('./includes/config.js');
|
|
17
16
|
|
|
18
17
|
var messages = require('./includes/messages.js');
|
|
19
18
|
/**
|
package/lib/tasks/build-js.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var gulp = require('gulp');
|
|
4
4
|
|
|
5
|
+
var gulpif = require('gulp-if');
|
|
6
|
+
|
|
5
7
|
var uglify = require('gulp-uglify');
|
|
6
8
|
|
|
7
9
|
var include = require('gulp-include');
|
|
@@ -12,12 +14,11 @@ var chokidar = require('chokidar');
|
|
|
12
14
|
|
|
13
15
|
var config = require('./includes/config.js');
|
|
14
16
|
|
|
15
|
-
var messages = require('./includes/messages.js');
|
|
16
|
-
|
|
17
|
+
var messages = require('./includes/messages.js');
|
|
17
18
|
|
|
18
19
|
function processThemeJs() {
|
|
19
20
|
messages.logProcessFiles('build:js');
|
|
20
|
-
return gulp.src([config.roots.js, "!".concat(config.roots.vendorJs)]).pipe(plumber()).pipe(include()).pipe(gulp.dest(config.dist.assets));
|
|
21
|
+
return gulp.src([config.roots.js, "!".concat(config.roots.vendorJs)]).pipe(plumber()).pipe(include()).pipe(gulpif(config.optimize, uglify())).pipe(gulp.dest(config.dist.assets));
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
function processVendorJs() {
|
package/lib/tasks/build-utils.js
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var gulp = require(
|
|
3
|
+
var gulp = require("gulp");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var gulpif = require("gulp-if");
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var del = require("del");
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var zip = require("gulp-zip");
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var size = require("gulp-size");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var plumber = require("gulp-plumber");
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var config = require("./includes/config.js");
|
|
16
|
+
|
|
17
|
+
var utils = require("./includes/utilities.js");
|
|
18
|
+
|
|
19
|
+
var messages = require("./includes/messages.js");
|
|
20
|
+
|
|
21
|
+
var assetsPaths = [config.src.assets, config.src.templates, config.src.sections, config.src.snippets, config.src.locales, config.src.config, config.src.layout];
|
|
22
|
+
var themeSettingsAssets = [config.tmp.templates, config.tmp.config];
|
|
23
|
+
/**
|
|
24
|
+
* Copies files from one fold to another, creating a new dir if doesn't exists and
|
|
25
|
+
* overwriting if it does exist
|
|
26
|
+
*
|
|
27
|
+
* @param {Array} files - files to copy
|
|
28
|
+
* @param {Object} srcOptions - second param for gulp.src function
|
|
29
|
+
* @param {String} dest - destination dir
|
|
30
|
+
* @returns {Stream}
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function copyFiles(files, srcOptions, dest) {
|
|
35
|
+
var log = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
36
|
+
return gulp.src(files, srcOptions).pipe(plumber(utils.errorHandler)).pipe(gulpif(log, size({
|
|
37
|
+
showFiles: true,
|
|
38
|
+
pretty: true
|
|
39
|
+
}))).pipe(gulp.dest(dest));
|
|
40
|
+
}
|
|
16
41
|
/**
|
|
17
42
|
* Clean up build dirs/files whenever doing a full/clean (re)build.
|
|
18
43
|
*
|
|
@@ -22,8 +47,8 @@ var utils = require('./includes/utilities.js');
|
|
|
22
47
|
*/
|
|
23
48
|
|
|
24
49
|
|
|
25
|
-
gulp.task(
|
|
26
|
-
return del([
|
|
50
|
+
gulp.task("clean", function () {
|
|
51
|
+
return del(["upload", "dist", "tmp"]);
|
|
27
52
|
});
|
|
28
53
|
/**
|
|
29
54
|
* Compress theme and build a shopify-compatible `.zip` file for uploading to store
|
|
@@ -33,11 +58,37 @@ gulp.task('clean', function () {
|
|
|
33
58
|
* @static
|
|
34
59
|
*/
|
|
35
60
|
|
|
36
|
-
gulp.task(
|
|
61
|
+
gulp.task("compress", function () {
|
|
37
62
|
var distFiles = "".concat(config.dist.root, "**/*");
|
|
38
|
-
|
|
39
|
-
return gulp.src([distFiles, ignoreConfig]).pipe(plumber(utils.errorHandler)).pipe(zip("".concat(config.packageJson.name, ".zip") || 'theme.zip')).pipe(size({
|
|
63
|
+
return gulp.src([distFiles]).pipe(plumber(utils.errorHandler)).pipe(zip("".concat(config.packageJson.name, ".zip") || "theme.zip")).pipe(size({
|
|
40
64
|
showFiles: true,
|
|
41
65
|
pretty: true
|
|
42
|
-
})).pipe(gulp.dest(
|
|
66
|
+
})).pipe(gulp.dest("./upload/"));
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Duplicates /src directory into a /tmp directory
|
|
70
|
+
*
|
|
71
|
+
* @function generate:tmp
|
|
72
|
+
* @memberof seed-cli.tasks.sync-settings
|
|
73
|
+
* @static
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
gulp.task("generate:tmp", function () {
|
|
77
|
+
messages.logProcessFiles('Generating tmp folder...');
|
|
78
|
+
return copyFiles(assetsPaths, {
|
|
79
|
+
base: config.src.root
|
|
80
|
+
}, config.tmp.root);
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Syncronizes the theme settings of /tmp directory into our src directory
|
|
84
|
+
*
|
|
85
|
+
* @function sync-settings:tmp:src
|
|
86
|
+
* @memberof seed-cli.tasks.sync-settings
|
|
87
|
+
* @static
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
gulp.task("sync-settings:tmp:src", function () {
|
|
91
|
+
return copyFiles(themeSettingsAssets, {
|
|
92
|
+
base: config.tmp.root
|
|
93
|
+
}, config.src.root);
|
|
43
94
|
});
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var join = require(
|
|
3
|
+
var join = require("path").join;
|
|
4
4
|
|
|
5
|
-
var logger = require(
|
|
5
|
+
var logger = require("debug")("seed-tools");
|
|
6
6
|
|
|
7
|
-
var findRoot = require(
|
|
7
|
+
var findRoot = require("find-root");
|
|
8
8
|
|
|
9
|
-
var autoprefixer = require(
|
|
9
|
+
var autoprefixer = require("autoprefixer");
|
|
10
10
|
|
|
11
|
-
var tailwindcss = require(
|
|
11
|
+
var tailwindcss = require("tailwindcss");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var cssnano = require("cssnano");
|
|
14
|
+
|
|
15
|
+
var argv = require("minimist")(process.argv.slice(2));
|
|
14
16
|
|
|
15
17
|
var themeRoot = findRoot(process.cwd());
|
|
18
|
+
var tailwindConfig = 'tailwind.config.js';
|
|
16
19
|
var pkg = {};
|
|
17
20
|
|
|
18
21
|
try {
|
|
19
|
-
pkg = require(join(themeRoot,
|
|
22
|
+
pkg = require(join(themeRoot, "package.json"));
|
|
20
23
|
} catch (err) {
|
|
21
24
|
logger(err);
|
|
22
25
|
}
|
|
@@ -37,10 +40,9 @@ try {
|
|
|
37
40
|
* @memberof seed-cli
|
|
38
41
|
* @summary Configuring seed-cli
|
|
39
42
|
* @prop {String} environment - development | staging | production
|
|
40
|
-
* @prop {String} tkconfig - path to themekit config file
|
|
41
|
-
* @prop {String} scssLintConfig - path to scss-lint config file
|
|
42
43
|
* @prop {String} deployLog - path to deploy log file
|
|
43
44
|
* @prop {String} src - globs (multi-filename matching patterns) for various source files
|
|
45
|
+
* @prop {String} tmp - globs (multi-filename matching patterns) for various tmp files
|
|
44
46
|
* @prop {Object} dist - paths to relevant folder locations in the distributable directory
|
|
45
47
|
* @prop {Object} roots - array of "root" (entry point) JS & CSS files
|
|
46
48
|
* @prop {Object} plugins - configuration objects passed to various plugins used in the task interface
|
|
@@ -48,49 +50,74 @@ try {
|
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
var config = {
|
|
51
|
-
environment: argv.
|
|
53
|
+
environment: argv.environment || "development",
|
|
54
|
+
optimize: !argv["skip-optimizations"],
|
|
52
55
|
themeRoot: themeRoot,
|
|
53
56
|
packageJson: pkg,
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
tailwindConfig: tailwindConfig,
|
|
58
|
+
seedConfig: "seed.config.js",
|
|
56
59
|
src: {
|
|
57
|
-
root:
|
|
58
|
-
js:
|
|
59
|
-
vendorJs:
|
|
60
|
-
json:
|
|
61
|
-
css:
|
|
62
|
-
cssLint:
|
|
63
|
-
vendorCss:
|
|
64
|
-
assets:
|
|
65
|
-
icons:
|
|
66
|
-
templates:
|
|
67
|
-
snippets:
|
|
68
|
-
sections:
|
|
69
|
-
locales:
|
|
70
|
-
config:
|
|
71
|
-
layout:
|
|
60
|
+
root: "src/",
|
|
61
|
+
js: "src/scripts/**/*.{js,js.liquid}",
|
|
62
|
+
vendorJs: "src/scripts/vendor/*.js",
|
|
63
|
+
json: "src/**/*.json",
|
|
64
|
+
css: "src/styles/**/*.{css,scss,scss.liquid}",
|
|
65
|
+
cssLint: "src/styles/**/*.{css,scss}",
|
|
66
|
+
vendorCss: "src/styles/vendor/*.{css,scss}",
|
|
67
|
+
assets: "src/assets/**/*",
|
|
68
|
+
icons: "src/icons/**/*.svg",
|
|
69
|
+
templates: "src/templates/**/*",
|
|
70
|
+
snippets: "src/snippets/*",
|
|
71
|
+
sections: "src/sections/*",
|
|
72
|
+
locales: "src/locales/*",
|
|
73
|
+
config: "src/config/*",
|
|
74
|
+
layout: "src/layout/*"
|
|
75
|
+
},
|
|
76
|
+
tmp: {
|
|
77
|
+
root: "tmp/",
|
|
78
|
+
js: "tmp/scripts/**/*.{js,js.liquid}",
|
|
79
|
+
vendorJs: "tmp/scripts/vendor/*.js",
|
|
80
|
+
json: "tmp/**/*.json",
|
|
81
|
+
css: "tmp/styles/**/*.{css,scss,scss.liquid}",
|
|
82
|
+
cssLint: "tmp/styles/**/*.{css,scss}",
|
|
83
|
+
vendorCss: "tmp/styles/vendor/*.{css,scss}",
|
|
84
|
+
assets: "tmp/assets/**/*",
|
|
85
|
+
icons: "tmp/icons/**/*.svg",
|
|
86
|
+
templates: "tmp/templates/**/*",
|
|
87
|
+
snippets: "tmp/snippets/*",
|
|
88
|
+
sections: "tmp/sections/*",
|
|
89
|
+
locales: "tmp/locales/*",
|
|
90
|
+
config: "tmp/config/*",
|
|
91
|
+
layout: "tmp/layout/*"
|
|
72
92
|
},
|
|
73
93
|
dist: {
|
|
74
|
-
root:
|
|
75
|
-
assets:
|
|
76
|
-
snippets:
|
|
77
|
-
sections:
|
|
78
|
-
layout:
|
|
79
|
-
templates:
|
|
80
|
-
locales:
|
|
94
|
+
root: "dist/",
|
|
95
|
+
assets: "dist/assets/",
|
|
96
|
+
snippets: "dist/snippets/",
|
|
97
|
+
sections: "dist/sections/",
|
|
98
|
+
layout: "dist/layout/",
|
|
99
|
+
templates: "dist/templates/",
|
|
100
|
+
locales: "dist/locales/"
|
|
81
101
|
},
|
|
82
102
|
roots: {
|
|
83
|
-
js:
|
|
84
|
-
vendorJs:
|
|
85
|
-
css:
|
|
103
|
+
js: "src/scripts/*.{js,js.liquid}",
|
|
104
|
+
vendorJs: "src/scripts/vendor.js",
|
|
105
|
+
css: "src/styles/*.{css,scss}"
|
|
86
106
|
},
|
|
87
107
|
plugins: {
|
|
88
108
|
cheerio: {
|
|
89
|
-
run: require(
|
|
109
|
+
run: require("./utilities.js").processSvg
|
|
90
110
|
},
|
|
91
111
|
postcss: [tailwindcss({
|
|
92
|
-
config: join(themeRoot,
|
|
112
|
+
config: join(themeRoot, tailwindConfig)
|
|
93
113
|
}), autoprefixer()]
|
|
94
114
|
}
|
|
95
115
|
};
|
|
116
|
+
|
|
117
|
+
if (config.optimize) {
|
|
118
|
+
config.plugins.postcss.push(cssnano({
|
|
119
|
+
preset: "default"
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
|
|
96
123
|
module.exports = config;
|
|
@@ -35,7 +35,7 @@ var messages = {
|
|
|
35
35
|
log('running task', chalk.white('-'), chalk.cyan(processName));
|
|
36
36
|
},
|
|
37
37
|
logChildProcess: function logChildProcess(cmd) {
|
|
38
|
-
log('running task', chalk.bold('[child process]'), chalk.white('-'), chalk.cyan(
|
|
38
|
+
log('running task', chalk.bold('[child process]'), chalk.white('-'), chalk.cyan(cmd));
|
|
39
39
|
},
|
|
40
40
|
logDeploys: function logDeploys(cmd, files) {
|
|
41
41
|
var timestamp = "Deploy complete @ ".concat(new Date(), ". ");
|
|
@@ -56,16 +56,16 @@ var messages = {
|
|
|
56
56
|
log('Updating JS Bundle...');
|
|
57
57
|
},
|
|
58
58
|
configChange: function configChange() {
|
|
59
|
-
return 'Changes to
|
|
59
|
+
return 'Changes to seed.config.js Detected: You may need to quit <seed watch>' + ' and run a full <seed deploy> as a result.';
|
|
60
60
|
},
|
|
61
61
|
translationsFailed: function translationsFailed() {
|
|
62
62
|
return 'Translation errors detected.';
|
|
63
63
|
},
|
|
64
64
|
invalidThemeId: function invalidThemeId(themeId, env) {
|
|
65
|
-
log('Invalid theme id for', chalk.cyan("".concat(env, ": ").concat(themeId)), chalk.yellow('`theme_id` must be
|
|
65
|
+
log('Invalid theme id for', chalk.cyan("".concat(env, ": ").concat(themeId)), chalk.yellow('`theme_id` must be a string.'));
|
|
66
66
|
},
|
|
67
67
|
configError: function configError() {
|
|
68
|
-
log('File missing:', chalk.yellow('`config.
|
|
68
|
+
log('File missing:', chalk.yellow('`seed.config.js` does not exist. You need to add a config file before you can make changes to your Shopify store.'));
|
|
69
69
|
},
|
|
70
70
|
deployTo: function deployTo(environment) {
|
|
71
71
|
log('Initiating deploy to', chalk.bold(environment));
|
|
@@ -6,12 +6,9 @@ var chalk = require("chalk");
|
|
|
6
6
|
|
|
7
7
|
var log = require("fancy-log");
|
|
8
8
|
|
|
9
|
-
var _ = require(
|
|
9
|
+
var _ = require("lodash");
|
|
10
10
|
|
|
11
|
-
var Promise = require(
|
|
12
|
-
|
|
13
|
-
var _require = require("../../utils"),
|
|
14
|
-
shopifyCLI = _require.shopifyCLI;
|
|
11
|
+
var Promise = require("bluebird");
|
|
15
12
|
|
|
16
13
|
var errors = [];
|
|
17
14
|
/**
|
|
@@ -23,27 +20,6 @@ var errors = [];
|
|
|
23
20
|
*/
|
|
24
21
|
|
|
25
22
|
var utilities = {
|
|
26
|
-
/**
|
|
27
|
-
* Launches shopify theme serve command to serve files on ./dist folder
|
|
28
|
-
*
|
|
29
|
-
* @memberof seed-cli.utilities
|
|
30
|
-
* @returns {object} - ChildProcess
|
|
31
|
-
*/
|
|
32
|
-
serveDist: function serveDist() {
|
|
33
|
-
return shopifyCLI.serve();
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Launches shopify theme push command to deploy files on ./dist folder
|
|
38
|
-
* to a store's theme
|
|
39
|
-
*
|
|
40
|
-
* @memberof seed-cli.utilities
|
|
41
|
-
* @returns {object} - ChildProcess
|
|
42
|
-
*/
|
|
43
|
-
deployDist: function deployDist() {
|
|
44
|
-
return shopifyCLI.push();
|
|
45
|
-
},
|
|
46
|
-
|
|
47
23
|
/**
|
|
48
24
|
* Handles the output for any errors that might have been captured
|
|
49
25
|
* during the build and zip Gulp tasks.
|
|
@@ -73,7 +49,7 @@ var utilities = {
|
|
|
73
49
|
log(chalk.red(err));
|
|
74
50
|
errors.push(err);
|
|
75
51
|
|
|
76
|
-
_this.emit(
|
|
52
|
+
_this.emit("end");
|
|
77
53
|
},
|
|
78
54
|
|
|
79
55
|
/**
|
|
@@ -100,32 +76,32 @@ var utilities = {
|
|
|
100
76
|
* @param {fs} file - reference to current icon file?
|
|
101
77
|
*/
|
|
102
78
|
processSvg: function processSvg($, file) {
|
|
103
|
-
var $svg = $(
|
|
79
|
+
var $svg = $("svg"); // eslint-disable-line no-var
|
|
104
80
|
|
|
105
81
|
var $newSvg = $('<svg aria-hidden="true" focusable="false" role="presentation" class="icon" />'); // eslint-disable-line no-var
|
|
106
82
|
|
|
107
|
-
var fileName = file.relative.replace(
|
|
83
|
+
var fileName = file.relative.replace(".svg", ""); // eslint-disable-line no-var
|
|
108
84
|
|
|
109
|
-
var viewBoxAttr = $svg.attr(
|
|
85
|
+
var viewBoxAttr = $svg.attr("viewbox"); // eslint-disable-line no-var
|
|
110
86
|
// Add necessary attributes
|
|
111
87
|
|
|
112
88
|
if (viewBoxAttr) {
|
|
113
|
-
var width = parseInt(viewBoxAttr.split(
|
|
89
|
+
var width = parseInt(viewBoxAttr.split(" ")[2], 10); // eslint-disable-line no-var
|
|
114
90
|
|
|
115
|
-
var height = parseInt(viewBoxAttr.split(
|
|
91
|
+
var height = parseInt(viewBoxAttr.split(" ")[3], 10); // eslint-disable-line no-var
|
|
116
92
|
|
|
117
93
|
var widthToHeightRatio = width / height; // eslint-disable-line no-var
|
|
118
94
|
|
|
119
95
|
if (widthToHeightRatio >= 1.5) {
|
|
120
|
-
$newSvg.addClass(
|
|
96
|
+
$newSvg.addClass("icon--wide");
|
|
121
97
|
}
|
|
122
98
|
|
|
123
|
-
$newSvg.attr(
|
|
99
|
+
$newSvg.attr("viewBox", viewBoxAttr);
|
|
124
100
|
} // Add required classes to full color icons
|
|
125
101
|
|
|
126
102
|
|
|
127
|
-
if (file.relative.indexOf(
|
|
128
|
-
$newSvg.addClass(
|
|
103
|
+
if (file.relative.indexOf("-full-color") >= 0) {
|
|
104
|
+
$newSvg.addClass("icon--full-color");
|
|
129
105
|
}
|
|
130
106
|
|
|
131
107
|
$newSvg.addClass(fileName).append($svg.contents());
|
|
@@ -145,8 +121,8 @@ var utilities = {
|
|
|
145
121
|
createEventCache: function createEventCache(options) {
|
|
146
122
|
_.defaults(options = options || {}, {
|
|
147
123
|
// eslint-disable-line no-param-reassign
|
|
148
|
-
changeEvents: [
|
|
149
|
-
unlinkEvents: [
|
|
124
|
+
changeEvents: ["add", "change"],
|
|
125
|
+
unlinkEvents: ["unlink"]
|
|
150
126
|
});
|
|
151
127
|
/**
|
|
152
128
|
* A cache object used for caching `[chokidar]{@link https://github.com/paulmillr/chokidar}`
|