Appearance
Sync โ
The Host and the Remote live in separate repositories. mono-utils keeps them in step, and both the Mono Host and the Mono Remote (in the mono-lit/templates monorepo) ship with it installed.
Sync flows both ways, through GitHub. Neither side talks to the other directly โ each one pushes to GitHub, and the other picks the change up on its next sync:
A Remote pulls in shell updates from the Host; the Host pulls in each Remote's new modules.
Working with the repos side by side?
Put every app in one repository as sibling folders and connect them by apps[].path โ no sync round-trip, and the host hot-updates when a remote changes. See Mono-Lith.
Setup Sync โ
Both templates use these files:
mono-vue-remote/
โโโ .mono/
โ โโโ apps/ # synced remotes land here
โ โโโ tsconfig.json # generated path aliases (see Prepare)
โโโ mono.config.ts
โโโ package.json
โโโ .env.dev
โโโ .envEverything mono generates lives under one gitignored .mono/ folder. You never edit it by hand.
mono.config.ts โ
Lists the apps to sync. On a Remote, list your Host here:
ts
import { defineConfig, JWTCompleteTokenTypes } from "mono-utils/runtime";
export default defineConfig({
name: 'mono-remote',
apps: [
{
name: 'mono-host',
url: 'https://github.com/mono-lit/templates/tree/main/vue-host',
envToken: 'MONO_TOKEN'
}
]
});The url carries the ref directly, GitHub-style:
โฆ/mono-vue-hostโ themainbranchโฆ/mono-vue-host/tree/v4.0.7โ a tagโฆ/mono-vue-host/tree/feat/layout-programโ a branch (slashes are fine)โฆ/mono-vue-host/tree/deac44a955ac63981e6bae705f5df3f2d61dcf0fโ a commit SHA
.env and .env.dev โ
envToken names a GitHub token kept in .env or .env.dev:
MONO_TOKEN=YOUR_GITHUB_TOKENIt is optional โ if everyone who syncs the app has been invited to its repo, mono sync uses your own git credentials and never needs a token.
package.json โ
The sync script:
json
{
"scripts": {
"mono:sync": "mono sync && mono prepare",
"mono:prepare": "mono prepare",
"postinstall": "mono sync && mono prepare"
}
}Run Sync โ
pnpm mono:syncEach app in mono.config.ts is downloaded into .mono/apps/. mono prepare then regenerates .mono/tsconfig.json, so the new app's @<name> alias is available to TypeScript right away.