Merge pull request #15004 from shiftkey/fs-extra-2-0-obsoletions

[fs-extra] 2.0.0 obsoletes walk and walkSync
This commit is contained in:
Mine Starks
2017-03-13 11:45:56 -07:00
committed by GitHub
2 changed files with 5 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
import fs = require('fs-extra');
import * as Path from 'path'
import * as Path from 'path';
var src: string;
var dest: string;
@@ -19,7 +19,7 @@ fs.copy(src, dest,
{
clobber: true,
preserveTimestamps: true,
filter: (src: string) => {return false}
filter: (src: string) => { return false; }
},
errorCallback
);
@@ -40,7 +40,7 @@ fs.copySync(src, dest,
{
clobber: true,
preserveTimestamps: true,
filter: (src: string) => {return false}
filter: (src: string) => { return false; }
}
);
fs.copySync(src, dest,
@@ -99,35 +99,3 @@ fs.ensureSymlink(path, errorCallback);
fs.ensureSymlinkSync(path);
fs.emptyDir(path, errorCallback);
fs.emptyDirSync(path);
var items: string[];
fs.walk("my-path")
.on('data', function (item) {
items.push(item.path);
})
.on('end', function () {
console.dir(items);
});
const ignoreHiddenFiles = (item: string): boolean => {
const basename = Path.basename(item)
return basename === '.' || basename[0] !== '.'
}
const sortPaths = (left: string, right: string) => left.localeCompare(right);
const options = {
filter: ignoreHiddenFiles,
pathSorter: sortPaths
}
fs.walk(path, options)
.on('readable', function (this: fs.PathEntryStream) {
let item: fs.PathEntry | undefined
while ((item = this.read())) {
items.push(item.path)
}
})
.on('end', function () {
})

7
fs-extra/index.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for fs-extra
// Type definitions for fs-extra v2.0.0
// Project: https://github.com/jprichardson/node-fs-extra
// Definitions by: midknight41 <https://github.com/midknight41>
// Definitions by: midknight41 <https://github.com/midknight41>, Brendan Forster <https://github.com/shiftkey>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts
@@ -120,9 +120,6 @@ export type PathEntryStream = {
read(): PathEntry | null
}
export function walk(path: string, options?: WalkOptions): WalkEventEmitter;
export function walkSync(path: string): ReadonlyArray<string>;
export interface CopyFilterFunction {
(src: string): boolean
}