Skip to content

Commit

Permalink
fix: 修复点名时报错
Browse files Browse the repository at this point in the history
  • Loading branch information
typed-sigterm committed Feb 27, 2025
1 parent 387004b commit 7ca5971
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ex-caller

## 版本管理与发布

使用 Git 管理版本。
使用 Git 管理版本。在 Gitee 有一个[只读镜像](https://gitee.com/typed-sigterm/ex-caller)

一个 commit 做一件事,非 CI 的提交必须添加 GPG 签名,无需添加 `Signoff`。Commit message 遵循[约定式提交 1.0.0](https://www.conventionalcommits.org/zh-hans/v1.0.0/)

Expand Down Expand Up @@ -88,6 +88,10 @@ ex-caller
6. 在 GitHub 创建 release,标题如 `ExCaller v1.0.0`,内容为 (1) 中增加的部分
7. 发布 release 后,构建流程自动启动,等待完成后查看 release assets

如果版本构建失败,则可以继续 commit 以修复问题,并把 tag 更新到最终成功发版的 commit。
如果版本发布失败,则可以继续 commit 以修复问题,并把 tag 更新到最终成功发版的 commit。

本仓库在 Gitee 有一个[只读镜像](https://gitee.com/typed-sigterm/ex-caller)
更新记录和版本号应以用户的视角撰写,因此:

- 版本号无需遵循 semver,根据用户感知的重要性来决定
- 更新记录一般不要包含技术细节
- 更新记录不必包含所有变更
8 changes: 6 additions & 2 deletions app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ watch(orientation, () => {
});
const token = import.meta.env.EXC_MIXPANEL_TOKEN;
if (import.meta.client && token)
mp.init(token, { track_pageview: true });
mp.init(token, {
persistence: 'localStorage',
track_pageview: __GA__,
});
if (!__GA__)
mp.disable();
// portable 下 localStorage 与文件同步
onMounted(async () => {
Expand Down
4 changes: 2 additions & 2 deletions app/utils/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export type TrackEvent =
const clientType = __APP__ ? 'app' : 'web';
type MixpanelResponse = Parameters<Callback>[0];

export async function track(event: TrackEvent, prop?: Record<string, unknown>) {
export async function track(event: TrackEvent, prop: Record<string, unknown>) {
const portable = clientType === 'app' ? await isPortable() : undefined;
return new Promise<MixpanelResponse>((resolve) => {
mp.track(event, {
mp.track?.(event, {
version: getBuildMeta().commit,
client_type: __APP__ ? 'app' : 'web',
portable,
Expand Down
4 changes: 1 addition & 3 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const meta: BuildMeta = {
commit: process.env.COMMIT_REF?.slice(0, 7),
};

const ga = meta.commit?.startsWith('v');

export default defineNuxtConfig({
future: {
compatibilityVersion: 4,
Expand Down Expand Up @@ -65,7 +63,7 @@ export default defineNuxtConfig({
},

define: {
'import.meta.env.EXC_MIXPANEL_TOKEN': ga ? JSON.stringify('73508c71e2f4527de3652427193e61d4') : 'undefined',
'import.meta.env.EXC_MIXPANEL_TOKEN': JSON.stringify('73508c71e2f4527de3652427193e61d4'),
},

plugins: [
Expand Down
2 changes: 1 addition & 1 deletion vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface ImportMetaEnv {
/** 是否移除独立 App 环境相关代码 */
readonly EXC_NO_APP: string
/** Mixpanel 项目 token */
readonly EXC_MIXPANEL_TOKEN?: string
readonly EXC_MIXPANEL_TOKEN: string
}

declare module '*.md' {
Expand Down

0 comments on commit 7ca5971

Please sign in to comment.