mirror of
https://github.com/tiktok/sparo.git
synced 2024-11-14 19:35:12 -05:00
chore: use path.parse instead of split
This commit is contained in:
parent
5c929b8543
commit
992f929e48
2 changed files with 12 additions and 6 deletions
|
@ -107,12 +107,8 @@ export class SparoProfileService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _getProfileName(profilePath: string): string {
|
private static _getProfileName(profilePath: string): string {
|
||||||
const pathArr: string[] = profilePath.split(path.sep);
|
const parsed: path.ParsedPath = path.parse(profilePath);
|
||||||
const last: string = pathArr[pathArr.length - 1];
|
return parsed.name;
|
||||||
if (last.endsWith('.json')) {
|
|
||||||
return last.slice(0, -5);
|
|
||||||
}
|
|
||||||
return last;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async resolveSparoProfileAsync(
|
public async resolveSparoProfileAsync(
|
||||||
|
|
10
common/changes/sparo/main_2024-03-05-03-36.json
Normal file
10
common/changes/sparo/main_2024-03-05-03-36.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"packageName": "sparo",
|
||||||
|
"comment": "",
|
||||||
|
"type": "none"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packageName": "sparo"
|
||||||
|
}
|
Loading…
Reference in a new issue