chore: use path.parse instead of split

This commit is contained in:
qun 2024-03-05 03:38:45 +00:00
parent 5c929b8543
commit 992f929e48
2 changed files with 12 additions and 6 deletions

View file

@ -107,12 +107,8 @@ export class SparoProfileService {
}
private static _getProfileName(profilePath: string): string {
const pathArr: string[] = profilePath.split(path.sep);
const last: string = pathArr[pathArr.length - 1];
if (last.endsWith('.json')) {
return last.slice(0, -5);
}
return last;
const parsed: path.ParsedPath = path.parse(profilePath);
return parsed.name;
}
public async resolveSparoProfileAsync(

View file

@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "sparo",
"comment": "",
"type": "none"
}
],
"packageName": "sparo"
}