File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 8
8
9
9
import path from 'path'
10
10
import fse from 'fs-extra'
11
+ import child_process from 'child_process'
11
12
import { successInfo } from './util'
12
13
14
+
13
15
export default function initProject ( operands ) {
16
+ console . log ( `alita init ...` . info )
17
+ console . log ( '\n' )
14
18
const initIndex = operands . indexOf ( 'init' )
15
19
const projectName = operands [ initIndex + 1 ]
16
20
@@ -37,6 +41,23 @@ export default function initProject(operands) {
37
41
...packageObj . dependencies ,
38
42
}
39
43
fse . outputJsonSync ( pjsonPath , packageObj , { spaces : ' ' } )
44
+
45
+ if ( fse . existsSync ( path . resolve ( targetpath , 'yarn.lock' ) ) ) {
46
+ child_process . execSync ( 'yarn add @areslabs/router' , {
47
+ cwd : targetpath ,
48
+ } )
49
+ child_process . execSync ( 'yarn add @areslabs/wx-animated' , {
50
+ cwd : targetpath ,
51
+ } )
52
+ } else {
53
+ child_process . execSync ( 'npm install --save @areslabs/router' , {
54
+ cwd : targetpath ,
55
+ } )
56
+ child_process . execSync ( 'npm install --save @areslabs/wx-animated' , {
57
+ cwd : targetpath ,
58
+ } )
59
+ }
60
+
40
61
console . log ( ' Run instructions for 小程序:' . blue )
41
62
console . log ( ` • alita -i ${ projectName } -o [目标小程序目录] (若需要监听文件修改添加参数:--watch)` . black )
42
63
}
You can’t perform that action at this time.
0 commit comments