File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,12 @@ import puppeteer from "puppeteer";
10
10
11
11
// 获取本地用户配置
12
12
const localUserConfigs = getAllUserConfigs ( ) ;
13
- console . log ( "localUserConfigs" , localUserConfigs ) ;
14
13
15
14
const TEMP_FOLDER_NAME = "sync_temp_workspace" ;
15
+ // GCM 配置目录
16
+ const GCM_CONFIG_DIR = path . join ( os . homedir ( ) , ".gcm" )
16
17
// 创建临时工作目录,准备同步配置
17
- const tempDir = path . join ( os . homedir ( ) , ".gcm" , TEMP_FOLDER_NAME ) ;
18
+ const tempDir = path . join ( GCM_CONFIG_DIR , TEMP_FOLDER_NAME ) ;
18
19
// 如果已存在,则递归清除目录
19
20
if ( fs . existsSync ( tempDir ) ) {
20
21
fs . rmSync ( tempDir , { recursive : true } ) ;
@@ -24,8 +25,16 @@ fs.mkdirSync(tempDir);
24
25
// 下载远程用户配置
25
26
const cloneConfigRepo = async ( ) => {
26
27
console . log ( "开始下载远程配置" ) ;
27
- // TODO 更换为用户的配置仓库
28
- execSync ( "git clone git@github.com:lexmin0412/config.git" , {
28
+
29
+ // 获取用户配置仓库
30
+ const { configRepoUrl } = await inquirer . prompt ( [
31
+ {
32
+ type : "input" ,
33
+ name : "configRepo" ,
34
+ message : "请输入配置仓库地址(建议使用 SSH 地址)" ,
35
+ }
36
+ ] )
37
+ execSync ( `git clone ${ configRepoUrl } ` , {
29
38
cwd : tempDir ,
30
39
} ) ;
31
40
console . log ( "下载远程配置成功" ) ;
You can’t perform that action at this time.
0 commit comments