added requireReload function
This commit is contained in:
parent
f1d89beb06
commit
c0ee2996ce
15
index.js
15
index.js
@ -8,7 +8,8 @@ var SmartfilePlugins;
|
||||
path: require("path"),
|
||||
vinyl: require("vinyl"),
|
||||
vinylFile: require("vinyl-file"),
|
||||
yaml: require("js-yaml")
|
||||
yaml: require("js-yaml"),
|
||||
requireReload: require("require-reload")
|
||||
};
|
||||
return plugins;
|
||||
};
|
||||
@ -67,12 +68,24 @@ var SmartfileVinyl;
|
||||
objectArg.readFileToVinyl = readFileToVinyl;
|
||||
};
|
||||
})(SmartfileVinyl || (SmartfileVinyl = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var SmartfileRequire;
|
||||
(function (SmartfileRequire) {
|
||||
var requireReload = function (path) {
|
||||
return plugins.requireReload(path);
|
||||
};
|
||||
SmartfileRequire.init = function (objectArg) {
|
||||
objectArg.requireReload = requireReload;
|
||||
};
|
||||
})(SmartfileRequire || (SmartfileRequire = {}));
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
/// <reference path="./smartfile.plugins.ts" />
|
||||
/// <reference path="./smartfile.simple.ts" />
|
||||
/// <reference path="./smartfile.vinyl.ts" />
|
||||
/// <reference path="./smartfile.require.ts" />
|
||||
var plugins = SmartfilePlugins.init();
|
||||
var smartfile = {};
|
||||
SmartfileSimple.init(smartfile);
|
||||
SmartfileVinyl.init(smartfile);
|
||||
SmartfileRequire.init(smartfile);
|
||||
module.exports = smartfile;
|
||||
|
@ -27,8 +27,8 @@
|
||||
"dependencies": {
|
||||
"beautylog": "1.0.6",
|
||||
"fs-extra": "0.26.2",
|
||||
"install": "^0.4.0",
|
||||
"js-yaml": "3.4.6",
|
||||
"require-reload": "0.2.2",
|
||||
"vinyl": "^1.1.0",
|
||||
"vinyl-file": "^1.3.0"
|
||||
},
|
||||
|
1
test.js
1
test.js
@ -6,3 +6,4 @@ console.log(smartfile.readFileToObject("./test/mytest.yaml"));
|
||||
console.log(smartfile.readFileToObject("./test/mytest.json"));
|
||||
console.log(smartfile.readFileToVinyl("./test/mytest.json"));
|
||||
//var thisIsAnError = smartfile.readFileToObject("./test/mytestDoesNotExist.json");
|
||||
beautylog.success("Test passed!");
|
||||
|
@ -2,12 +2,14 @@
|
||||
/// <reference path="./smartfile.plugins.ts" />
|
||||
/// <reference path="./smartfile.simple.ts" />
|
||||
/// <reference path="./smartfile.vinyl.ts" />
|
||||
/// <reference path="./smartfile.require.ts" />
|
||||
var plugins = SmartfilePlugins.init();
|
||||
|
||||
|
||||
var smartfile:any = {};
|
||||
SmartfileSimple.init(smartfile);
|
||||
SmartfileVinyl.init(smartfile);
|
||||
SmartfileRequire.init(smartfile);
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,8 @@ module SmartfilePlugins {
|
||||
path: require("path"),
|
||||
vinyl: require("vinyl"),
|
||||
vinylFile: require("vinyl-file"),
|
||||
yaml: require("js-yaml")
|
||||
yaml: require("js-yaml"),
|
||||
requireReload: require("require-reload")
|
||||
};
|
||||
return plugins;
|
||||
}
|
||||
|
10
ts/smartfile.require.ts
Normal file
10
ts/smartfile.require.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module SmartfileRequire {
|
||||
var requireReload = function(path:string){
|
||||
return plugins.requireReload(path);
|
||||
};
|
||||
|
||||
export var init = function(objectArg){
|
||||
objectArg.requireReload = requireReload;
|
||||
}
|
||||
}
|
@ -6,3 +6,4 @@ console.log(smartfile.readFileToObject("./test/mytest.yaml"));
|
||||
console.log(smartfile.readFileToObject("./test/mytest.json"));
|
||||
console.log(smartfile.readFileToVinyl("./test/mytest.json"));
|
||||
//var thisIsAnError = smartfile.readFileToObject("./test/mytestDoesNotExist.json");
|
||||
beautylog.success("Test passed!");
|
||||
|
Loading…
Reference in New Issue
Block a user