Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ jobs:
- name: Build production bundle
run: deno task build -- --production

- name: Upload source maps to PostHog
env:
POSTHOG_CLI_API_KEY: "${{ secrets.POSTHOG_CLI_API_KEY }}"
POSTHOG_CLI_PROJECT_ID: "345524"
POSTHOG_CLI_HOST: "https://us.posthog.com"
run: |
npx --yes @posthog/cli sourcemap inject --directory public/
npx --yes @posthog/cli sourcemap upload --directory public/

- name: Deploy to Tigris (testnet)
env:
AWS_ACCESS_KEY_ID: "${{ secrets.TIGRIS_ACCESS_KEY_ID }}"
Expand All @@ -72,6 +81,7 @@ jobs:
--endpoint-url https://fly.storage.tigris.dev \
--acl public-read \
--delete \
--exclude "*.map" \
--no-progress

deploy-mainnet:
Expand Down Expand Up @@ -138,6 +148,15 @@ jobs:
- name: Build production bundle
run: deno task build -- --production

- name: Upload source maps to PostHog
env:
POSTHOG_CLI_API_KEY: "${{ secrets.POSTHOG_CLI_API_KEY }}"
POSTHOG_CLI_PROJECT_ID: "345524"
POSTHOG_CLI_HOST: "https://us.posthog.com"
run: |
npx --yes @posthog/cli sourcemap inject --directory public/
npx --yes @posthog/cli sourcemap upload --directory public/

- name: Deploy to Tigris (mainnet)
env:
AWS_ACCESS_KEY_ID: "${{ secrets.MAINNET_TIGRIS_ACCESS_KEY_ID }}"
Expand All @@ -148,4 +167,5 @@ jobs:
--endpoint-url https://fly.storage.tigris.dev \
--acl public-read \
--delete \
--exclude "*.map" \
--no-progress
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonlight-protocol/provider-console",
"version": "0.2.24",
"version": "0.2.25",
"license": "MIT",
"tasks": {
"dev": "deno run --allow-all --allow-env --watch src/server.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ await esbuild.build({
target: "es2022",
supported: { decorators: false },
minify: isProduction,
sourcemap: !isProduction,
sourcemap: true,
define: {
"__APP_VERSION__": JSON.stringify(version),
"__DEV_MODE__": JSON.stringify(!isProduction),
Expand Down
12 changes: 12 additions & 0 deletions src/lib/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { IS_PRODUCTION, POSTHOG_HOST, POSTHOG_KEY } from "./config.ts";

interface Analytics {
capture(event: string, properties?: Record<string, unknown>): void;
captureException(error: unknown, properties?: Record<string, unknown>): void;
identify(distinctId: string, properties?: Record<string, unknown>): void;
reset(): void;
}

const noop: Analytics = {
capture() {},
captureException() {},
identify() {},
reset() {},
};
Expand All @@ -35,13 +37,16 @@ export function initAnalytics(): void {
posthog.init(POSTHOG_KEY, {
api_host: POSTHOG_HOST,
person_profiles: "identified_only",
capture_exceptions: true,
loaded: () => {
console.debug("[analytics] PostHog initialized");
},
});

analytics = {
capture: (event, properties) => posthog.capture(event, properties),
captureException: (error, properties) =>
posthog.captureException(error, properties),
identify: (distinctId, properties) =>
posthog.identify(distinctId, properties),
reset: () => posthog.reset(),
Expand All @@ -58,6 +63,13 @@ export function capture(
analytics.capture(event, properties);
}

export function captureException(
error: unknown,
properties?: Record<string, unknown>,
): void {
analytics.captureException(error, properties);
}

export function identify(
distinctId: string,
properties?: Record<string, unknown>,
Expand Down
Loading