big consolidation
This commit is contained in:
parent
d02e59a829
commit
f5e89c57e5
13
dist/index.d.ts
vendored
13
dist/index.d.ts
vendored
@ -1,16 +1,11 @@
|
||||
import "typings-global";
|
||||
import * as SmartfileChecks from "./smartfile.checks";
|
||||
import * as SmartfileFsaction from "./smartfile.fsaction";
|
||||
import * as SmartfileGet from "./smartfile.get";
|
||||
import * as SmartfileLocal from "./smartfile.local";
|
||||
import * as SmartfileFs from "./smartfile.fs";
|
||||
import * as SmartfileInterpreter from "./smartfile.interpreter";
|
||||
import * as SmartfileMemory from "./smartfile.memory";
|
||||
import * as SmartfileRemote from "./smartfile.remote";
|
||||
export { Smartfile } from "./smartfile.classes.smartfile";
|
||||
export declare let fsaction: typeof SmartfileFsaction;
|
||||
export declare let fs: any;
|
||||
export declare let checks: typeof SmartfileChecks;
|
||||
export declare let get: typeof SmartfileGet;
|
||||
export declare let local: typeof SmartfileLocal;
|
||||
export declare let fs: typeof SmartfileFs;
|
||||
export declare let interpreter: typeof SmartfileInterpreter;
|
||||
export declare let memory: typeof SmartfileMemory;
|
||||
export declare let remote: typeof SmartfileRemote;
|
||||
export declare let requireReload: (path: string) => any;
|
||||
|
18
dist/index.js
vendored
18
dist/index.js
vendored
@ -1,21 +1,15 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./smartfile.plugins");
|
||||
var SmartfileChecks = require("./smartfile.checks");
|
||||
var SmartfileFsaction = require("./smartfile.fsaction");
|
||||
var SmartfileGet = require("./smartfile.get");
|
||||
var SmartfileLocal = require("./smartfile.local");
|
||||
var SmartfileFs = require("./smartfile.fs");
|
||||
var SmartfileInterpreter = require("./smartfile.interpreter");
|
||||
var SmartfileMemory = require("./smartfile.memory");
|
||||
var SmartfileRemote = require("./smartfile.remote");
|
||||
var smartfile_classes_smartfile_1 = require("./smartfile.classes.smartfile");
|
||||
exports.Smartfile = smartfile_classes_smartfile_1.Smartfile;
|
||||
exports.fsaction = SmartfileFsaction;
|
||||
exports.fs = plugins.fs;
|
||||
exports.checks = SmartfileChecks;
|
||||
exports.get = SmartfileGet;
|
||||
exports.local = SmartfileLocal;
|
||||
exports.fs = SmartfileFs;
|
||||
exports.interpreter = SmartfileInterpreter;
|
||||
exports.memory = SmartfileMemory;
|
||||
exports.remote = SmartfileRemote;
|
||||
exports.requireReload = SmartfileLocal.requireReload;
|
||||
exports.requireReload = SmartfileFs.requireReload;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFFeEIsSUFBWSxPQUFPLFdBQU0scUJBQXFCLENBQUMsQ0FBQTtBQUMvQyxJQUFZLGVBQWUsV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQ3RELElBQVksaUJBQWlCLFdBQU0sc0JBQXNCLENBQUMsQ0FBQTtBQUMxRCxJQUFZLFlBQVksV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQ2hELElBQVksY0FBYyxXQUFNLG1CQUFtQixDQUFDLENBQUE7QUFDcEQsSUFBWSxlQUFlLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUN0RCxJQUFZLGVBQWUsV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBRXRELDRDQUF3QiwrQkFBK0IsQ0FBQztBQUFoRCw0REFBZ0Q7QUFFN0MsZ0JBQVEsR0FBRyxpQkFBaUIsQ0FBQztBQUM3QixVQUFFLEdBQUcsT0FBTyxDQUFDLEVBQUUsQ0FBQztBQUNoQixjQUFNLEdBQUcsZUFBZSxDQUFDO0FBQ3pCLFdBQUcsR0FBRyxZQUFZLENBQUM7QUFDbkIsYUFBSyxHQUFHLGNBQWMsQ0FBQztBQUN2QixjQUFNLEdBQUcsZUFBZSxDQUFDO0FBQ3pCLGNBQU0sR0FBRyxlQUFlLENBQUM7QUFDekIscUJ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mV0ZXJcIiBcbmltcG9ydCAqIGFzIFNtYXJ0ZmlsZU1lbW9yeSBmcm9tIFwiLi9zbWFydGZpbGUubWVtb3J5XCI7XG5pbXBvcnQgKiBhcyBTbWFydGZpbGVSZW1vdGUgZnJvbSBcIi4vc21hcnRmaWxlLnJlbW90ZVwiO1xuXG5leHBvcnQge1NtYXJ0ZmlsZX0gZnJvbSBcIi4vc21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlXCI7XG5cbmV4cG9ydCBsZXQgZnMgPSBTbWFydGZpbGVGcztcbmV4cG9ydCBsZXQgaW50ZXJwcmV0ZXIgPSBTbWFydGZpbGVJbnRlcnByZXRlcjtcbmV4cG9ydCBsZXQgbWVtb3J5ID0gU21hcnRmaWxlTWVtb3J5O1xuZXhwb3J0IGxldCByZW1vdGUgPSBTbWFydGZpbGVSZW1vdGU7XG5leHBvcnQgbGV0IHJlcXVpcmVSZWxvYWQgPSBTbWFydGZpbGVGcy5yZXF1aXJlUmVsb2FkO1xuIl19
|
||||
|
15
dist/smartfile.checks.d.ts
vendored
15
dist/smartfile.checks.d.ts
vendored
@ -1,15 +0,0 @@
|
||||
import "typings-global";
|
||||
/**
|
||||
*
|
||||
* @param filePath
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export declare let fileExistsSync: (filePath: any) => boolean;
|
||||
/**
|
||||
*
|
||||
* @param filePath
|
||||
* @returns {any}
|
||||
*/
|
||||
export declare let fileExists: (filePath: any) => any;
|
||||
export declare let isDirectory: (pathArg: any) => boolean;
|
||||
export declare let isFile: (pathArg: any) => boolean;
|
39
dist/smartfile.checks.js
vendored
39
dist/smartfile.checks.js
vendored
@ -1,39 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./smartfile.plugins");
|
||||
/**
|
||||
*
|
||||
* @param filePath
|
||||
* @returns {boolean}
|
||||
*/
|
||||
exports.fileExistsSync = function (filePath) {
|
||||
var fileExistsBool = false;
|
||||
try {
|
||||
plugins.fs.readFileSync(filePath);
|
||||
fileExistsBool = true;
|
||||
}
|
||||
catch (err) {
|
||||
fileExistsBool = false;
|
||||
}
|
||||
return fileExistsBool;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param filePath
|
||||
* @returns {any}
|
||||
*/
|
||||
exports.fileExists = function (filePath) {
|
||||
var done = plugins.q.defer();
|
||||
plugins.fs.access(filePath, plugins.fs.R_OK, function (err) {
|
||||
err ? done.reject() : done.resolve();
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
exports.isDirectory = function (pathArg) {
|
||||
return plugins.fs.statSync(pathArg).isDirectory();
|
||||
};
|
||||
exports.isFile = function (pathArg) {
|
||||
return plugins.fs.statSync(pathArg).isFile();
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5jaGVja3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFPLE9BQU8sV0FBVyxxQkFBcUIsQ0FBQyxDQUFDO0FBRWhEOzs7O0dBSUc7QUFDUSxzQkFBYyxHQUFHLFVBQVMsUUFBUTtJQUN6QyxJQUFJLGNBQWMsR0FBVyxLQUFLLENBQUM7SUFDbkMsSUFBSSxDQUFDO1FBQ0QsT0FBTyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDbEMsY0FBYyxHQUFHLElBQUksQ0FBQTtJQUN6QixDQUNBO0lBQUEsS0FBSyxDQUFBLENBQUMsR0FBRyxDQUFDLENBQUEsQ0FBQztRQUNQLGNBQWMsR0FBRyxLQUFLLENBQUM7SUFDM0IsQ0FBQztJQUNELE1BQU0sQ0FBQyxjQUFjLENBQUM7QUFDMUIsQ0FBQyxDQUFDO0FBRUY7Ozs7R0FJRztBQUNRLGtCQUFVLEdBQUcsVUFBUyxRQUFR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hpc3RzQm9vbDpib29sZWFuID0gZmFsc2U7XHJcbiAgICB0cnkge1xyXG4gICAgICAgIHBsdWdpbnMuZnMucmVhZEZpbGVTeW5jKGZpbGVQYXRoKTtcclxuICAgICAgICBmaWxlRXhpc3RzQm9vbCA9IHRydWVcclxuICAgIH1cclxuICAgIGNhdGNoKGVycil7XHJcbiAgICAgICAgZmlsZUV4aXN0c0Jvb2wgPSBmYWxzZTtcclxuICAgIH1cclxuICAgIHJldHVybiBmaWxlRXhpc3RzQm9vbDtcclxufTtcclxuXHJcbi8qKlxyXG4gKlxyXG4gKiBAcGFyYW0gZmlsZVBhdGhcclxuICogQHJldHVybnMge2FueX1cclxuICovXHJcbmV4cG9ydCBsZXQgZmlsZUV4aXN0cyA9IGZ1bmN0aW9uKGZpbGVQYXRoKXtcclxuICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XHJcbiAgICBwbHVnaW5zLmZzLmFjY2VzcyhmaWxlUGF0aCwgcGx1Z2lucy5mcy5SX09LLCBmdW5jdGlvbiAoZXJyKSB7XHJcbiAgICAgICAgZXJyID8gZG9uZS5yZWplY3QoKSA6IGRvbmUucmVzb2x2ZSgpO1xyXG4gICAgfSk7XHJcbiAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG59O1xyXG5cclxuZXhwb3J0IGxldCBpc0RpcmVjdG9yeSA9IGZ1bmN0aW9uKHBhdGhBcmcpOmJvb2xlYW57XHJcbiAgICByZXR1cm4gcGx1Z2lucy5mcy5zdGF0U3luYyhwYXRoQXJnKS5pc0RpcmVjdG9yeSgpO1xyXG59O1xyXG5cclxuZXhwb3J0IGxldCBpc0ZpbGUgPSBmdW5jdGlvbihwYXRoQXJnKTpib29sZWFue1xyXG4gICAgcmV0dXJuIHBsdWdpbnMuZnMuc3RhdFN5bmMocGF0aEFyZykuaXNGaWxlKCk7XHJcbn07XHJcbiJdfQ==
|
2
dist/smartfile.classes.smartfile.js
vendored
2
dist/smartfile.classes.smartfile.js
vendored
@ -7,4 +7,4 @@ var Smartfile = (function () {
|
||||
}());
|
||||
exports.Smartfile = Smartfile;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5jbGFzc2VzLnNtYXJ0ZmlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7SUFDSTtJQUVBLENBQUM7O0lBQ0wsZ0JBQUM7QUFBRCxDQUpBLEFBSUMsSUFBQTtBQUpZLGlCQUFTLFlBSXJCLENBQUEiLCJmaWxlIjoic21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNsYXNzIFNtYXJ0ZmlsZSB7XHJcbiAgICBjb25zdHJ1Y3Rvcigpe1xyXG4gICAgICAgIFxyXG4gICAgfTtcclxufSJdfQ==
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5jbGFzc2VzLnNtYXJ0ZmlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7SUFDSTtJQUVBLENBQUM7O0lBQ0wsZ0JBQUM7QUFBRCxDQUpBLEFBSUMsSUFBQTtBQUpZLGlCQUFTLFlBSXJCLENBQUEiLCJmaWxlIjoic21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNsYXNzIFNtYXJ0ZmlsZSB7XG4gICAgY29uc3RydWN0b3IoKXtcbiAgICAgICAgXG4gICAgfTtcbn0iXX0=
|
||||
|
@ -1,4 +1,8 @@
|
||||
import "typings-global";
|
||||
export declare let copy: (fromArg: string, toArg: string) => any;
|
||||
export declare let copySync: (fromArg: string, toArg: string) => boolean;
|
||||
export declare let remove: (pathArg: string) => any;
|
||||
export declare let removeSync: (pathArg: string) => boolean;
|
||||
export declare let toFS: (options: {
|
||||
from: string;
|
||||
toPath: string;
|
||||
@ -36,3 +40,19 @@ export declare let toVinylSync: (filePathArg: any, options?: {}) => any;
|
||||
* @returns {any}
|
||||
*/
|
||||
export declare let requireReload: (path: string) => any;
|
||||
export declare let foldersSync: (pathArg: any) => any;
|
||||
export declare let folders: (pathArg: string) => any;
|
||||
/**
|
||||
*
|
||||
* @param filePath
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export declare let fileExistsSync: (filePath: any) => boolean;
|
||||
/**
|
||||
*
|
||||
* @param filePath
|
||||
* @returns {any}
|
||||
*/
|
||||
export declare let fileExists: (filePath: any) => any;
|
||||
export declare let isDirectory: (pathArg: any) => boolean;
|
||||
export declare let isFile: (pathArg: any) => boolean;
|
136
dist/smartfile.fs.js
vendored
Normal file
136
dist/smartfile.fs.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
dist/smartfile.fsaction.d.ts
vendored
5
dist/smartfile.fsaction.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
import "typings-global";
|
||||
export declare let copy: (fromArg: string, toArg: string) => any;
|
||||
export declare let copySync: (fromArg: string, toArg: string) => boolean;
|
||||
export declare let remove: (pathArg: string) => any;
|
||||
export declare let removeSync: (pathArg: string) => boolean;
|
27
dist/smartfile.fsaction.js
vendored
27
dist/smartfile.fsaction.js
vendored
@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./smartfile.plugins");
|
||||
exports.copy = function (fromArg, toArg) {
|
||||
var done = plugins.q.defer();
|
||||
plugins.fs.copy(fromArg, toArg, {}, function () {
|
||||
done.resolve();
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
exports.copySync = function (fromArg, toArg) {
|
||||
plugins.fs.copySync(fromArg, toArg);
|
||||
return true;
|
||||
};
|
||||
exports.remove = function (pathArg) {
|
||||
var done = plugins.q.defer();
|
||||
plugins.fs.remove(pathArg, function () {
|
||||
done.resolve();
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
exports.removeSync = function (pathArg) {
|
||||
plugins.fs.removeSync(pathArg);
|
||||
return true;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5mc2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFHckMsWUFBSSxHQUFHLFVBQVMsT0FBYyxFQUFFLEtBQVk7SUFDbkQsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixPQUFPLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUMsS0FBSyxFQUFDLEVBQUUsRUFBQztRQUM3QixJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7SUFDbkIsQ0FBQyxDQUFDLENBQUM7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUM7QUFFUyxnQkFBUSxHQUFHLFVBQVMsT0FBYyxFQUFDLEtBQVk7SUFDdEQsT0FBTyxDQUFDLEVBQUUsQ0FBQyxRQUFRLENBQUMsT0FBTyxFQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ25DLE1BQU0sQ0FBQyxJQUFJLENBQUM7QUFDaEIsQ0FBQyxDQUFDO0FBRVMsY0FBTSxHQUFHLFVBQVMsT0FBYztJQUN2QyxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLE9BQU8sQ0FBQyxFQUFFLENBQUMsTUFBTSxDQUFDLE9BQU8sRUFBQztRQUN0QixJQUFJLENBQUMsT0FBTyxFQU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pb24ocGF0aEFyZzpzdHJpbmcpe1xyXG4gICAgdmFyIGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcclxuICAgIHBsdWdpbnMuZnMucmVtb3ZlKHBhdGhBcmcsZnVuY3Rpb24oKXtcclxuICAgICAgICBkb25lLnJlc29sdmUoKTtcclxuICAgIH0pO1xyXG4gICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxufTtcclxuXHJcbmV4cG9ydCBsZXQgcmVtb3ZlU3luYyA9IGZ1bmN0aW9uKHBhdGhBcmc6c3RyaW5nKTpib29sZWFue1xyXG4gICAgcGx1Z2lucy5mcy5yZW1vdmVTeW5jKHBhdGhBcmcpO1xyXG4gICAgcmV0dXJuIHRydWU7XHJcbn07Il19
|
4
dist/smartfile.get.d.ts
vendored
4
dist/smartfile.get.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
import "typings-global";
|
||||
export declare let filetype: (pathArg: string) => string;
|
||||
export declare let foldersSync: (pathArg: any) => any;
|
||||
export declare let folders: (pathArg: string) => any;
|
23
dist/smartfile.get.js
vendored
23
dist/smartfile.get.js
vendored
@ -1,23 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./smartfile.plugins");
|
||||
exports.filetype = function (pathArg) {
|
||||
var extName = plugins.path.extname(pathArg);
|
||||
var fileType = extName.replace(/\.([a-z]*)/, "$1"); //remove . form fileType
|
||||
return fileType;
|
||||
};
|
||||
exports.foldersSync = function (pathArg) {
|
||||
return plugins.fs.readdirSync(pathArg).filter(function (file) {
|
||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||
});
|
||||
};
|
||||
exports.folders = function (pathArg) {
|
||||
var done = plugins.q.defer();
|
||||
var folderArray = plugins.fs.readdirSync(pathArg).filter(function (file) {
|
||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||
});
|
||||
done.resolve(folderArray);
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
//# sourceM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bGUpKS5pc0RpcmVjdG9yeSgpO1xyXG4gICAgfSk7XHJcbn07XHJcblxyXG5leHBvcnQgbGV0IGZvbGRlcnMgPSBmdW5jdGlvbihwYXRoQXJnOnN0cmluZyl7XHJcbiAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgbGV0IGZvbGRlckFycmF5ID0gcGx1Z2lucy5mcy5yZWFkZGlyU3luYyhwYXRoQXJnKS5maWx0ZXIoZnVuY3Rpb24oZmlsZSkge1xyXG4gICAgICAgIHJldHVybiBwbHVnaW5zLmZzLnN0YXRTeW5jKHBsdWdpbnMucGF0aC5qb2luKHBhdGhBcmcsIGZpbGUpKS5pc0RpcmVjdG9yeSgpO1xyXG4gICAgfSk7XHJcbiAgICBkb25lLnJlc29sdmUoZm9sZGVyQXJyYXkpO1xyXG4gICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxufTsiXX0=
|
4
dist/smartfile.interpreter.d.ts
vendored
4
dist/smartfile.interpreter.d.ts
vendored
@ -1,3 +1,3 @@
|
||||
import "typings-global";
|
||||
declare var _default: (fileStringArg: string, fileTypeArg: any) => any;
|
||||
export = _default;
|
||||
export declare let filetype: (pathArg: string) => string;
|
||||
export declare let objectFile: (fileStringArg: string, fileTypeArg: any) => any;
|
||||
|
9
dist/smartfile.interpreter.js
vendored
9
dist/smartfile.interpreter.js
vendored
@ -1,7 +1,12 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./smartfile.plugins");
|
||||
module.exports = function (fileStringArg, fileTypeArg) {
|
||||
exports.filetype = function (pathArg) {
|
||||
var extName = plugins.path.extname(pathArg);
|
||||
var fileType = extName.replace(/\.([a-z]*)/, "$1"); //remove . form fileType
|
||||
return fileType;
|
||||
};
|
||||
exports.objectFile = function (fileStringArg, fileTypeArg) {
|
||||
switch (fileTypeArg) {
|
||||
case "yml":
|
||||
case "yaml":
|
||||
@ -14,4 +19,4 @@ module.exports = function (fileStringArg, fileTypeArg)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2FkKGZpbGVTdHJpbmdBcmcpO1xuICAgICAgICBjYXNlIFwianNvblwiOlxuICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UoZmlsZVN0cmluZ0FyZyk7XG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5lcnJvcihcImZpbGUgdHlwZSBcIiArIGZpbGVUeXBlQXJnLmJsdWUgKyBcIiBub3Qgc3VwcG9ydGVkXCIpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxufSJdfQ==
|
||||
|
62
dist/smartfile.local.js
vendored
62
dist/smartfile.local.js
vendored
@ -1,62 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./smartfile.plugins");
|
||||
var SmartfileGet = require("./smartfile.get");
|
||||
var SmartfileInterpreter = require("./smartfile.interpreter");
|
||||
exports.toFS = function (options, cb) {
|
||||
if (cb === void 0) { cb = undefined; }
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param filePathArg
|
||||
* @returns {*}
|
||||
*/
|
||||
exports.toGulpStreamSync = function (filePathArg) {
|
||||
var stream = plugins.gulp.src(filePathArg);
|
||||
return stream;
|
||||
};
|
||||
exports.toGulpDestSync = function (folderPathArg) {
|
||||
return plugins.gulp.dest(folderPathArg);
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param filePathArg
|
||||
* @param fileTypeArg
|
||||
* @returns {any}
|
||||
*/
|
||||
exports.toObjectSync = function (filePathArg, fileTypeArg) {
|
||||
var fileString = plugins.fs.readFileSync(filePathArg, 'utf8');
|
||||
var fileType;
|
||||
fileTypeArg ? fileType = fileTypeArg : fileType = SmartfileGet.filetype(filePathArg);
|
||||
return SmartfileInterpreter(fileString, fileType);
|
||||
};
|
||||
/**
|
||||
* reads a file content to a String
|
||||
* @param filePath
|
||||
* @returns {string|Buffer|any}
|
||||
*/
|
||||
exports.toStringSync = function (filePath) {
|
||||
var fileString;
|
||||
fileString = plugins.fs.readFileSync(filePath, "utf8");
|
||||
return fileString;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param filePathArg
|
||||
* @param options
|
||||
* @returns {number}
|
||||
*/
|
||||
exports.toVinylSync = function (filePathArg, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
return plugins.vinylFile.readSync(filePathArg, options);
|
||||
};
|
||||
/**
|
||||
* lets you reload files hot.
|
||||
* @param path
|
||||
* @returns {any}
|
||||
*/
|
||||
exports.requireReload = function (path) {
|
||||
return plugins.requireReload(path);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5sb2NhbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFDaEQsSUFBTyxZQUFZLFdBQVcsaUJBQWlCLENBQUMsQ0FBQztBQUNqRCxJQUFPLG9CQUFvQixXQUFXLHlCQUF5QixDQUFDLENBQUM7QUFDdEQsWUFBSSxHQUFHLFVBQVMsT0FBbUMsRUFBRSxFQUFZO0lBQVosa0JBQVksR0FBWixjQUFZO0FBRTVFLENBQUMsQ0FBQztBQUVGOzs7O0dBSUc7QUFDUSx3QkFBZ0IsR0FBRyxVQUFTLFdBQWtCO0lBQ3JELElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0lBQzNDLE1BQU0sQ0FBQyxNQUFNLENBQUM7QUFDbEIsQ0FBQyxDQUFDO0FBRVMsc0JBQWMsR0FBRyxVQUFTLGFBQW9CO0lBQ3JELE1BQU0sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsQ0FBQztBQUM1QyxDQUFDLENBQUM7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hcclxuICogQHJldHVybnMge2FueX1cclxuICovXHJcbmV4cG9ydCBsZXQgcmVxdWlyZVJlbG9hZCA9IGZ1bmN0aW9uKHBhdGg6c3RyaW5nKXtcclxuICAgIHJldHVybiBwbHVnaW5zLnJlcXVpcmVSZWxvYWQocGF0aCk7XHJcbn07Il19
|
4
dist/smartfile.memory.js
vendored
4
dist/smartfile.memory.js
vendored
File diff suppressed because one or more lines are too long
2
dist/smartfile.plugins.js
vendored
2
dist/smartfile.plugins.js
vendored
@ -14,4 +14,4 @@ exports.yaml = require("js-yaml");
|
||||
exports.request = require("request");
|
||||
exports.requireReload = require("require-reload");
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDYixpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNqQyxVQUFFLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0FBQ3pCLFlBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDdkIsU0FBQyxHQUFHO0lBQ1gsU0FBUyxFQUFFLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQztDQUN4QyxDQUFDO0FBQ1ksWUFBSSxXQUFXLE1BQU0sQ0FBQyxDQUFDO0FBQzFCLFNBQUMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDZCxhQUFLLFdBQVcsT0FBTyxDQUFDLENBQUM7QUFDNUIsaUJBQVMsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUM7QUFDbEMsWUFBSSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztBQUMxQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQ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XG5leHBvcnQgaW1wb3J0IHZpbnlsID0gcmVxdWlyZShcInZpbnlsXCIpO1xuZXhwb3J0IGxldCB2aW55bEZpbGUgPSByZXF1aXJlKFwidmlueWwtZmlsZVwiKTtcbmV4cG9ydCBsZXQgeWFtbCA9IHJlcXVpcmUoXCJqcy15YW1sXCIpO1xuZXhwb3J0IGxldCByZXF1ZXN0ID0gcmVxdWlyZShcInJlcXVlc3RcIik7XG5leHBvcnQgbGV0IHJlcXVpcmVSZWxvYWQgPSByZXF1aXJlKFwicmVxdWlyZS1yZWxvYWRcIik7XG4iXX0=
|
||||
|
5
dist/smartfile.remote.js
vendored
5
dist/smartfile.remote.js
vendored
File diff suppressed because one or more lines are too long
@ -26,7 +26,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/smartfile",
|
||||
"dependencies": {
|
||||
"beautylog": "^5.0.5",
|
||||
"beautylog": "^5.0.12",
|
||||
"fs-extra": "^0.30.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-remote-src": "^0.4.1",
|
||||
@ -39,9 +39,9 @@
|
||||
"vinyl-file": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-function": "^1.3.1",
|
||||
"npmts": "^5.1.13",
|
||||
"should": "^8.4.0",
|
||||
"gulp-function": "^1.3.6",
|
||||
"npmts-g": "^5.2.6",
|
||||
"should": "^9.0.2",
|
||||
"typings-test": "^1.0.1"
|
||||
}
|
||||
}
|
||||
|
78
test/test.js
78
test/test.js
File diff suppressed because one or more lines are too long
82
test/test.ts
82
test/test.ts
@ -1,5 +1,5 @@
|
||||
import "typings-test";
|
||||
import * as smartfile from "../dist/index.js";
|
||||
import * as smartfile from "../dist/index";
|
||||
let beautylog = require("beautylog");
|
||||
let gulp = require("gulp");
|
||||
let gFunction = require("gulp-function");
|
||||
@ -7,33 +7,47 @@ import should = require("should");
|
||||
let vinyl = require("vinyl");
|
||||
|
||||
describe("smartfile".yellow,function(){
|
||||
describe(".checks".yellow,function(){
|
||||
|
||||
|
||||
describe(".fs".yellow,function(){
|
||||
describe(".fileExistsSync".yellow,function(){
|
||||
it("should return an accurate boolean",function(){
|
||||
(smartfile.checks.fileExistsSync("./test/mytest.json")).should.be.true();
|
||||
(smartfile.checks.fileExistsSync("./test/notthere.json")).should.be.false();
|
||||
(smartfile.fs.fileExistsSync("./test/mytest.json")).should.be.true();
|
||||
(smartfile.fs.fileExistsSync("./test/notthere.json")).should.be.false();
|
||||
});
|
||||
});
|
||||
describe(".fileExists".yellow,function(){
|
||||
it("should return a working promise",function(){
|
||||
(smartfile.checks.fileExists("./test/mytest.json")).should.be.Promise();
|
||||
(smartfile.checks.fileExists("./test/mytest.json")).should.be.fulfilled();
|
||||
(smartfile.checks.fileExists("./test/notthere.json")).should.not.be.fulfilled();
|
||||
(smartfile.fs.fileExists("./test/mytest.json")).should.be.Promise();
|
||||
(smartfile.fs.fileExists("./test/mytest.json")).should.be.fulfilled();
|
||||
(smartfile.fs.fileExists("./test/notthere.json")).should.not.be.fulfilled();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
describe(".fsaction".yellow,function(){
|
||||
});
|
||||
describe(".foldersSync()",function(){
|
||||
it("should get the file type from a string",function(){
|
||||
smartfile.fs.foldersSync("./test/").should.containDeep([ "testfolder"]);
|
||||
smartfile.fs.foldersSync("./test/").should.not.containDeep([ "notExistentFolder"]);
|
||||
});
|
||||
});
|
||||
describe(".folders()",function(){
|
||||
it("should get the file type from a string",function(done){
|
||||
smartfile.fs.folders("./test/")
|
||||
.then(function(folderArrayArg){
|
||||
folderArrayArg.should.containDeep([ "testfolder"]);
|
||||
folderArrayArg.should.not.containDeep([ "notExistentFolder"]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe(".copy()".yellow,function(){
|
||||
it("should copy a directory",function(){
|
||||
smartfile.fsaction.copy("./test/testfolder/","./test/temp/")
|
||||
smartfile.fs.copy("./test/testfolder/","./test/temp/")
|
||||
});
|
||||
it("should copy a file",function(){
|
||||
smartfile.fsaction.copy("./test/mytest.yaml","./test/temp/")
|
||||
smartfile.fs.copy("./test/mytest.yaml","./test/temp/")
|
||||
});
|
||||
it("should copy a file and rename it",function(){
|
||||
smartfile.fsaction.copy("./test/mytest.yaml","./test/temp/mytestRenamed.yaml")
|
||||
smartfile.fs.copy("./test/mytest.yaml","./test/temp/mytestRenamed.yaml")
|
||||
});
|
||||
});
|
||||
describe(".remove()",function(){
|
||||
@ -46,51 +60,35 @@ describe("smartfile".yellow,function(){
|
||||
});
|
||||
});
|
||||
|
||||
describe(".get",function(){
|
||||
describe(".interpreter",function(){
|
||||
describe(".filetype()",function(){
|
||||
it("should get the file type from a string",function(){
|
||||
smartfile.get.filetype("./somefolder/data.json").should.equal("json");
|
||||
});
|
||||
});
|
||||
describe(".foldersSync()",function(){
|
||||
it("should get the file type from a string",function(){
|
||||
smartfile.get.foldersSync("./test/").should.containDeep([ "testfolder"]);
|
||||
smartfile.get.foldersSync("./test/").should.not.containDeep([ "notExistentFolder"]);
|
||||
});
|
||||
});
|
||||
describe(".folders()",function(){
|
||||
it("should get the file type from a string",function(done){
|
||||
smartfile.get.folders("./test/")
|
||||
.then(function(folderArrayArg){
|
||||
folderArrayArg.should.containDeep([ "testfolder"]);
|
||||
folderArrayArg.should.not.containDeep([ "notExistentFolder"]);
|
||||
done();
|
||||
});
|
||||
smartfile.interpreter.filetype("./somefolder/data.json").should.equal("json");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe(".local".yellow,function(){
|
||||
describe(".fs".yellow,function(){
|
||||
describe("toGulpStreamSync() and toGulpDestSync",function(){
|
||||
it("should produce a gulp stream",function(done){
|
||||
smartfile.local.toGulpStreamSync("./test/my*")
|
||||
.pipe(smartfile.local.toGulpDestSync("./test/temp/"))
|
||||
smartfile.fs.toGulpStreamSync("./test/my*")
|
||||
.pipe(smartfile.fs.toGulpDestSync("./test/temp/"))
|
||||
.pipe(gFunction(done,"atEnd"));
|
||||
});
|
||||
});
|
||||
describe(".toObjectSync()".yellow,function(){
|
||||
it("should read an " + ".yaml".blue + " file to an object",function(){
|
||||
let testData = smartfile.local.toObjectSync("./test/mytest.yaml");
|
||||
let testData = smartfile.fs.toObjectSync("./test/mytest.yaml");
|
||||
testData.should.have.property("key1","this works");
|
||||
testData.should.have.property("key2","this works too");
|
||||
|
||||
});
|
||||
it("should state unknown file type for unknown file types",function(){
|
||||
let testData = smartfile.local.toObjectSync("./test/mytest.txt");
|
||||
let testData = smartfile.fs.toObjectSync("./test/mytest.txt");
|
||||
});
|
||||
it("should read an " + ".json".blue + " file to an object",function(){
|
||||
let testData = smartfile.local.toObjectSync("./test/mytest.json");
|
||||
let testData = smartfile.fs.toObjectSync("./test/mytest.json");
|
||||
testData.should.have.property("key1","this works");
|
||||
testData.should.have.property("key2","this works too");
|
||||
|
||||
@ -99,14 +97,14 @@ describe("smartfile".yellow,function(){
|
||||
describe(".toStringSync()".yellow,function(){
|
||||
it("should read a file to a string",function(){
|
||||
should.equal(
|
||||
smartfile.local.toStringSync("./test/mytest.txt"),
|
||||
smartfile.fs.toStringSync("./test/mytest.txt"),
|
||||
"Some TestString &&%$"
|
||||
);
|
||||
});
|
||||
});
|
||||
describe(".toVinylSync".yellow,function(){
|
||||
it("should read an " + ".json OR .yaml".blue + " file to an " + "vinyl file object".cyan,function(){
|
||||
let testData = smartfile.local.toVinylSync("./test/mytest.json");
|
||||
let testData = smartfile.fs.toVinylSync("./test/mytest.json");
|
||||
(vinyl.isVinyl(testData)).should.be.true();
|
||||
|
||||
});
|
||||
@ -179,7 +177,7 @@ describe("smartfile".yellow,function(){
|
||||
describe("toGulpStreamSync()",function(){
|
||||
it("should produce a gulp stream",function(done){
|
||||
smartfile.remote.toGulpStreamSync("mytest.txt","https://raw.githubusercontent.com/pushrocks/smartfile/master/test/")
|
||||
.pipe(smartfile.local.toGulpDestSync("./test/temp/"))
|
||||
.pipe(smartfile.fs.toGulpDestSync("./test/temp/"))
|
||||
.pipe(gFunction(done,"atEnd"));
|
||||
});
|
||||
});
|
||||
|
@ -1,14 +1,15 @@
|
||||
import "typings-global";
|
||||
|
||||
import * as plugins from "./smartfile.plugins";
|
||||
import * as SmartfileLocal from "./smartfile.fs";
|
||||
import * as SmartfileFs from "./smartfile.fs";
|
||||
import * as SmartfileInterpreter from "./smartfile.interpreter"
|
||||
import * as SmartfileMemory from "./smartfile.memory";
|
||||
import * as SmartfileRemote from "./smartfile.remote";
|
||||
|
||||
export {Smartfile} from "./smartfile.classes.smartfile";
|
||||
|
||||
export let fs = plugins.fs;
|
||||
export let local = SmartfileLocal;
|
||||
export let fs = SmartfileFs;
|
||||
export let interpreter = SmartfileInterpreter;
|
||||
export let memory = SmartfileMemory;
|
||||
export let remote = SmartfileRemote;
|
||||
export let requireReload = SmartfileLocal.requireReload;
|
||||
export let requireReload = SmartfileFs.requireReload;
|
||||
|
@ -66,8 +66,8 @@ export let toGulpDestSync = function(folderPathArg:string){
|
||||
export let toObjectSync = function(filePathArg,fileTypeArg?) {
|
||||
let fileString = plugins.fs.readFileSync(filePathArg, 'utf8');
|
||||
let fileType;
|
||||
fileTypeArg ? fileType = fileTypeArg : fileType = filetype(filePathArg);
|
||||
return SmartfileInterpreter(fileString,fileType);
|
||||
fileTypeArg ? fileType = fileTypeArg : fileType = SmartfileInterpreter.filetype(filePathArg);
|
||||
return SmartfileInterpreter.objectFile(fileString,fileType);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -100,12 +100,6 @@ export let requireReload = function(path:string){
|
||||
return plugins.requireReload(path);
|
||||
};
|
||||
|
||||
export let filetype = function(pathArg:string):string {
|
||||
let extName = plugins.path.extname(pathArg);
|
||||
let fileType = extName.replace(/\.([a-z]*)/,"$1"); //remove . form fileType
|
||||
return fileType;
|
||||
};
|
||||
|
||||
export let foldersSync = function(pathArg){
|
||||
return plugins.fs.readdirSync(pathArg).filter(function(file) {
|
||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||
|
@ -2,7 +2,13 @@ import "typings-global";
|
||||
|
||||
import plugins = require("./smartfile.plugins");
|
||||
|
||||
export = function(fileStringArg:string, fileTypeArg){
|
||||
export let filetype = (pathArg:string):string => {
|
||||
let extName = plugins.path.extname(pathArg);
|
||||
let fileType = extName.replace(/\.([a-z]*)/,"$1"); //remove . form fileType
|
||||
return fileType;
|
||||
};
|
||||
|
||||
export let objectFile = (fileStringArg:string, fileTypeArg) => {
|
||||
switch (fileTypeArg) {
|
||||
case "yml" :
|
||||
case "yaml":
|
||||
|
@ -46,7 +46,7 @@ export let toGulpStream = function(fileArg:string|string[]|plugins.vinyl|plugins
|
||||
* @returns {any|any}
|
||||
*/
|
||||
export let toObject = function(fileStringArg:string,fileTypeArg:string){
|
||||
return SmartfileInterpreter(fileStringArg,fileTypeArg);
|
||||
return SmartfileInterpreter.objectFile(fileStringArg,fileTypeArg);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,6 @@
|
||||
import "typings-global";
|
||||
import plugins = require("./smartfile.plugins");
|
||||
import SmartfileInterpreter = require("./smartfile.interpreter");
|
||||
import SmartfileGet = require("./smartfile.get");
|
||||
|
||||
export let toFs = function(from:string,toPath:string) {
|
||||
var done = plugins.q.defer();
|
||||
@ -34,7 +33,7 @@ export let toObject = function(fromArg:string){
|
||||
plugins.request.get(fromArg, function (error, response, bodyString) {
|
||||
let returnObject;
|
||||
if (!error && response.statusCode == 200) {
|
||||
returnObject = SmartfileInterpreter(bodyString,SmartfileGet.filetype(fromArg));
|
||||
returnObject = SmartfileInterpreter.objectFile(bodyString,SmartfileInterpreter.filetype(fromArg));
|
||||
done.resolve(returnObject);
|
||||
} else {
|
||||
console.log('could not get remote file from ' + fromArg);
|
||||
|
Loading…
Reference in New Issue
Block a user