1.0.2 • Published 2 years ago

merge-json-configs v1.0.2

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

merge-json-configs

Library and CLI for merging multiple JSON configuration files together.

Features

  • Strips comments out from JSONC documents like tsconfig.json
  • Deep merging includes arrays and nested objects
  • Supports an unlimited number of files to merge with the last file gaining precedence in overrides.

Usage

Run on the command line:

yarn dlx merge-json-configs file1.json file2.json

Or, install it as a library:

yarn add merge-json-configs

The mergeJsonConfigs() and readJsonFile() functions are exported from the default module:

import { mergeJsonConfigs } from 'merge-json-configs'

mergeJsonConfigs('file1.json', 'file2.json')

You can also mimic the CLI's functionality by importing runCLI() from the cli module:

import { runCLI } from 'merge-json-configs/cli'

runCLI(['file1.json', 'file2.json'])

Development

This project uses Yarn Zero-Installs, so you shouldn't need to install any dependencies. Running yarn run will show you all of the commands that you have access to while developing on the project.

When you commit code, various lint tools are run on the changed files that you are committing, like eslint, prettier, and commitlint. We use conventional commits so that features and fixes will be automatically surfaced in the changelog.

New versions are published automatically from main and the other release branches.

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago