0.0.7 • Published 5 years ago
zync v0.0.7
Zync
Zync keeps shared code in sync with multiple projects in a monorepo.
Why?
Sharing source between projects can be a pain in the *\$\$. Zync simply copied the files to multiple projects within a repo so that it can be built with the configuration of each individual project.
Quick start
Zync is opinionated to make its use simple. ALL files in the source directory are kept in sync.
- Create a directory that contains the shared files.
- Create the destination directories
- Create a config file at the root of the repo
- Run
zyncanywhere within the repo - Use
zync check [project name]as a pre-build check to ensure all files are in sync.
Things to know
- Always edit the source files and never the files copied.
- Copied files will be overwritten by by running the
zynccommand. zyncwill watch files for changes. UseCTRL + Cto exit.- Run
zync checkto ensure there are no extra files in either source or destination.
Config file
baseSourcePathandbaseDestinationPathare relative to the location ofzync.config.jsonwhich should be at the root of the repo.sourceanddestinationare relative to their respectivebase*Path.
{
"baseSourcePath": "packages",
"projects": [
{
"name": "app",
"baseDestinationPath": "app/shared-readonly",
"paths": [
{
"source": "constants",
"destination": "constants"
},
...
]
},
{
"name": "hosting",
"baseDestinationPath": "server/shared-readonly",
"paths": [
{
"source": "constants",
"destination": "constants"
},
...
]
},
...
]
}Example
Before zync
.
└── monoreporoot
├── app
│ ├── shared-readonly
│ │ └── constants (*placeholder to sync)
│ └── src
│ └── index.ts
├── packages
│ └── constants
│ └── constants.ts
├── server
│ ├── shared-readonly
│ │ └── constants (*placeholder to sync)
│ └── src
│ └── index.ts
└── zync.config.jsonAfter zync (Files copied marked by *)
.
└── monoreporoot
├── app
│ ├── shared-readonly
│ │ └── constants
│ │ └── constants.ts *
│ └── src
│ └── index.ts
├── packages
│ └── constants
│ └── constants.ts
├── server
│ ├── shared-readonly
│ │ └── constants
│ │ └── constants.ts *
│ └── src
│ └── index.ts
└── zync.config.json