yaml-front-matter
Advanced tools
Comparing version 4.0.0-0 to 4.0.0-1
#!/usr/bin/env node | ||
var program = require('commander') | ||
, jsYaml = require('../'); | ||
, yamlFront = require('../') | ||
, package = require('../package.json'); | ||
program | ||
.version('1.0.1') | ||
.usage('[options] <file>') | ||
.version(package.version, '-v, --version') | ||
.usage('[options] <string>') | ||
.option('-c, --content [name]', 'set the property name for the files contents [__content]') | ||
.parse(process.argv); | ||
.on('--help', function() { | ||
console.log(''); | ||
console.log(' Examples') | ||
console.log(''); | ||
console.log(' Basic'); | ||
console.log(' yaml-front-matter <yaml-front-matter>'); | ||
console.log(''); | ||
console.log(' Piping content from an input file to an output file') | ||
console.log(' cat ./some/file.txt | yaml-front-matter > output.txt'); | ||
}); | ||
program.parse(process.argv); | ||
if (program.args.length > 0) { | ||
if (program.content) { | ||
console.log(jsYaml.loadFront(program.args[0], { contentKeyName: program.content })); | ||
} else { | ||
console.log(jsYaml.loadFront(program.args[0])); | ||
} | ||
processData(program.args[0]); | ||
} else { | ||
var data = ''; | ||
process.stdin.on('readable', function () { | ||
var chunk; | ||
while (chunk = process.stdin.read()) { | ||
data += chunk; | ||
} | ||
}); | ||
process.stdin.on('end', function () { | ||
// There will be a trailing \n from the user hitting enter. Get rid of it. | ||
// data = data.replace("\r\n", '\n'); | ||
processData(data); | ||
}); | ||
} | ||
function processData(data) { | ||
process.stdout.write(JSON.stringify(yamlFront.loadFront(data, | ||
{ contentKeyName: program.content || '__content' }), undefined, 2)); | ||
} |
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="4.0.0-1"></a> | ||
# [4.0.0-1](https://github.com/dworthen/js-yaml-front-matter/compare/v4.0.0-0...v4.0.0-1) (2018-02-27) | ||
### Bug Fixes | ||
* **cli:** Update cli to support latest version ([1f0bd9e](https://github.com/dworthen/js-yaml-front-matter/commit/1f0bd9e)) | ||
<a name="4.0.0-0"></a> | ||
@@ -7,0 +17,0 @@ # [4.0.0-0](https://github.com/dworthen/js-yaml-front-matter/compare/v3.4.0...v4.0.0-0) (2018-02-27) |
@@ -8,3 +8,3 @@ { | ||
"module": "src/index.js", | ||
"version": "4.0.0-0", | ||
"version": "4.0.0-1", | ||
"keywords": [ | ||
@@ -26,2 +26,3 @@ "yaml" | ||
"browser-sync": "^2.11.1", | ||
"commander": "^2.14.1", | ||
"gulp": "^3.9.0", | ||
@@ -28,0 +29,0 @@ "gulp-concat": "^2.6.0", |
@@ -67,3 +67,3 @@ # Yaml Front Matter | ||
```shell | ||
$ npm install yaml-front-matter | ||
$ npm install yaml-front-matter@next | ||
``` | ||
@@ -70,0 +70,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
208141
4719
3
16