Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/somewhatabstract/checksync
A tool for detecting when related text blocks change
https://github.com/somewhatabstract/checksync
code-quality developer-tools development-utils development-workflow linting synchronization tool tools tools-engineering
Last synced: about 1 month ago
JSON representation
A tool for detecting when related text blocks change
- Host: GitHub
- URL: https://github.com/somewhatabstract/checksync
- Owner: somewhatabstract
- License: mit
- Created: 2019-08-22T20:37:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-11T15:33:53.000Z (about 1 month ago)
- Last Synced: 2024-12-13T04:10:32.983Z (about 1 month ago)
- Topics: code-quality, developer-tools, development-utils, development-workflow, linting, synchronization, tool, tools, tools-engineering
- Language: TypeScript
- Homepage:
- Size: 6.15 MB
- Stars: 17
- Watchers: 6
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# checksync
[![Node CI](https://github.com/somewhatabstract/checksync/workflows/Node%20CI/badge.svg)](https://github.com/somewhatabstract/checksync/actions) [![codecov](https://codecov.io/gh/somewhatabstract/checksync/branch/main/graph/badge.svg)](https://codecov.io/gh/somewhatabstract/checksync) [![npm (tag)](https://img.shields.io/npm/v/checksync/latest)](https://www.npmjs.com/package/checksync) [![Required Node Version](https://img.shields.io/node/v/checksync/latest)](https://www.npmjs.com/package/checksync)
## Usage
You can install `checksync` if you want, but the easiest way to use it is via `npx`.
```shell
npx checksync --help
```For detailed usage information, run `npx checksync --help`.
### Example workflow
1. Add synchronization tags to files indicating what sections to synchronize and with which files:
```javascript
// my-javascriptfile.js
// sync-start:mysyncid ./my-pythonfile.py
/**
* Some code that needs to be synchronised.
*/
// sync-end:mysyncid
``````python
# my-pythonfile.py
# sync-start:mysyncid ./my-javascriptfile.js
'''
Some code that needs to be synchronised.
'''
# sync-end:mysyncid
```Use consecutive `sync-start` tags with the same identifier to target multiple files.
```c#
// my-csharpfile.cs
// sync-start:mysyncid ./my-pythonfile.py
// sync-start:mysyncid ./my-javascriptfile.js
/**
* Some code that needs to be synchronised.
*/
// sync-end:mysyncid
```1. Run `checksync` to verify the tags are correct:
```shell
yarn checksync
```1. Run with `--update-tags` or `-u` to automatically insert the missing checksums:
```shell
yarn checksync -u
```1. Add a pre-commit step to run `checksync` on commiting changes so that you catch when synchronized blocks change.
You can do this using a package like husky, or pre-commit.1. Commit your tagged files!
To get more information about the various arguments that `checksync` supports as well as information about sync-tags, run `yarn checksync --help`.
### Target file paths
All target paths are relative to your project root directory. By default, this is determined, using `ancesdir` to be the ancestor directory of the files being processed that contains `package.json`. If you want to specify a different root (for example, if you're syncing across multiple packages in a monorepo) you can specify a custom marker name using the `--root-marker` argument.
## Contributing
For details on contributing to `checksync`, checkout our [contribution guidelines](CONTRIBUTING.md).