Skip to content

Commit d8d63aa

Browse files
committed
fix: fix the sort of series
1 parent e6e97b8 commit d8d63aa

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

script/user-chart/add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "@src/api/gist"
99
import fs from "fs"
1010
import { exitWith } from "../util/process"
11-
import { descriptionOf, filenameOf, getExistGist, validateTokenFromEnv } from "./common"
11+
import { type Browser, descriptionOf, filenameOf, getExistGist, type UserCount, validateTokenFromEnv } from "./common"
1212

1313
type AddArgv = {
1414
browser: Browser

script/user-chart/common.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { findTarget, type Gist } from "@api/gist"
22
import { exitWith } from "../util/process"
33

4+
export type Browser =
5+
| 'chrome'
6+
| 'firefox'
7+
| 'edge'
8+
9+
export type UserCount = Record<string, number>
10+
411
/**
512
* Validate the token from environment variables
613
*/

script/user-chart/render.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "echarts"
99
import { writeFileSync } from "fs"
1010
import { exit } from 'process'
11-
import { filenameOf, getExistGist, validateTokenFromEnv } from "./common"
11+
import { filenameOf, getExistGist, validateTokenFromEnv, type Browser, type UserCount } from "./common"
1212

1313
type EcOption = ComposeOption<
1414
| LineSeriesOption
@@ -175,10 +175,15 @@ const USER_COUNT_GIST_DESC = "User count of timer, auto-generated"
175175
const USER_COUNT_SVG_FILE_NAME = "user_count.svg"
176176

177177
async function getOriginData(token: string): Promise<OriginData> {
178-
const [firefox, edge, chrome]: UserCount[] = await Promise.all(
179-
ALL_BROWSERS.map(b => getDataFromGist(token, b))
180-
)
181-
return { chrome, firefox, edge }
178+
const result: OriginData = {
179+
chrome: {},
180+
firefox: {},
181+
edge: {},
182+
}
183+
for (const b of ALL_BROWSERS) {
184+
result[b] = await getDataFromGist(token, b)
185+
}
186+
return result
182187
}
183188

184189
/**

script/user-chart/user-chart.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)