bolt icon indicating copy to clipboard operation
bolt copied to clipboard

Fix bolt install validations

Open jamiebuilds opened this issue 8 years ago • 6 comments

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

jamiebuilds avatar Oct 22 '17 02:10 jamiebuilds

cc @lukebatchelor

jamiebuilds avatar Oct 22 '17 02:10 jamiebuilds

Hmmm... I did notice it was moved, do you think itd be better to have the checked up location, or separated into another module?

lukebatchelor avatar Oct 22 '17 04:10 lukebatchelor

I would break it into three steps:

async function install() {
  let everythingNeededToSymlink = await validateAndReturnInstallSymlinksStuff();
  await yarn.install();
  await symlinkAllTheStuff(everythingNeededToSymlink);
}

jamiebuilds avatar Oct 22 '17 06:10 jamiebuilds

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?

ajaymathur avatar Feb 03 '18 12:02 ajaymathur

What are we validating with bins?

jamiebuilds avatar Feb 06 '18 00:02 jamiebuilds

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

ajaymathur avatar Feb 06 '18 05:02 ajaymathur