From bcecf9c260bcacf501c52aa49353eb2dd284102b Mon Sep 17 00:00:00 2001 From: Jamie Wong Date: Sat, 7 Jul 2018 23:05:49 -0700 Subject: [PATCH] Set name to filename by default --- import/index.ts | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/import/index.ts b/import/index.ts index 419f846..2f9aac5 100644 --- a/import/index.ts +++ b/import/index.ts @@ -9,6 +9,14 @@ import {importFromFirefox} from './firefox' import {importSingleSpeedscopeProfile} from '../file-format' export async function importProfile(fileName: string, contents: string): Promise { + const profile = await _importProfile(fileName, contents) + if (profile && !profile.getName()) { + profile.setName(fileName) + } + return profile +} + +async function _importProfile(fileName: string, contents: string): Promise { // First pass: Check known file format names to infer the file type if (fileName.endsWith('.speedscope.json')) { console.log('Importing as speedscope json file') diff --git a/package.json b/package.json index feeb069..8edbd52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "speedscope", - "version": "0.1.0", + "version": "0.1.1", "description": "", "main": "index.js", "bin": {