From 7b8a293f30335e1ddc2f9695b291e257e75610dd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Oct 2014 08:38:33 -0700 Subject: [PATCH] Inline path to listSync call --- src/module-cache.coffee | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/module-cache.coffee b/src/module-cache.coffee index 378cf900c..26b98309b 100644 --- a/src/module-cache.coffee +++ b/src/module-cache.coffee @@ -11,8 +11,7 @@ cache = ranges: {} loadDependencies = (modulePath, rootPath, rootMetadata, moduleCache) -> - nodeModulesPath = path.join(modulePath, 'node_modules') - for childPath in fs.listSync(nodeModulesPath) + for childPath in fs.listSync(path.join(modulePath, 'node_modules')) continue if path.basename(childPath) is '.bin' continue if rootPath is modulePath and rootMetadata.packageDependencies?.hasOwnProperty(path.basename(childPath)) @@ -40,7 +39,6 @@ loadFolderCompatibility = (modulePath, rootPath, rootMetadata, moduleCache) -> metadataPath = path.join(modulePath, 'package.json') return unless fs.isFileSync(metadataPath) - nodeModulesPath = path.join(modulePath, 'node_modules') dependencies = JSON.parse(fs.readFileSync(metadataPath))?.dependencies ? {} for name, version of dependencies @@ -65,7 +63,7 @@ loadFolderCompatibility = (modulePath, rootPath, rootMetadata, moduleCache) -> if paths.length > 0 and Object.keys(dependencies).length > 0 moduleCache.folders.push({paths, dependencies}) - for childPath in fs.listSync(nodeModulesPath) + for childPath in fs.listSync(path.join(modulePath, 'node_modules')) continue if path.basename(childPath) is '.bin' continue if rootPath is modulePath and rootMetadata.packageDependencies?.hasOwnProperty(path.basename(childPath))