Skip to content

Commit

Permalink
Additional refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Hernandez committed Dec 18, 2017
1 parent f7740c8 commit ef226fa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
15 changes: 6 additions & 9 deletions src/package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 15 additions & 18 deletions src/static-site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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) {
Expand All @@ -87,7 +87,7 @@ function getAllDependencies (props) {
return {devDependencies, dependencies}
}

function getDevDeps (props) {
function getDevDeps ({react}) {
let list = [
'autoprefixer',
'browser-sync',
Expand All @@ -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
}

0 comments on commit ef226fa

Please sign in to comment.