1
1
const path = require ( 'path' ) ;
2
2
const fs = require ( 'fs' ) ;
3
- const { spawn } = require ( 'child_process' ) ;
3
+ const { spawn} = require ( 'child_process' ) ;
4
4
5
5
module . exports = function reactfulInit ( config ) {
6
6
return new Promise ( ( resolve , reject ) => {
7
7
const pmCommand = config . useYarn ? 'yarn' : 'npm' ;
8
- const { appName, appPath } = config ;
8
+ const { appName, appPath} = config ;
9
9
const packageJson = {
10
10
name : appName ,
11
11
version : '0.1.0' ,
@@ -27,19 +27,15 @@ module.exports = function reactfulInit(config) {
27
27
'prod-stop' : `pm2 stop ${ appName } Prod` ,
28
28
'prod-reload' : `pm2 reload --update-env ${ appName } Prod` ,
29
29
'prod-logs' : `pm2 logs ${ appName } Prod` ,
30
- _reactful_commands : '_reactful_commands' ,
30
+ _reactful_commands : '_reactful_commands'
31
31
} ,
32
32
babel : {
33
- presets : [
34
- 'react' ,
35
- [ 'env' , { targets : { node : 'current' } } ] ,
36
- 'stage-2' ,
37
- ] ,
33
+ presets : [ 'react' , [ 'env' , { targets : { node : 'current' } } ] , 'stage-2' ]
38
34
} ,
39
35
jest : {
40
36
modulePaths : [ './src' ] ,
41
- testPathIgnorePatterns : [ '/node_modules/' ] ,
42
- } ,
37
+ testPathIgnorePatterns : [ '/node_modules/' ]
38
+ }
43
39
} ;
44
40
45
41
fs . writeFileSync (
@@ -55,23 +51,15 @@ module.exports = function reactfulInit(config) {
55
51
const reactfulJson = {
56
52
main : 'main.js' ,
57
53
styles : 'styles.js' ,
58
- vendor : 'vendor.js' ,
54
+ vendor : 'vendor.js'
59
55
} ;
60
56
61
57
fs . writeFileSync (
62
58
path . resolve ( appPath , '.reactful.json' ) ,
63
59
JSON . stringify ( reactfulJson , null , 2 )
64
60
) ;
65
61
66
- const {
67
- main : mainDeps ,
68
- dev : devDeps ,
69
- full : fullDeps ,
70
- } = require ( './dependencies' ) ;
71
-
72
- if ( config . appType === 'full' ) {
73
- mainDeps . push ( ...fullDeps ) ;
74
- }
62
+ const { main : mainDeps , dev : devDeps } = require ( './dependencies' ) ;
75
63
76
64
const installProdCmd = config . useYarn ? 'yarn add' : 'npm install --save' ;
77
65
const installDevCmd = config . useYarn
@@ -87,7 +75,7 @@ module.exports = function reactfulInit(config) {
87
75
{
88
76
shell : true ,
89
77
stdio : 'inherit' ,
90
- cwd : path . resolve ( appPath ) ,
78
+ cwd : path . resolve ( appPath )
91
79
}
92
80
) ;
93
81
0 commit comments