const path = require('path')
const yeoman = require('yeoman-generator')

const dependencies = [
  'weex-html5',
]

const devDependencies = [
  'eslint',
  'eslint-config-weex',
  'serve',
  'webpack',
  'weex-loader',
]

module.exports = yeoman.Base.extend({

  constructor: function () {
    yeoman.Base.apply(this, arguments)

    // compose with Android and iOS generator
    const args = { args: arguments[0], options: this.options }
    this.composeWith('weex:android', args, {
      local: require.resolve(path.resolve(__dirname, 'android'))
    })
    this.composeWith('weex:ios', args, {
      local: require.resolve(path.resolve(__dirname, 'ios'))
    })
  },

  configuring: function() {
  },

  writing: function() {
    this.fs.copy(this.templatePath('**/*'), this.destinationPath())

    // const copyTo = (src, dist) => {
    //   if (src && dist) {
    //     this.fs.copy(this.templatePath(src), this.destinationPath(dist))
    //   }
    // }

    // copyTo('_gitignore', '.gitignore')
    // copyTo('android', 'android')
    // copyTo('_buckconfig', '.buckconfig')
  },

  install: function() {
    // this.npmInstall(dependencies, { save: true })
    // this.npmInstall(devDependencies, { saveDev: true })
  },

  end: function() {
  }
})

@@ -720,24 +720,27 @@
 tion() %7B%0A   
+ //
  this.fs.cop
@@ -796,19 +796,16 @@
 ())%0A%0A   
- //
  const c
@@ -811,17 +811,16 @@
 copy
-To
  = (
-src
+file
 , di
@@ -833,41 +833,8 @@
  %7B%0A 
-   //   if (src && dist) %7B%0A    //
     
@@ -869,11 +869,12 @@
 ath(
-src
+file
 ), t
@@ -897,155 +897,148 @@
 ath(
-dist))%0A    //
+file))%0A 
    %7D%0A
+%0A
     
-// %7D%0A
+copy('README.md')
 %0A   
- //
  copy
-To('_gitignore', '.gitignore
+('webpack.config.js
 ')%0A   
- //
  copy
-To('android', 'android
+('package.json')%0A    copy('src/index.we
 ')%0A   
- //
  copy
-To('_buckconfig', '.buckconfig
+('web/index.html
 ')%0A 

copy templates file explicitly