When using a tool like Lerna with hoisting (common dependencies installed in project root node_modules and not sub-project node_modules) or upcoming Yarn workspaces support, the resolving of blendid gulp main task file as well as gulp itself is broken.
The current script assumes resolution in the package directory while with these kind of tool, it get installed higher in the project hierarchy.
To solve this, we switched to require.resolve to resolve the actual location of the required files. This uses Node.js resolution mechanism to find the right package location.
The downside is that require.resolve returns the actual entry file and not the base package directory (blendid/gulpfile.js/index.js for require.resolve('blendid')). The implications is that if the entry file changes for blendid or gulp, the script is broken.
All in all, since we depends explicitly on particular versions of gulp, it should not be a problem to keep it in sync.
Can it be possible to have a look at this PR? I need to keep a customized bin/blendid script in all my projects now. I would like to remove it if possible :)
When using a tool like Lerna with hoisting (common dependencies installed in project root
node_modules
and not sub-projectnode_modules
) or upcoming Yarn workspaces support, the resolving ofblendid
gulp main task file as well as gulp itself is broken.The current script assumes resolution in the package directory while with these kind of tool, it get installed higher in the project hierarchy.
To solve this, we switched to
require.resolve
to resolve the actual location of the required files. This uses Node.js resolution mechanism to find the right package location.The downside is that
require.resolve
returns the actual entry file and not the base package directory (blendid/gulpfile.js/index.js
forrequire.resolve('blendid')
). The implications is that if the entry file changes forblendid
orgulp
, the script is broken.All in all, since we depends explicitly on particular versions of gulp, it should not be a problem to keep it in sync.