Merge pull request #46 from L-Qun/main

chore: use path.parse instead of split
This commit is contained in:
Cheng Liu 2024-03-04 20:34:32 -08:00 committed by GitHub
commit 34737f5fd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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"
}