Skip to content

Commit a6b59ba

Browse files
maparentmdroidian
authored andcommitted
Convert to PNPM.
* Package files have to be more explicit in their dependencies. * pnpm workspace definition. * nuclear option: Use the react->@types/react@18 for tsc. * Patch for @blueprintjs/core@3.50.4 and adjust versioning for dependencies. (#425) --------- Co-authored-by: Michael Gartner <mclicks@gmail.com> some coderabbit suggestions, update pnpm to 10.15.1, remove some unneeded changes, comments
1 parent 8464cf1 commit a6b59ba

37 files changed

+18158
-29771
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,24 @@ jobs:
1212
- name: Checkout Code
1313
uses: actions/checkout@v4
1414

15+
- uses: pnpm/action-setup@v4
16+
name: Install pnpm
17+
with:
18+
version: 10.15.1
19+
run_install: false
20+
1521
- name: Setup Node.js environment
1622
uses: actions/setup-node@v4
1723
with:
1824
node-version: 20
19-
cache: "npm"
25+
cache: "pnpm"
2026

2127
- name: Install Dependencies
22-
run: npm ci
28+
run: pnpm install --frozen-lockfile
2329

2430
- name: Check TypeScript Types
2531
run: npx turbo check-types
2632

2733
# TODO: Add future linting, testing, style checks, etc.
2834
# name: Lint
29-
# run: npm run lint
35+
# run: pnpm run lint

.github/workflows/database-deploy.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@ jobs:
1212
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID_PROD }}
1313
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD_PROD }}
1414
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v3
15+
- name: Checkout Code
16+
uses: actions/checkout@v4
17+
18+
- name: Install pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
version: 10.15.1
22+
run_install: false
23+
24+
- uses: actions/setup-node@v4
1725
with:
1826
node-version: "20"
19-
- run: npm ci
27+
cache: "pnpm"
28+
29+
- name: Install Dependencies
30+
run: pnpm install --frozen-lockfile
31+
2032
- uses: supabase/setup-cli@v1
2133
with:
2234
version: latest
35+
2336
- run: npx turbo deploy -F @repo/database

.github/workflows/roam-main.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,20 @@ jobs:
2323
- name: Checkout Code
2424
uses: actions/checkout@v4
2525

26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: 10.15.1
30+
run_install: false
31+
2632
- name: Setup Node.js environment
2733
uses: actions/setup-node@v4
2834
with:
2935
node-version: 20
30-
cache: "npm"
36+
cache: "pnpm"
3137

3238
- name: Install Dependencies
33-
run: npm ci
39+
run: pnpm install --frozen-lockfile
3440

3541
- name: Deploy
3642
run: npx turbo run deploy --filter=roam

.github/workflows/roam-pr.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ jobs:
2424
- name: Checkout Code
2525
uses: actions/checkout@v4
2626

27+
- name: Install pnpm
28+
uses: pnpm/action-setup@v4
29+
with:
30+
version: 10.15.1
31+
run_install: false
32+
2733
- name: Setup Node.js environment
2834
uses: actions/setup-node@v4
2935
with:
3036
node-version: 20
31-
cache: "npm"
37+
cache: "pnpm"
3238

3339
- name: Install Dependencies
34-
run: npm ci
40+
run: pnpm install --frozen-lockfile
3541

3642
- name: Deploy
3743
run: npx turbo run deploy --filter=roam

.github/workflows/roam-release.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@ jobs:
1717
- name: Checkout Code
1818
uses: actions/checkout@v4
1919

20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v4
22+
with:
23+
version: 10.15.1
24+
run_install: false
25+
2026
- name: Setup Node.js environment
2127
uses: actions/setup-node@v4
2228
with:
2329
node-version: 20
24-
cache: "npm"
30+
cache: "pnpm"
2531

2632
- name: Install Dependencies
27-
run: npm ci
33+
run: pnpm install --frozen-lockfile
2834

2935
- name: Update Roam Depot Extension
3036
run: npx turbo run publish --filter=roam

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ git clone https://github.com/DiscourseGraphs/discourse-graph.git
5050

5151
```bash
5252
cd discourse-graph
53-
npm install
53+
npm install -g pnpm@10
54+
pnpm install
5455
```
5556

5657
3. Run all applications in development mode:

apps/obsidian/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@
99
"build": "tsx scripts/build.ts",
1010
"lint": "eslint .",
1111
"lint:fix": "eslint . --fix",
12-
"publish": "tsx scripts/publish-obsidian.ts",
12+
"publish": "tsx scripts/publish.ts --version 0.1.0",
1313
"check-types": "tsc --noEmit --skipLibCheck"
1414
},
1515
"keywords": [],
1616
"author": "",
1717
"license": "Apache-2.0",
1818
"devDependencies": {
1919
"@octokit/core": "^6.1.2",
20+
"@repo/typescript-config": "workspace:*",
2021
"@types/node": "^20",
22+
"@types/react": "catalog:obsidian",
23+
"@types/react-dom": "catalog:obsidian",
2124
"autoprefixer": "^10.4.21",
2225
"builtin-modules": "3.3.0",
2326
"dotenv": "^16.4.5",
@@ -27,11 +30,13 @@
2730
"tailwindcss": "^3.4.17",
2831
"tslib": "2.5.1",
2932
"tsx": "^4.19.2",
30-
"typescript": "5.5.4"
33+
"typescript": "5.5.4",
34+
"zod": "^3.24.1"
3135
},
3236
"dependencies": {
33-
"react": "^19.0.0",
34-
"react-dom": "^19.0.0",
37+
"nanoid": "^4.0.2",
38+
"react": "catalog:obsidian",
39+
"react-dom": "catalog:obsidian",
3540
"tailwindcss-animate": "^1.0.7"
3641
}
3742
}

apps/obsidian/scripts/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This directory contains a script for publishing the Discourse Graph Obsidian plu
99

1010
## Prerequisites
1111

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

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

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

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

5454
**🧪 Pre-release** (automatic detection)
5555
- **Triggers**: Any version with `alpha` or `beta` suffixes
56-
- **GitHub**: Marked as "Pre-release"
56+
- **GitHub**: Marked as "Pre-release"
5757
- **Main Branch**: Not updated (keeps stable code in main)
5858
- **Use Case**: Testing, beta versions, internal releases
5959

@@ -122,7 +122,7 @@ tsx scripts/publish.ts --version 0.1.0-alpha-canvas-feature --release-name "Canv
122122
tsx scripts/publish.ts --version 0.1.0-canvas-feature
123123
```
124124

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

140-
### Using npm script from obsidian directory
140+
### Using pnpm script from obsidian directory
141141
```bash
142142
cd apps/obsidian
143-
npm run publish -- --version 1.0.0-beta.1
143+
pnpm run publish -- --version 1.0.0-beta.1
144144
```
145145

146146
## What the Script Does
147147

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

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

190190
## Troubleshooting
@@ -195,16 +195,16 @@ Publishes to: `DiscourseGraphs/discourse-graph-obsidian`
195195
```bash
196196
# ❌ Wrong
197197
tsx scripts/publish.ts
198-
199-
# ✅ Correct
198+
199+
# ✅ Correct
200200
tsx scripts/publish.ts --version 1.0.0
201201
```
202202

203203
2. **"Invalid version format"**
204204
```bash
205205
# ❌ Wrong
206206
tsx scripts/publish.ts --version "beta-1"
207-
207+
208208
# ✅ Correct
209209
tsx scripts/publish.ts --version 1.0.0-beta.1
210210
```
@@ -219,7 +219,7 @@ Publishes to: `DiscourseGraphs/discourse-graph-obsidian`
219219
- Verify repository exists and is accessible
220220

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

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

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

254254
### Security:
255255
- Uses GitHub API instead of git commands for better security
256-
- Never commits tokens to repository
256+
- Never commits tokens to repository

apps/obsidian/scripts/publish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ const copyDirectory = ({
258258
const buildPlugin = async (dir: string): Promise<void> => {
259259
log("Building plugin...");
260260

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

263263
const buildDir = path.join(dir, "dist");
264264
const missingFiles = REQUIRED_BUILD_FILES.filter(

apps/obsidian/src/components/NodeTypeSettings.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,11 @@ const NodeTypeSettings = () => {
382382
handleNodeTypeChange(fieldConfig.key, newValue);
383383

384384
return (
385-
<FieldWrapper fieldConfig={fieldConfig} error={error} key={fieldConfig.key}>
385+
<FieldWrapper
386+
fieldConfig={fieldConfig}
387+
error={error}
388+
key={fieldConfig.key}
389+
>
386390
{fieldConfig.key === "template" ? (
387391
<TemplateField
388392
value={value}
@@ -418,14 +422,14 @@ const NodeTypeSettings = () => {
418422
>
419423
<div className="flex items-center justify-between">
420424
<div className="flex items-center gap-2">
421-
{nodeType.color && (
422-
<div
423-
className="h-4 w-4 rounded-full"
424-
style={{ backgroundColor: nodeType.color }}
425-
/>
426-
)}
427-
<span>{nodeType.name}</span>
428-
</div>
425+
{nodeType.color && (
426+
<div
427+
className="h-4 w-4 rounded-full"
428+
style={{ backgroundColor: nodeType.color }}
429+
/>
430+
)}
431+
<span>{nodeType.name}</span>
432+
</div>
429433
<div className="flex gap-2">
430434
<button
431435
className="icon-button"
@@ -437,7 +441,7 @@ const NodeTypeSettings = () => {
437441
>
438442
<div
439443
className="icon"
440-
ref={(el) => el && setIcon(el, "pencil")}
444+
ref={(el) => (el && setIcon(el, "pencil")) || undefined}
441445
/>
442446
</button>
443447
<button
@@ -450,7 +454,7 @@ const NodeTypeSettings = () => {
450454
>
451455
<div
452456
className="icon"
453-
ref={(el) => el && setIcon(el, "trash")}
457+
ref={(el) => (el && setIcon(el, "trash")) || undefined}
454458
/>
455459
</button>
456460
</div>
@@ -476,7 +480,7 @@ const NodeTypeSettings = () => {
476480
>
477481
<div
478482
className="icon"
479-
ref={(el) => el && setIcon(el, "arrow-left")}
483+
ref={(el) => (el && setIcon(el, "arrow-left")) || undefined}
480484
/>
481485
</button>
482486
<h3 className="dg-h3">Edit Node Type</h3>

0 commit comments

Comments
 (0)