Conversation
|
Hey! Nice work on the monorepo split. One thing I noticed: It's not causing issues today since core is consumed through the react/legacy packages where React is already present. But once non-React adapters (Vue, Svelte, vanilla) are added down the line, their users would get React auto-installed by npm 7+ or peer warnings -- which would be confusing. Since the goal of the split is to keep core framework-agnostic, would it make sense to drop the |
|
Small concern about cross-package dependencies using Locally this works fine because npm workspaces resolves Since the root already specifies Alternatively, if you'd prefer to keep |
yes, totally. My bad! |
Tried |
…o version ^2.3.0 in multiple packages
🦋 Changeset detectedLatest commit: 160ac21 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
714cb8e to
2af50df
Compare
|
|
|
|
…in Spatial Navigation
… core and react packages
Summary
This PR refactors the repository into an npm workspaces + Turborepo monorepo. The previous single-package layout is split into focused packages and a demo app, with the root acting only as the workspace orchestrator.
1. Root as workspace root
package.json: Root is now a private workspace root ("name": "root","private": true) withworkspaces: ["apps/*", "packages/*"]. Scripts delegate to Turborepo:start,build, andtestrun viaturbo. Publishable package metadata, dependencies, and tooling were moved into the individual packages.turbo.json: Added Turborepo config with tasks forbuild,test, andstart;build/testuse dependency order (dependsOn: ["^build"]) and define outputs for caching (e.g../dist,./lib,./coverage).startis persistent and not cached..gitignore: Added.turboto ignore Turborepo logs.tsconfig.json: Formatting-only change (e.g.libandexcludeon single lines).2. New package layout
packages/core(@noriginmedia/norigin-spatial-navigation-core)Core spatial navigation logic:
SpatialNavigation,VisualDebugger,WritingDirection,measureLayout, and their tests. Same code as before, moved from repo rootsrc/intopackages/core/src/. Build and test scripts (webpack, jest) live in this package.packages/react(@noriginmedia/norigin-spatial-navigation-react)React bindings:
useFocusable,useFocusContext, andFocusContext. Depends on@noriginmedia/norigin-spatial-navigation-core. Imports from the core package instead of local paths; API unchanged.packages/legacy(@noriginmedia/norigin-spatial-navigation)Umbrella package for backward compatibility. Re-exports core and React:
export * from '@noriginmedia/norigin-spatial-navigation-core'and...react. Consumers that depend on@noriginmedia/norigin-spatial-navigationcan keep the same import and get both core and React APIs.apps/react-demo(@noriginmedia/norigin-spatial-navigation-react-demo, private)Demo app moved from repo root into
apps/react-demo. Uses the legacy package:import { useFocusable, init, FocusContext, ... } from '@noriginmedia/norigin-spatial-navigation'. Behavior and UI are unchanged (menu, content rows, assets, progress bar, etc.).3. Changesets for versioning and releases
package.json: Changesets are wired at the workspace root. Scripts:changeset(create a new changeset),changeset:version(bump versions from changesets), andchangeset:publish(publish to npm). Dev dependencies:@changesets/cliand@changesets/changelog-github..changeset/config.json: Config usesbaseBranch: "main",commit: false(releases are committed by CI or manually, not by the CLI), andupdateInternalDependencies: "patch"so dependents (e.g.norigin-spatial-navigation-reactand the legacy package) get patch bumps when core changes. Changelog is generated with@changesets/cli/changelog; packages are published withaccess: "public"..github/workflows/release.yml) runs on push tomain. It useschangesets/actionto runchangeset:version(update versions and CHANGELOGs from.changeset/*.mdfiles) andchangeset:publish(publish updated packages to npm). So the monorepo keeps a single, changeset-driven release process for the three publishable packages (core,react, and the legacy umbrella).