code-sync-cli
v0.1.30
Published
CLI to synchronize code across multiple repositories
Downloads
48
Readme
I understand the issue. Let's try this again with the correct markdown formatting for your README.md
file. You should be able to copy and paste this directly into a Markdown file:
# Code Sync CLI
Code Sync CLI is a command-line tool designed to synchronize shared code across multiple Git repositories. It streamlines the process of managing common code in various client projects, reducing the manual effort of copying and pasting code.
## Features
- **Central Repository Sync**: Synchronize code from a central Git repository to multiple client repositories.
- **Flexible Configuration**: Define specific files and folders to sync, with support for different paths in different codebases.
- **Version Control**: Sync specific versions of shared code, including support for tags, branches, and commits.
- **Conflict Handling**: Detect and handle conflicts between the central repository and client repositories.
- **Command-Line Interface**: Easy-to-use CLI for initiating and managing synchronization.
## Installation
Install the package globally using npm:
```bash
npm install -g code-sync-cli
```
## Usage
1. **Create a configuration file** (e.g., `my-config.json`) in your project root with the necessary configuration.
2. **Run the sync command with the config file**:
```
code-sync sync --config my-config.json
```
This will synchronize the files as per the configuration in the specified file. If no file is specified, `sync-config.json` will be used by default.
## Configuration
The `sync-config.json` file should follow this structure:
```json
{
"centralRepo": {
"url": "[email protected]:central-repo.git",
"auth": {
"method": "ssh",
"key": "/path/to/ssh/key"
},
"branch": "master"
},
"syncItems": [
{
"sourcePath": "path/in/central/repo/utility1",
"destinationPath": "path/in/client/repo/utility1",
"version": "latest"
},
{
"sourcePath": "path/in/central/repo/config",
"destinationPath": "different/path/in/another/client/repo/config",
"version": "specific-commit-or-tag"
}
// More items as needed...
],
"options": {
"overwrite": true,
"conflictResolution": "prompt",
"defaultVersion": "global-commit-or-tag"
}
}
```
## Sample Configuration
To create a sample configuration file, run:
```
code-sync create-sample-config
```
This will generate a `sync-config.json` file in your current directory, which you can modify according to your requirements.
### Usage
Now users can easily generate a sample configuration file by running:
```bash
code-sync create-sample-config
```
This command makes it easier for new users to get started by providing them with a template that they can edit to match their specific synchronization needs.
## Contributing
Contributions are welcome! Feel free to submit pull requests or create issues for bugs and feature requests.
## License
This project is licensed under the [MIT License](LICENSE).