fix absolute pathing

This commit is contained in:
Philipp Kunz 2016-09-30 16:16:11 +02:00
parent 2cb8c5117a
commit cfcd1f7aaf
7 changed files with 37 additions and 15 deletions

View File

@ -68,7 +68,7 @@ export declare let removeMany: (filePathArrayArg: string[]) => plugins.q.Promise
/** /**
* like removeFilePathArray but SYNCHRONOUSLY * like removeFilePathArray but SYNCHRONOUSLY
*/ */
export declare let removeManySync: (filePathArrayArg: string[]) => boolean; export declare let removeManySync: (filePathArrayArg: string[]) => void;
/** /**
* *
* @param filePathArg * @param filePathArg
@ -135,6 +135,7 @@ export declare let listAllItems: (pathArg: string, regexFilter?: RegExp) => plug
export declare let listAllItemsSync: (pathArg: string, regexFilter?: RegExp) => string[]; export declare let listAllItemsSync: (pathArg: string, regexFilter?: RegExp) => string[];
/** /**
* lists a file tree using a miniMatch filter * lists a file tree using a miniMatch filter
* note: if the miniMatch Filter is an absolute path, the cwdArg will be omitted
* @returns Promise<string[]> string array with the absolute paths of all matching files * @returns Promise<string[]> string array with the absolute paths of all matching files
*/ */
export declare let listFileTree: (dirPath: string, miniMatchFilter: string) => plugins.q.Promise<string[]>; export declare let listFileTree: (dirPathArg: string, miniMatchFilter: string) => plugins.q.Promise<string[]>;

14
dist/smartfile.fs.js vendored

File diff suppressed because one or more lines are too long

View File

@ -9,8 +9,9 @@ export declare let g: {
}; };
export import path = require('path'); export import path = require('path');
export import q = require('q'); export import q = require('q');
export declare let request: any;
export declare let requireReload: any;
export import smartpath = require('smartpath');
export import vinyl = require('vinyl'); export import vinyl = require('vinyl');
export declare let vinylFile: any; export declare let vinylFile: any;
export declare let yaml: any; export declare let yaml: any;
export declare let request: any;
export declare let requireReload: any;

View File

@ -10,9 +10,10 @@ exports.g = {
}; };
exports.path = require("path"); exports.path = require("path");
exports.q = require("q"); exports.q = require("q");
exports.request = require('request');
exports.requireReload = require('require-reload');
exports.smartpath = require("smartpath");
exports.vinyl = require("vinyl"); exports.vinyl = require("vinyl");
exports.vinylFile = require('vinyl-file'); exports.vinylFile = require('vinyl-file');
exports.yaml = require('js-yaml'); exports.yaml = require('js-yaml');
exports.request = require('request'); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGZpbGUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLHlDQUE4QztBQUM5QywyQkFBZ0M7QUFDaEMsc0NBQTJDO0FBQ2hDLFFBQUEsSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtBQUN0QixRQUFBLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUE7QUFDdEIsUUFBQSxDQUFDLEdBQUc7SUFDWCxTQUFTLEVBQUUsT0FBTyxDQUFDLGlCQUFpQixDQUFDO0NBQ3hDLENBQUE7QUFDRCwrQkFBb0M7QUFDcEMseUJBQThCO0FBQ25CLFFBQUEsT0FBTyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQTtBQUM1QixRQUFBLGFBQWEsR0FBRyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtBQUNwRCx5Q0FBOEM7QUFDOUMsaUNBQXNDO0FBQzNCLFFBQUEsU0FBUyxHQUFHLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBQTtBQUNqQyxRQUFBLElBQUksR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUEifQ==
exports.requireReload = require('require-reload');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGZpbGUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLHlDQUE4QztBQUM5QywyQkFBZ0M7QUFDaEMsc0NBQTJDO0FBQ2hDLFFBQUEsSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtBQUN0QixRQUFBLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUE7QUFDdEIsUUFBQSxDQUFDLEdBQUc7SUFDWCxTQUFTLEVBQUUsT0FBTyxDQUFDLGlCQUFpQixDQUFDO0NBQ3hDLENBQUE7QUFDRCwrQkFBb0M7QUFDcEMseUJBQThCO0FBQzlCLGlDQUFzQztBQUMzQixRQUFBLFNBQVMsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUE7QUFDakMsUUFBQSxJQUFJLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFBO0FBQ3pCLFFBQUEsT0FBTyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQTtBQUM1QixRQUFBLGFBQWEsR0FBRyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBQSJ9

View File

@ -38,6 +38,7 @@
"q": "^1.4.1", "q": "^1.4.1",
"request": "^2.75.0", "request": "^2.75.0",
"require-reload": "0.2.2", "require-reload": "0.2.2",
"smartpath": "^3.2.2",
"typings-global": "^1.0.14", "typings-global": "^1.0.14",
"vinyl": "^1.2.0", "vinyl": "^1.2.0",
"vinyl-file": "^2.0.0" "vinyl-file": "^2.0.0"

View File

@ -151,11 +151,10 @@ export let removeMany = function(filePathArrayArg: string[]){
/** /**
* like removeFilePathArray but SYNCHRONOUSLY * like removeFilePathArray but SYNCHRONOUSLY
*/ */
export let removeManySync = function(filePathArrayArg: string[]){ export let removeManySync = function(filePathArrayArg: string[]): void {
for (let filePath of filePathArrayArg) { for (let filePath of filePathArrayArg) {
removeSync(filePath) removeSync(filePath)
} }
return true
} }
/*=============================================================== /*===============================================================
@ -322,10 +321,20 @@ export let listAllItemsSync = function(pathArg: string, regexFilter?: RegExp): s
/** /**
* lists a file tree using a miniMatch filter * lists a file tree using a miniMatch filter
* note: if the miniMatch Filter is an absolute path, the cwdArg will be omitted
* @returns Promise<string[]> string array with the absolute paths of all matching files * @returns Promise<string[]> string array with the absolute paths of all matching files
*/ */
export let listFileTree = (dirPath: string, miniMatchFilter: string): plugins.q.Promise<string[]> => { export let listFileTree = (dirPathArg: string, miniMatchFilter: string): plugins.q.Promise<string[]> => {
let done = plugins.q.defer<string[]>() let done = plugins.q.defer<string[]>()
// handle absolute miniMatchFilter
let dirPath: string
if(plugins.path.isAbsolute(miniMatchFilter)){
dirPath = '/'
} else {
dirPath = dirPathArg
}
let options = { let options = {
cwd: dirPath cwd: dirPath
} }

View File

@ -9,8 +9,9 @@ export let g = {
} }
export import path = require('path') export import path = require('path')
export import q = require('q') export import q = require('q')
export let request = require('request')
export let requireReload = require('require-reload')
export import smartpath = require('smartpath')
export import vinyl = require('vinyl') export import vinyl = require('vinyl')
export let vinylFile = require('vinyl-file') export let vinylFile = require('vinyl-file')
export let yaml = require('js-yaml') export let yaml = require('js-yaml')
export let request = require('request')
export let requireReload = require('require-reload')