This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 680
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It appears that `process.env.PWD` is not consistent across platform as well as across sub-directory invocations. Indeed, even if it is consistent on Mac OS X (and probably Unix at the same time but untested), there is inconsitencies problem on Windows when using a POSIX transformer platform like Cygwin or MSYS2. Indeed, in those cases, `PWD` is not the canonical Windows path but the original POSIX path of the terminal. Furthermore, invoking from a sub-directory also fiddles with the `PWD` adding subdirectory into it. To fix that, it seems that Gulp is providing an environment variable that points to the root directory of the project and which is constant across platforms. See gulpjs/gulp@2bf23ba for the actual INIT_CWD implementation. So, to fix the problem everywhere, added a function `resolveRelativeToProject` that does the correct resolving using `INIT_CWD` environment variable instead of the previously used `PWD`. To make stuff easier to use next time, a `projectPath` function was added that does the resolving of paths relative to the project root directory. All previous usages of `path.(resolve|join)(process.env.PWD, ...)` that were used throughout the website are now using `projectPath(...)` instead. Fixed bin script `blendid/gulpfile.js/index.js` resolution to use `__dirname` instead of `require.resolve`. The `require.resolve` does not work when using `yarn link` to development `blendid` features. Indeed, `require.resolve` does the resolution from the linked project leading to `blendid` not being resolvable (because not present in the linked `node_modules` directory). By using `__dirname`, we achieve the same goal as before but being more robust to linked project for development.
- Loading branch information
1 parent
fea876c
commit 6809dd4
Showing
33 changed files
with
165 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var path = require('path') | ||
|
||
/** | ||
* A function that can be used to resolve a path relatively to the | ||
* project directory. | ||
* | ||
* We often want to resolve paths relatively to the project root | ||
* directory. To do that, we use the `INIT_CWD` environment variable | ||
* provided by Gulp. This variable always resolves to the project | ||
* root directory so we use it as the seed path and then add the | ||
* remaining arguments passed and resolving everything using the | ||
* `path.resolve` function. | ||
* | ||
* The returned path is a fully resolved absolute path relative to | ||
* the project root directory. | ||
*/ | ||
module.exports = function projectPath(...paths) { | ||
return path.resolve(process.env.INIT_CWD, ...paths); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.