File tree Expand file tree Collapse file tree 9 files changed +279
-34
lines changed
Expand file tree Collapse file tree 9 files changed +279
-34
lines changed Original file line number Diff line number Diff line change 1- # BLOB_READ_WRITE_TOKEN=
1+ # BLOB_READ_WRITE_TOKEN=
2+ # POSTHOG_CLI_HOST=https://us.posthog.com
3+ # POSTHOG_CLI_ENV_ID=...
4+ # POSTHOG_CLI_TOKEN=...
Original file line number Diff line number Diff line change 1313 },
1414 "license" : " Apache-2.0" ,
1515 "devDependencies" : {
16+ "@posthog/cli" : " 0.5.22" ,
1617 "@repo/eslint-config" : " workspace:*" ,
1718 "@repo/tailwind-config" : " workspace:*" ,
1819 "@repo/types" : " workspace:*" ,
6364 "fuzzy" : " ^0.1.3" ,
6465 "lodash.isequal" : " ^4.5.0" ,
6566 "nanoid" : " 2.0.4" ,
66- "posthog-js" : " ^1.306.1 " ,
67+ "posthog-js" : " catalog: " ,
6768 "react-charts" : " ^3.0.0-beta.48" ,
6869 "react-draggable" : " 4.4.5" ,
6970 "react-in-viewport" : " 1.0.0-alpha.20" ,
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ export const compile = ({
169169 "window.__DISCOURSE_GRAPH_VERSION__" : `"${ getVersion ( ) } "` ,
170170 "window.__DISCOURSE_GRAPH_BUILD_DATE__" : `"${ getBuildDate ( ) } "` ,
171171 } ,
172- sourcemap : process . env . NODE_ENV === "production" ? undefined : "inline" ,
172+ sourcemap : process . env . NODE_ENV === "production" ? "external" : "inline" ,
173173 minify : process . env . NODE_ENV === "production" ,
174174 entryNames : out ,
175175 external : externalModules . map ( ( [ e ] ) => e ) . concat ( [ "crypto" ] ) ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { put } from "@vercel/blob";
22import fs , { readFileSync } from "fs" ;
33import { join } from "path" ;
44import { compile } from "./compile" ;
5+ import { posthog } from "./posthog" ;
56import { config } from "@repo/database/dbDotEnv" ;
67import { execSync } from "child_process" ;
78
@@ -23,6 +24,13 @@ const deploy = async () => {
2324 process . exit ( 1 ) ;
2425 }
2526
27+ try {
28+ posthog ( ) ;
29+ } catch ( error ) {
30+ console . error ( "Deployment failed on posthog:" , error ) ;
31+ process . exit ( 1 ) ;
32+ }
33+
2634 try {
2735 const resolvedWorkspace = "roam" ;
2836 if ( ! resolvedWorkspace ) throw new Error ( "Workspace is required" ) ;
Original file line number Diff line number Diff line change 1+ import { config } from "dotenv" ;
2+ import { execSync } from "child_process" ;
3+
4+ export const posthog = ( version ?: string ) => {
5+ config ( ) ;
6+
7+ process . env . POSTHOG_CLI_HOST =
8+ process . env . POSTHOG_CLI_HOST ||
9+ process . env . NEXT_PUBLIC_POSTHOG_HOST ||
10+ "https://us.posthog.com" ;
11+ process . env . POSTHOG_CLI_TOKEN =
12+ process . env . POSTHOG_CLI_TOKEN || process . env . NEXT_PUBLIC_POSTHOG_KEY ;
13+ const { POSTHOG_CLI_ENV_ID , POSTHOG_CLI_TOKEN } = process . env ;
14+ if ( POSTHOG_CLI_ENV_ID === undefined )
15+ throw new Error ( "Missing posthog variable: POSTHOG_CLI_ENV_ID" ) ;
16+ if ( POSTHOG_CLI_TOKEN === undefined )
17+ throw new Error ( "Missing posthog variable: POSTHOG_CLI_TOKEN" ) ;
18+ let cmd = "posthog-cli sourcemap inject --directory dist --project Roam" ;
19+ if ( version !== undefined ) {
20+ cmd = `${ cmd } --version ${ version } ` ;
21+ }
22+ execSync ( cmd ) ;
23+ } ;
Original file line number Diff line number Diff line change 2424 "mdast-util-to-string" : " ^4.0.0" ,
2525 "next" : " 15.5.7" ,
2626 "openai" : " ^4.98.0" ,
27+ "posthog-js" : " catalog:" ,
2728 "react" : " catalog:" ,
2829 "react-dom" : " catalog:" ,
2930 "rehype-parse" : " ^9.0.1" ,
Original file line number Diff line number Diff line change 3030 "tailwindConfig" : " ./packages/tailwind-config/tailwind.config.ts"
3131 },
3232 "dependencies" : {
33- "posthog-js" : " ^1.306.1 "
33+ "posthog-js" : " catalog: "
3434 }
3535}
You can’t perform that action at this time.
0 commit comments