Set name to filename by default

This commit is contained in:
Jamie Wong
2018-07-07 23:05:49 -07:00
parent 3172e61f05
commit bcecf9c260
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -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
View File
@@ -1,6 +1,6 @@
{
"name": "speedscope",
"version": "0.1.0",
"version": "0.1.1",
"description": "",
"main": "index.js",
"bin": {