Skip to content

Commit

Permalink
fix: let the user download the zip file when it does not exist in the…
Browse files Browse the repository at this point in the history
… folder
  • Loading branch information
Chun-Yang committed Aug 29, 2016
1 parent 7c09d5e commit d5ddc55
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/update/check-dot-design-dir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable no-console */

const chalk = require('chalk');
const fs = require('fs');

module.exports = function checkDotDesignDir() {
// check if DESIGN_FILE exists
try {
const hasDotDesignDir = fs.statSync('.design').isDirectory();
if (!hasDotDesignDir) {
throw new Error('Can not find design.zip or .design folder');
}
} catch (e) {
console.log(chalk.red.bold(
'You need to download webflow zip file here and rename it as design.zip.'
));
throw new Error('need webflow design.zip file.');
}
};
3 changes: 3 additions & 0 deletions lib/update/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ const copyImages = require('./copy-images');
const copyCss = require('./copy-css');
const copyFonts = require('./copy-fonts');
const runReacterminator = require('./run-reacterminator');
const checkDotDesignDir = require('./check-dot-design-dir');

module.exports = function update() {
unzipDesign();

checkDotDesignDir();

copyImages();

copyCss();
Expand Down

0 comments on commit d5ddc55

Please sign in to comment.