mirror of
https://github.com/tiktok/sparo.git
synced 2024-11-14 19:35:12 -05:00
chore: improve logging
This commit is contained in:
parent
f55b682f19
commit
e379119283
1 changed files with 17 additions and 7 deletions
|
@ -107,13 +107,23 @@ export class ListProfilesCommand implements ICommand<IListProfilesCommandOptions
|
||||||
.join(' ')} ${Array.from(fromSelectors)
|
.join(' ')} ${Array.from(fromSelectors)
|
||||||
.map((x) => `--from ${x}`)
|
.map((x) => `--from ${x}`)
|
||||||
.join(' ')} `;
|
.join(' ')} `;
|
||||||
const res: { projects: IProject[] } = JSON.parse(childProcess.execSync(rushListCmd).toString());
|
let res: { projects: IProject[] } | undefined;
|
||||||
for (const project of res.projects) {
|
const resultString: string = childProcess.execSync(rushListCmd).toString();
|
||||||
if (profileProjects.has(project.name)) {
|
try {
|
||||||
const profiles: string[] | undefined = profileProjects.get(project.name);
|
res = JSON.parse(resultString);
|
||||||
profiles?.push(profileName);
|
} catch (e) {
|
||||||
} else {
|
throw new Error(
|
||||||
profileProjects.set(project.name, [profileName]);
|
`Parse json result from ${rushListCmd} failed.\nError: ${e.message}\nrush returns:\n${resultString}\n`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (res) {
|
||||||
|
for (const project of res.projects) {
|
||||||
|
if (profileProjects.has(project.name)) {
|
||||||
|
const profiles: string[] | undefined = profileProjects.get(project.name);
|
||||||
|
profiles?.push(profileName);
|
||||||
|
} else {
|
||||||
|
profileProjects.set(project.name, [profileName]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue