gulp-archieml
Advanced tools
Comparing version
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 | ||
 [](https://github.com/DallasMorningNews/gulp-archieml) [](https://github.com/DallasMorningNews/gulp-archieml/blob/master/LICENSE) | ||
[](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
39.23%5
25%49
6.52%4
33.33%10
150%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated