Giter Site home page Giter Site logo

checksync's Introduction

checksync

Dependabot Status Node CI codecov npm (tag) Required Node Version

Installation

Install using your preferred package manager.

yarn add --dev checksync
npm install --save-dev checksync

After installation, try running checksync with the --help argument to see more information:

yarn checksync --help
npx checksync --help

Usage

For detailed usage information, run yarn checksync --help.

Example workflow

  1. Add synchronization tags to files indicating what sections to synchronize and with which files:

    // my-javascriptfile.js
    // sync-start:mysyncid ./my-pythonfile.py
    /**
     * Some code that needs to be synchronised.
     */
    // sync-end:mysyncid
    # 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.

    // 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
  2. Run checksync to verify the tags are correct:

    yarn checksync <globs|files|dirs>
  3. Run with --update-tags or -u to automatically insert the missing checksums:

    yarn checksync -u <globs|files|dirs>
  4. 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.

  5. 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.

Comment styles

By default, checksync supports comment lines that begin with // and # as commonly found in JavaScript, Python, and other languages. You can override this default using the --comments or -c argument.

yarn checksync -c="//,#,'" <globs|files|dirs>

Ignoring files

checksync supports both a comma-separated list of globs (via --ignore) and a comma-separated list of .gitignore style files (via --ignore-files) to control what files are ignored. By default, the .gitignore file is used unless the --no-ignore-file argument is used.

Contributing

For details on contributing to checksync, checkout our contribution guidelines.

checksync's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar jeremywiebe avatar somewhatabstract avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.