Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Conversation

@ruyadorno
Copy link
Contributor

@ruyadorno ruyadorno commented Jul 3, 2021

This currently failing test ensures that lifecycle scripts for a link dep that is bundled within a package are also run during reify.

The gist of this test is that the package @ruyadorno/dep-with-a-link has a dependency which is a file: link to a folder inside its own tarball, this linked dependency has a "prepare" lifecycle script that should be run at reify in order to generate binaries it might rely on, you can see its contents here:

$ pacote extract @ruyadorno/dep-with-a-link@1.1.0 ./dep-with-a-link && cat ./dep-with-a-link/package.json && cat ./dep-with-a-link/linked-dep/package.json
{
  resolved: 'https://registry.npmjs.org/@ruyadorno/dep-with-a-link/-/dep-with-a-link-1.1.0.tgz',
  integrity: 'sha512-lMNI/+zSaSlNZ3m9JILIysu/A51qSfAtgBs36A4nLyuIBEWLvpuN6XOnWW5kKERjO55t9Z759wC1qKnW3IL1mg==',
  from: '@ruyadorno/dep-with-a-link@1.1.0'
}
{
  "name": "@ruyadorno/dep-with-a-link",
  "version": "1.1.0",
  "description": "A published package with a linked dep",
  "author": "Ruy Adorno <ruyadorno@hotmail.com> (https://ruyadorno.com/)",
  "license": "MIT",
  "dependencies": {
    "linked-dep": "file:linked-dep"
  }
}
{
  "name": "linked-dep",
  "version": "1.0.0",
  "scripts": {
    "prepare": "node -e \"require('fs').writeFileSync(require('path').resolve('linked-dep-prepare'), '')\""
  }
}

Now in order for this test to pass we need to make sure the prepare script for that linked dependency runs properly in order for the file linked-dep-prepare file to be generated as expected. Here's what the contents of that test fixture look like post reify:

 .
 ├── a
 │   ├── a-prepare
 │   └── package.json
 ├── node_modules
 │   ├── @ruyadorno
 │   │   └── dep-with-a-link
 │   │       ├── linked-dep
-│   │       │   ├── linked-dep-prepare
 │   │       │   └── package.json
 │   │       └── package.json
 │   ├── a -> ../a
 │   └── linked-dep -> @ruyadorno/dep-with-a-link/linked-dep
 ├── package-lock.json
 └── package.json

cc @isaacs

This test ensures that lifecycle scripts for a link dep that is bundled
within a package are also run during reify.
@fritzy
Copy link
Contributor

fritzy commented Jan 18, 2022

@ruyadorno Closing this in order to archive the repo.

@fritzy fritzy closed this Jan 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants