Fix bolt install validations
https://github.com/boltpkg/bolt/pull/36 refactored bolt install and moved a bunch of validations into a shared module.
The problem is that these validations previously caused Bolt to exit early, now they aren't run until the linking phase.
These validations should be hoisted up
cc @lukebatchelor
Hmmm... I did notice it was moved, do you think itd be better to have the checked up location, or separated into another module?
I would break it into three steps:
async function install() {
let everythingNeededToSymlink = await validateAndReturnInstallSymlinksStuff();
await yarn.install();
await symlinkAllTheStuff(everythingNeededToSymlink);
}
Half way through, I realised we cannot move logic to get symlinks/ and validate for bin before install as it we don't know bin (s) until they are installed..
Should we just have validation logic for external and internal dependencies before install but validation for bin after install?
What are we validating with bins?
Following are the validation for bin
pathIsInside(actualBinFile, project.pkg.nodeModules)`
if (!actualBinFileRelative) {
throw new BoltError('${binName} is not a symlink');
}
There is a comment on this too:
// TODO: For now, we'll search through each of the bin files in the Project and find which ones are
// dependencies we are symlinking. In the future, we should really be going through each dependency
// and all of its dependencies and checking which ones expose bins so that all the transitive ones
// are included too