refactor(apps/*,docs): unify PostHog config (#875)

* refactor(apps/*,docs): unify PostHog config

* [autofix.ci] apply automated fixes

* refactor: remove ImportMeta and keep ImportMetaEnv only

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Makito
2026-01-04 23:58:03 +09:00
committed by GitHub
co-authored by autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
parent 7043ff7afc
commit 00d3105719
12 changed files with 83 additions and 20 deletions
+5 -3
View File
@@ -1,6 +1,8 @@
import posthog from 'posthog-js'
posthog.init('phc_pzjziJjrVZpa9SqnQqq0QEKvkmuCPH7GDTA6TbRTEf9', {
api_host: 'https://us.i.posthog.com',
person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_POCKET } from '../../../../posthog.config'
posthog.init(POSTHOG_PROJECT_KEY_POCKET, {
...DEFAULT_POSTHOG_CONFIG,
// Project-specific config...
})
+3 -4
View File
@@ -1,9 +1,8 @@
/// <reference types="vite/client" />
/// <reference types="../../vite-env.d.ts" />
interface ImportMetaEnv {
readonly VITE_APP_TARGET_HUGGINGFACE_SPACE: boolean
readonly VITE_PLATFORM: 'ios' | 'android' | 'web'
// more env variables...
}
interface ImportMeta {
readonly env: ImportMetaEnv
}
@@ -1,6 +1,8 @@
import posthog from 'posthog-js'
posthog.init('phc_rljw376z5gt6vXJlc3sTr7hFbXodciY9THEQXIRnW53', {
api_host: 'https://us.i.posthog.com',
person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_DESKTOP } from '../../../../../posthog.config'
posthog.init(POSTHOG_PROJECT_KEY_DESKTOP, {
...DEFAULT_POSTHOG_CONFIG,
// Project-specific config...
})
+6
View File
@@ -0,0 +1,6 @@
/// <reference types="vite/client" />
/// <reference types="../../vite-env.d.ts" />
interface ImportMetaEnv {
// Env variables...
}
+5 -3
View File
@@ -1,6 +1,8 @@
import posthog from 'posthog-js'
posthog.init('phc_pzjziJjrVZpa9SqnQqq0QEKvkmuCPH7GDTA6TbRTEf9', {
api_host: 'https://us.i.posthog.com',
person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_WEB } from '../../../../posthog.config'
posthog.init(POSTHOG_PROJECT_KEY_WEB, {
...DEFAULT_POSTHOG_CONFIG,
// Project-specific config...
})
+3 -4
View File
@@ -1,8 +1,7 @@
/// <reference types="vite/client" />
/// <reference types="../../vite-env.d.ts" />
interface ImportMetaEnv {
readonly VITE_APP_TARGET_HUGGINGFACE_SPACE: boolean
// more env variables...
}
interface ImportMeta {
readonly env: ImportMetaEnv
}
+5 -3
View File
@@ -1,6 +1,8 @@
import posthog from 'posthog-js'
posthog.init('phc_pzjziJjrVZpa9SqnQqq0QEKvkmuCPH7GDTA6TbRTEf9', {
api_host: 'https://us.i.posthog.com',
person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_DOCS } from '../../../posthog.config'
posthog.init(POSTHOG_PROJECT_KEY_DOCS, {
...DEFAULT_POSTHOG_CONFIG,
// Project-specific config...
})
+6
View File
@@ -0,0 +1,6 @@
/// <reference types="vite/client" />
/// <reference types="../vite-env.d.ts" />
interface ImportMetaEnv {
// Env variables...
}
+1
View File
@@ -58,6 +58,7 @@
"eslint-plugin-oxlint": "^1.35.0",
"nano-staged": "catalog:",
"oxlint": "^1.35.0",
"posthog-js": "catalog:",
"publint": "^0.3.16",
"rollup": "^4.54.0",
"simple-git-hooks": "^2.13.1",
+3
View File
@@ -209,6 +209,9 @@ importers:
oxlint:
specifier: ^1.35.0
version: 1.36.0
posthog-js:
specifier: 'catalog:'
version: 1.306.1
publint:
specifier: ^0.3.16
version: 0.3.16
+29
View File
@@ -0,0 +1,29 @@
/// <reference types="vite/client" />
import type { PostHogConfig } from 'posthog-js'
// These PostHog project API keys are considered public and are safe
// to be stored here as clear text.
export const POSTHOG_PROJECT_KEY_WEB
= import.meta.env.VITE_POSTHOG_PROJECT_KEY_WEB
?? 'phc_pzjziJjrVZpa9SqnQqq0QEKvkmuCPH7GDTA6TbRTEf9' // cspell:disable-line
export const POSTHOG_PROJECT_KEY_DESKTOP
= import.meta.env.VITE_POSTHOG_PROJECT_KEY_DESKTOP
?? 'phc_rljw376z5gt6vXJlc3sTr7hFbXodciY9THEQXIRnW53'// cspell:disable-line
// FIXME: Using the same key for 'web' for now.
export const POSTHOG_PROJECT_KEY_POCKET
= import.meta.env.VITE_POSTHOG_PROJECT_KEY_POCKET
?? 'phc_pzjziJjrVZpa9SqnQqq0QEKvkmuCPH7GDTA6TbRTEf9' // cspell:disable-line
// FIXME: Using the same key for 'web' for now.
export const POSTHOG_PROJECT_KEY_DOCS
= import.meta.env.VITE_POSTHOG_PROJECT_KEY_DOCS
?? 'phc_pzjziJjrVZpa9SqnQqq0QEKvkmuCPH7GDTA6TbRTEf9' // cspell:disable-line
export const DEFAULT_POSTHOG_CONFIG = {
api_host: 'https://us.i.posthog.com',
person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well
} as const satisfies Partial<PostHogConfig>
+12
View File
@@ -0,0 +1,12 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_POSTHOG_PROJECT_KEY_WEB?: string
readonly VITE_POSTHOG_PROJECT_KEY_DESKTOP?: string
readonly VITE_POSTHOG_PROJECT_KEY_POCKET?: string
readonly VITE_POSTHOG_PROJECT_KEY_DOCS?: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}