11import fs from 'fs'
22import moment from 'moment'
33// @ts -ignore
4- import * as git from 'isomorphic-git/dist/for-node/isomorphic-git/index '
4+ import * as git from 'isomorphic-git/dist'
55import Model from './model'
66
7+ const { http } = require ( 'isomorphic-git/dist/http' )
8+
79export default class Deploy extends Model {
810 outputDir : string = `${ this . appDir } /output`
911
@@ -48,13 +50,13 @@ export default class Deploy extends Model {
4850 }
4951 if ( ! isRepo ) {
5052 await git . init ( { fs, dir : this . outputDir } )
51- await git . config ( {
53+ await git . setConfig ( {
5254 fs,
5355 dir : this . outputDir ,
5456 path : 'user.name' ,
5557 value : setting . username ,
5658 } )
57- await git . config ( {
59+ await git . setConfig ( {
5860 fs,
5961 dir : this . outputDir ,
6062 path : 'user.email' ,
@@ -91,7 +93,7 @@ export default class Deploy extends Model {
9193 if ( isRepo ) {
9294 result = await this . commonPush ( )
9395 } else {
94- result = await this . firstPush ( )
96+ // result = await this.firstPush()
9597 }
9698 return result
9799 }
@@ -103,19 +105,19 @@ export default class Deploy extends Model {
103105
104106 try {
105107 await git . init ( { fs, dir : this . outputDir } )
106- await git . config ( {
108+ await git . setConfig ( {
107109 fs,
108110 dir : this . outputDir ,
109111 path : 'user.name' ,
110112 value : setting . username ,
111113 } )
112- await git . config ( {
114+ await git . setConfig ( {
113115 fs,
114116 dir : this . outputDir ,
115117 path : 'user.email' ,
116118 value : setting . email ,
117119 } )
118- await git . add ( { fs, dir : this . outputDir , filepath : './* ' } )
120+ await git . add ( { fs, dir : this . outputDir , filepath : '.' } )
119121 await git . commit ( {
120122 fs,
121123 dir : this . outputDir ,
@@ -126,16 +128,17 @@ export default class Deploy extends Model {
126128 } )
127129 // await git.fastCheckout({ fs, dir: this.outputDir, ref: setting.branch })
128130 await this . checkCurrentBranch ( )
129- const pushRes = await git . push ( {
130- fs,
131- dir : this . outputDir ,
132- remote : 'origin' ,
133- ref : setting . branch ,
134- force : true ,
135- } )
131+ // const pushRes = await git.push({
132+ // fs,
133+ // dir: this.outputDir,
134+ // remote: 'origin',
135+ // ref: setting.branch,
136+ // force: true,
137+ // http,
138+ // })
136139 return {
137140 success : true ,
138- data : pushRes ,
141+ // data: pushRes,
139142 message : '' ,
140143 localBranchs,
141144 }
@@ -172,17 +175,18 @@ export default class Deploy extends Model {
172175
173176 await this . checkCurrentBranch ( )
174177
175- const pushRes = await git . push ( {
176- fs,
177- dir : this . outputDir ,
178- remote : 'origin' ,
179- ref : setting . branch ,
180- force : true ,
181- } )
182- console . log ( 'pushRes' , pushRes )
178+ // const pushRes = await git.push({
179+ // fs,
180+ // dir: this.outputDir,
181+ // remote: 'origin',
182+ // ref: setting.branch,
183+ // force: true,
184+ // http,
185+ // })
186+ // console.log('pushRes', pushRes)
183187 return {
184188 success : true ,
185- data : pushRes ,
189+ // data: pushRes,
186190 message : '' ,
187191 localBranchs,
188192 }
@@ -211,7 +215,7 @@ export default class Deploy extends Model {
211215 await git . branch ( { fs, dir : this . outputDir , ref : setting . branch } )
212216 }
213217
214- await git . fastCheckout ( { fs, dir : this . outputDir , ref : setting . branch } )
218+ await git . checkout ( { fs, dir : this . outputDir , ref : setting . branch } )
215219 }
216220 }
217221}
0 commit comments