gulp-yaml-include
Advanced tools
Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "gulp-yaml-include", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "A gulp plugin for yaml-include.", | ||
@@ -17,13 +17,14 @@ "main": "./src/index.js", | ||
"dependencies": { | ||
"js-yaml": "^3.4.2", | ||
"through2": "^2.0.0", | ||
"yaml-include": "^1.1.0" | ||
"js-yaml": "^3.7.0", | ||
"through2": "^2.0.3", | ||
"yaml-include": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"gulp-util": "^3.0.6", | ||
"coveralls": "^2.11.4", | ||
"event-stream": "^3.3.1", | ||
"istanbul": "^0.4.0", | ||
"mocha": "^2.3.3", | ||
"mocha-lcov-reporter": "^1.0.0" | ||
"coveralls": "^2.11.15", | ||
"eslint": "^3.12.2", | ||
"event-stream": "^3.3.4", | ||
"gulp-util": "^3.0.8", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^2.5.3", | ||
"mocha-lcov-reporter": "^1.2.0" | ||
}, | ||
@@ -30,0 +31,0 @@ "keywords": [ |
@@ -35,4 +35,3 @@ # gulp-yaml-include | ||
version: 1 | ||
# known issue: relative path problem | ||
sub: !!inc/file src/parts/sub.yaml | ||
sub: !!inc/file parts/sub.yaml | ||
``` | ||
@@ -54,8 +53,4 @@ | ||
## TODO | ||
- fix relative paths | ||
## LICENSE | ||
BSD-2-Clause |
@@ -8,6 +8,4 @@ "use strict"; | ||
module.exports = function (opt) { | ||
module.exports = function () { | ||
opt = opt || {}; //TODO | ||
return through.obj(function (file, enc, cb) { | ||
@@ -18,2 +16,3 @@ if (file.isNull()) { | ||
} | ||
yamlinc.setBaseFile(file.path); | ||
if (file.isBuffer()) { | ||
@@ -20,0 +19,0 @@ var yml = yaml.load(file.contents.toString(enc), { |
@@ -1,5 +0,6 @@ | ||
"use strict"; | ||
var assert = require("assert"), | ||
var path = require("path"), | ||
fs = require("fs"), | ||
assert = require("assert"), | ||
es = require("event-stream"), | ||
@@ -13,5 +14,7 @@ gutil = require("gulp-util"), | ||
var stream = index(); | ||
var testBuffer = new Buffer("paths: !!inc/file tests/hoge.yaml"), | ||
testFile = new gutil.File({ | ||
contents: testBuffer | ||
var testFile = new gutil.File({ | ||
base: __dirname, | ||
cwd: __dirname, | ||
path: path.join(__dirname, 'test.yaml'), | ||
contents: fs.readFileSync(path.join(__dirname, "test.yaml")) | ||
}); | ||
@@ -35,7 +38,8 @@ | ||
var testFile = new gutil.File({ | ||
base: __dirname, | ||
cwd: __dirname, | ||
path: path.join(__dirname, 'test.yaml'), | ||
contents: testStream | ||
}); | ||
testStream.write(new Buffer("paths: !!inc/file tests/hoge.yaml")); | ||
testStream.write(new Buffer("\n")); | ||
testStream.write(new Buffer("c: 1")); | ||
testStream.write(fs.readFileSync(path.join(__dirname, "test.yaml"))); | ||
testStream.end(); | ||
@@ -74,2 +78,23 @@ | ||
}); | ||
it("should work subdir inc", function (done) { | ||
var stream = index(); | ||
var testFile = new gutil.File({ | ||
base: __dirname, | ||
cwd: __dirname, | ||
path: path.join(__dirname, 'base.yaml'), | ||
contents: fs.readFileSync(path.join(__dirname, "base.yaml")) | ||
}); | ||
stream.on("data", function () { | ||
assert.equal("version: 1\nsub:\n hoge: fuga\n", testFile.contents.toString()); | ||
}); | ||
stream.on("end", function () { | ||
done(); | ||
}); | ||
stream.write(testFile); | ||
stream.end(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
8159
15
115
7
55
1
Updatedjs-yaml@^3.7.0
Updatedthrough2@^2.0.3
Updatedyaml-include@^1.2.0