-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
80 additions
and
90 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,61 @@ | ||
export interface Config { | ||
install?: string; | ||
dev?: string; | ||
devUrl?: string; | ||
build?: string; | ||
serve?: string; | ||
serveUrl?: number; | ||
managerLoaded?: string; | ||
previewFrameLocator?: string; | ||
previewLoadedText?: string; | ||
/** | ||
* If set, wait this amount of time (ms) after the dev server | ||
* starts before starting the browser. Used for Histoire, which | ||
* is incompatible with `wait-on` for some reason. | ||
*/ | ||
waitOnTimeout?: number; | ||
// NOTE: this must be kept in sync with ./bench.schema, which defines | ||
// the table schema in BigQuery | ||
export interface BenchResults { | ||
branch: string; | ||
commit: string; | ||
timestamp: string; | ||
label: string; | ||
|
||
/** The time it takes to create the base sandbox without storybook */ | ||
createTime: number; | ||
/** The time it takes to install the base sandbox after it has been initialized */ | ||
generateTime: number; | ||
/** The time it takes to run `sb init` on the base sandbox */ | ||
initTime: number; | ||
/** Size of base sandbox node_modules without storybook pre-install */ | ||
createSize: number; | ||
/** Size of base sandbox node_modules without storybook post-install */ | ||
generateSize: number; | ||
/** Size of the sandbox node_modules post `sb init` */ | ||
initSize: number; | ||
/** Difference bewtween `initSize` and `generateSize` */ | ||
diffSize: number; | ||
/** Full `sb build` time */ | ||
buildTime: number; | ||
/** Size of the storybook-static directory in total */ | ||
buildSize: number; | ||
/** Size of the storybook-static/sb-addons in total */ | ||
buildSbAddonsSize: number; | ||
/** Size of the storybook-static/sb-common-assets */ | ||
buildSbCommonSize: number; | ||
/** Size of the storybook-static/sb-manager */ | ||
buildSbManagerSize: number; | ||
/** Size of storybook-static/sb-preview */ | ||
buildSbPreviewSize: number; | ||
/** Size of the `static` directory if it exists */ | ||
buildStaticSize: number; | ||
/** Total size of `sb-x` above */ | ||
buildPrebuildSize: number; | ||
/** Total size of everything else (user's stories & components & CSS & assets etc.) */ | ||
buildPreviewSize: number; | ||
/** Time to wait-on iframe.html */ | ||
devPreviewResponsive: number; | ||
/** Time to wait-on index.html */ | ||
devManagerResponsive: number; | ||
/** Time to browse to index.html and view the SB logo */ | ||
devManagerHeaderVisible: number; | ||
/** Time to browse to index.html and load the story index */ | ||
devManagerIndexVisible: number; | ||
/** Time to browse to index.html and load iframe content and the story is rendered */ | ||
devStoryVisible: number; | ||
/** Time to browse to index.html and load iframe content and the docs page is rendered */ | ||
devDocsVisible: number; | ||
/** Time to browse to index.html and view the SB logo */ | ||
buildManagerHeaderVisible: number; | ||
/** Time to browse to index.html and load the story index */ | ||
buildManagerIndexVisible: number; | ||
/** Time to browse to index.html and load iframe content and the story is rendered */ | ||
buildStoryVisible: number; | ||
/** Time to browse to index.html and load iframe content and the docs page is rendered */ | ||
buildDocsVisible: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { join } from 'path'; | ||
import { ensureDir, writeJSON, readJSON } from 'fs-extra'; | ||
import type { BenchResults } from './types'; | ||
|
||
export const now = () => new Date().getTime(); | ||
|
||
export interface SaveBenchOptions { | ||
rootDir?: string; | ||
} | ||
|
||
export const saveBench = async (data: any, options: SaveBenchOptions) => { | ||
export const saveBench = async (data: Partial<BenchResults>, options: SaveBenchOptions) => { | ||
const dirname = options.rootDir || process.cwd(); | ||
const existing = await ensureDir(dirname).then(() => { | ||
return loadBench(options).catch(() => ({})); | ||
}); | ||
await writeJSON(join(dirname, `bench.json`), { ...existing, ...data }, { spaces: 2 }); | ||
}; | ||
|
||
export const loadBench = async (options: SaveBenchOptions) => { | ||
export const loadBench = async (options: SaveBenchOptions): Promise<Partial<BenchResults>> => { | ||
const dirname = options.rootDir || process.cwd(); | ||
return readJSON(join(dirname, `bench.json`)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters