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
11 changes: 11 additions & 0 deletions .changeset/beige-worms-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@pascal-app/editor": patch
"@pascal-app/viewer": patch
"@pascal-app/nodes": patch
"@pascal-app/core": patch
"@pascal-app/mcp": patch
---

Backport the [**tsgo** adoption change](https://github.com/pascalorg/editor/pull/442) from upstream Pascal primarily for this change to the **@react-three/fiber** JSX interface module augmentation:

> The blocker for TS 7 here was the react-three-fiber + `three/webgpu` JSX augmentation in `viewer`: mapping the whole `three/webgpu` namespace (`ThreeToJSXElements<typeof THREE>`) made the native checker fail with **TS2320** (heritage conflict on `PMREMGenerator`: core-three's `WebGLRenderer` arg vs webgpu's abstract `Renderer`), **TS2430**, and **TS2590** ("union too complex"). `tsc 6` tolerated it. This narrows the augmentation to the one webgpu node material used as a JSX tag — `<lineBasicNodeMaterial>` — following R3F's "extract the classes you need" guidance. Types-only; runtime `extend(THREE)` is unchanged.
4 changes: 2 additions & 2 deletions apps/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "dotenv -e ../../.env.local -- next build",
"start": "next start",
"lint": "biome lint",
"check-types": "next typegen && tsc --noEmit"
"check-types": "next typegen && tsgo --noEmit"
},
"dependencies": {
"@iconify/react": "^6.0.2",
Expand All @@ -25,7 +25,7 @@
"clsx": "^2.1.1",
"geist": "^1.7.0",
"lucide-react": "^1.7.0",
"next": "16.2.1",
"next": "16.2.9",
"postcss": "^8.5.6",
"react": "^19.2.4",
"react-dom": "^19.2.4",
Expand Down
2 changes: 1 addition & 1 deletion apps/ifc-converter/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
4 changes: 2 additions & 2 deletions apps/ifc-converter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build": "next build",
"start": "next start",
"lint": "biome lint",
"check-types": "next typegen && tsc --noEmit"
"check-types": "next typegen && tsgo --noEmit"
},
"dependencies": {
"@pascal-app/core": "*",
Expand All @@ -23,7 +23,7 @@
"@react-three/fiber": "^9.5.0",
"@tailwindcss/postcss": "^4.2.1",
"clsx": "^2.1.1",
"next": "16.2.1",
"next": "16.2.9",
"postcss": "^8.5.6",
"react": "^19.2.4",
"react-dom": "^19.2.4",
Expand Down
62 changes: 40 additions & 22 deletions bun.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
"restart": "bun kill && bun clean:cache && bun dev",
"changeset": "changeset",
"ci:version": "changeset version && bun install",
"ci:publish": "bun run scripts/publish-fork.ts"
"ci:publish": "bun run scripts/publish-fork.ts",
"snapshot": "bun run scripts/publish-fork.ts --snapshot"
},
"devDependencies": {
"@biomejs/biome": "^2.4.6",
"@biomejs/biome": "^2.4.16",
"@changesets/cli": "2.31.0",
"@typescript/native-preview": "7.0.0-dev.20260624.1",
"dotenv-cli": "^11.0.0",
"turbo": "^2.8.15",
"typescript": "6.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
],
"scripts": {
"build": "tsc --build",
"dev": "tsc --build --watch",
"dev": "tsgo --build --watch",
"test": "bun test",
"bench:registry": "bun run src/registry/__bench__/relations-resolver.bench.ts",
"prepublishOnly": "npm run build"
Expand Down
5 changes: 2 additions & 3 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
"README.md"
],
"scripts": {
"build": "tsc -p tsconfig.build.json",
"dev": "tsc -p tsconfig.build.json --watch",
"check-types": "tsc --noEmit"
"build": "tsgo -p tsconfig.build.json",
"check-types": "tsgo --noEmit"
},
"peerDependencies": {
"@pascal-app/core": "workspace:^",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
type ZoneNode,
} from '@pascal-app/core'
import { useViewer } from '@pascal-app/viewer'
import type { ThreeElements } from '@react-three/fiber'
import { useThree } from '@react-three/fiber'
import { useEffect, useRef } from 'react'
import {
Expand All @@ -40,12 +39,6 @@ import { sfxEmitter } from '../../../lib/sfx-bus'
import useEditor from '../../../store/use-editor'
import { CursorSphere } from '../shared/cursor-sphere'

declare module 'react/jsx-runtime' {
namespace JSX {
interface IntrinsicElements extends ThreeElements {}
}
}

/**
* Module-level flag to prevent the SelectionManager from deselecting
* on the grid:click that fires right after a box-select drag completes.
Expand Down
2 changes: 1 addition & 1 deletion packages/ifc-converter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "tsc --build",
"dev": "tsc --build --watch",
"dev": "tsgo --build --watch",
"prepublishOnly": "npm run build"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
],
"scripts": {
"build": "tsc --build",
"dev": "tsc --build --watch",
"dev": "tsgo --build --watch",
"start": "bun dist/bin/pascal-mcp.js",
"test": "bun test",
"smoke": "bun run scripts/smoke.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "tsc --build",
"dev": "tsc --build --watch",
"dev": "tsgo --build --watch",
"test": "bun test",
"prepublishOnly": "bun run build && bun test"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"lint": "eslint . --max-warnings 0",
"generate:component": "turbo gen react-component",
"check-types": "tsc --noEmit"
"check-types": "tsgo --noEmit"
},
"devDependencies": {
"@repo/eslint-config": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "tsc --build",
"dev": "tsc --build --watch",
"dev": "tsgo --build --watch",
"prepublishOnly": "npm run build"
},
"peerDependencies": {
Expand Down
12 changes: 10 additions & 2 deletions packages/viewer/src/components/viewer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { type AnyNodeId, StairOpeningSystem } from '@pascal-app/core'
import { Canvas, extend, type ThreeToJSXElements, useFrame, useThree } from '@react-three/fiber'
import { Canvas, extend, type ThreeElement, useFrame, useThree } from '@react-three/fiber'
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react'
import * as THREE from 'three/webgpu'
import { PERF_OVERLAY_ENABLED, pushGpuSample } from '../../lib/gpu-perf'
Expand All @@ -23,7 +23,15 @@ import { SelectionManager } from './selection-manager'
import { ViewerCamera } from './viewer-camera'

declare module '@react-three/fiber' {
interface ThreeElements extends ThreeToJSXElements<typeof THREE> {}
// The TS 7 native compiler (tsgo) rejects mapping the entire `three/webgpu`
// namespace into JSX — `ThreeToJSXElements<typeof THREE>` triggers a TS2320
// heritage conflict with R3F's core-three base plus a TS2590 "union too
// complex". tsc 6 tolerates it; tsgo does not. R3F's base ThreeElements
// already covers core three, so we extract only the webgpu/TSL node materials
// we actually use as JSX (see r3f.docs.pmnd.rs/api/typescript).
interface ThreeElements {
lineBasicNodeMaterial: ThreeElement<typeof THREE.LineBasicNodeMaterial>
}
}

extend(THREE as any)
Expand Down
29 changes: 25 additions & 4 deletions scripts/publish-fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ import { extname, join } from "node:path";
//
// To target a different scope (e.g. @meterup) set PUBLISH_SCOPE — that is the
// only thing that changes. Auth comes from .npmrc (NODE_AUTH_TOKEN).
//
// With --snapshot (run after `bun changeset` + `bun run build`): mints
// 0.0.0-snapshot-<timestamp> versions via `changeset version --snapshot`,
// publishes them to the `snapshot` dist-tag (leaving `latest` untouched), and
// skips git tags / GitHub Releases. It dirties the working tree (version bumps +
// consumed changesets) — discard with `git checkout .` afterward; CI is ephemeral.

const SOURCE_PREFIX = "@pascal-app/";
const SCOPE = process.env.PUBLISH_SCOPE ?? "@meterup";
Expand All @@ -30,6 +36,11 @@ const TARGET_PREFIX = `${SCOPE}/${NAME_PREFIX}`; // e.g. "@meterup/pascal-"
const REGISTRY = "https://npm.pkg.github.com";
const DRY_RUN = process.argv.includes("--dry-run");
const IN_CI = process.env.GITHUB_ACTIONS === "true";
// --snapshot: mint ephemeral 0.0.0-snapshot-<timestamp> versions and publish them
// to the `snapshot` dist-tag instead of `latest` (see changesets snapshot releases).
const SNAPSHOT = process.argv.includes("--snapshot");
const SNAPSHOT_TAG = "snapshot"; // both the changesets snapshot id and the dist-tag
const DIST_TAG = SNAPSHOT ? SNAPSHOT_TAG : "latest";
// "owner/repo" of the publishing fork in CI; used to link packages to this repo.
const GITHUB_REPOSITORY = process.env.GITHUB_REPOSITORY;

Expand Down Expand Up @@ -70,6 +81,15 @@ const relinkRepository = (packageDir: string, repo: string, directory: string):
writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
};

// Snapshot mode mints throwaway versions from the pending changesets. Only
// packages with a changeset (+ their dependents) get a snapshot version; the
// rest keep their released version and are skipped below as already-published.
// `bun install` re-resolves the lockfile so `bun pm pack` emits snapshot ranges.
if (SNAPSHOT && !DRY_RUN) {
await $`bunx changeset version --snapshot ${SNAPSHOT_TAG}`;
await $`bun install`;
}

const newTags: string[] = [];

for (const dir of readdirSync("packages")) {
Expand Down Expand Up @@ -106,8 +126,8 @@ for (const dir of readdirSync("packages")) {
continue;
}

console.log(`→ Publishing ${tag}`);
await $`npm publish ${packed} --ignore-scripts --registry ${REGISTRY}`;
console.log(`→ Publishing ${tag} (dist-tag: ${DIST_TAG})`);
await $`npm publish ${packed} --ignore-scripts --registry ${REGISTRY} --tag ${DIST_TAG}`;
newTags.push(tag);
} finally {
rmSync(work, { recursive: true, force: true });
Expand All @@ -119,8 +139,9 @@ for (const dir of readdirSync("packages")) {
// printed name against a workspace package, which never matches our rescoped
// names (the source stays @pascal-app/*), so it errors. Instead we own the tag
// + release here, named after what was actually published. Best-effort so a
// re-run (tag/release already exists) doesn't fail the job.
if (IN_CI && newTags.length > 0) {
// re-run (tag/release already exists) doesn't fail the job. Skipped for
// snapshots — they're ephemeral and shouldn't leave tags/releases behind.
if (!SNAPSHOT && IN_CI && newTags.length > 0) {
for (const tag of newTags) await $`git tag ${tag}`.nothrow();
await $`git push origin ${newTags}`.nothrow();
for (const tag of newTags) {
Expand Down
Loading