tools-cc 1.0.8 → 1.0.10
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/CHANGELOG.md +19 -0
- package/CHANGELOG_en.md +19 -0
- package/README.md +31 -5
- package/README_en.md +31 -5
- package/dist/commands/help.js +18 -1
- package/dist/commands/template.d.ts +3 -1
- package/dist/commands/template.js +38 -6
- package/dist/commands/use.js +11 -1
- package/dist/core/manifest.js +10 -1
- package/dist/core/project.js +27 -1
- package/dist/index.js +3 -2
- package/dist/types/config.d.ts +3 -1
- package/dist/types/config.js +4 -2
- package/dist/utils/parsePath.d.ts +1 -1
- package/dist/utils/parsePath.js +5 -3
- package/package.json +1 -1
- package/src/commands/help.ts +18 -1
- package/src/commands/template.ts +202 -160
- package/src/commands/use.ts +11 -1
- package/src/core/manifest.ts +67 -57
- package/src/core/project.ts +304 -276
- package/src/index.ts +254 -253
- package/src/types/config.ts +116 -112
- package/src/utils/parsePath.ts +6 -4
- package/tests/commands/use.test.ts +12 -6
- package/tests/core/project.test.ts +324 -316
- package/tests/types/config.test.ts +44 -16
- package/tests/utils/parsePath.test.ts +18 -9
package/src/core/project.ts
CHANGED
|
@@ -1,277 +1,305 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { ProjectConfig, LegacyProjectConfig, normalizeProjectConfig, SourceSelection, ExportConfig } from '../types';
|
|
4
|
-
import { loadManifest } from './manifest';
|
|
5
|
-
import { getToolsccDir, getProjectConfigPath } from '../utils/path';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 默认选择配置 - 导入所有内容
|
|
9
|
-
*/
|
|
10
|
-
const DEFAULT_SELECTION: SourceSelection = {
|
|
11
|
-
skills: ['*'],
|
|
12
|
-
commands: ['*'],
|
|
13
|
-
agents: ['*']
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
await fs.ensureDir(path.join(toolsccDir, '
|
|
23
|
-
await fs.ensureDir(path.join(toolsccDir, '
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
await fs.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
await fs.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
await
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { ProjectConfig, LegacyProjectConfig, normalizeProjectConfig, SourceSelection, ExportConfig } from '../types';
|
|
4
|
+
import { loadManifest } from './manifest';
|
|
5
|
+
import { getToolsccDir, getProjectConfigPath } from '../utils/path';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 默认选择配置 - 导入所有内容
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_SELECTION: SourceSelection = {
|
|
11
|
+
skills: ['*'],
|
|
12
|
+
commands: ['*'],
|
|
13
|
+
agents: ['*'],
|
|
14
|
+
rules: ['*']
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export async function initProject(projectDir: string): Promise<void> {
|
|
18
|
+
const toolsccDir = getToolsccDir(projectDir);
|
|
19
|
+
const configFile = getProjectConfigPath(projectDir);
|
|
20
|
+
|
|
21
|
+
// Create .toolscc directory structure
|
|
22
|
+
await fs.ensureDir(path.join(toolsccDir, 'skills'));
|
|
23
|
+
await fs.ensureDir(path.join(toolsccDir, 'commands'));
|
|
24
|
+
await fs.ensureDir(path.join(toolsccDir, 'agents'));
|
|
25
|
+
await fs.ensureDir(path.join(toolsccDir, 'rules'));
|
|
26
|
+
|
|
27
|
+
// Create project config if not exists
|
|
28
|
+
if (!(await fs.pathExists(configFile))) {
|
|
29
|
+
const config: ProjectConfig = {
|
|
30
|
+
sources: {},
|
|
31
|
+
links: []
|
|
32
|
+
};
|
|
33
|
+
await fs.writeJson(configFile, config, { spaces: 2 });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 读取项目配置,自动处理新旧格式
|
|
39
|
+
*/
|
|
40
|
+
async function readProjectConfig(configFile: string): Promise<ProjectConfig> {
|
|
41
|
+
const rawConfig = await fs.readJson(configFile);
|
|
42
|
+
return normalizeProjectConfig(rawConfig);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 获取源名称列表(兼容新旧格式)
|
|
47
|
+
*/
|
|
48
|
+
function getSourceNames(config: ProjectConfig): string[] {
|
|
49
|
+
return Object.keys(config.sources);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 检查是否应该复制某项(根据选择配置)
|
|
54
|
+
*/
|
|
55
|
+
function shouldInclude(itemName: string, selection: string[]): boolean {
|
|
56
|
+
// 如果选择包含通配符,包含所有项
|
|
57
|
+
if (selection.includes('*')) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
// 否则检查是否在选择列表中
|
|
61
|
+
return selection.includes(itemName);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function useSource(
|
|
65
|
+
sourceName: string,
|
|
66
|
+
sourceDir: string,
|
|
67
|
+
projectDir: string,
|
|
68
|
+
selection?: SourceSelection
|
|
69
|
+
): Promise<void> {
|
|
70
|
+
// Input validation
|
|
71
|
+
if (!sourceName || !sourceName.trim()) {
|
|
72
|
+
throw new Error('Source name is required');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Check source directory existence
|
|
76
|
+
if (!(await fs.pathExists(sourceDir))) {
|
|
77
|
+
throw new Error(`Source directory does not exist: ${sourceDir}`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const toolsccDir = getToolsccDir(projectDir);
|
|
81
|
+
const manifest = await loadManifest(sourceDir);
|
|
82
|
+
|
|
83
|
+
// Ensure project is initialized
|
|
84
|
+
await initProject(projectDir);
|
|
85
|
+
|
|
86
|
+
// 使用传入的选择配置或默认配置
|
|
87
|
+
const effectiveSelection: SourceSelection = selection ?? DEFAULT_SELECTION;
|
|
88
|
+
|
|
89
|
+
// Copy/link skills (flattened with prefix)
|
|
90
|
+
const sourceSkillsDir = path.join(sourceDir, 'skills');
|
|
91
|
+
if (await fs.pathExists(sourceSkillsDir)) {
|
|
92
|
+
const skills = await fs.readdir(sourceSkillsDir);
|
|
93
|
+
for (const skill of skills) {
|
|
94
|
+
// 检查是否应该包含此 skill
|
|
95
|
+
if (!shouldInclude(skill, effectiveSelection.skills)) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const srcPath = path.join(sourceSkillsDir, skill);
|
|
100
|
+
const name = `${sourceName}` == `${skill}` ? skill : `${sourceName}-${skill}`;
|
|
101
|
+
const destPath = path.join(toolsccDir, 'skills', name);
|
|
102
|
+
|
|
103
|
+
// Remove existing if exists
|
|
104
|
+
await fs.remove(destPath);
|
|
105
|
+
|
|
106
|
+
// Copy directory
|
|
107
|
+
await fs.copy(srcPath, destPath);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Copy commands (in subdirectory by source name)
|
|
112
|
+
const sourceCommandsDir = path.join(sourceDir, 'commands');
|
|
113
|
+
if (await fs.pathExists(sourceCommandsDir)) {
|
|
114
|
+
// 检查是否有选择 commands
|
|
115
|
+
if (effectiveSelection.commands.includes('*')) {
|
|
116
|
+
// 复制所有 commands
|
|
117
|
+
const destDir = path.join(toolsccDir, 'commands', sourceName);
|
|
118
|
+
await fs.remove(destDir);
|
|
119
|
+
await fs.copy(sourceCommandsDir, destDir);
|
|
120
|
+
} else if (effectiveSelection.commands.length > 0) {
|
|
121
|
+
// 只复制选中的 commands
|
|
122
|
+
const destDir = path.join(toolsccDir, 'commands', sourceName);
|
|
123
|
+
await fs.ensureDir(destDir);
|
|
124
|
+
|
|
125
|
+
for (const cmdName of effectiveSelection.commands) {
|
|
126
|
+
const srcFile = path.join(sourceCommandsDir, `${cmdName}.md`);
|
|
127
|
+
if (await fs.pathExists(srcFile)) {
|
|
128
|
+
await fs.copy(srcFile, path.join(destDir, `${cmdName}.md`));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Copy agents (in subdirectory by source name)
|
|
135
|
+
const sourceAgentsDir = path.join(sourceDir, 'agents');
|
|
136
|
+
if (await fs.pathExists(sourceAgentsDir)) {
|
|
137
|
+
// 检查是否有选择 agents
|
|
138
|
+
if (effectiveSelection.agents.includes('*')) {
|
|
139
|
+
// 复制所有 agents
|
|
140
|
+
const destDir = path.join(toolsccDir, 'agents', sourceName);
|
|
141
|
+
await fs.remove(destDir);
|
|
142
|
+
await fs.copy(sourceAgentsDir, destDir);
|
|
143
|
+
} else if (effectiveSelection.agents.length > 0) {
|
|
144
|
+
// 只复制选中的 agents
|
|
145
|
+
const destDir = path.join(toolsccDir, 'agents', sourceName);
|
|
146
|
+
await fs.ensureDir(destDir);
|
|
147
|
+
|
|
148
|
+
for (const agentName of effectiveSelection.agents) {
|
|
149
|
+
const srcFile = path.join(sourceAgentsDir, `${agentName}.md`);
|
|
150
|
+
if (await fs.pathExists(srcFile)) {
|
|
151
|
+
await fs.copy(srcFile, path.join(destDir, `${agentName}.md`));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Copy rules (in subdirectory by source name)
|
|
158
|
+
const sourceRulesDir = path.join(sourceDir, 'rules');
|
|
159
|
+
if (await fs.pathExists(sourceRulesDir)) {
|
|
160
|
+
// 检查是否有选择 rules
|
|
161
|
+
if (effectiveSelection.rules.includes('*')) {
|
|
162
|
+
// 复制所有 rules
|
|
163
|
+
const destDir = path.join(toolsccDir, 'rules', sourceName);
|
|
164
|
+
await fs.remove(destDir);
|
|
165
|
+
await fs.copy(sourceRulesDir, destDir);
|
|
166
|
+
} else if (effectiveSelection.rules.length > 0) {
|
|
167
|
+
// 只复制选中的 rules
|
|
168
|
+
const destDir = path.join(toolsccDir, 'rules', sourceName);
|
|
169
|
+
await fs.ensureDir(destDir);
|
|
170
|
+
|
|
171
|
+
for (const ruleName of effectiveSelection.rules) {
|
|
172
|
+
const srcDir = path.join(sourceRulesDir, ruleName);
|
|
173
|
+
if (await fs.pathExists(srcDir)) {
|
|
174
|
+
await fs.copy(srcDir, path.join(destDir, ruleName));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Update project config - 保存实际使用的选择配置
|
|
181
|
+
const configFile = getProjectConfigPath(projectDir);
|
|
182
|
+
const config = await readProjectConfig(configFile);
|
|
183
|
+
config.sources[sourceName] = effectiveSelection;
|
|
184
|
+
await fs.writeJson(configFile, config, { spaces: 2 });
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export async function unuseSource(sourceName: string, projectDir: string): Promise<void> {
|
|
188
|
+
// Input validation
|
|
189
|
+
if (!sourceName || !sourceName.trim()) {
|
|
190
|
+
throw new Error('Source name is required');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const toolsccDir = getToolsccDir(projectDir);
|
|
194
|
+
const configFile = getProjectConfigPath(projectDir);
|
|
195
|
+
|
|
196
|
+
// Remove skills with prefix
|
|
197
|
+
const skillsDir = path.join(toolsccDir, 'skills');
|
|
198
|
+
if (await fs.pathExists(skillsDir)) {
|
|
199
|
+
const skills = await fs.readdir(skillsDir);
|
|
200
|
+
for (const skill of skills) {
|
|
201
|
+
if (skill.startsWith(`${sourceName}-`)) {
|
|
202
|
+
await fs.remove(path.join(skillsDir, skill));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Remove commands subdirectory
|
|
208
|
+
await fs.remove(path.join(toolsccDir, 'commands', sourceName));
|
|
209
|
+
|
|
210
|
+
// Remove agents subdirectory
|
|
211
|
+
await fs.remove(path.join(toolsccDir, 'agents', sourceName));
|
|
212
|
+
|
|
213
|
+
// Remove rules subdirectory
|
|
214
|
+
await fs.remove(path.join(toolsccDir, 'rules', sourceName));
|
|
215
|
+
|
|
216
|
+
// Update project config with error handling
|
|
217
|
+
let config: ProjectConfig;
|
|
218
|
+
try {
|
|
219
|
+
config = await readProjectConfig(configFile);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
// If config file doesn't exist or is invalid, nothing to update
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
delete config.sources[sourceName];
|
|
226
|
+
await fs.writeJson(configFile, config, { spaces: 2 });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export async function listUsedSources(projectDir: string): Promise<string[]> {
|
|
230
|
+
const configFile = getProjectConfigPath(projectDir);
|
|
231
|
+
|
|
232
|
+
if (!(await fs.pathExists(configFile))) {
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const config = await readProjectConfig(configFile);
|
|
237
|
+
return getSourceNames(config);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* 导出项目配置到 JSON 文件
|
|
242
|
+
*/
|
|
243
|
+
export async function exportProjectConfig(
|
|
244
|
+
projectDir: string,
|
|
245
|
+
outputPath: string
|
|
246
|
+
): Promise<void> {
|
|
247
|
+
const configFile = getProjectConfigPath(projectDir);
|
|
248
|
+
|
|
249
|
+
if (!(await fs.pathExists(configFile))) {
|
|
250
|
+
throw new Error('Project not initialized. Use `tools-cc use <source>` to get started.');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const config = await readProjectConfig(configFile);
|
|
254
|
+
|
|
255
|
+
const exportConfig: ExportConfig = {
|
|
256
|
+
version: '1.0',
|
|
257
|
+
type: 'project',
|
|
258
|
+
config,
|
|
259
|
+
exportedAt: new Date().toISOString()
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
await fs.writeJson(outputPath, exportConfig, { spaces: 2 });
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* 从 JSON 文件导入项目配置
|
|
267
|
+
*/
|
|
268
|
+
export async function importProjectConfig(
|
|
269
|
+
configPath: string,
|
|
270
|
+
projectDir: string,
|
|
271
|
+
resolveSourcePath: (sourceName: string) => Promise<string>
|
|
272
|
+
): Promise<void> {
|
|
273
|
+
if (!(await fs.pathExists(configPath))) {
|
|
274
|
+
throw new Error(`Config file not found: ${configPath}`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const exportConfig: ExportConfig = await fs.readJson(configPath);
|
|
278
|
+
|
|
279
|
+
// Validate version
|
|
280
|
+
if (exportConfig.version !== '1.0') {
|
|
281
|
+
throw new Error(`Unsupported config version: ${exportConfig.version}`);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Validate type
|
|
285
|
+
if (exportConfig.type !== 'project') {
|
|
286
|
+
throw new Error(`Invalid config type: ${exportConfig.type}. Expected 'project'.`);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Initialize project
|
|
290
|
+
await initProject(projectDir);
|
|
291
|
+
|
|
292
|
+
// Apply each source
|
|
293
|
+
for (const [sourceName, selection] of Object.entries(exportConfig.config.sources)) {
|
|
294
|
+
const sourceDir = await resolveSourcePath(sourceName);
|
|
295
|
+
await useSource(sourceName, sourceDir, projectDir, selection);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Update links if present
|
|
299
|
+
if (exportConfig.config.links && exportConfig.config.links.length > 0) {
|
|
300
|
+
const configFile = getProjectConfigPath(projectDir);
|
|
301
|
+
const config = await readProjectConfig(configFile);
|
|
302
|
+
config.links = exportConfig.config.links;
|
|
303
|
+
await fs.writeJson(configFile, config, { spaces: 2 });
|
|
304
|
+
}
|
|
277
305
|
}
|