Skip to content
This repository has been archived by the owner on Nov 15, 2017. It is now read-only.

Commit

Permalink
Remove error thrown when running slate build (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Berthe authored May 10, 2017
1 parent da64d0d commit f1070d1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
6 changes: 0 additions & 6 deletions src/tasks/build-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const gulp = require('gulp');
const fs = require('fs');
const plumber = require('gulp-plumber');
const size = require('gulp-size');
const chokidar = require('chokidar');
Expand All @@ -11,11 +10,6 @@ const messages = require('./includes/messages.js');
function processConfig(file) {
messages.logProcessFiles('build:config');

// eslint-disable-next-line no-sync, node/no-deprecated-api
if (!fs.existsSync(file)) {
throw new Error(messages.configError());
}

return gulp.src(file)
.pipe(plumber(utils.errorHandler))
.pipe(size({
Expand Down
18 changes: 15 additions & 3 deletions src/tasks/deploy-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,22 @@ function validateId(settings) {
* @memberof slate-cli.tasks.watch, slate-cli.tasks.deploy
* @private
*/

gulp.task('validate:id', () => {
const file = fs.readFileSync(config.tkConfig, 'utf8');
let file;

try {
file = fs.readFileSync(config.tkConfig, 'utf8');
} catch (err) {
if (err.code !== 'ENOENT') {
throw new Error(err);
}

messages.configError();

const exitCode = 2;
return process.exit(exitCode);
}

const tkConfig = yaml.safeLoad(file);
let envObj;

Expand All @@ -95,7 +108,6 @@ gulp.task('validate:id', () => {
const exitCode = 2;
return process.exit(exitCode);
});

});

/**
Expand Down
4 changes: 3 additions & 1 deletion src/tasks/includes/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ const messages = {
},

configError: () => {
return '`config.yml` does not exist. You need to add a config file before you can upload your theme to Shopify.';
gutil.log('File missing:',
gutil.colors.yellow('`config.yml` does not exist. You need to add a config file before you can make changes to your Shopify store.'),
);
},

deployTo: (environment) => {
Expand Down

0 comments on commit f1070d1

Please sign in to comment.