Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ignore-sync

foray101015.4kMIT8.0.0

a CLI tool to build and sync *ignore files across files and repositories

.dockerignore, .eslintignore, .gitignore, .npmignore, dockerignore, eslintignore, gitignore, ignore, npmignore

readme

ignore-sync

a cli tool to build and sync *ignore files across files and repositories

Why

  1. Github default .gitignore doesn't cover all our needs, we always need to compose and manage multiple .gitignore files from github, such as Node.gitignore + macOS.gitignore, in order to remove all the noises in our development. It should be automated.

  2. For library developer, we often need to compose a .npmignore from .gitignore and some extra ignore patterns that we do not wish to ignore by .gitignore, such as test files and .*rc files. If .gitignore is updated, you will need to update corresponding part of .npmignore manually. We should avoid this repetitive work.

a short example on how ignore-sync handle ignore files

[github/gitignore]
Node.gitignore
Global/macOS.gitignore

[inline]
*.test.js
yarn.lock

Installation and setup

  1. npm install --save-dev ignore-sync
  2. update package.json

    `diff json { "scripts": {

    • "ignore-sync": "ignore-sync ." } } `
  3. now follow how to use to create *ignore-sync files, then npm run ignore-sync, all corresponding ignore files will be generated.

Development Setup

We are using corepack to manage the yarn version

corepack enable

How to use

  1. ignore-sync works on any ignore file that name end with ignore, such as .gitignore, .npmignore, .eslintignore, etc. Simply creating a file that end with ignore-sync.

    example: .gitignore-sync -> .gitignore

  2. create a source tag in your *ignore-sync file to identify the source of ignore patterns

    [put_source_tag_here]

    different source tag identifies different source of ignore patterns

    • [inline]
      • the ignore patterns will be copied directly to generated ignore file
    • [local]
      • the content of these local files will be copied directly to generated ignore file
      • support glob pattern, e.g. packages/**/.gitignore
      • support referencing other ignore-sync files, e.g. referencing .gitignore-sync in .npmignore-sync
    • [relative]

      • the content of these local files will be copied with relative path prefix to generated ignore file
      • support glob pattern, e.g. packages/**/.gitignore
      • support referencing other ignore-sync files, e.g. referencing .gitignore-sync in .npmignore-sync
      • example

        # input: /packages/a/.prettierignore
        ignored.md
        # input: /.prettierignore-sync
        [relative]
        packages/a/.prettierignore
        # output: /.prettierignore
        packages/a/ignored.md
    • [$username/$repo#$ref]

      • the content of these github files will be downloaded and appended to generated ignore file
      • recommend using ignore patterns from [github/gitignore]
      • $ref is optional, default to the default branch
  3. npm run ignore-sync

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

8.0.0 (2024-12-20)

⚠ BREAKING CHANGES

  • require node ^18.12.0 || >=20.9.0

Bug Fixes

  • ensure postinstall always succeeds (ea27ed4)

7.0.1 (2023-05-17)

Bug Fixes

  • use default branch instead of master (993b749)

7.0.0 (2023-05-02)

⚠ BREAKING CHANGES

  • require node ^16.14.0 || >=18.12.0 (a09d957)
  • drop nodejs 14.17 and 18.11 (3db126f)

Bug Fixes

  • support repository with dot or hyphen (a731938)

6.0.2 (2022-10-08)

Bug Fixes

  • fix a breaking change introduced by axios v1.1.2 (ec435d2)

6.0.1 (2022-10-06)

Bug Fixes

  • fix a breaking change introduced by axios v1.1.0 (f4db4eb)

6.0.0 (2022-10-06)

⚠ BREAKING CHANGES

  • drop node.js v12 and v17 (238cdca)

Features

  • support referencing other ignore-sync files (00dd0ef)

5.0.1 (2022-04-07)

Bug Fixes

  • do not lock dependencies (5145557)

5.0.0 (2022-04-07)

⚠ BREAKING CHANGES

  • only support node ^12.22.0 || ^14.17.0 || >=16.13.0

Bug Fixes

  • deps: update dependency ramda to v0.28.0 (2791564)
  • ignore unnecessary files in release build (d59c987)

  • bump node version requirement (c311a06)

4.0.0 (2021-05-14)

⚠ BREAKING CHANGES

  • drop node 10

Bug Fixes

  • windows-paths: always use posix join on normalized line (#391) (ed9c552)

  • drop node 10 (2b5f11a)

3.1.0 (2021-02-05)

Features

  • support glob in local and relative source tag (2a4519a)

Bug Fixes

  • deps: update dependency axios to v0.21.1 (1ef8865)

3.0.1 (2020-11-16)

Bug Fixes

  • relative-tag: missing ** in pattern & generate invalid ignore pattern on Windows (#308) (7fd174e)

3.0.0 (2020-11-04)

⚠ BREAKING CHANGES

  • drop nodejs < 10.13

Features

  • append path to local files by [relative] (#301) (7e4a806)

2.0.1 (2019-06-11)

Bug Fixes

  • deps: update dependency axios to v0.19.0 (5b62722)
  • deps: update dependency fs-extra to v8 (#40) (8c9d309)

2.0.0 (2018-11-11)

Bug Fixes

  • do not trim space for ignore patterns and source tags (a631e78)
  • ensure only trailing line break is removed from generated files (d23b84b)

Features

  • accept paths as cli arguments & respect .gitignore in subdirectory (af80fc9)
  • support ? which match a single character in ignore file (6f02e1b)

BREAKING CHANGES

  • paths are required
  • source tags with space before opening tag will be ignored

1.2.0 (2018-04-19)

Features

  • use process.cwd() if no package.json is found (ef803f3)