diff --git a/src/package/index.js b/src/package/index.js index dee3c23..502db87 100644 --- a/src/package/index.js +++ b/src/package/index.js @@ -6,15 +6,12 @@ module.exports = class Package extends Generator { let prompts = [] if (this.config.get('cli')) { - prompts = [ - ...prompts, - { - type: String, - name: 'command', - message: 'What is the command name for your cli?', - default: this.config.get('name') - } - ] + prompts = [{ + type: String, + name: 'command', + message: 'What is the command name for your cli?', + default: this.config.get('name') + }] } return this.prompt(prompts) diff --git a/src/static-site/index.js b/src/static-site/index.js index 5712ee2..186e7f5 100644 --- a/src/static-site/index.js +++ b/src/static-site/index.js @@ -48,7 +48,7 @@ function getFiles (props) { return {staticFiles, tplFiles} } -function getStaticFiles (props) { +function getStaticFiles ({react}) { let files = [ 'pages/components/header.ejs', 'pages/components/metas.ejs', @@ -65,11 +65,11 @@ function getStaticFiles (props) { 'webpack.prod.js' ] - if (props.react) { - files = [...files, 'src/App.js'] + if (react) { + return [...files, 'src/App.js'] + } else { + return files } - - return files } function getTplFiles (props) { @@ -87,7 +87,7 @@ function getAllDependencies (props) { return {devDependencies, dependencies} } -function getDevDeps (props) { +function getDevDeps ({react}) { let list = [ 'autoprefixer', 'browser-sync', @@ -102,27 +102,24 @@ function getDevDeps (props) { 'webpack-stream' ] - if (props.react) { - list = [ - ...list, - 'babel-preset-react' - ] + if (react) { + return [...list, 'babel-preset-react'] + } else { + return list } - - return list } -function getDependencies (props) { +function getDependencies ({react}) { let list = ['mini.css'] - if (props.react) { - list = [ + if (react) { + return [ ...list, 'mini.css-react', 'react', 'react-dom' ] + } else { + return list } - - return list }