@madebyseed/seed-cli-tools 1.0.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/.babelrc +3 -0
- package/.eslintrc +7 -0
- package/lib/commands/deploy.js +29 -0
- package/lib/commands/watch.js +56 -0
- package/lib/config.js +28 -0
- package/lib/gulpfile.js +48 -0
- package/lib/tasks/build-assets.js +89 -0
- package/lib/tasks/build-css.js +58 -0
- package/lib/tasks/build-js.js +52 -0
- package/lib/tasks/build-svg.js +94 -0
- package/lib/tasks/build-utils.js +43 -0
- package/lib/tasks/deploy.js +19 -0
- package/lib/tasks/includes/config.js +96 -0
- package/lib/tasks/includes/messages.js +77 -0
- package/lib/tasks/includes/utilities.js +222 -0
- package/lib/tasks/watchers.js +44 -0
- package/lib/utils.js +96 -0
- package/package.json +57 -0
- package/src/commands/deploy.js +25 -0
- package/src/commands/watch.js +62 -0
- package/src/config.js +22 -0
- package/src/gulpfile.js +61 -0
- package/src/tasks/build-assets.js +93 -0
- package/src/tasks/build-css.js +54 -0
- package/src/tasks/build-js.js +53 -0
- package/src/tasks/build-svg.js +89 -0
- package/src/tasks/build-utils.js +37 -0
- package/src/tasks/deploy.js +15 -0
- package/src/tasks/includes/config.js +95 -0
- package/src/tasks/includes/messages.js +116 -0
- package/src/tasks/includes/utilities.js +211 -0
- package/src/tasks/watchers.js +48 -0
- package/src/utils.js +90 -0
package/.babelrc
ADDED
package/.eslintrc
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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"])('slate-tools:deploy');
|
|
17
|
+
|
|
18
|
+
function _default(program) {
|
|
19
|
+
program.command('deploy').alias('d').description('Runs a full deploy of your theme\'s code to a Shopify store specified in config.yml. Existing files will be overwritten.').option('-e, --env <environment>[,<environment>...]', 'Shopify store(s) to deploy code to (specified in config.yml - default: development)', 'development').option('-m, --manual', 'outputs the compiled theme files to <theme>/upload/<theme>.zip for manual deployment').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 = ['deploy', '--environment', options.env];
|
|
24
|
+
(0, _crossSpawn["default"])(_config["default"].gulp, args.concat(['--gulpfile', _config["default"].gulpFile, '--cwd', _config["default"].themeRoot]), {
|
|
25
|
+
detached: false,
|
|
26
|
+
stdio: 'inherit'
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = _default;
|
|
7
|
+
|
|
8
|
+
var _chalk = require("chalk");
|
|
9
|
+
|
|
10
|
+
var _figures = _interopRequireDefault(require("figures"));
|
|
11
|
+
|
|
12
|
+
var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
|
|
13
|
+
|
|
14
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
15
|
+
|
|
16
|
+
var _config = _interopRequireDefault(require("../config"));
|
|
17
|
+
|
|
18
|
+
var _utils = require("../utils");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
var logger = (0, _debug["default"])("seed-tools:watch");
|
|
23
|
+
|
|
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 () {
|
|
26
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
27
|
+
logger("--gulpfile ".concat(_config["default"].gulpFile));
|
|
28
|
+
logger("--cwd ".concat(_config["default"].themeRoot));
|
|
29
|
+
var store = (0, _utils.getStoreName)(_config["default"].themeRoot);
|
|
30
|
+
|
|
31
|
+
if (!store) {
|
|
32
|
+
console.log("");
|
|
33
|
+
console.log((0, _chalk.red)(" ".concat(_figures["default"].cross, " no store field in seed.config.js")));
|
|
34
|
+
console.log(" Add 'store: <store.myshopify.com>' to your project seed.config.js");
|
|
35
|
+
console.log("");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log("Logging into ".concat((0, _chalk.yellow)(store), " with Shopify CLI..."));
|
|
40
|
+
|
|
41
|
+
var loginProcess = _utils.shopifyCLI.login(store);
|
|
42
|
+
|
|
43
|
+
if (loginProcess.error) {
|
|
44
|
+
console.log("");
|
|
45
|
+
console.log((0, _chalk.red)(" ".concat(_figures["default"].cross, " Failed logging into ").concat(store, ", are you sure you're using the correct account?")));
|
|
46
|
+
console.log("");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var gulpArgs = ["watch", "--gulpfile", _config["default"].gulpFile, "--cwd", _config["default"].themeRoot, "--environment", options.env];
|
|
51
|
+
(0, _crossSpawn["default"])(_config["default"].gulp, gulpArgs, {
|
|
52
|
+
detached: false,
|
|
53
|
+
stdio: "inherit"
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
package/lib/config.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _path = require("path");
|
|
9
|
+
|
|
10
|
+
var _fs = require("fs");
|
|
11
|
+
|
|
12
|
+
var _findRoot = _interopRequireDefault(require("find-root"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
var workingDirectory = process.cwd();
|
|
17
|
+
var currentDirectory = __dirname;
|
|
18
|
+
var themeRoot = (0, _findRoot["default"])(workingDirectory);
|
|
19
|
+
var defaultGulpPath = (0, _path.join)(themeRoot, (0, _path.normalize)("node_modules/.bin/gulp")); // Legacy path for older versions of Node.
|
|
20
|
+
|
|
21
|
+
var legacyGulpPath = (0, _path.join)(themeRoot, (0, _path.normalize)("node_modules/seed-cli-tools/node_modules/.bin/gulp"));
|
|
22
|
+
var config = {
|
|
23
|
+
gulpFile: (0, _path.join)(currentDirectory, "gulpfile.js"),
|
|
24
|
+
gulp: (0, _fs.existsSync)(defaultGulpPath) ? defaultGulpPath : legacyGulpPath,
|
|
25
|
+
themeRoot: themeRoot
|
|
26
|
+
};
|
|
27
|
+
var _default = config;
|
|
28
|
+
exports["default"] = _default;
|
package/lib/gulpfile.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var gulp = require('gulp'); // const argv = require('yargs').argv;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var runSequence = require('gulp4-run-sequence'); // imports gulp tasks from the `tasks` directory
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
require('require-directory')(module, './tasks');
|
|
10
|
+
|
|
11
|
+
gulp.task('build', gulp.series('clean', gulp.parallel('build:js', 'build:vendor-js', 'build:css', 'build:assets', 'build:svg')));
|
|
12
|
+
gulp.task('build:zip', gulp.series('clean', gulp.parallel('build:js', 'build:vendor-js', 'build:css', 'build:assets', 'build:svg')));
|
|
13
|
+
/**
|
|
14
|
+
* Does a full clean/rebuild of your theme and creates a `.zip` compatible with
|
|
15
|
+
* shopify.
|
|
16
|
+
*
|
|
17
|
+
* @function zip
|
|
18
|
+
* @memberof slate-cli.tasks
|
|
19
|
+
* @static
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
gulp.task('zip', function (done) {
|
|
23
|
+
runSequence('build:zip', 'compress', done);
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Simple wrapper around src & dist watchers
|
|
27
|
+
*
|
|
28
|
+
* @summary Monitor your codebase for file changes and take the appropriate
|
|
29
|
+
* action
|
|
30
|
+
* @function watch
|
|
31
|
+
* @memberof slate-cli.tasks.watch
|
|
32
|
+
* @static
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
gulp.task('watch', gulp.series('build', gulp.parallel('watch:src', 'watch:dist')));
|
|
36
|
+
/**
|
|
37
|
+
* Does a full (re)build followed by a full deploy, cleaning existing files on
|
|
38
|
+
* the remote server and replacing them with the full set of files pushed to
|
|
39
|
+
* `dist` in the build
|
|
40
|
+
*
|
|
41
|
+
* @summary Deploy your built files to the Shopify Store set in
|
|
42
|
+
* `slate-cli.config`
|
|
43
|
+
* @function deploy:manual
|
|
44
|
+
* @memberof slate-cli.tasks.deploy
|
|
45
|
+
* @static
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
gulp.task('deploy', gulp.series('build', 'deploy:dist'));
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var gulp = require('gulp');
|
|
4
|
+
|
|
5
|
+
var plumber = require('gulp-plumber');
|
|
6
|
+
|
|
7
|
+
var chokidar = require('chokidar');
|
|
8
|
+
|
|
9
|
+
var vinylPaths = require('vinyl-paths');
|
|
10
|
+
|
|
11
|
+
var del = require('del');
|
|
12
|
+
|
|
13
|
+
var size = require('gulp-size');
|
|
14
|
+
|
|
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
|
+
/**
|
|
23
|
+
* Copies assets to the `/dist` directory
|
|
24
|
+
*
|
|
25
|
+
* @param {Array} files
|
|
26
|
+
* @returns {Stream}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
function processAssets(files) {
|
|
31
|
+
messages.logProcessFiles('build:assets');
|
|
32
|
+
return gulp.src(files, {
|
|
33
|
+
base: config.src.root
|
|
34
|
+
}).pipe(plumber(utils.errorHandler)).pipe(size({
|
|
35
|
+
showFiles: true,
|
|
36
|
+
pretty: true
|
|
37
|
+
})).pipe(gulp.dest(config.dist.root));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Deletes specified files
|
|
41
|
+
*
|
|
42
|
+
* @param {Array} files
|
|
43
|
+
* @returns {Stream}
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
function removeAssets(files) {
|
|
49
|
+
messages.logProcessFiles('remove:assets');
|
|
50
|
+
var mapFiles = files.map(function (file) {
|
|
51
|
+
var distFile = file.replace(config.src.root, config.dist.root);
|
|
52
|
+
return distFile;
|
|
53
|
+
});
|
|
54
|
+
return gulp.src(mapFiles).pipe(plumber(utils.errorHandler)).pipe(vinylPaths(del)).pipe(size({
|
|
55
|
+
showFiles: true,
|
|
56
|
+
pretty: true
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Copies assets to the `/dist` directory
|
|
61
|
+
*
|
|
62
|
+
* @function build:assets
|
|
63
|
+
* @memberof seed-cli.tasks.build
|
|
64
|
+
* @static
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
gulp.task('build:assets', function () {
|
|
69
|
+
return processAssets(assetsPaths);
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Watches assets in the `/src` directory
|
|
73
|
+
*
|
|
74
|
+
* @function watch:assets
|
|
75
|
+
* @memberof seed-cli.tasks.watch
|
|
76
|
+
* @static
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
gulp.task('watch:assets', function () {
|
|
80
|
+
var eventCache = utils.createEventCache();
|
|
81
|
+
chokidar.watch(assetsPaths, {
|
|
82
|
+
ignored: /(^|[/\\])\../,
|
|
83
|
+
ignoreInitial: true
|
|
84
|
+
}).on('all', function (event, path) {
|
|
85
|
+
messages.logFileEvent(event, path);
|
|
86
|
+
eventCache.addEvent(event, path);
|
|
87
|
+
utils.processCache(eventCache, processAssets, removeAssets);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var gulp = require('gulp');
|
|
4
|
+
|
|
5
|
+
var sass = require('gulp-sass')(require('sass'));
|
|
6
|
+
|
|
7
|
+
var postcss = require('gulp-postcss');
|
|
8
|
+
|
|
9
|
+
var cssimport = require('gulp-cssimport');
|
|
10
|
+
|
|
11
|
+
var plumber = require('gulp-plumber');
|
|
12
|
+
|
|
13
|
+
var chokidar = require('chokidar');
|
|
14
|
+
|
|
15
|
+
var config = require('./includes/config.js'); // const utils = require('./includes/utilities.js');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var messages = require('./includes/messages.js');
|
|
19
|
+
/**
|
|
20
|
+
* Concatenate css via gulp-cssimport and copys to the `/dist` folder
|
|
21
|
+
*
|
|
22
|
+
* @param {Array} files
|
|
23
|
+
* @returns {Stream}
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
function processCss() {
|
|
29
|
+
return gulp.src(config.roots.css).pipe(plumber()).pipe(sass().on('error', sass.logError)).pipe(postcss(config.plugins.postcss)).pipe(cssimport()).pipe(gulp.dest(config.dist.assets));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Concatenate css via gulp-cssimport
|
|
33
|
+
*
|
|
34
|
+
* @function build:css
|
|
35
|
+
* @memberof seed-cli.tasks.build
|
|
36
|
+
* @static
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
gulp.task('build:css', function () {
|
|
41
|
+
return processCss();
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Watches css in the `/src` directory
|
|
45
|
+
*
|
|
46
|
+
* @function watch:css
|
|
47
|
+
* @memberof seed-cli.tasks.watch
|
|
48
|
+
* @static
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
gulp.task('watch:css', function () {
|
|
52
|
+
chokidar.watch(config.src.css, {
|
|
53
|
+
ignoreInitial: true
|
|
54
|
+
}).on('all', function (event, path) {
|
|
55
|
+
messages.logFileEvent(event, path);
|
|
56
|
+
processCss();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var gulp = require('gulp');
|
|
4
|
+
|
|
5
|
+
var uglify = require('gulp-uglify');
|
|
6
|
+
|
|
7
|
+
var include = require('gulp-include');
|
|
8
|
+
|
|
9
|
+
var plumber = require('gulp-plumber');
|
|
10
|
+
|
|
11
|
+
var chokidar = require('chokidar');
|
|
12
|
+
|
|
13
|
+
var config = require('./includes/config.js');
|
|
14
|
+
|
|
15
|
+
var messages = require('./includes/messages.js'); // const utils = require('./includes/utilities.js');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function processThemeJs() {
|
|
19
|
+
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
|
+
}
|
|
22
|
+
|
|
23
|
+
function processVendorJs() {
|
|
24
|
+
messages.logProcessFiles('build:vendor-js');
|
|
25
|
+
return gulp.src(config.roots.vendorJs).pipe(plumber()).pipe(include()).pipe(uglify({
|
|
26
|
+
mangle: true,
|
|
27
|
+
compress: true
|
|
28
|
+
})).pipe(gulp.dest(config.dist.assets));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
gulp.task('build:js', function () {
|
|
32
|
+
return processThemeJs();
|
|
33
|
+
});
|
|
34
|
+
gulp.task('watch:js', function () {
|
|
35
|
+
chokidar.watch([config.src.js, "!".concat(config.roots.vendorJs), "!".concat(config.src.vendorJs)], {
|
|
36
|
+
ignoreInitial: true
|
|
37
|
+
}).on('all', function (event, path) {
|
|
38
|
+
messages.logFileEvent(event, path);
|
|
39
|
+
processThemeJs();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
gulp.task('build:vendor-js', function () {
|
|
43
|
+
return processVendorJs();
|
|
44
|
+
});
|
|
45
|
+
gulp.task('watch:vendor-js', function () {
|
|
46
|
+
chokidar.watch([config.roots.vendorJs, config.src.vendorJs], {
|
|
47
|
+
ignoreInitial: true
|
|
48
|
+
}).on('all', function (event, path) {
|
|
49
|
+
messages.logFileEvent(event, path);
|
|
50
|
+
processVendorJs();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var gulp = require('gulp');
|
|
4
|
+
|
|
5
|
+
var vinylPaths = require('vinyl-paths');
|
|
6
|
+
|
|
7
|
+
var del = require('del');
|
|
8
|
+
|
|
9
|
+
var size = require('gulp-size');
|
|
10
|
+
|
|
11
|
+
var chokidar = require('chokidar');
|
|
12
|
+
|
|
13
|
+
var svgmin = require('gulp-svgmin');
|
|
14
|
+
|
|
15
|
+
var cheerio = require('gulp-cheerio');
|
|
16
|
+
|
|
17
|
+
var extReplace = require('gulp-ext-replace');
|
|
18
|
+
|
|
19
|
+
var plumber = require('gulp-plumber');
|
|
20
|
+
|
|
21
|
+
var config = require('./includes/config.js');
|
|
22
|
+
|
|
23
|
+
var utils = require('./includes/utilities.js');
|
|
24
|
+
|
|
25
|
+
var messages = require('./includes/messages.js');
|
|
26
|
+
/**
|
|
27
|
+
* Processing for SVGs prior to deployment - adds accessibility markup, and converts
|
|
28
|
+
* the file to a liquid snippet.
|
|
29
|
+
*
|
|
30
|
+
* @param {String|Array} files - glob/array of files to match & send to the stream
|
|
31
|
+
* @returns {Stream}
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function processIcons(files) {
|
|
37
|
+
messages.logProcessFiles('build:svg');
|
|
38
|
+
return gulp.src(files).pipe(plumber(utils.errorHandler)).pipe(svgmin()).pipe(cheerio(config.plugins.cheerio)).pipe(extReplace('.liquid')).pipe(size({
|
|
39
|
+
showFiles: true,
|
|
40
|
+
pretty: true
|
|
41
|
+
})).pipe(gulp.dest(config.dist.snippets));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Cleanup/remove liquid snippets from the `dist` directory during watch tasks if
|
|
45
|
+
* any underlying SVG files in the `src` folder have been removed.
|
|
46
|
+
*
|
|
47
|
+
* @param {String|Array} files - glob/array of files to match & send to the stream
|
|
48
|
+
* @returns {Stream}
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
function removeIcons(files) {
|
|
54
|
+
messages.logProcessFiles('remove:svg');
|
|
55
|
+
var mapFiles = files.map(function (file) {
|
|
56
|
+
var distFile = file.replace('src/icons', 'dist/snippets');
|
|
57
|
+
var snippetFile = distFile.replace('.svg', '.liquid');
|
|
58
|
+
return snippetFile;
|
|
59
|
+
});
|
|
60
|
+
return gulp.src(mapFiles).pipe(plumber(utils.errorHandler)).pipe(vinylPaths(del)).pipe(size({
|
|
61
|
+
showFiles: true,
|
|
62
|
+
pretty: true
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Pre-processing for svg icons
|
|
67
|
+
*
|
|
68
|
+
* @function build:svg
|
|
69
|
+
* @memberof slate-cli.tasks.build
|
|
70
|
+
* @static
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
gulp.task('build:svg', function () {
|
|
75
|
+
return processIcons(config.src.icons);
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Watches source svg icons for changes...
|
|
79
|
+
*
|
|
80
|
+
* @function watch:svg
|
|
81
|
+
* @memberof slate-cli.tasks.watch
|
|
82
|
+
* @static
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
gulp.task('watch:svg', function () {
|
|
86
|
+
var cache = utils.createEventCache();
|
|
87
|
+
chokidar.watch([config.src.icons], {
|
|
88
|
+
ignoreInitial: true
|
|
89
|
+
}).on('all', function (event, path) {
|
|
90
|
+
messages.logFileEvent(event, path);
|
|
91
|
+
cache.addEvent(event, path);
|
|
92
|
+
utils.processCache(cache, processIcons, removeIcons);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var gulp = require('gulp');
|
|
4
|
+
|
|
5
|
+
var del = require('del');
|
|
6
|
+
|
|
7
|
+
var zip = require('gulp-zip');
|
|
8
|
+
|
|
9
|
+
var size = require('gulp-size');
|
|
10
|
+
|
|
11
|
+
var plumber = require('gulp-plumber');
|
|
12
|
+
|
|
13
|
+
var config = require('./includes/config.js');
|
|
14
|
+
|
|
15
|
+
var utils = require('./includes/utilities.js');
|
|
16
|
+
/**
|
|
17
|
+
* Clean up build dirs/files whenever doing a full/clean (re)build.
|
|
18
|
+
*
|
|
19
|
+
* @function build:clean
|
|
20
|
+
* @memberof slate-cli.tasks.build
|
|
21
|
+
* @static
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
gulp.task('clean', function () {
|
|
26
|
+
return del(['upload', 'dist']);
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Compress theme and build a shopify-compatible `.zip` file for uploading to store
|
|
30
|
+
*
|
|
31
|
+
* @function compress
|
|
32
|
+
* @memberof slate-cli.tasks.deploy
|
|
33
|
+
* @static
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
gulp.task('compress', function () {
|
|
37
|
+
var distFiles = "".concat(config.dist.root, "**/*");
|
|
38
|
+
var ignoreConfig = "!".concat(config.dist.root, "config.yml");
|
|
39
|
+
return gulp.src([distFiles, ignoreConfig]).pipe(plumber(utils.errorHandler)).pipe(zip("".concat(config.packageJson.name, ".zip") || 'theme.zip')).pipe(size({
|
|
40
|
+
showFiles: true,
|
|
41
|
+
pretty: true
|
|
42
|
+
})).pipe(gulp.dest('./upload/'));
|
|
43
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var gulp = require('gulp');
|
|
4
|
+
|
|
5
|
+
var utils = require('./includes/utilities.js');
|
|
6
|
+
/**
|
|
7
|
+
* Initiates shopify's cli command 'shopify theme push' on the dist folder,
|
|
8
|
+
* pushing it to stores theme
|
|
9
|
+
*
|
|
10
|
+
* @function deploy:dist
|
|
11
|
+
* @memberof seed-cli.tasks.deploy
|
|
12
|
+
* @static
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
gulp.task('deploy:dist', function () {
|
|
17
|
+
console.log("Running Shopify theme push on ./dist...");
|
|
18
|
+
return utils.deployDist();
|
|
19
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var join = require('path').join;
|
|
4
|
+
|
|
5
|
+
var logger = require('debug')('seed-tools');
|
|
6
|
+
|
|
7
|
+
var findRoot = require('find-root');
|
|
8
|
+
|
|
9
|
+
var autoprefixer = require('autoprefixer');
|
|
10
|
+
|
|
11
|
+
var tailwindcss = require('tailwindcss');
|
|
12
|
+
|
|
13
|
+
var argv = require('minimist')(process.argv.slice(2));
|
|
14
|
+
|
|
15
|
+
var themeRoot = findRoot(process.cwd());
|
|
16
|
+
var pkg = {};
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
pkg = require(join(themeRoot, 'package.json'));
|
|
20
|
+
} catch (err) {
|
|
21
|
+
logger(err);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* seed-cli configuration object
|
|
25
|
+
* ## Markdown stuff
|
|
26
|
+
*
|
|
27
|
+
* It's a big description written in `markdown`
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
*
|
|
31
|
+
* ```javascript
|
|
32
|
+
* $('something')
|
|
33
|
+
* .something(else);
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @namespace config
|
|
37
|
+
* @memberof seed-cli
|
|
38
|
+
* @summary Configuring seed-cli
|
|
39
|
+
* @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
|
+
* @prop {String} deployLog - path to deploy log file
|
|
43
|
+
* @prop {String} src - globs (multi-filename matching patterns) for various source files
|
|
44
|
+
* @prop {Object} dist - paths to relevant folder locations in the distributable directory
|
|
45
|
+
* @prop {Object} roots - array of "root" (entry point) JS & CSS files
|
|
46
|
+
* @prop {Object} plugins - configuration objects passed to various plugins used in the task interface
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
var config = {
|
|
51
|
+
environment: argv.enviroment || 'development',
|
|
52
|
+
themeRoot: themeRoot,
|
|
53
|
+
packageJson: pkg,
|
|
54
|
+
tkConfig: 'config.yml',
|
|
55
|
+
deployLog: 'deploy.log',
|
|
56
|
+
src: {
|
|
57
|
+
root: 'src/',
|
|
58
|
+
js: 'src/scripts/**/*.{js,js.liquid}',
|
|
59
|
+
vendorJs: 'src/scripts/vendor/*.js',
|
|
60
|
+
json: 'src/**/*.json',
|
|
61
|
+
css: 'src/styles/**/*.{css,scss,scss.liquid}',
|
|
62
|
+
cssLint: 'src/styles/**/*.{css,scss}',
|
|
63
|
+
vendorCss: 'src/styles/vendor/*.{css,scss}',
|
|
64
|
+
assets: 'src/assets/**/*',
|
|
65
|
+
icons: 'src/icons/**/*.svg',
|
|
66
|
+
templates: 'src/templates/**/*',
|
|
67
|
+
snippets: 'src/snippets/*',
|
|
68
|
+
sections: 'src/sections/*',
|
|
69
|
+
locales: 'src/locales/*',
|
|
70
|
+
config: 'src/config/*',
|
|
71
|
+
layout: 'src/layout/*'
|
|
72
|
+
},
|
|
73
|
+
dist: {
|
|
74
|
+
root: 'dist/',
|
|
75
|
+
assets: 'dist/assets/',
|
|
76
|
+
snippets: 'dist/snippets/',
|
|
77
|
+
sections: 'dist/sections/',
|
|
78
|
+
layout: 'dist/layout/',
|
|
79
|
+
templates: 'dist/templates/',
|
|
80
|
+
locales: 'dist/locales/'
|
|
81
|
+
},
|
|
82
|
+
roots: {
|
|
83
|
+
js: 'src/scripts/*.{js,js.liquid}',
|
|
84
|
+
vendorJs: 'src/scripts/vendor.js',
|
|
85
|
+
css: 'src/styles/*.{css,scss}'
|
|
86
|
+
},
|
|
87
|
+
plugins: {
|
|
88
|
+
cheerio: {
|
|
89
|
+
run: require('./utilities.js').processSvg
|
|
90
|
+
},
|
|
91
|
+
postcss: [tailwindcss({
|
|
92
|
+
config: join(themeRoot, 'tailwind.config.js')
|
|
93
|
+
}), autoprefixer()]
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
module.exports = config;
|