Closed maoueh closed 6 years ago
I tested on Mac OS X the run part as well as all the init-*
tasks, all good. I will test on Windows today night when I get home.
based off @kferran's check it seems to be good. will merge. thanks again @maoueh!
@benjtinsley Thanks for taking care of merging, this slipped through and I completely forgot to come back!
commit 73b30596ec9961320befc5325846d8cb6bc4ee1c
Fixed process.cwd() changes and reverted previous fixes
Changing from
--gulpfile node_modules/blendid/gulpfile.js
to--gulpfile node_modules/blendid/gulpfile.js/index.js
had the unintended consequence of making theprocess.cwd()
not the same being one directory lower than before.As such, a workaround fix was performed in 19e4825 & 538c85c to make blendid assets now relative one level lower also.
This was not a proper fix and instead, the
bin/blendid
script has been updated to use one level lower by pointing to the previous directory directly instead of pointing to the main file of the directory. Previous modifications of previous workaround were reverted.As part of testing, fixed a bunch of small globbing problem with Gulp like .gitkeep files not copied or some other files not ignored correctly.
commit 262796320d40cf60b45235655c4d2f6ccf33e126
Fix resolution of calling project
package.json
file (Fixes #532)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 thePWD
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 https://github.com/gulpjs/gulp/commit/2bf23ba407a594ac8ee7e693ec93b17dd906f926 for the actual INIT_CWD implementation.
So, to fix the problem everywhere, added a function
resolveRelativeToProject
that does the correct resolving usingINIT_CWD
environment variable instead of the previously usedPWD
.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 ofpath.(resolve|join (process.env.PWD, ...)
that were used throughout the website are now usingprojectPath(...)
instead.Fixed bin script
blendid/gulpfile.js/index.js
resolution to use__dirname
instead ofrequire.resolve
. Therequire.resolve
does not work when usingyarn link
to developmentblendid
features. Indeed,require.resolve
does the resolution from the linked project leading toblendid
not being resolvable (because not present in the linkednode_modules
directory). By using__dirname
, we achieve the same goal as before but being more robust to linked project for development.