Skip to content

Commit 5f37ff2

Browse files
committed
eng-1262: allow for same id, different triples (#679)
1 parent 7579fb7 commit 5f37ff2

File tree

9 files changed

+279
-34
lines changed

9 files changed

+279
-34
lines changed

apps/roam/.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
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=...

apps/roam/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
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:*",
@@ -63,7 +64,7 @@
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",

apps/roam/scripts/compile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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"]),

apps/roam/scripts/deploy.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { put } from "@vercel/blob";
22
import fs, { readFileSync } from "fs";
33
import { join } from "path";
44
import { compile } from "./compile";
5+
import { posthog } from "./posthog";
56
import { config } from "@repo/database/dbDotEnv";
67
import { 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");

apps/roam/scripts/posthog.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
};

apps/website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
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",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"tailwindConfig": "./packages/tailwind-config/tailwind.config.ts"
3131
},
3232
"dependencies": {
33-
"posthog-js": "^1.306.1"
33+
"posthog-js": "catalog:"
3434
}
3535
}

0 commit comments

Comments
 (0)