Source Code Delivery
lpm add extracts full source files directly into your project, similar to how shadcn/ui works. Instead of installing into node_modules, the source code becomes part of your codebase.
How It Works
lpm add @lpm.dev/acme.login-form
This downloads the package and copies the source files into your project directory. You own the code and can modify it freely.
Compared to lpm install
lpm install | lpm add | |
|---|---|---|
| Where code goes | node_modules/ | Your project directory |
| Updates | lpm install pulls new versions | Manual (re-run lpm add) |
| Customization | Fork or wrap | Edit directly |
| Use case | Libraries, utilities | Components, templates, boilerplate |
Interactive Configuration
Package authors can define interactive config options in lpm.config.json. When you run lpm add, the CLI prompts you to choose:
? Which components do you want? (select multiple)
◉ Dialog
◉ Button
○ Tabs
? Styling framework (required)
● Panda CSS
○ Tailwind CSS
You can also skip prompts by passing options as URL parameters:
lpm add "@lpm.dev/acme.ui-kit?component=dialog,button&styling=panda"
Or use defaults with the --yes flag:
lpm add @lpm.dev/acme.ui-kit --yes
See Source Configuration for how authors set up these options.
Smart Import Rewriting
When a source package contains multiple files that import each other, the CLI rewrites internal imports to match your project's alias setup.
After choosing a destination, the CLI asks:
? Import alias for this directory? @/components/design-system
The author's internal imports are rewritten to use your alias:
// Author wrote:
import { cn } from "../../lib/utils"
// You get:
import { cn } from "@/components/design-system/lib/utils"
External imports like react, next/link, and @radix-ui/dialog are never touched.
Swift Projects
lpm add works with Swift projects too. The CLI auto-detects your project type and adapts:
SPM Packages (Package.swift)
If your project has a Package.swift, files are copied into the appropriate Sources/ target directory. SPM auto-discovers new .swift files - no manifest changes needed.
lpm add @lpm.dev/acme.swift-charts
# ✓ Copied to Sources/MyApp/Charts/
# Files will be compiled automatically on next build.
Xcode App Projects (.xcodeproj)
For traditional Xcode projects, the CLI creates a local SPM package inside your project and auto-links it in the .xcodeproj - zero manual Xcode steps:
lpm add @lpm.dev/acme.swift-charts
# ✓ Created Packages/LPMComponents/
# ✓ Copied Charts sources
# ✓ Auto-linked in MyApp.xcodeproj
On first run, the CLI scaffolds Packages/LPMComponents/ with a Package.swift and Sources/ directory. It then programmatically adds the local package reference and product dependency to your .xcodeproj file. Xcode hot-reloads the change - no restart needed.
Subsequent lpm add commands add new targets to the same local package. The linking is idempotent - re-running for an already-linked product is a no-op.
No import rewriting is needed for Swift - import Charts works everywhere.
When to Use Source Delivery
Source delivery works well for:
- UI components that teams want to customize per project
- SwiftUI views and layouts you want to own and modify
- Starter templates and boilerplate code
- Configuration files that need per-project adjustments
- Code examples and reference implementations
For Swift library dependencies (logging, networking, etc.), use the Swift Package Registry instead — SPM manages versions and transitive dependencies automatically.
For JavaScript libraries you want to keep updated automatically, use lpm install instead.
Learn More
- Source Configuration -
lpm.config.jsonreference for authors - Package Types - LPM supports more than just source packages