add-typescript-to-cypress
add-typescript-to-cypress copied to clipboard
Support lerna projects with yarn workspace integration
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.
Hmm I am not testing with yarn or lerna, but feel free to add this feature and submit a pull request. Look how it copies files - you just need to somehow pass the correct folder cypress.
Sent from my iPhone
On Jan 28, 2018, at 09:46, Jaime Sangcap [email protected] wrote:
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\taskifyPlease 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.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
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.
Yeah, look at this file https://github.com/bahmutov/add-typescript-to-cypress/blob/master/src/add-plugin.js that is executed postinstall
the postinstall works now, I've used lerna without yarn workspace integration. I will send a PR for the docs
@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/**"
]
}
}
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?