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
12 changes: 9 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10.15.1
run_install: false

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache: "pnpm"

- name: Install Dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Check TypeScript Types
run: npx turbo check-types

# TODO: Add future linting, testing, style checks, etc.
# name: Lint
# run: npm run lint
# run: pnpm run lint
19 changes: 16 additions & 3 deletions .github/workflows/database-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@ jobs:
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID_PROD }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD_PROD }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- name: Checkout Code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.1
run_install: false

- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm ci
cache: "pnpm"

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- uses: supabase/setup-cli@v1
with:
version: latest

- run: npx turbo deploy -F @repo/database
10 changes: 8 additions & 2 deletions .github/workflows/roam-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.1
run_install: false

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache: "pnpm"

- name: Install Dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Deploy
run: npx turbo run deploy --filter=roam
10 changes: 8 additions & 2 deletions .github/workflows/roam-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.1
run_install: false

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache: "pnpm"

- name: Install Dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Deploy
run: npx turbo run deploy --filter=roam
10 changes: 8 additions & 2 deletions .github/workflows/roam-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.1
run_install: false

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache: "pnpm"

- name: Install Dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Update Roam Depot Extension
run: npx turbo run publish --filter=roam
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ git clone https://github.com/DiscourseGraphs/discourse-graph.git

```bash
cd discourse-graph
npm install
npm install -g pnpm@10
pnpm install
```

3. Run all applications in development mode:
Expand Down
15 changes: 11 additions & 4 deletions apps/obsidian/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,36 @@
"build": "tsx scripts/build.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"publish": "tsx scripts/publish-obsidian.ts",
"publish": "tsx scripts/publish.ts --version 0.1.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed: the publish script requires a version. This probably had issues before.

"check-types": "tsc --noEmit --skipLibCheck"
},
"keywords": [],
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@octokit/core": "^6.1.2",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/node": "^20",
"@types/react": "catalog:obsidian",
"@types/react-dom": "catalog:obsidian",
"autoprefixer": "^10.4.21",
"builtin-modules": "3.3.0",
"dotenv": "^16.4.5",
"esbuild": "0.17.3",
"eslint": "catalog:",
"obsidian": "^1.7.2",
"postcss": "^8.5.3",
"tailwindcss": "^3.4.17",
"tslib": "2.5.1",
"tsx": "^4.19.2",
"typescript": "5.5.4"
"typescript": "5.5.4",
"zod": "^3.24.1"
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"nanoid": "^4.0.2",
"react": "catalog:obsidian",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we bump obsidian to 19.1 to consolidate website/obsidian on the same version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for it; but @trangdoan982 should check it if there are side-effects there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly: let's leave it at that for now, then try update in another PR.

"react-dom": "catalog:obsidian",
"tailwindcss-animate": "^1.0.7"
}
}
28 changes: 14 additions & 14 deletions apps/obsidian/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This directory contains a script for publishing the Discourse Graph Obsidian plu

## Prerequisites

1. **Node.js and npm** - Ensure you have Node.js 18+ installed
1. **Node.js and pnpm** - Ensure you have Node.js 20+ installed, with pnpm@10 installed globally (`npm install -g pnpm`)
2. **Git** - For repository operations
3. **GitHub Token** - For authentication (see Authentication section)

Expand Down Expand Up @@ -42,7 +42,7 @@ The script automatically determines release type based on version format and alw
### BRAT Version Priority

BRAT uses alphabetical ordering for pre-release identifiers. This is why we enforce:
- **Internal**: `alpha-*` (comes first alphabetically)
- **Internal**: `alpha-*` (comes first alphabetically)
- **External**: `beta-*` (comes after alpha, gets higher priority)

This ensures that external beta releases always take precedence over internal alpha releases for BRAT auto-updates.
Expand All @@ -53,7 +53,7 @@ The script automatically determines the release type based on version format:

**🧪 Pre-release** (automatic detection)
- **Triggers**: Any version with `alpha` or `beta` suffixes
- **GitHub**: Marked as "Pre-release"
- **GitHub**: Marked as "Pre-release"
- **Main Branch**: Not updated (keeps stable code in main)
Comment on lines 54 to 57
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Inconsistent “beta” release status between sections

Above you state pre-releases (alpha/beta) are marked as “Pre-release”, but the table shows “GitHub Release: ✅ Stable” for beta. Align to “🧪 Pre-release” for beta rows.

-| `x.y.z-beta.n` | External Pre-release | ✅ Yes | ❌ No |  ✅ Stable | `1.0.0-beta.1` |
+| `x.y.z-beta.n` | External Pre-release | ✅ Yes | ❌ No |  🧪 Pre-release | `1.0.0-beta.1` |

Also applies to: 101-106

🧰 Tools
🪛 LanguageTool

[grammar] ~55-~55: There might be a mistake here.
Context: ...Pre-release** (automatic detection) - Triggers: Any version with alpha or `...

(QB_NEW_EN)


[grammar] ~56-~56: There might be a mistake here.
Context: ...ion with alpha or beta suffixes - GitHub: Marked as "Pre-release" - **Mai...

(QB_NEW_EN)


[grammar] ~57-~57: There might be a mistake here.
Context: ...GitHub: Marked as "Pre-release" - Main Branch: Not updated (keeps stable ...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In apps/obsidian/scripts/README.md around lines 54 to 57 (and also apply same
fix to lines 101–106), the table entry incorrectly marks beta releases as
"GitHub Release: ✅ Stable" while the section above defines beta as a
pre-release; update the beta rows in the table to mark GitHub releases as "🧪
Pre-release" (or equivalent pre-release indicator) to match the documented
behavior and keep the wording consistent across both places.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of PR scope. This was only included because of automated spacing adjustments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maparent Understood! You're absolutely right that this documentation inconsistency is out of scope for the PNPM migration PR.

Would you like me to create a follow-up issue to track the beta release documentation inconsistency for future cleanup?

- **Use Case**: Testing, beta versions, internal releases

Expand Down Expand Up @@ -122,7 +122,7 @@ tsx scripts/publish.ts --version 0.1.0-alpha-canvas-feature --release-name "Canv
tsx scripts/publish.ts --version 0.1.0-canvas-feature
```

### Beta Release for Public Testing
### Beta Release for Public Testing
```bash
# ✅ Correct format with beta prefix - creates pre-release automatically
tsx scripts/publish.ts --version 1.0.0-beta.1 --release-name "Beta: New Graph View"
Expand All @@ -137,18 +137,18 @@ tsx scripts/publish.ts --version 1.0.0-test.1
tsx scripts/publish.ts --version 1.0.0
```

### Using npm script from obsidian directory
### Using pnpm script from obsidian directory
```bash
cd apps/obsidian
npm run publish -- --version 1.0.0-beta.1
pnpm run publish -- --version 1.0.0-beta.1
```
Comment on lines +140 to 144
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Publish script invocation may pass duplicate --version

The README suggests pnpm run publish -- --version ..., but the package.json script currently hardcodes --version 0.1.0. This will pass two versions. Either remove the default in package.json or change the README to call tsx directly.

If you choose to remove the hardcoded version (preferred), apply this in apps/obsidian/package.json (see separate comment there).


🏁 Script executed:

#!/bin/bash
# Inspect the "publish" script in apps/obsidian/package.json to verify if it hardcodes a version flag
grep -R '"publish"' -n apps/obsidian/package.json -A5

Length of output: 218


Remove hardcoded --version from the Obsidian publish script

We’ve confirmed that apps/obsidian/package.json defines:

"publish": "tsx scripts/publish.ts --version 0.1.0"

but the README instructs users to run:

pnpm run publish -- --version 1.0.0-beta.1

which results in two --version flags being passed.

To resolve this, please remove the hardcoded --version in package.json so that the version is supplied only via the CLI. For example:

• File: apps/obsidian/package.json
Change:

- "publish": "tsx scripts/publish.ts --version 0.1.0"
+ "publish": "tsx scripts/publish.ts"

After this change, the README snippet remains correct and users can set any version via:

cd apps/obsidian
pnpm run publish -- --version 1.0.0-beta.1
🤖 Prompt for AI Agents
In apps/obsidian/package.json (remove hardcoded --version so README and CLI flag
don't collide), replace the publish script that currently includes a fixed
"--version x.y.z" with a script that simply runs the publish script file (e.g.,
"tsx scripts/publish.ts") so the version is supplied only via the CLI; update
package.json accordingly and verify pnpm run publish -- --version <value> works
as expected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone more familiar with that part of the codebase should implement a better solution, or mark it as needed for later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maparent Understood! This is indeed a technical debt item that can be addressed later. The current hardcoded version won't break functionality, just creates a confusing developer experience.

Would you like me to create a GitHub issue to track this improvement? I can document the problem (duplicate --version flags when using the README's suggested command) and the proposed solution (remove hardcoded version from package.json) so it doesn't get lost.


🧠 Learnings used
Learnt from: CR
PR: DiscourseGraphs/discourse-graph#0
File: .cursor/rules/obsidian.mdc:0-0
Timestamp: 2025-07-19T22:34:16.794Z
Learning: Applies to apps/obsidian/package.json : Prefer existing dependencies from package.json when adding or using dependencies in the Obsidian plugin


## What the Script Does

### For All Releases:
1. **Validates input** - Checks version format and arguments
2. **Detects release type** - Internal vs External based on version format
3. **Builds the plugin** - Runs `npm run build` to create distribution files
3. **Builds the plugin** - Runs `pnpm run build` to create distribution files
4. **Copies source files** - Copies plugin source (excluding build artifacts)
5. **Creates GitHub release** - Always creates a release with:
- Custom or default release name
Expand Down Expand Up @@ -184,7 +184,7 @@ Publishes to: `DiscourseGraphs/discourse-graph-obsidian`
### Repository State by Release Type:

**Internal Release**: Repository unchanged, GitHub pre-release created
**External Pre-release**: Repository unchanged, GitHub pre-release created
**External Pre-release**: Repository unchanged, GitHub pre-release created
**External Stable**: Repository main branch updated + GitHub stable release created

## Troubleshooting
Expand All @@ -195,16 +195,16 @@ Publishes to: `DiscourseGraphs/discourse-graph-obsidian`
```bash
# ❌ Wrong
tsx scripts/publish.ts
# ✅ Correct

# ✅ Correct
tsx scripts/publish.ts --version 1.0.0
```

2. **"Invalid version format"**
```bash
# ❌ Wrong
tsx scripts/publish.ts --version "beta-1"

# ✅ Correct
tsx scripts/publish.ts --version 1.0.0-beta.1
```
Expand All @@ -219,7 +219,7 @@ Publishes to: `DiscourseGraphs/discourse-graph-obsidian`
- Verify repository exists and is accessible

5. **"Required build files missing"**
- Run `npm run build` manually to check for build errors
- Run `pnpm run build` manually to check for build errors
- Ensure TypeScript compiles without errors

6. **BRAT picking wrong version**
Expand Down Expand Up @@ -247,10 +247,10 @@ This is why the naming convention is critical for ensuring the right version get

### Key Functions:
- `isExternalRelease()` - Determines if version is external (stable/beta) or internal (alpha)
- `updateMainBranch()` - Uses GitHub API to create proper commits
- `updateMainBranch()` - Uses GitHub API to create proper commits
- `createGithubRelease()` - Creates releases with assets and automatic pre-release detection
- `updateManifest()` - Updates version in manifest.json

### Security:
- Uses GitHub API instead of git commands for better security
- Never commits tokens to repository
- Never commits tokens to repository
2 changes: 1 addition & 1 deletion apps/obsidian/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const copyDirectory = ({
const buildPlugin = async (dir: string): Promise<void> => {
log("Building plugin...");

await execCommand("npm run build", { cwd: dir });
await execCommand("pnpm run build", { cwd: dir });

const buildDir = path.join(dir, "dist");
const missingFiles = REQUIRED_BUILD_FILES.filter(
Expand Down
28 changes: 16 additions & 12 deletions apps/obsidian/src/components/NodeTypeSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,11 @@ const NodeTypeSettings = () => {
handleNodeTypeChange(fieldConfig.key, newValue);

return (
<FieldWrapper fieldConfig={fieldConfig} error={error} key={fieldConfig.key}>
<FieldWrapper
fieldConfig={fieldConfig}
error={error}
key={fieldConfig.key}
>
{fieldConfig.key === "template" ? (
<TemplateField
value={value}
Expand Down Expand Up @@ -418,14 +422,14 @@ const NodeTypeSettings = () => {
>
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
{nodeType.color && (
<div
className="h-4 w-4 rounded-full"
style={{ backgroundColor: nodeType.color }}
/>
)}
<span>{nodeType.name}</span>
</div>
{nodeType.color && (
<div
className="h-4 w-4 rounded-full"
style={{ backgroundColor: nodeType.color }}
/>
)}
<span>{nodeType.name}</span>
</div>
<div className="flex gap-2">
<button
className="icon-button"
Expand All @@ -437,7 +441,7 @@ const NodeTypeSettings = () => {
>
<div
className="icon"
ref={(el) => el && setIcon(el, "pencil")}
ref={(el) => (el && setIcon(el, "pencil")) || undefined}
/>
</button>
<button
Expand All @@ -450,7 +454,7 @@ const NodeTypeSettings = () => {
>
<div
className="icon"
ref={(el) => el && setIcon(el, "trash")}
ref={(el) => (el && setIcon(el, "trash")) || undefined}
/>
</button>
</div>
Expand All @@ -476,7 +480,7 @@ const NodeTypeSettings = () => {
>
<div
className="icon"
ref={(el) => el && setIcon(el, "arrow-left")}
ref={(el) => (el && setIcon(el, "arrow-left")) || undefined}
/>
</button>
<h3 className="dg-h3">Edit Node Type</h3>
Expand Down
2 changes: 1 addition & 1 deletion apps/obsidian/src/utils/generateUid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import nanoid from "nanoid";
const { nanoid } = require("nanoid");

const generateUid = (prefix = "dg") => {
return `${prefix}_${nanoid()}`;
Expand Down
3 changes: 3 additions & 0 deletions apps/obsidian/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"importHelpers": true,
"isolatedModules": true,
"strictNullChecks": true,
"paths": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record: changes to these files were necessary at some point, but not anymore. Could revert. But It think declaring types explicitly is useful.

"~/*": ["./src/*"]
}
}
}
4 changes: 2 additions & 2 deletions apps/roam/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
npm install
pnpm install
npx turbo run build --filter=roam
cp dist/* .
cp dist/* .
Loading