@@ -42,24 +42,31 @@ const log = {
42
42
} ;
43
43
44
44
var name$1 = "gacm" ;
45
- var version$1 = "1.2.5 " ;
45
+ var version$1 = "1.2.6 " ;
46
46
var description$1 = "gacm" ;
47
+ var author$1 = "alqmc" ;
48
+ var license$1 = "MIT" ;
47
49
var scripts = {
48
50
build : "gulp --require sucrase/register/ts --gulpfile build/gulpfile.ts" ,
49
51
clear : "rimraf dist" ,
50
52
link : "cd dist && pnpm link --global" ,
51
53
push : "git push gitee master && git push github master" ,
52
54
"update:version" : "sucrase-node build/utils/version.ts" ,
55
+ lint : "eslint . --fix" ,
53
56
log : "changeloger" ,
54
57
release : "sucrase-node script/release.ts" ,
55
58
prepare : "husky install"
56
59
} ;
57
- var author$1 = "alqmc" ;
58
- var license$1 = "MIT" ;
60
+ var dependencies$1 = {
61
+ execa : "5.1.1" ,
62
+ kolorist : "^1.5.1" ,
63
+ minimist : "^1.2.6" ,
64
+ prompts : "^2.4.2"
65
+ } ;
59
66
var devDependencies = {
60
67
"@alqmc/build-ts" : "^0.0.8" ,
61
68
"@alqmc/build-utils" : "^0.0.3" ,
62
- "@alqmc/eslint-config" : "0.0.4 " ,
69
+ "@alqmc/eslint-config-ts " : "^ 0.0.9 " ,
63
70
"@commitlint/cli" : "^8.3.5" ,
64
71
"@commitlint/config-angular" : "^8.3.4" ,
65
72
"@commitlint/config-conventional" : "^16.2.1" ,
@@ -70,6 +77,7 @@ var devDependencies = {
70
77
cac : "^6.7.14" ,
71
78
changeloger : "0.1.0" ,
72
79
commitizen : "^4.1.2" ,
80
+ eslint : "^8.31.0" ,
73
81
"fs-extra" : "^10.1.0" ,
74
82
gulp : "^4.0.2" ,
75
83
husky : "^8.0.1" ,
@@ -81,23 +89,31 @@ var devDependencies = {
81
89
tslib : "^2.4.0" ,
82
90
typescript : "^4.6.3"
83
91
} ;
84
- var dependencies$1 = {
85
- execa : "5.1.1" ,
86
- kolorist : "^1.5.1" ,
87
- minimist : "^1.2.6" ,
88
- prompts : "^2.4.2"
89
- } ;
90
92
var pkg$1 = {
91
93
name : name$1 ,
92
94
version : version$1 ,
93
95
description : description$1 ,
94
- scripts : scripts ,
95
96
author : author$1 ,
96
97
license : license$1 ,
97
- devDependencies : devDependencies ,
98
- dependencies : dependencies$1
98
+ scripts : scripts ,
99
+ dependencies : dependencies$1 ,
100
+ devDependencies : devDependencies
99
101
} ;
100
102
103
+ const transformData = ( data ) => {
104
+ const userInfo = { version : "" , users : [ ] } ;
105
+ Object . keys ( data ) . forEach ( ( x ) => {
106
+ userInfo . users . push ( {
107
+ name : data [ x ] . name ,
108
+ email : data [ x ] . email ,
109
+ alias : data [ x ] . name
110
+ } ) ;
111
+ } ) ;
112
+ return userInfo ;
113
+ } ;
114
+ const isExistAlias = ( users , alias , name , email ) => {
115
+ return users . some ( ( x ) => x . alias === alias || ! x . alias && x . name === alias || name && email && x . name === name && x . email === email ) ;
116
+ } ;
101
117
const insertUser = async ( name , email , alias = name ) => {
102
118
let userConfig = await getFileUser ( registriesPath ) ;
103
119
if ( ! userConfig )
@@ -127,20 +143,6 @@ const insertUser = async (name, email, alias = name) => {
127
143
}
128
144
await writeFileUser ( registriesPath , userConfig ) ;
129
145
} ;
130
- const transformData = ( data ) => {
131
- const userInfo = { version : "" , users : [ ] } ;
132
- Object . keys ( data ) . forEach ( ( x ) => {
133
- userInfo . users . push ( {
134
- name : data [ x ] . name ,
135
- email : data [ x ] . email ,
136
- alias : data [ x ] . name
137
- } ) ;
138
- } ) ;
139
- return userInfo ;
140
- } ;
141
- const isExistAlias = ( users , alias , name , email ) => {
142
- return users . some ( ( x ) => x . alias === alias || ! x . alias && x . name === alias || name && email && x . name === name && x . email === email ) ;
143
- } ;
144
146
145
147
const { readFile, writeFile } = fs . promises ;
146
148
const getFileUser = async ( rootPath ) => {
@@ -186,31 +188,30 @@ const execCommand = async (cmd, args) => {
186
188
return res . stdout . trim ( ) ;
187
189
} ;
188
190
191
+ const padding = ( message = "" , before = 1 , after = 1 ) => {
192
+ return new Array ( before ) . fill ( " " ) . join ( " " ) + message + new Array ( after ) . fill ( " " ) . join ( " " ) ;
193
+ } ;
189
194
const geneDashLine = ( message , length ) => {
190
195
const finalMessage = new Array ( Math . max ( 2 , length - message . length + 2 ) ) . join ( "-" ) ;
191
196
return padding ( kolorist . white ( finalMessage ) ) ;
192
197
} ;
193
- const padding = ( message = "" , before = 1 , after = 1 ) => {
194
- return new Array ( before ) . fill ( " " ) . join ( " " ) + message + new Array ( after ) . fill ( " " ) . join ( " " ) ;
195
- } ;
196
198
const printMessages = ( messages ) => {
197
199
console . log ( "\n" ) ;
198
- for ( const message of messages ) {
200
+ for ( const message of messages )
199
201
console . log ( message ) ;
200
- }
201
202
console . log ( "\n" ) ;
202
203
} ;
203
204
204
205
var name = "gacm" ;
205
- var version = "1.2.5 " ;
206
+ var version = "1.2.6 " ;
206
207
var description = "git account manage" ;
208
+ var author = "alqmc" ;
209
+ var license = "MIT" ;
207
210
var keywords = [
208
211
"git" ,
209
212
"account" ,
210
213
"manage"
211
214
] ;
212
- var license = "MIT" ;
213
- var author = "alqmc" ;
214
215
var bin = {
215
216
gacm : "gacm.js" ,
216
217
gnrm : "gnrm.js"
@@ -229,9 +230,9 @@ var pkg = {
229
230
version : version ,
230
231
"private" : false ,
231
232
description : description ,
232
- keywords : keywords ,
233
- license : license ,
234
233
author : author ,
234
+ license : license ,
235
+ keywords : keywords ,
235
236
bin : bin ,
236
237
publishConfig : publishConfig ,
237
238
dependencies : dependencies
@@ -243,9 +244,8 @@ const useLs = async () => {
243
244
} ) ;
244
245
const currectEmail = await execCommand ( "git" , [ "config" , "user.email" ] ) . catch ( ( ) => {
245
246
} ) ;
246
- if ( userList . users . length === 0 && ( ! currectUser || ! currectEmail ) ) {
247
+ if ( userList . users . length === 0 && ( ! currectUser || ! currectEmail ) )
247
248
return log . info ( "no user" ) ;
248
- }
249
249
if ( ! userList . users . some ( ( x ) => x . name === currectUser ) && currectUser && currectEmail ) {
250
250
await insertUser ( currectUser , currectEmail ) ;
251
251
log . info ( `[found new user]: ${ currectUser } ` ) ;
@@ -268,23 +268,21 @@ const useLs = async () => {
268
268
const useDelete = async ( name ) => {
269
269
const userList = await getFileUser ( registriesPath ) ;
270
270
if ( ! userList )
271
- return log . error ( ` no user` ) ;
271
+ return log . error ( " no user" ) ;
272
272
const useUser = userList . users . find ( ( x ) => x . alias === name || ! x . alias && x . name === name ) ;
273
273
if ( ! useUser )
274
274
return log . error ( `${ name } not found` ) ;
275
- for ( let i = 0 ; i < userList . users . length ; i ++ ) {
275
+ for ( let i = 0 ; i < userList . users . length ; i ++ )
276
276
if ( ! userList . users [ i ] . alias && userList . users [ i ] . name === name || userList . users [ i ] . alias === name ) {
277
277
log . success ( `[delete]: ${ userList . users [ i ] . alias } ${ userList . users [ i ] . alias !== userList . users [ i ] . name ? `(${ userList . users [ i ] . name } )` : "" } ` ) ;
278
278
userList . users . splice ( i , 1 ) ;
279
279
}
280
- }
281
280
await writeFileUser ( registriesPath , userList ) ;
282
281
} ;
283
282
284
283
const useAdd = async ( cmd ) => {
285
- if ( cmd . name && cmd . email ) {
284
+ if ( cmd . name && cmd . email )
286
285
await insertUser ( cmd . name , cmd . email , cmd . alias ) ;
287
- }
288
286
} ;
289
287
290
288
const useAlias = async ( origin , target ) => {
@@ -313,8 +311,8 @@ const useAlias = async (origin, target) => {
313
311
const useUse = async ( name , cmd ) => {
314
312
const userList = await getFileUser ( registriesPath ) ;
315
313
if ( ! userList )
316
- return log . error ( ` no user exists` ) ;
317
- let useUser = void 0 ;
314
+ return log . error ( " no user exists" ) ;
315
+ let useUser ;
318
316
if ( name ) {
319
317
useUser = userList . users . find ( ( x ) => x . alias === name ) ;
320
318
} else {
@@ -330,7 +328,7 @@ const useUse = async (name, cmd) => {
330
328
} )
331
329
} ) ;
332
330
if ( ! user ) {
333
- log . error ( ` user cancel operation` ) ;
331
+ log . error ( " user cancel operation" ) ;
334
332
return ;
335
333
}
336
334
useUser = user ;
0 commit comments