Development
This guide will help you set up your development environment for working on Learningmap.
Prerequisites
- Node.js: Version 18 or higher
- pnpm: Version 8 or higher (required - the project enforces pnpm usage)
Installation
-
Clone the repository:
git clone https://github.com/openpatch/learningmap.git cd learningmap -
Install dependencies:
pnpm install -
Build all packages:
pnpm build
Repository Structure
Learningmap is a pnpm monorepo with the following structure:
learningmap/
├── packages/
│ ├── learningmap/ # Core React component library
│ └── web-component/ # Web component wrapper
├── platforms/
│ ├── web/ # Web application (learningmap.app)
│ └── vscode/ # VS Code extension
├── docs/ # Documentation (Hyperbook)
└── scripts/ # Build and development scripts
Development Workflow
Available Scripts
From the root directory:
pnpm dev- Watch mode for development (rebuilds on file changes)pnpm build- Build all packagespnpm test- Run tests across all packagespnpm lint- Type-check with TypeScriptpnpm docs:dev- Start documentation dev server (http://localhost:3000)pnpm docs:build- Build documentation
Working on Packages
Each package has its own scripts:
pnpm build- Build the packagepnpm lint- Type-check with TypeScriptpnpm test- Run tests with Vitest
Important: Always build packages before testing, as packages depend on each other's built artifacts.
Development Mode
For active development with automatic rebuilds:
pnpm dev
This starts a watcher that rebuilds packages when you make changes.
Documentation
To work on documentation:
pnpm docs:dev
The documentation is built with Hyperbook and is located in the docs/ directory.
VS Code Extension
To develop the VS Code extension:
-
Build the extension:
pnpm --filter learningmap-vscode build -
Open the
platforms/vscodedirectory in VS Code -
Press F5 to launch the Extension Development Host
-
Open or create a
.learningmapfile to test the editor
See platforms/vscode/DEVELOPMENT.md for more details.
Testing Your Changes
- Type-check:
pnpm lint - Run tests:
pnpm test - Build:
pnpm build
All PRs must pass these checks.
Tech Stack
- Language: TypeScript
- UI Framework: React 19
- Build Tool: Vite + esbuild
- Visual Editor: ReactFlow (@xyflow/react)
- Layout Engine: ELK.js for auto-layout
- Testing: Vitest
- Code Quality: Prettier, Husky
Version Management
This project uses Changesets for version management:
- Make your changes
- Run
pnpm exec changesetto create a changeset - Follow the prompts to describe your changes
- Commit the changeset file with your PR
Common Issues
pnpm not found
Install pnpm globally:
npm install -g pnpm
Build failures
Make sure all dependencies are installed:
pnpm install
pnpm build
TypeScript errors
Run type-checking to see all errors:
pnpm lint
