Skip to content

Commit

Permalink
Merge pull request #46 from L-Qun/main
Browse files Browse the repository at this point in the history
chore: use path.parse instead of split
  • Loading branch information
chengcyber authored Mar 5, 2024
2 parents d09c3e8 + 992f929 commit 34737f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 2 additions & 6 deletions apps/sparo-lib/src/services/SparoProfileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions common/changes/sparo/main_2024-03-05-03-36.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "sparo",
"comment": "",
"type": "none"
}
],
"packageName": "sparo"
}

0 comments on commit 34737f5

Please sign in to comment.