Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

merge-yaml-cli

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-yaml-cli - npm Package Compare versions

Comparing version 1.0.5 to 1.1.0

cli.js

4

CHANGELOG.md

@@ -6,2 +6,6 @@ # Change Log

## [1.1.0] - 2017-05-29
- Update dependencies
- Add a Node.js API to require the module, give it an array of globs and return a YAML string
## [1.0.5] - 2016-12-03

@@ -8,0 +12,0 @@ - Update dependencies

37

index.js

@@ -1,35 +0,18 @@

#!/usr/bin/env node
const fs = require('fs')
const os = require('os')
const glob = require('glob')
const mergeYaml = require('merge-yaml')
const jsYaml = require('js-yaml')
const EventEmitter = require('events')
const args = require('yargs')
.usage('Usage: $0 <options>')
.example('$0 -i one.yml two/*.yml -o out.yml')
.array('i')
.alias('i', 'inputs')
.describe('i', 'Input files specified as glob file patterns')
.demand('i')
.string('o')
.alias('o', 'output')
.describe('o', 'Output file')
.demand('o')
.strict()
.argv
class YamlMerger extends EventEmitter {
merge (sources) {
const files = [].concat.apply([], sources.map(g => glob.sync(g, {nodir: true})))
const files = [].concat.apply([], args.inputs.map(g => glob.sync(g, {nodir: true})))
this.emit('files', files)
console.log('Merging files:')
console.log(files.join(os.EOL), os.EOL)
const mergeResult = mergeYaml(files)
const mergeResult = mergeYaml(files)
return jsYaml.safeDump(mergeResult)
}
};
console.log('Writing:')
console.log(args.output)
fs.writeFileSync(args.output, jsYaml.safeDump(mergeResult))
console.log(os.EOL)
console.log('Finished merge!')
module.exports = new YamlMerger()
{
"name": "merge-yaml-cli",
"version": "1.0.5",
"version": "1.1.0",
"description": "CLI utility for merging YAML files",
"main": "index.js",
"bin": {
"merge-yaml": "./index.js"
"merge-yaml": "./cli.js"
},

@@ -31,7 +32,7 @@ "keywords": [

"merge-yaml": "^1.0.0",
"yargs": "^6.5.0"
"yargs": "^8.0.1"
},
"devDependencies": {
"standard": "^8.6.0"
"standard": "^10.0.0"
}
}
# merge-yaml-cli
[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
[![Known Vulnerabilities](https://snyk.io/test/github/brainsiq/merge-yaml-cli/ac54a80e5f7f1648aecc380c7aea470f49f1ccef/badge.svg)](https://snyk.io/test/github/brainsiq/merge-yaml-cli/ac54a80e5f7f1648aecc380c7aea470f49f1ccef) [![Standard - JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](http://standardjs.com/)
[![CircleCI](https://circleci.com/gh/brainsiq/merge-yaml-cli/tree/master.svg?style=shield&circle-token=077fdc5153f1faebffa5e687a44369759c6a820d)](https://circleci.com/gh/brainsiq/merge-yaml-cli/tree/master)
[![CircleCI](https://circleci.com/gh/brainsiq/merge-yaml-cli/tree/master.svg?style=svg&circle-token=077fdc5153f1faebffa5e687a44369759c6a820d)](https://circleci.com/gh/brainsiq/merge-yaml-cli/tree/master) [![Known Vulnerabilities](https://snyk.io/test/github/brainsiq/merge-yaml-cli/ac54a80e5f7f1648aecc380c7aea470f49f1ccef/badge.svg)](https://snyk.io/test/github/brainsiq/merge-yaml-cli/ac54a80e5f7f1648aecc380c7aea470f49f1ccef)
[![NPM](https://nodei.co/npm/merge-yaml-cli.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/merge-yaml-cli/)

@@ -16,2 +17,12 @@ A simple CLI wrapper around [merge-yaml](https://www.npmjs.com/package/merge-yaml) using [glob](https://www.npmjs.com/package/glob) patterns to specify input files.

#### Node.js API
```
const mergeYaml = require('merge-yaml-cli')
mergeYaml.on('files', console.log('Files found: ', files))
const result = mergeYaml.merge(['example.yml', 'includes/*.yml'])
```
#### Tests

@@ -18,0 +29,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc