EmberExperts / ember-cli-deploy-netlify-cli

Integrate your deploy pipeline with netlify manual deploys using netlify-cli.
2 stars 1 forks source link

Doesn't seem to work well with monorepos #3

Open abhilashlr opened 4 years ago

abhilashlr commented 4 years ago

For a project folder structure like:

repo
|--- packages
|    |--- host-app => `ember deploy production` will be run in here
|    |--- addon-1
|    +--- addon-2
+--- node_modules/.bin/netlify

The deploy plugin is expecting the node_modules to be under host-app folder due to this line. Perhaps, workspaces/monorepos create the node_modules at the root of the repo.

The plugin should detect if it is run from a workspace configured ember app and if so, not expect it to have the node_modules but the root one.

One possible solution I could think of is to use npx based commands for this same LoC and prevent the need for a devDependency of netlify.

Exelord commented 4 years ago

Yep, we could find some solution for that :)

abhilashlr commented 4 years ago

Seems to be weird today for me that the same path node_modules/.bin/netlify is available inside packages/host-app/ path 🤦 . Not sure what was the issue before. We can go ahead and close this and choose to reopen if I find the trace of this issue. Thanks for your time @Exelord 👍

MichalBryxi commented 4 years ago

👋 This is a real issue. I am able to bypass this by putting following nohoist option into root package.json. I tried various combinations and this seems to be the minimum viable set:

{
  "name": "monorepo",
  "private": true,
  "workspaces": {
    "packages": [
      "frontend",
      "monorepo-components"
    ],
    "nohoist": [
      "**/ember-cli-deploy-netlify-cli", 
      "**/netlify", 
      "**/ember-cli-deploy-netlify-cli/**", 
      "**/netlify/**"
    ]
  },
}

Then I will get:

❯ ls -alh frontend/node_modules/.bin/netlify
lrwxr-xr-x  1 michal  staff    22B 18 Jul 20:55 frontend/node_modules/.bin/netlify -> ../netlify-cli/bin/run

Documenting for future travelers.

But it would be better if the users of this library would not have to do such hacks.