1.2.6 • Published 2 years ago

flatten-ignorefiles v1.2.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

JSR JSR

flatten-ignorefiles

A CLI utility to recursively discover ignore files, and flatten them into a single file.

Installation

Deno

deno install -g --allow-read --allow-write jsr:@bcheidemann/flatten-ignorefiles -n flatten-ignorefiles

NPM

npm install -g flatten-ignorefiles

Usage

$ flatten-ignorefiles --help
Usage: flatten-ignorefiles [options]

Options:
  -h, --help               Print command line options and usage.
  -d, --dir                The base directory to search for ignore files.
                           (default: ".")
  -g, --glob               The glob pattern used to search for ignore
                           files.
                           (default: "**/.gitignore")
  -e, --exclude-glob       Exclude ignore files matching the provied
                           pattern.
                           (default: "**/node_modules")
  -o, --out                The output file path for the flattened ignore
                           file. If not provided, the flattened file will
                           be logged to stdout. Relative to --dir.
                           (optional)
  -r, --remove             Remove the discovered ignore files.
                           (default: false)
  --skip-source-comments   If omitted, comments will be added indicating
                           the source file for each section of the
                           flattened output file.
                           (default: false)
  --strip-whitespace       Removes the whitespace from source files.
                           (default: false)
  --strip-comments         Removes the comments from source files.
                           (default: false)

Use Case: Flatten and remove recursive .gitignore files

The following command will flatten all recursive .gitignore files into a single root file, deleting the other files.

$ flatten-ignorefiles --out .gitignore --remove

Use Case: Convert recursive .gitignore files into a non-recursive .dockerignore file

The following command will flatten all recursive .gitignore files into a single root .dockerignore file, preserving the .gitignore files.

$ flatten-ignorefiles --out .dockerignore --remove

Programatic Usage

import { discoverIgnoreFiles, flattenIgnoreFiles } from "jsr:@bcheidemann/flatten-ignorefiles";

const files = discoverIgnoreFiles({
  // Options
});

const content = flattenIgnoreFiles(files, {
  // Options
});

console.log(content);
1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago