template-syncer 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +146 -55
- package/bin/syn.js +37 -83
- package/lib/index.d.ts +4 -116
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +14 -1045
- package/lib/index.js.map +1 -1
- package/lib/package.json +15 -12
- package/lib/syncer.d.ts +65 -0
- package/lib/syncer.d.ts.map +1 -0
- package/lib/syncer.js +413 -0
- package/lib/syncer.js.map +1 -0
- package/lib/types.d.ts +95 -32
- package/lib/types.d.ts.map +1 -1
- package/lib/ui/index.d.ts +4 -0
- package/lib/ui/index.d.ts.map +1 -0
- package/lib/ui/index.js +11 -0
- package/lib/ui/index.js.map +1 -0
- package/lib/ui/logger.d.ts +26 -0
- package/lib/ui/logger.d.ts.map +1 -0
- package/lib/ui/logger.js +60 -0
- package/lib/ui/logger.js.map +1 -0
- package/lib/ui/prompts.d.ts +48 -0
- package/lib/ui/prompts.d.ts.map +1 -0
- package/lib/ui/prompts.js +202 -0
- package/lib/ui/prompts.js.map +1 -0
- package/lib/ui/tree.d.ts +10 -0
- package/lib/ui/tree.d.ts.map +1 -0
- package/lib/ui/tree.js +130 -0
- package/lib/ui/tree.js.map +1 -0
- package/lib/utils/categorizer.d.ts +24 -0
- package/lib/utils/categorizer.d.ts.map +1 -0
- package/lib/utils/categorizer.js +201 -0
- package/lib/utils/categorizer.js.map +1 -0
- package/lib/utils/git.d.ts +37 -0
- package/lib/utils/git.d.ts.map +1 -0
- package/lib/utils/git.js +98 -0
- package/lib/utils/git.js.map +1 -0
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +14 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/merger.d.ts +40 -0
- package/lib/utils/merger.d.ts.map +1 -0
- package/lib/utils/merger.js +223 -0
- package/lib/utils/merger.js.map +1 -0
- package/lib/utils/platform.d.ts +44 -0
- package/lib/utils/platform.d.ts.map +1 -0
- package/lib/utils/platform.js +169 -0
- package/lib/utils/platform.js.map +1 -0
- package/lib/utils/scanner.d.ts +40 -0
- package/lib/utils/scanner.d.ts.map +1 -0
- package/lib/utils/scanner.js +222 -0
- package/lib/utils/scanner.js.map +1 -0
- package/package.json +15 -12
package/README.md
CHANGED
|
@@ -4,107 +4,198 @@
|
|
|
4
4
|
|
|
5
5
|
<a href="https://github.com/iceywu/template-syncer">
|
|
6
6
|
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/iceywu/template-syncer?logo=github&color=%234d80f0&link=https%3A%2F%2Fgithub.com%2iceywu%2Ftemplate-syncer">
|
|
7
|
-
|
|
7
|
+
</a>
|
|
8
8
|
<a href="https://www.npmjs.com/package/template-syncer">
|
|
9
9
|
<img alt="npm" src="https://img.shields.io/npm/v/template-syncer?logo=npm&color=%234d80f0&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Ftemplate-syncer">
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/template-syncer">
|
|
12
12
|
<img alt="npm" src="https://img.shields.io/npm/dw/template-syncer?logo=npm&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Ftemplate-syncer">
|
|
13
13
|
</a>
|
|
14
|
-
<a href="https://www.npmjs.com/package/template-syncer">
|
|
15
|
-
<img src="https://img.shields.io/npm/dt/template-syncer?style=flat-square" alt="downloads">
|
|
16
|
-
</a>
|
|
17
14
|
|
|
18
15
|
## ✨ 特性
|
|
19
16
|
|
|
20
17
|
- 🚀 **智能同步** - 自动检测并同步模板更新
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- 🔄 **差异对比** - 使用 Git diff 显示文件变更
|
|
18
|
+
- 🌍 **跨平台** - 完美支持 Windows/macOS/Linux
|
|
19
|
+
- 📦 **智能合并** - package.json 等配置文件智能合并
|
|
20
|
+
- 🎯 **自动分类** - 基于 glob 模式的智能文件分类
|
|
21
|
+
- 🔌 **可扩展** - 支持自定义分类规则和合并策略
|
|
26
22
|
- 💾 **安全备份** - 操作前自动创建 Git 备份
|
|
27
|
-
-
|
|
23
|
+
- 🌿 **多分支** - 支持从任意分支同步
|
|
28
24
|
|
|
29
25
|
## 📦 安装
|
|
30
26
|
|
|
31
27
|
```bash
|
|
28
|
+
pnpm add -g template-syncer
|
|
29
|
+
# 或
|
|
32
30
|
npm install -g template-syncer
|
|
33
31
|
```
|
|
34
32
|
|
|
35
|
-
##
|
|
33
|
+
## ⚡ 快速使用 (npx)
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
无需安装,直接使用:
|
|
38
36
|
|
|
39
37
|
```bash
|
|
40
|
-
#
|
|
41
|
-
|
|
38
|
+
# 交互式同步
|
|
39
|
+
npx template-syncer
|
|
42
40
|
|
|
43
41
|
# 指定模板仓库
|
|
44
|
-
|
|
42
|
+
npx template-syncer -r https://github.com/user/template.git
|
|
45
43
|
|
|
46
|
-
#
|
|
47
|
-
|
|
44
|
+
# 指定分支
|
|
45
|
+
npx template-syncer -r https://github.com/user/template.git -b dev
|
|
48
46
|
|
|
49
|
-
#
|
|
50
|
-
|
|
47
|
+
# 初始化配置
|
|
48
|
+
npx template-syncer --init
|
|
51
49
|
|
|
52
|
-
#
|
|
53
|
-
|
|
50
|
+
# 预览差异
|
|
51
|
+
npx template-syncer --preview
|
|
54
52
|
```
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
## 🚀 使用方法
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
2. **仓库克隆** - 克隆指定的模板仓库
|
|
60
|
-
3. **分支选择** - 如果未指定分支,会列出所有分支供选择
|
|
61
|
-
4. **文件选择** - 默认全选,可以自定义选择要检查的文件
|
|
62
|
-
5. **差异对比** - 与模板进行对比,找出有变化的文件
|
|
63
|
-
6. **变更选择** - 选择要更新的文件,可以预览差异
|
|
64
|
-
7. **批量更新** - 一次性更新所有选中的文件
|
|
56
|
+
### 基本用法
|
|
65
57
|
|
|
66
|
-
|
|
58
|
+
```bash
|
|
59
|
+
# 交互式同步
|
|
60
|
+
syn
|
|
67
61
|
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
- **样式文件**: `.css`, `.scss`, `.less`
|
|
71
|
-
- **文档文件**: `.md`, `.txt`
|
|
72
|
-
- **配置文件**: `.gitignore`, `.npmrc`, `.eslintrc`, `.prettierrc` 等
|
|
73
|
-
- **容器文件**: `Dockerfile`, `.dockerignore`
|
|
74
|
-
- **构建文件**: `Makefile`, 各种配置文件
|
|
62
|
+
# 指定模板仓库
|
|
63
|
+
syn -r https://github.com/user/template.git
|
|
75
64
|
|
|
76
|
-
|
|
65
|
+
# 指定分支
|
|
66
|
+
syn -r https://github.com/user/template.git -b dev
|
|
77
67
|
|
|
78
|
-
|
|
79
|
-
syn
|
|
68
|
+
# 详细输出
|
|
69
|
+
syn -v
|
|
80
70
|
```
|
|
81
71
|
|
|
82
|
-
###
|
|
72
|
+
### 运行模式
|
|
83
73
|
|
|
84
|
-
|
|
74
|
+
```bash
|
|
75
|
+
syn # 交互式同步 (默认)
|
|
76
|
+
syn --init # 初始化配置
|
|
77
|
+
syn --batch # 批量处理模式
|
|
78
|
+
syn --preview # 预览差异
|
|
79
|
+
syn --smart # 智能推荐模式
|
|
80
|
+
```
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
### 配置文件
|
|
83
|
+
|
|
84
|
+
运行 `syn --init` 创建配置文件 `.template-sync.json`:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"repo": "https://github.com/user/template.git",
|
|
89
|
+
"branch": "main",
|
|
90
|
+
"ignore": [".env.local"],
|
|
91
|
+
"rules": {
|
|
92
|
+
"deleteOrphans": false,
|
|
93
|
+
"deletePatterns": ["src/deprecated/**"],
|
|
94
|
+
"protectPatterns": ["src/local/**", "*.local.*"],
|
|
95
|
+
"autoBackup": true,
|
|
96
|
+
"defaultMergeStrategy": "overwrite"
|
|
97
|
+
},
|
|
98
|
+
"lastSync": "2024-01-01T00:00:00.000Z"
|
|
99
|
+
}
|
|
100
|
+
```
|
|
89
101
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
### 同步规则 (rules)
|
|
103
|
+
|
|
104
|
+
| 选项 | 类型 | 默认值 | 说明 |
|
|
105
|
+
|------|------|--------|------|
|
|
106
|
+
| `deleteOrphans` | boolean | `false` | 是否删除本地独有文件 |
|
|
107
|
+
| `deletePatterns` | string[] | `[]` | 要删除的文件模式 (glob) |
|
|
108
|
+
| `protectPatterns` | string[] | `[]` | 保护不被删除的文件模式 |
|
|
109
|
+
| `autoBackup` | boolean | `true` | 同步前自动备份 |
|
|
110
|
+
| `defaultMergeStrategy` | string | `"overwrite"` | 默认合并策略 |
|
|
111
|
+
|
|
112
|
+
**示例:删除本地独有的 Swift 文件**
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"rules": {
|
|
117
|
+
"deleteOrphans": true,
|
|
118
|
+
"deletePatterns": ["**/*.swift"],
|
|
119
|
+
"protectPatterns": ["src/local/**"]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
```
|
|
93
124
|
|
|
94
|
-
|
|
95
|
-
|
|
125
|
+
## 🔧 高级用法
|
|
126
|
+
|
|
127
|
+
### 编程式使用
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { TemplateSyncer } from 'template-syncer';
|
|
131
|
+
|
|
132
|
+
const syncer = new TemplateSyncer({
|
|
133
|
+
repo: 'https://github.com/user/template.git',
|
|
134
|
+
branch: 'main',
|
|
135
|
+
verbose: true,
|
|
136
|
+
// 自定义忽略模式
|
|
137
|
+
ignore: ['*.local', 'secrets/**'],
|
|
138
|
+
// 自定义分类规则
|
|
139
|
+
categories: [
|
|
140
|
+
{ match: '**/custom/*.ts', category: '自定义模块', icon: '🎯', priority: 100 }
|
|
141
|
+
],
|
|
142
|
+
// 自定义合并策略
|
|
143
|
+
mergers: {
|
|
144
|
+
'config.json': 'smart',
|
|
145
|
+
'README.md': 'skip'
|
|
146
|
+
},
|
|
147
|
+
// 同步规则
|
|
148
|
+
rules: {
|
|
149
|
+
deleteOrphans: true,
|
|
150
|
+
deletePatterns: ['src/deprecated/**'],
|
|
151
|
+
protectPatterns: ['src/local/**'],
|
|
152
|
+
autoBackup: true
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
await syncer.sync();
|
|
157
|
+
```
|
|
96
158
|
|
|
97
|
-
|
|
98
|
-
|
|
159
|
+
### 合并策略
|
|
160
|
+
|
|
161
|
+
| 策略 | 说明 |
|
|
162
|
+
|------|------|
|
|
163
|
+
| `overwrite` | 直接覆盖 (默认) |
|
|
164
|
+
| `skip` | 跳过不处理 |
|
|
165
|
+
| `smart` | 智能合并 (JSON 文件) |
|
|
166
|
+
| `ask` | 询问用户 |
|
|
167
|
+
|
|
168
|
+
### 自定义分类规则
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
const syncer = new TemplateSyncer({
|
|
172
|
+
categories: [
|
|
173
|
+
// 高优先级规则
|
|
174
|
+
{ match: '**/api/*.ts', category: 'API 模块', icon: '🔌', priority: 100 },
|
|
175
|
+
// 低优先级规则
|
|
176
|
+
{ match: '**/*.ts', category: 'TypeScript', icon: '🔷', priority: 10 }
|
|
177
|
+
]
|
|
178
|
+
});
|
|
99
179
|
```
|
|
100
180
|
|
|
181
|
+
## 📁 支持的文件类型
|
|
182
|
+
|
|
183
|
+
工具会自动识别并分类各种文件:
|
|
184
|
+
|
|
185
|
+
- **项目配置**: package.json, Cargo.toml, go.mod 等
|
|
186
|
+
- **构建工具**: vite.config.*, webpack.config.* 等
|
|
187
|
+
- **代码质量**: .eslintrc*, .prettierrc* 等
|
|
188
|
+
- **框架配置**: nuxt.config.*, next.config.* 等
|
|
189
|
+
- **容器化**: Dockerfile, docker-compose.yml 等
|
|
190
|
+
- **CI/CD**: .github/workflows/*, .gitlab-ci.yml 等
|
|
191
|
+
- **各种编程语言**: .ts, .js, .py, .go, .rs, .java 等
|
|
101
192
|
|
|
102
193
|
## 🛡️ 安全性
|
|
103
194
|
|
|
104
195
|
- **Git 备份**: 操作前自动创建 stash 备份
|
|
105
|
-
- **交互确认**:
|
|
106
|
-
-
|
|
196
|
+
- **交互确认**: 每次操作都需要用户确认
|
|
197
|
+
- **差异预览**: 可以先预览再决定是否应用
|
|
107
198
|
|
|
108
199
|
## 📄 许可证
|
|
109
200
|
|
|
110
|
-
[MIT License](./LICENSE)
|
|
201
|
+
[MIT License](./LICENSE)
|
package/bin/syn.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { Command } = require('commander');
|
|
4
|
-
const { TemplateSyncer } = require('../lib/
|
|
4
|
+
const { TemplateSyncer } = require('../lib/syncer');
|
|
5
5
|
const pkg = require('../package.json');
|
|
6
6
|
|
|
7
7
|
const program = new Command();
|
|
@@ -10,109 +10,65 @@ program
|
|
|
10
10
|
.name('syn')
|
|
11
11
|
.description('智能模板同步工具 - 让你的项目与模板仓库保持同步')
|
|
12
12
|
.version(pkg.version)
|
|
13
|
-
.option('-r, --repo <url>', '
|
|
14
|
-
.option('-b, --branch <name>', '
|
|
15
|
-
.option('-v, --verbose', '
|
|
16
|
-
.option('-i, --init', '
|
|
17
|
-
.option('--batch', '
|
|
18
|
-
.option('-p, --preview', '
|
|
19
|
-
.option('-s, --smart', '
|
|
20
|
-
.helpOption('-h, --help', '
|
|
13
|
+
.option('-r, --repo <url>', '模板仓库 URL')
|
|
14
|
+
.option('-b, --branch <name>', '分支名称')
|
|
15
|
+
.option('-v, --verbose', '详细输出')
|
|
16
|
+
.option('-i, --init', '初始化配置')
|
|
17
|
+
.option('--batch', '批量处理模式')
|
|
18
|
+
.option('-p, --preview', '预览差异')
|
|
19
|
+
.option('-s, --smart', '智能同步模式')
|
|
20
|
+
.helpOption('-h, --help', '显示帮助');
|
|
21
21
|
|
|
22
22
|
program.addHelpText('after', `
|
|
23
23
|
|
|
24
24
|
示例:
|
|
25
25
|
$ syn # 交互式同步
|
|
26
26
|
$ syn --init # 初始化配置
|
|
27
|
-
$ syn --batch #
|
|
28
|
-
$ syn --preview #
|
|
27
|
+
$ syn --batch # 批量处理模式
|
|
28
|
+
$ syn --preview # 预览差异
|
|
29
29
|
$ syn --smart # 智能推荐模式
|
|
30
|
-
$ syn
|
|
31
|
-
$ syn
|
|
32
|
-
$ syn --repo git@github.com:your/template.git --verbose
|
|
30
|
+
$ syn -r https://github.com/user/template.git
|
|
31
|
+
$ syn -r https://github.com/user/template.git -b dev
|
|
33
32
|
|
|
34
33
|
支持的仓库格式:
|
|
35
|
-
•
|
|
36
|
-
• GitLab: https://gitlab.com/owner/repo.git
|
|
37
|
-
• Bitbucket: https://bitbucket.org/owner/repo.git
|
|
34
|
+
• HTTPS: https://github.com/owner/repo.git
|
|
38
35
|
• SSH: git@github.com:owner/repo.git
|
|
39
36
|
|
|
40
|
-
分支支持:
|
|
41
|
-
• 指定分支: --branch dev
|
|
42
|
-
• 不指定分支时会列出所有分支供选择
|
|
43
|
-
• 支持任意分支名称
|
|
44
|
-
|
|
45
37
|
功能特性:
|
|
46
38
|
✅ 智能合并 package.json
|
|
47
|
-
✅
|
|
48
|
-
✅
|
|
49
|
-
✅ 交互式确认更新
|
|
50
|
-
✅ Git 备份保护
|
|
51
|
-
✅ 配置文件保存
|
|
39
|
+
✅ 跨平台支持 (Windows/macOS/Linux)
|
|
40
|
+
✅ 自动文件分类
|
|
52
41
|
✅ 多分支支持
|
|
42
|
+
✅ Git 备份保护
|
|
43
|
+
✅ 可扩展的分类规则
|
|
53
44
|
|
|
54
45
|
更多信息: https://github.com/IceyWu/template-syncer
|
|
55
46
|
`);
|
|
56
47
|
|
|
57
|
-
// 主要执行逻辑
|
|
58
48
|
async function main() {
|
|
59
49
|
try {
|
|
60
50
|
program.parse();
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
const syncer = new TemplateSyncer(syncerOptions);
|
|
79
|
-
|
|
80
|
-
if (options.init) {
|
|
81
|
-
await syncer.initConfig(); } else if (options.batch) {
|
|
82
|
-
// 高级批量操作模式
|
|
83
|
-
try {
|
|
84
|
-
await syncer.batchProcess();
|
|
85
|
-
} finally {
|
|
86
|
-
// 清理临时文件
|
|
87
|
-
syncer.cleanup();
|
|
88
|
-
}
|
|
89
|
-
} else if (options.preview) {
|
|
90
|
-
// 预览模式
|
|
91
|
-
try {
|
|
92
|
-
await syncer.getTemplateRepo();
|
|
93
|
-
await syncer.cloneTemplate();
|
|
94
|
-
const templateFiles = await syncer.scanTemplateFiles();
|
|
95
|
-
const currentFiles = await syncer.scanCurrentFiles();
|
|
96
|
-
const changedFiles = await syncer.compareFiles(templateFiles, currentFiles);
|
|
97
|
-
await syncer.previewAllDifferences(changedFiles);
|
|
98
|
-
} finally {
|
|
99
|
-
// 清理临时文件
|
|
100
|
-
syncer.cleanup();
|
|
101
|
-
}
|
|
102
|
-
} else if (options.smart) {
|
|
103
|
-
// 智能同步模式
|
|
104
|
-
try {
|
|
105
|
-
await syncer.intelligentSync();
|
|
106
|
-
} finally {
|
|
107
|
-
// 清理临时文件
|
|
108
|
-
syncer.cleanup();
|
|
109
|
-
}
|
|
51
|
+
const opts = program.opts();
|
|
52
|
+
|
|
53
|
+
const syncer = new TemplateSyncer({
|
|
54
|
+
repo: opts.repo,
|
|
55
|
+
branch: opts.branch,
|
|
56
|
+
verbose: opts.verbose
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (opts.init) {
|
|
60
|
+
await syncer.init();
|
|
61
|
+
} else if (opts.batch) {
|
|
62
|
+
await syncer.batch();
|
|
63
|
+
} else if (opts.preview) {
|
|
64
|
+
await syncer.preview();
|
|
65
|
+
} else if (opts.smart) {
|
|
66
|
+
await syncer.smart();
|
|
110
67
|
} else {
|
|
111
|
-
// 默认交互式同步
|
|
112
68
|
await syncer.sync();
|
|
113
69
|
}
|
|
114
70
|
} catch (error) {
|
|
115
|
-
console.error('❌
|
|
71
|
+
console.error('❌ 执行失败:', error.message);
|
|
116
72
|
if (program.opts().verbose) {
|
|
117
73
|
console.error(error.stack);
|
|
118
74
|
}
|
|
@@ -120,16 +76,14 @@ async function main() {
|
|
|
120
76
|
}
|
|
121
77
|
}
|
|
122
78
|
|
|
123
|
-
// 处理未捕获的异常
|
|
124
79
|
process.on('uncaughtException', (error) => {
|
|
125
80
|
console.error('💥 未捕获的异常:', error.message);
|
|
126
81
|
process.exit(1);
|
|
127
82
|
});
|
|
128
83
|
|
|
129
|
-
process.on('unhandledRejection', (reason
|
|
84
|
+
process.on('unhandledRejection', (reason) => {
|
|
130
85
|
console.error('💥 未处理的 Promise 拒绝:', reason);
|
|
131
86
|
process.exit(1);
|
|
132
87
|
});
|
|
133
88
|
|
|
134
|
-
// 启动程序
|
|
135
89
|
main();
|
package/lib/index.d.ts
CHANGED
|
@@ -1,117 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export declare class TemplateSyncer {
|
|
7
|
-
private tempDir;
|
|
8
|
-
private templateRepo;
|
|
9
|
-
private branch;
|
|
10
|
-
private configFile;
|
|
11
|
-
private changes;
|
|
12
|
-
private verbose;
|
|
13
|
-
private ignorePatterns;
|
|
14
|
-
private fileTypeConfig;
|
|
15
|
-
private specialFiles;
|
|
16
|
-
constructor(options?: TemplateSyncerOptions);
|
|
17
|
-
/**
|
|
18
|
-
* 创建 Git 备份
|
|
19
|
-
*/
|
|
20
|
-
createBackup(): void;
|
|
21
|
-
/**
|
|
22
|
-
* 克隆模板仓库
|
|
23
|
-
*/
|
|
24
|
-
cloneTemplate(): Promise<void>; /**
|
|
25
|
-
* 获取或设置模板仓库
|
|
26
|
-
*/
|
|
27
|
-
getTemplateRepo(): Promise<string>;
|
|
28
|
-
/**
|
|
29
|
-
* 测试仓库连接
|
|
30
|
-
*/
|
|
31
|
-
testRepository(repo: string): Promise<boolean>;
|
|
32
|
-
/**
|
|
33
|
-
* 扫描模板文件
|
|
34
|
-
*/
|
|
35
|
-
scanTemplateFiles(): Promise<FileConfig[]>;
|
|
36
|
-
/**
|
|
37
|
-
* 扫描当前项目文件
|
|
38
|
-
*/
|
|
39
|
-
scanCurrentFiles(): Promise<FileConfig[]>;
|
|
40
|
-
/**
|
|
41
|
-
* 分析文件类型和特征
|
|
42
|
-
*/
|
|
43
|
-
private analyzeFile;
|
|
44
|
-
/**
|
|
45
|
-
* 对比文件并生成变更列表
|
|
46
|
-
*/
|
|
47
|
-
compareFiles(templateFiles: FileConfig[], currentFiles: FileConfig[]): Promise<FileConfig[]>;
|
|
48
|
-
/**
|
|
49
|
-
* 交互式选择要应用的变更
|
|
50
|
-
*/
|
|
51
|
-
selectChangesToApply(changes: FileConfig[]): Promise<FileConfig[]>;
|
|
52
|
-
/**
|
|
53
|
-
* 按分类选择文件
|
|
54
|
-
*/
|
|
55
|
-
private selectByCategory;
|
|
56
|
-
/**
|
|
57
|
-
* 逐一选择文件
|
|
58
|
-
*/
|
|
59
|
-
private selectIndividually;
|
|
60
|
-
/**
|
|
61
|
-
* 批量更新文件
|
|
62
|
-
*/
|
|
63
|
-
batchUpdateFiles(files: FileConfig[]): Promise<BatchResults>;
|
|
64
|
-
/**
|
|
65
|
-
* 更新单个文件
|
|
66
|
-
*/
|
|
67
|
-
private updateSingleFile;
|
|
68
|
-
/**
|
|
69
|
-
* 智能合并 package.json
|
|
70
|
-
*/
|
|
71
|
-
private mergePackageJson;
|
|
72
|
-
/**
|
|
73
|
-
* 显示操作摘要
|
|
74
|
-
*/
|
|
75
|
-
showSummary(results: BatchResults): void;
|
|
76
|
-
/**
|
|
77
|
-
* 清理临时文件
|
|
78
|
-
*/
|
|
79
|
-
cleanup(): void;
|
|
80
|
-
/**
|
|
81
|
-
* 加载配置文件
|
|
82
|
-
*/
|
|
83
|
-
private loadConfig;
|
|
84
|
-
/**
|
|
85
|
-
* 保存配置文件
|
|
86
|
-
*/
|
|
87
|
-
private saveConfig;
|
|
88
|
-
/**
|
|
89
|
-
* 主同步流程
|
|
90
|
-
*/
|
|
91
|
-
sync(options?: TemplateSyncerOptions): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* 初始化配置向导
|
|
94
|
-
*/
|
|
95
|
-
initConfig(): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* 批量处理模式
|
|
98
|
-
*/
|
|
99
|
-
batchProcess(): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* 生成智能推荐
|
|
102
|
-
*/
|
|
103
|
-
private generateRecommendations;
|
|
104
|
-
/**
|
|
105
|
-
* 预览所有差异
|
|
106
|
-
*/
|
|
107
|
-
previewAllDifferences(files: FileConfig[]): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* 智能同步模式
|
|
110
|
-
*/
|
|
111
|
-
intelligentSync(): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
* 选择分支
|
|
114
|
-
*/
|
|
115
|
-
private selectBranch;
|
|
116
|
-
}
|
|
1
|
+
export { TemplateSyncer } from './syncer';
|
|
2
|
+
export type { FileInfo, FileChange, SyncerOptions, SyncConfig, SyncRules, CategoryRule, MergeStrategy, BatchResult, Recommendation } from './types';
|
|
3
|
+
export { platform, Categorizer, Merger, Git, Scanner } from './utils';
|
|
4
|
+
export { prompts, logger } from './ui';
|
|
117
5
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,YAAY,EACV,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC"}
|