Building a VS Code extension is fun, but what happens when you want to take that same logic to mobile?
I've been working on DotSense, a developer wellness tool. It started as a VS Code extension, but I wanted to expand it to Android using Kotlin & React Native.
The problem? My business logic was tightly coupled to the VS Code API. I couldn't just "copy-paste" it to mobile.
The Decision: Monorepo Architecture
I decided to refactor the entire project into a Monorepo structure using npm workspaces.
packages/core: The "Brain" (Analytics, Gamification, Statistics). Pure TypeScript, no platform dependencies.
packages/vscode-extension: The "Desktop UI". Consumes the core.
packages/mobile: The "Mobile App" π± (Coming soon). Will consume the same core.
The "Red Screen" of Death
Extracting the core wasn't painless. As soon as I moved the files and updated the tsconfig.json, my terminal exploded.
101 TypeScript Errors.
It looked terrifying, but it was actually a roadmap. Every error was a dependency I needed to untangle.
Here is a 60-second timelapse of the process, from the chaos of 101 errors to the satisfaction of a clean compile:
Key Steps in the Migration
Isolating Types: I moved all shared interfaces (like UserStats, Achievement) to the core package.
Configuring Paths: Updated tsconfig.json in the extension to map @dotsense/core to the local package.
Linking: Used npm install at the root to link the local packages together.
JSON
// packages/vscode-extension/package.json
{
"dependencies": {
"@dotsense/core": "*"
}
}
The Result
After hours of fixing imports and decoupling logic, the build finally passed. Now, I have a single source of truth for my app's logic.
If I fix a bug in the Core, it's fixed for both VS Code and Android instantly.
Next stop: Building the Android Native Module with Kotlin!
Have you ever migrated a live project to a Monorepo? Let me know in the comments! π
Top comments (0)