File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
2+ const inquirer = require ( 'inquirer' ) ;
3+
4+ const utils = require ( '../src/utils' ) ;
5+
6+ async function install ( ) {
7+ const authPath = utils . fs . resolvePath ( '~/auth.json' ) ;
8+
9+ const answers = await inquirer . prompt ( [
10+ {
11+ type : 'input' ,
12+ name : 'user' ,
13+ message : 'What is your github user?' ,
14+ } ,
15+
16+ {
17+ type : 'input' ,
18+ name : 'token' ,
19+ message : 'What is your GitHub token?' ,
20+ } ,
21+ ] ) ;
22+
23+ // Write file
24+ const data = {
25+ github : [
26+ {
27+ user : answers . user ,
28+ token : answers . token ,
29+ } ,
30+ ] ,
31+ } ;
32+
33+ fs . writeFileSync ( authPath , JSON . stringify ( data ) ) ;
34+ console . log ( `File ${ authPath } created with your github details` ) ;
35+ }
36+
37+ install ( ) ;
Original file line number Diff line number Diff line change 1818 "license" : " MIT" ,
1919 "private" : false ,
2020 "scripts" : {
21+ "postinstall" : " node install/index.js" ,
2122 "start" : " node src/index.js" ,
2223 "cleanup" : " node test/cleanup.js"
2324 },
You can’t perform that action at this time.
0 commit comments