Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support lerna projects with yarn workspace integration #5

Open
jaimesangcap opened this issue Jan 28, 2018 · 6 comments
Open

Support lerna projects with yarn workspace integration #5

jaimesangcap opened this issue Jan 28, 2018 · 6 comments

Comments

@jaimesangcap
Copy link

Feature request

I'm using Lerna with yarn workspace integration. Below is my folder structure

* F:\greenfield\taskify
  | ----packages/
  | --------client/
  | ------------package.json
  | --------server/
  | ------------package.json
  | --------e2e/
  | ------------cypress/
  | ------------package.json
  | ----package.json
  | ----lerna.json

When I run the command (actual command after $):
F:\greenfield\taskify$ lerna add --scope=e2e @bahmutov/add-typescript-to-cypress --dev
or
F:\greenfield\taskify\packages\e2e $ yarn add --dev @bahmutov/add-typescript-to-cypress

I'm having the below error.

error F:\greenfield\taskify\node_modules\@bahmutov\add-t
ypescript-to-cypress: Command failed.
Exit code: 1
Command: node src/add-plugin.js
Arguments:
Directory: F:\greenfield\taskify\node_modules\@bahmutov\
add-typescript-to-cypress
Output:
⚠️ Cannot find "cypress" folder in F:\greenfield\taskify

Please scaffold Cypress folder by opening Cypress once
and then installing this package again
See: https://github.com/bahmutov/add-typescript-to-cypress

It seems like the process.cwd() is picking up the project root directory every time.

I've tried googling if it's possible to set the cwd when running the command but no luck.

@bahmutov
Copy link
Owner

bahmutov commented Jan 28, 2018 via email

@jaimesangcap
Copy link
Author

jaimesangcap commented Jan 28, 2018

Thank you for super quick response 😄

I'm just new to js/nodejs/npm world but I'm very willing to take a stab on this one.

@bahmutov
Copy link
Owner

Yeah, look at this file https://github.com/bahmutov/add-typescript-to-cypress/blob/master/src/add-plugin.js that is executed postinstall

@jaimesangcap
Copy link
Author

the postinstall works now, I've used lerna without yarn workspace integration. I will send a PR for the docs

@jaimesangcap jaimesangcap reopened this Jan 31, 2018
@jaimesangcap jaimesangcap changed the title Support yarn workspace or lerna projects Support lerna projects with yarn workspace integration Jan 31, 2018
@dshimkoski
Copy link

@jaimesangcap You can use nohoist to get around this problem.

For example, in a package.json:

{
  "private": true,
  "workspaces": {
    "packages": [
      "packages/*"
    ],
    "nohoist": [
      "**/@bahmutov/add-typescript-to-cypress",
      "**/@bahmutov/add-typescript-to-cypress/**"
    ]
  }
}

@mkaraula
Copy link

mkaraula commented Feb 6, 2020

I ran across this Issue today. I use lerna without yarn workspaces and therefore can't use nohoist in my package.json

I made it work with
npx lerna bootstrap --hoist --nohoist="@bahmutov/add-typescript-to-cypress"

But I would still prefer to have this fixed within this package. But I am not sure how tell it prior to installing it where the cypress folder is actually located. Any ideas how such a fix could look like?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants