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.

Setup Sync โ€‹

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

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

mono.apps.json โ€‹

Points to the apps you want to sync. If you're on a Remote, list your Host here:

json
[
  {
    "name": "mono-host",
    "url": "https://github.com/EJI-ICT/mono-host.git",
    "branch": "main",
    "path": ".apps",
    "envToken": "MONO_TOKEN"
  }
]

.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": "dotenv -e .env.dev -- node ./node_modules/mono-utils/dist/mono-clone.mjs",
    ...
  },
  "dependencies": {
    ...
  },
  "devDependencies": {
    ...
  }
}

Run Sync โ€‹

Then run:

pnpm mono:sync

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