Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
f20b9eb2
...
f20b9eb23bfea0465d3d513c6cc0a882222e005d
authored
2014-07-31 16:41:09 +0200
by
Ludovic Perrine
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Search node_modules in parent directories until the root is reached (fixes #956)
1 parent
b62c37d9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
bin/bootstrap.js
bin/bootstrap.js
View file @
f20b9eb
...
...
@@ -248,7 +248,14 @@ CasperError.prototype = Object.getPrototypeOf(new Error());
return
resolveFile
(
path
,
fs
.
pathJoin
(
phantom
.
casperPath
,
'modules'
));
}
function
nodeModulePath
(
path
)
{
return
resolveFile
(
path
,
fs
.
pathJoin
(
getCurrentScriptRoot
(),
'node_modules'
));
var
resolved
,
prevBaseDir
;
var
baseDir
=
getCurrentScriptRoot
();
do
{
resolved
=
resolveFile
(
path
,
fs
.
pathJoin
(
baseDir
,
'node_modules'
));
prevBaseDir
=
baseDir
;
baseDir
=
fs
.
absolute
(
fs
.
pathJoin
(
prevBaseDir
,
'..'
));
}
while
(
!
resolved
&&
baseDir
!==
'/'
&&
baseDir
!==
prevBaseDir
);
return
resolved
;
}
function
localModulePath
(
path
)
{
return
resolveFile
(
path
,
phantom
.
casperScriptBaseDir
||
fs
.
workingDirectory
);
...
...
Please
register
or
sign in
to post a comment