grunt-yaml
Advanced tools
Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "grunt-yaml", | ||
"description": "Compiles YAML to JSON.", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"homepage": "https://github.com/shiwano/grunt-yaml", | ||
@@ -45,5 +45,4 @@ "author": { | ||
"js-yaml": "~3.0.1", | ||
"async": "~0.2.9", | ||
"lodash": "~2.4.1" | ||
} | ||
} |
@@ -99,3 +99,3 @@ # grunt-yaml [![Build Status](https://secure.travis-ci.org/shiwano/grunt-yaml.png?branch=master)](http://travis-ci.org/shiwano/grunt-yaml) | ||
A Object that defines custom types to [js-yaml](https://github.com/nodeca/js-yaml). A Object key is a `tag` and `loadKind` pair which is separated with space (e.g. '!include scalar' or '!max sequence', '!extend mapping'). A Object value is a wrapper of loadResolver function which take `value` and `yamlLoader` arguments. | ||
A Object that defines custom types to [js-yaml](https://github.com/nodeca/js-yaml). A Object key is a `tag` and `loadKind` pair which is separated with a white space (e.g. `!include scalar` or `!max sequence`, `!extend mapping`). A Object value is a wrapper of loadResolver function which take `value` and `yamlLoader` arguments. | ||
@@ -124,2 +124,3 @@ See also js-yaml [document](https://github.com/nodeca/js-yaml/wiki/Custom-types). | ||
## Release History | ||
* 2014-01-18 v0.3.1 Use grunt.warn on js-yaml error. | ||
* 2014-01-17 v0.3.0 Introduce `customTypes` option for js-yaml v0.3.X. (Remove `constructors` option) | ||
@@ -126,0 +127,0 @@ * 2014-01-17 v0.2.2 Add src and dest path to middleware. |
@@ -13,3 +13,2 @@ /* | ||
yaml = require('js-yaml'), | ||
async = require('async'), | ||
_ = require('lodash'); | ||
@@ -21,3 +20,8 @@ | ||
function loadYaml(data) { | ||
return yaml.safeLoad(data, { schema: yamlSchema }); | ||
try { | ||
return yaml.safeLoad(data, { schema: yamlSchema }); | ||
} catch (e) { | ||
grunt.warn(e); | ||
return null; | ||
} | ||
} | ||
@@ -35,2 +39,3 @@ | ||
var result = resolver.call(this, state.result, loadYaml); | ||
if (_.isUndefined(result) || _.isFunction(result)) { | ||
@@ -64,15 +69,9 @@ return false; | ||
filePair.src.forEach(function(src) { | ||
if (grunt.file.isDir(src) || (options.ignored && path.basename(src).match(options.ignored))) | ||
if (grunt.file.isDir(src) || (options.ignored && path.basename(src).match(options.ignored))) { | ||
return; | ||
} | ||
var dest = filePair.dest.replace(/\.ya?ml$/, '.json'); | ||
var data = grunt.file.read(src); | ||
try { | ||
var result = loadYaml(data); | ||
} catch (e) { | ||
grunt.log.error(e); | ||
return false; | ||
} | ||
var result = loadYaml(data); | ||
var json = JSON.stringify(result, null, options.space); | ||
@@ -79,0 +78,0 @@ |
Sorry, the diff of this file is not supported yet
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
3
135
16803
- Removedasync@~0.2.9
- Removedasync@0.2.10(transitive)