mirror of
https://github.com/tiktok/sparo.git
synced 2024-11-14 11:25:09 -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)
|
||||
.map((x) => `--from ${x}`)
|
||||
.join(' ')} `;
|
||||
const res: { projects: IProject[] } = JSON.parse(childProcess.execSync(rushListCmd).toString());
|
||||
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]);
|
||||
let res: { projects: IProject[] } | undefined;
|
||||
const resultString: string = childProcess.execSync(rushListCmd).toString();
|
||||
try {
|
||||
res = JSON.parse(resultString);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`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