From f5e76adccaf8e470b6175b84e11d6604ba1ccc4b Mon Sep 17 00:00:00 2001 From: Christian Gaetano Date: Fri, 5 May 2017 09:24:29 -0400 Subject: [PATCH 1/2] Only normalize file paths rather than verify them This provides huge performance improvements and respects symlink paths. Node-glob should only be matching real files, and pruneLibrary() gives users the ability to remove entries that don't lead to files. --- src/lib/TrackedFile.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/TrackedFile.js b/src/lib/TrackedFile.js index 08b52cc..2be5538 100644 --- a/src/lib/TrackedFile.js +++ b/src/lib/TrackedFile.js @@ -1,4 +1,3 @@ -import fs from 'fs'; import path from 'path'; /** The path and current hash of a file to be tracked by Impostr. */ @@ -11,7 +10,7 @@ export default class TrackedFile { */ constructor(filePath) { try { - this.path = fs.realpathSync(path.normalize(filePath)); + this.path = TrackedFile.formatAnyPath(filePath); this.hash = ''; } catch (readErr) { throw readErr; @@ -24,6 +23,6 @@ export default class TrackedFile { * @return {string} A file path in the format used by the Impostr library. */ static formatAnyPath(inputPath) { - return fs.realpathSync(path.normalize(inputPath)); + return path.normalize(inputPath); } } From cabed3abffbd5efb7870439b112c7be00daf13f2 Mon Sep 17 00:00:00 2001 From: Christian Gaetano Date: Fri, 5 May 2017 09:27:11 -0400 Subject: [PATCH 2/2] Version bump for file path changes --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d8e070e..c4c06de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "impostr", - "version": "0.1.9", + "version": "0.1.10", "description": "Impostr helps you keep track of who's who and what's what. Simple caching tool for checking for file changes over time.", "main": "build/impostr.js", "repository": "https://github.com/cgatno/impostr",