https://github.com/xarunoba/ccoco
🥥 — Change configurations on checkout
https://github.com/xarunoba/ccoco
ccoco cli config-changer developer-experience git nodejs post-checkout
Last synced: 4 months ago
JSON representation
🥥 — Change configurations on checkout
- Host: GitHub
- URL: https://github.com/xarunoba/ccoco
- Owner: xarunoba
- License: mit
- Created: 2024-05-20T15:39:55.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-04T05:16:41.000Z (6 months ago)
- Last Synced: 2025-12-06T16:50:16.967Z (6 months ago)
- Topics: ccoco, cli, config-changer, developer-experience, git, nodejs, post-checkout
- Language: Go
- Homepage: https://pkg.go.dev/github.com/xarunoba/ccoco
- Size: 253 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: .github/README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# @xarunoba/ccoco 🥥
 [](https://github.com/xarunoba/ccoco?tab=MIT-1-ov-file#readme)
[](https://www.npmjs.com/package/@xarunoba/ccoco?activeTab=readme)
**`ccoco`** — change config on checkout
Change your configurations on checkout for easy config environment change. Integrate with git hooks.
> [!WARNING]
> **`ccoco` is currently in experimental mode. Every release might have breaking changes before `v1.0.0`. Make sure to specify the version you'd like to use.**
## Why
My team didn't want to populate the `package.json` too much with scripts so I created a tool that can easily replace the main config files whenever a branch changed.
`ccoco` initially started as a tool specifically used for the Node.js ecosystem but has been rewritten to Go for platform independence. You can use `ccoco` for any kinds of projects as long as it is within a Git repository.
## Installation
### Download Binary
Download from the Release page, add it to your PATH, and then initialize `ccoco` in your project directory.
### Go Install
```bash
go install github.com/xarunoba/ccoco@latest
```
### npm/pnpm/yarn
You can install `ccoco` from the `npmjs` repository.
```bash
npm install -D @xarunoba/ccoco
pnpm add -D @xarunoba/ccoco
yarn add -D @xarunoba/ccoco
npx ccoco
pnpm ccoco
yarn ccoco
```
There's also an extra alias for `ccoco` for `npm/pnpm/yarn` where instead of `npx ccoco` you can simply do `npx cc`.
### .gitignore
Please add `.ccoco` in your `.gitignore` file.
## Usage
Initialize `ccoco`
```bash
ccoco init
# or use alias: ccoco i
```
Add file/s to `ccoco.config.json`
```bash
ccoco add file1 file2 ...
# ccoco add myconfiguration.yml another.json
# or use alias: ccoco a
```
Remove file/s from `ccoco.config.json`
```bash
ccoco remove file1 file2 ...
# ccoco remove myconfiguration.yml another.json
# or use alias: ccoco rm
```
Generate per-branch config files based on your current repository's list of branches and the files mentioned in `ccoco.config.json`
```bash
ccoco generate
# or use alias: ccoco gen
```
Inject `ccoco` in your `post-checkout` git hook.
```bash
ccoco githook
# or use alias: ccoco gh
```
Manually run ccoco when not using the git hook injection OR when you want to integrate it with a git hook manager.
```bash
ccoco run
# or use alias: ccoco r
# or use alias: ccoco start
```
### Using sub-branches
`ccoco` will recursively check if a sub-branch has a config file until it reaches the "root" of the sub-branch.
#### Example
1. Branch `nested/one/two` does not have a config file created.
2. `ccoco` will recursively check for the config file existing in `nested/one` up until the root `nested` and will fail if it cannot find one.
## Configuring `ccoco`
`ccoco` can be configured via `ccoco.config.json`
```json
{
"files": [".env"] // the file that will be generated by ccoco generate
}
```
### Preflights
You can set your preflight scripts in the `.ccoco/preflights` directory. These scripts will execute before `ccoco`.
> This will only run when you have injected `ccoco` via the `ccoco githook` command.