Skip to content

Sync โ€‹

Since the Host and Remote live in separate repositories, there is a small helper library called mono-utils that handles syncing between them.

The templates Mono Host and Mono Remote already ship with mono-utils installed.

Sync flows both ways through GitHub โ€” a Remote pulls in shell updates from the Host, and the Host pulls in each Remote's new modules:

Setup Sync โ€‹

Both Mono Host and Mono Remote use these files to handle the syncing process:

mono-vue-remote/
โ”œโ”€โ”€ .apps/
โ”œโ”€โ”€ mono.config.ts
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ .env.dev
โ””โ”€โ”€ .env

mono.config.ts โ€‹

Points to the apps you want to sync. If you're 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/EJI-ICT/mono-vue-host',
        envToken: 'MONO_TOKEN'
      }
    ]
});

The url carries the ref (branch / tag / commit) directly, GitHub-style:

  • https://github.com/EJI-ICT/mono-vue-host โ€” defaults to the main branch
  • https://github.com/EJI-ICT/mono-vue-host/tree/v4.0.7 โ€” a tag
  • https://github.com/EJI-ICT/mono-vue-host/tree/feat/layout-program โ€” a branch (slashes are fine)
  • https://github.com/EJI-ICT/mono-vue-host/tree/deac44a955ac63981e6bae705f5df3f2d61dcf0f โ€” a commit SHA

.env and .env.dev โ€‹

The envToken above (MONO_TOKEN) lives in .env or .env.dev โ€” just a normal GitHub token.

MONO_TOKEN=YOUR_GITHUB_TOKEN

package.json โ€‹

The sync script:

json
{
  "name": "mono-vue",
  "private": true,
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "mono:sync": "mono sync",
    ...
  },
  "dependencies": {
    ...
  },
  "devDependencies": {
    ...
  }
}

Run Sync โ€‹

Then run:

pnpm mono:sync

It will download each app listed in mono.config.ts using the GitHub token from .env.dev or .env, and place them into your .apps/ folder.