Set name to filename by default
This commit is contained in:
@@ -9,6 +9,14 @@ import {importFromFirefox} from './firefox'
|
||||
import {importSingleSpeedscopeProfile} from '../file-format'
|
||||
|
||||
export async function importProfile(fileName: string, contents: string): Promise<Profile | null> {
|
||||
const profile = await _importProfile(fileName, contents)
|
||||
if (profile && !profile.getName()) {
|
||||
profile.setName(fileName)
|
||||
}
|
||||
return profile
|
||||
}
|
||||
|
||||
async function _importProfile(fileName: string, contents: string): Promise<Profile | null> {
|
||||
// First pass: Check known file format names to infer the file type
|
||||
if (fileName.endsWith('.speedscope.json')) {
|
||||
console.log('Importing as speedscope json file')
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "speedscope",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
||||
Reference in New Issue
Block a user