1 | const Generator = require('yeoman-generator')
|
2 | const yosay = require('yosay')
|
3 | const basePath = (path) => `../../app/templates/app/${path}`
|
4 |
|
5 | module.exports = class extends Generator {
|
6 | constructor (args, opts) {
|
7 | super(args, opts)
|
8 | }
|
9 |
|
10 | initializing () {
|
11 | this.log(yosay('Iniciando update'))
|
12 | }
|
13 |
|
14 | writing() {
|
15 |
|
16 | this.log('updating "./build" directory')
|
17 | this.fs.copy(
|
18 | this.templatePath(basePath('build')),
|
19 | this.destinationPath('./build')
|
20 | )
|
21 |
|
22 |
|
23 | this.log('updating "./config" directory')
|
24 | this.fs.copy(
|
25 | this.templatePath(basePath('config')),
|
26 | this.destinationPath('./config')
|
27 | )
|
28 |
|
29 |
|
30 | this.log('updating some files in "./src" directory')
|
31 | this.fs.copy(
|
32 | this.templatePath(basePath('src/app/dashboard')),
|
33 | this.destinationPath('./src/app/dashboard')
|
34 | )
|
35 | this.fs.copy(
|
36 | this.templatePath(basePath('src/app/login')),
|
37 | this.destinationPath('./src/app/login')
|
38 | )
|
39 | this.fs.copy(
|
40 | this.templatePath(basePath('src/vuex')),
|
41 | this.destinationPath('./src/vuex')
|
42 | )
|
43 |
|
44 | this.fs.copy(
|
45 | this.templatePath(basePath('src/api.conf.js')),
|
46 | this.destinationPath('./src/api.conf.js')
|
47 | )
|
48 | this.fs.copy(
|
49 | this.templatePath(basePath('src/auth.js')),
|
50 | this.destinationPath('./src/auth.js')
|
51 | )
|
52 | this.fs.copy(
|
53 | this.templatePath(basePath('src/utils.js')),
|
54 | this.destinationPath('./src/utils.js')
|
55 | )
|
56 |
|
57 |
|
58 | this.log('updating "./static" directory')
|
59 | this.fs.copy(
|
60 | this.templatePath(basePath('static')),
|
61 | this.destinationPath('./static')
|
62 | )
|
63 |
|
64 |
|
65 | this.log('updating some files in "./" directory')
|
66 |
|
67 | const dotfiles = [
|
68 | '.babelrc',
|
69 | '.eslintignore',
|
70 | '.eslintrc.js',
|
71 | '.editorconfig',
|
72 | '.gitignore',
|
73 | '.postcssrc.js'
|
74 | ]
|
75 |
|
76 | dotfiles.map(file => {
|
77 | this.fs.copy(
|
78 | this.templatePath(basePath(`${file}`)),
|
79 | this.destinationPath(`./${file}`)
|
80 | )
|
81 | })
|
82 |
|
83 | }
|
84 | }
|