gulp-archieml
Advanced tools
Comparing version 1.0.0 to 1.1.0
50
index.js
@@ -1,30 +0,30 @@ | ||
'use strict'; | ||
const archieml = require('archieml'); | ||
const PluginError = require('plugin-error'); | ||
const replaceExt = require('replace-ext'); | ||
const through = require('through2'); | ||
var gutil = require('gulp-util'), | ||
through = require('through2'), | ||
archieml = require('archieml'); | ||
module.exports = function () { | ||
return through.obj(function(file, enc, cb) { | ||
if (file.isNull()) { | ||
cb(null, file); | ||
return; | ||
} | ||
module.exports = () => through.obj(function archieToJson(file, enc, cb) { | ||
if (file.isNull()) { | ||
cb(null, file); | ||
return; | ||
} | ||
if (file.isStream()) { | ||
cb(new gutil.PluginError('gulp-archieml', 'Streaming not supported')); | ||
return; | ||
} | ||
if (file.isStream()) { | ||
cb(new PluginError('gulp-archieml', 'Streaming not supported')); | ||
return; | ||
} | ||
try { | ||
var parsed = archieml.load(file.contents.toString()); | ||
file.contents = new Buffer(JSON.stringify(parsed)); | ||
file.path = gutil.replaceExtension(file.path, '.json'); | ||
this.push(file); | ||
} catch (err) { | ||
this.emit('error', new gutil.PluginError('gulp-archieml', err)); | ||
} | ||
try { | ||
const parsed = archieml.load(file.contents.toString()); | ||
const jsonFile = Object.assign(file, { | ||
contents: Buffer.from(JSON.stringify(parsed)), | ||
path: replaceExt(file.path, '.json'), | ||
}); | ||
this.push(jsonFile); | ||
} catch (err) { | ||
this.emit('error', new PluginError('gulp-archieml', err)); | ||
} | ||
cb(); | ||
}); | ||
}; | ||
cb(); | ||
}); |
{ | ||
"name": "gulp-archieml", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A Gulp plugin for parsing ArchieML files.", | ||
@@ -12,6 +12,7 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=6.4.0" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/jshint/bin/jshint index.js && ./node_modules/mocha/bin/mocha test" | ||
"lint": "eslint index.js", | ||
"test": "istanbul cover _mocha test && istanbul report html" | ||
}, | ||
@@ -25,12 +26,19 @@ "files": [ | ||
"dependencies": { | ||
"archieml": "^0.3.1", | ||
"gulp-util": "^3.0.1", | ||
"archieml": "^0.4.2", | ||
"plugin-error": "^1.0.1", | ||
"replace-ext": "^1.0.0", | ||
"through2": "^0.6.3" | ||
}, | ||
"devDependencies": { | ||
"assert": "^1.3.0", | ||
"jshint": "^2.9.1", | ||
"mocha": "^2.4.5", | ||
"assert": "^1.4.1", | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb": "^17.0.0", | ||
"eslint-plugin-import": "^2.13.0", | ||
"eslint-plugin-jsx-a11y": "^6.1.1", | ||
"eslint-plugin-react": "^7.10.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^5.2.0", | ||
"mocha-junit-reporter": "^1.17.0", | ||
"vinyl-fs": "^2.4.2" | ||
} | ||
} |
# gulp-archieml | ||
![CircleCI](https://img.shields.io/circleci/project/github/DallasMorningNews/gulp-archieml.svg) [![npm](https://img.shields.io/npm/v/gulp-archieml.svg)](https://github.com/DallasMorningNews/gulp-archieml) [![GitHub license](https://img.shields.io/github/license/DallasMorningNews/gulp-archieml.svg)](https://github.com/DallasMorningNews/gulp-archieml/blob/master/LICENSE) | ||
[![Circle CI](https://circleci.com/gh/DallasMorningNews/gulp-archieml.svg?style=svg)](https://circleci.com/gh/DallasMorningNews/gulp-archieml) | ||
A Gulp plugin for parsing Archie Markup Language (ArchieML) files into JSON using [archieml-js](https://github.com/newsdev/archieml-js). | ||
@@ -24,10 +23,8 @@ | ||
```js | ||
var gulp = require('gulp'), | ||
archieml = require('gulp-archieml'); | ||
const gulp = require('gulp'); | ||
const archieml = require('gulp-archieml'); | ||
gulp.task('test', function() { | ||
return gulp.src('./path/to/*.aml') | ||
.pipe(archieml()) | ||
.pipe(gulp.dest('./path/to/json/output/')); | ||
}); | ||
gulp.task('test', () => gulp.src('./path/to/*.aml') | ||
.pipe(archieml()) | ||
.pipe(gulp.dest('./path/to/json/output/'))); | ||
``` | ||
@@ -43,5 +40,11 @@ | ||
Coverage is calculated using Istanbul and output to the _coverage_ folder: | ||
``` | ||
$ open coverage/index.html | ||
``` | ||
## License | ||
MIT ©2016 [The Dallas Morning News](https://github.com/DallasMorningNews) |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
5157
5
49
4
10
2
+ Addedplugin-error@^1.0.1
+ Addedreplace-ext@^1.0.0
+ Addedansi-colors@1.1.0(transitive)
+ Addedarchieml@0.4.2(transitive)
+ Addedarr-diff@4.0.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedextend-shallow@3.0.2(transitive)
+ Addedis-extendable@1.0.1(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedisobject@3.0.1(transitive)
+ Addedplugin-error@1.0.1(transitive)
+ Addedreplace-ext@1.0.1(transitive)
- Removedgulp-util@^3.0.1
- Removedansi-gray@0.1.1(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedarchieml@0.3.1(transitive)
- Removedarray-differ@1.0.0(transitive)
- Removedarray-uniq@1.0.3(transitive)
- Removedbeeper@1.1.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedclone@1.0.4(transitive)
- Removedclone-stats@0.0.1(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removeddateformat@2.2.0(transitive)
- Removedduplexer2@0.0.2(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfancy-log@1.3.3(transitive)
- Removedglogg@1.0.2(transitive)
- Removedgulp-util@3.0.8(transitive)
- Removedgulplog@1.0.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-gulplog@0.1.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedlodash._basecopy@3.0.1(transitive)
- Removedlodash._basetostring@3.0.1(transitive)
- Removedlodash._basevalues@3.0.0(transitive)
- Removedlodash._getnative@3.9.1(transitive)
- Removedlodash._isiterateecall@3.0.9(transitive)
- Removedlodash._reescape@3.0.0(transitive)
- Removedlodash._reevaluate@3.0.0(transitive)
- Removedlodash._reinterpolate@3.0.0(transitive)
- Removedlodash._root@3.0.1(transitive)
- Removedlodash.escape@3.2.0(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.keys@3.1.2(transitive)
- Removedlodash.restparam@3.6.1(transitive)
- Removedlodash.template@3.6.2(transitive)
- Removedlodash.templatesettings@3.1.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmultipipe@0.1.2(transitive)
- Removedobject-assign@3.0.0(transitive)
- Removedparse-node-version@1.0.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@1.1.142.3.8(transitive)
- Removedreplace-ext@0.0.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsparkles@1.0.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedtime-stamp@1.1.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedvinyl@0.5.3(transitive)
Updatedarchieml@^0.4.2