Skip to content

Doesn't link .bin files #274

Closed
Closed

Description

@tjbenton

If a project has a cli for it declared in the package.json, it get's ignored during lerna bootstrap.

Here's what I expected to get

├── package-1/
│   ├── bin/
│   │   └── cli-tool
│   ├── index.js
│   └── package.json
└── package-2/
    ├── node_modules/
    │   ├── .bin/
    │   │   └── cli-tool
    │   └── package-1/
    │       ├── index.js
    │       └── package.json
    └── package.json
```pack

Activity

  1. rygine commented on Jul 12, 2016

    @rygine
    Contributor

    @tjbenton this is fixed via PR #192

  2. jamiebuilds commented on Jul 13, 2016

    @jamiebuilds
    Contributor

    There's a bunch of issues about linking already, closing this

  3. thomasklein commented on Jan 6, 2017

    @thomasklein

    Hi guys! First of all, thanks for lerna!

    @rygine I'm using node 6.6.0, npm 3.10.3 and lerna 2.0.0-beta.31 and the issue is happening to me when another level of nesting is added.

    My setup:

    package-1
       package.json (dependency: eslint)
    package-2
       package.json (dependency package-1)
       package.json.scripts
          "lint": "eslint"
    

    In package-2 no node_modules/.bin directory is created and therefore eslint is not found. I only get package-1 symlinked in package-2/node_modules.

    Why do I even have this setup? package-1 should group dependencies - kinda preset style.

  4. rygine commented on Jan 6, 2017

    @rygine
    Contributor

    @thomasklein i believe this is working as intended. however, if all dependencies are hoisted, that's a different story. can you post your dependencies for each of those packages, and what kind of bootstrap you are running?

  5. thomasklein commented on Jan 7, 2017

    @thomasklein

    Sure! I forgot to mention that in my case the packages are scoped; although my understanding is that it shouldn't make a difference...

    package.json
        "dependencies": {
            "lerna": "^2.0.0-beta.31" 
        }
    lerna.json
        "lerna": "2.0.0-beta.31",
        "version": "1.0.0"
    packages
         @company/package-1
              "version": "1.0.0",
               "dependencies": {
                    "eslint": "^3.12.2"
               }
         @company/package-2
              "dependencies": {
                   "@company/package-1": "^1.0.0"
              },
              "scripts": {
                   "lint": "eslint"
              }
    

    (basically what I had posted before)

    From within rootI run ./node/modules/.bin/lerna bootstrap.

    Meanwhile I wrote myself shell scripts that create the symlinks to the "binary" executables on scripts.postinstall.


    System: Mac
    node: 6.6.0
    npm: 3.10.3

  6. rygine commented on Jan 9, 2017

    @rygine
    Contributor

    @thomasklein i think what you're experiencing is the correct behavior. the original issue filed had to do with package binaries (not dependency binaries) being symlink'd. since each of your packages can operate independent of each other, they should all declare eslint as a dependency, if they rely on it.

    does that make sense?

  7. thomasklein commented on Jan 10, 2017

    @thomasklein

    Hi Ry! Thanks for taking your time on this, much appreciated!

    A pity that the npm docs are not really verbose about it...

    Setup for a package.json

    {
      "name": "name",
      "version": "1.0.0",
      "description": "description",
      "dependencies": {
        "eslint": "3.12.1"
      }
    }
    

    Now if you run npm install && ls node_modules/.bin you should get

    acorn               esvalidate          rimraf
    eslint              js-yaml             shjs
    esparse             mkdirp              strip-json-comments
    

    E.g. esparseis only a transitive dependency but nevertheless I have now it's executable available.

    In that sense my example is similar, where eslintis a transitive dependency and it's exported bin should therefore also be available in the node_module/.bin folder.

  8. lock commented on Dec 28, 2018

    @lock

    This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  9. locked as resolved and limited conversation to collaborators on Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions