[Pkg-javascript-commits] [node-klaw] 01/05: New upstream version 2.0.0

Julien Puydt julien.puydt at laposte.net
Tue Jun 27 10:26:12 UTC 2017


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-klaw.

commit aa454e6b138be4d3c832e1b0c2ab40509c21ac75
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Tue Jun 27 12:17:38 2017 +0200

    New upstream version 2.0.0
---
 .travis.yml               |  8 +++-----
 CHANGELOG.md              |  8 ++++++++
 README.md                 | 23 ++++++++++++++---------
 appveyor.yml              |  4 +---
 package.json              | 11 +++++------
 src/assign.js             | 16 ----------------
 src/index.js              | 11 ++---------
 tests/walk_mockfs.test.js | 41 -----------------------------------------
 8 files changed, 33 insertions(+), 89 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8662b6f..7c6af16 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,14 +1,12 @@
 sudo: false
 language: node_js
 node_js:
-  - "0.10"
-  - "0.12"
-  - "io.js"
   - "4"
-  - "5"
+  - "6"
+  - "8"
 matrix:
   include:
-    - node_js: "4"
+    - node_js: "6"
       env: TEST_SUITE=lint
 env:
   - TEST_SUITE=unit
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 83410c7..c3c0274 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+2.0.0 / 2017-06-23
+------------------
+
+### Changed
+
+- `graceful-fs` is now a regular dependency, and is always loaded. This should speed up `require` time
+- Dropped support for Node 0.10 & 0.12 and io.js
+
 1.3.1 / 2016-10-25
 ------------------
 ### Added
diff --git a/README.md b/README.md
index 78386e4..130f905 100644
--- a/README.md
+++ b/README.md
@@ -1,20 +1,23 @@
 Node.js - klaw
 ==============
 
+<a href="https://standardjs.com" style="float: right; padding: 0 0 20px 20px;"><img src="https://cdn.rawgit.com/feross/standard/master/sticker.svg" alt="JavaScript Standard Style" width="100" align="right"></a>
+
 A Node.js file system walker extracted from [fs-extra](https://github.com/jprichardson/node-fs-extra).
 
 [![npm Package](https://img.shields.io/npm/v/klaw.svg?style=flat-square)](https://www.npmjs.org/package/klaw)
 [![build status](https://api.travis-ci.org/jprichardson/node-klaw.svg)](http://travis-ci.org/jprichardson/node-klaw)
 [![windows build status](https://ci.appveyor.com/api/projects/status/github/jprichardson/node-klaw?branch=master&svg=true)](https://ci.appveyor.com/project/jprichardson/node-klaw/branch/master)
 
-<!-- [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) -->
-<a href="http://standardjs.com"><img src="https://cdn.rawgit.com/feross/standard/master/sticker.svg" alt="Standard" width="100"></a>
-
 Install
 -------
 
     npm i --save klaw
 
+If you're using Typescript, we've got [types](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/11492/files):
+
+    npm i --save-dev @types/klaw
+
 
 Name
 ----
@@ -22,6 +25,12 @@ Name
 `klaw` is `walk` backwards :p
 
 
+Sync
+----
+
+If you need the same functionality but synchronous, you can use [klaw-sync](https://github.com/manidlou/node-klaw-sync).
+
+
 Usage
 -----
 
@@ -73,10 +82,6 @@ klaw('/some/dir')
   })
 ```
 
-If you're not sure of the differences on Node.js streams 1, 2, 3 then I'd
-recommend this resource as a good starting point: https://strongloop.com/strongblog/whats-new-io-js-beta-streams3/.
-
-
 ### Error Handling
 
 Listen for the `error` event.
@@ -153,7 +158,7 @@ klaw('/some/dir', { filter : filterFunc  })
   .on('data', function(item){
     // only items of none hidden folders will reach here
   })
-    
+
 ```
 
 **Example (totaling size of PNG files):**
@@ -195,7 +200,7 @@ var deleteAction = through2.obj(function (item, enc, next) {
 
   if (path.extname(item.path) === '.tmp') {
     item.deleted = true
-    fs.unklink(item.path, next)
+    fs.unlink(item.path, next)
   } else {
     item.deleted = false
     next()
diff --git a/appveyor.yml b/appveyor.yml
index 08a2803..8aeb13b 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -2,10 +2,8 @@
 environment:
   matrix:
     # node.js
-    - nodejs_version: "0.10"
-    - nodejs_version: "0.12"
     - nodejs_version: "4"
-    - nodejs_version: "5"
+    - nodejs_version: "6"
 
 # Install scripts. (runs after repo cloning)
 install:
diff --git a/package.json b/package.json
index 6a2346a..9fa4f7d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "klaw",
-  "version": "1.3.1",
+  "version": "2.0.0",
   "description": "File system walker with Readable stream interface.",
   "main": "./src/index.js",
   "scripts": {
@@ -26,15 +26,14 @@
     "url": "https://github.com/jprichardson/node-klaw/issues"
   },
   "homepage": "https://github.com/jprichardson/node-klaw#readme",
+  "dependencies": {
+    "graceful-fs": "^4.1.9"
+  },
   "devDependencies": {
     "mkdirp": "^0.5.1",
-    "mock-fs": "^3.8.0",
     "rimraf": "^2.4.3",
-    "standard": "^8.4.0",
+    "standard": "^10.0.2",
     "tap-spec": "^4.1.1",
     "tape": "^4.2.2"
-  },
-  "optionalDependencies": {
-    "graceful-fs": "^4.1.9"
   }
 }
diff --git a/src/assign.js b/src/assign.js
deleted file mode 100644
index 69740f6..0000000
--- a/src/assign.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// simple mutable assign (extracted from fs-extra)
-// I really like object-assign package, but I wanted a lean package with zero deps
-function _assign () {
-  var args = [].slice.call(arguments).filter(function (i) { return i })
-  var dest = args.shift()
-  args.forEach(function (src) {
-    Object.keys(src).forEach(function (key) {
-      dest[key] = src[key]
-    })
-  })
-
-  return dest
-}
-
-// thank you baby Jesus for Node v4 and Object.assign
-module.exports = Object.assign || _assign
diff --git a/src/index.js b/src/index.js
index ae4a20e..0e5f869 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,26 +1,19 @@
 var assert = require('assert')
-var fs
-try {
-  fs = require('graceful-fs')
-} catch (e) {
-  fs = require('fs')
-}
 var path = require('path')
 var Readable = require('stream').Readable
 var util = require('util')
-var assign = require('./assign')
 
 function Walker (dir, options) {
   assert.strictEqual(typeof dir, 'string', '`dir` parameter should be of type string. Got type: ' + typeof dir)
   var defaultStreamOptions = { objectMode: true }
   var defaultOpts = { queueMethod: 'shift', pathSorter: undefined, filter: undefined }
-  options = assign(defaultOpts, options, defaultStreamOptions)
+  options = Object.assign(defaultOpts, options, defaultStreamOptions)
 
   Readable.call(this, options)
   this.root = path.resolve(dir)
   this.paths = [this.root]
   this.options = options
-  this.fs = options.fs || fs // mock-fs
+  this.fs = options.fs || require('graceful-fs')
 }
 util.inherits(Walker, Readable)
 
diff --git a/tests/walk_mockfs.test.js b/tests/walk_mockfs.test.js
deleted file mode 100644
index e3fc3cb..0000000
--- a/tests/walk_mockfs.test.js
+++ /dev/null
@@ -1,41 +0,0 @@
-var mkdirp = require('mkdirp')
-var mockfs = require('mock-fs')
-var os = require('os')
-var path = require('path')
-var test = require('tape')
-var klaw = require('../')
-var fixtures = require('./fixtures')
-var fs = mockfs.fs()
-
-test('walk directory on mockfs', function (t) {
-  var testDir = path.join(os.tmpdir(), '/does/not/matter/in/mockfs')
-  fixtures.forEach(function (f) {
-    f = path.join(testDir, f)
-    var dir = path.dirname(f)
-    mkdirp.sync(dir, { fs: fs })
-    fs.writeFileSync(f, path.basename(f, path.extname(f)))
-  })
-
-  t.plan(1)
-  var items = []
-  klaw(testDir, { fs: fs })
-    .on('readable', function () {
-      var item
-      while ((item = this.read())) {
-        items.push(item.path)
-      }
-    })
-    .on('error', t.end)
-    .on('end', function () {
-      items.sort()
-      var expected = ['a', 'a/b', 'a/b/c', 'a/b/c/d.txt', 'a/e.jpg', 'h', 'h/i', 'h/i/j',
-        'h/i/j/k.txt', 'h/i/l.txt', 'h/i/m.jpg']
-      expected = expected.map(function (item) {
-        return path.join(path.join(testDir, item))
-      })
-      expected.unshift(testDir)
-
-      t.same(items, expected)
-      t.end()
-    })
-})

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-klaw.git



More information about the Pkg-javascript-commits mailing list