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

deploy uses monorepo root for output instead of working dir or absolute path #4980

Closed
AWare opened this issue Jul 5, 2022 · 15 comments · Fixed by #5026
Closed

deploy uses monorepo root for output instead of working dir or absolute path #4980

AWare opened this issue Jul 5, 2022 · 15 comments · Fixed by #5026

Comments

@AWare
Copy link
Contributor

AWare commented Jul 5, 2022

pnpm version: 7.5.0

Code to reproduce the issue:

say you're in a project 'p' within a monorepo

> pnpm --filter p deploy dist
> pnpm --filter p deploy $(pwd)/dist

Expected behavior:

I'd expect them both to put them within the current working dir.

Actual behavior:

it will put dist within the root of the monorepo,

Additional information:

it would also be really handy to infer the package from the working directory so filter can be omitted

Edit: apologies, just realised I got expected and actual the wrong way round

@zkochan
Copy link
Member

zkochan commented Jul 5, 2022

I don't have objections to changing it, but I would be interested in more opinions. cc @pnpm/collaborators

@shellscape
Copy link
Contributor

please allow me some time to think about this. it's a very complex question.

@DRoet
Copy link

DRoet commented Jul 6, 2022

I think inferring the package/workspace from the working directory would be a nice addition. that's kind of what I expected when first running pnpm deploy without any options.

@JounQin
Copy link

JounQin commented Jul 6, 2022

This would a breaking change, and personally I'm always using dist/packageName, maybe we add pattern support like dist/$pkg + packages/$pkg/dist?

@zkochan
Copy link
Member

zkochan commented Jul 6, 2022

This command is experimental. Breaking changes are allowed.

@LeviticusMB
Copy link

I must say I was a bit surprised that pnpm --filter=... deploy /opt/foo/ didn't install anything at all in /opt.

AWare added a commit to AWare/pnpm that referenced this issue Jul 13, 2022
replaces path.join in deploy with path.resolve which will resolve relative and absolute paths to a relative path.
pnpm#4980
AWare added a commit to AWare/pnpm that referenced this issue Jul 13, 2022
…ry (pnpm#4980)

Previously the deploy target directory was specified as a relative path
to the workspace project root. This meant that absolute paths could not be used.
Now this uses the current working directory and allows absolute paths,
this is more in line with users expectations of unix command behaivour.

close pnpm#4980
@zkochan
Copy link
Member

zkochan commented Jul 13, 2022

@shellscape did you think about it?

A PR is submitted but I don't see enough feedback yet.

@shellscape
Copy link
Contributor

I've been sick the last few days. I'll weigh in tomorrow

@AWare
Copy link
Contributor Author

AWare commented Jul 14, 2022

If you're using ${workspaceDir}/dist/${pkg} then I'd wager that it's likely that when you build, your working directory might also be ${workspaceDir} whereas if you use ${workspaceDir}/${pkg}/dist, it's likely that you're going to be in ${workspaceDir}/${pkg}. So I'd posture that using the working dir is more natural for both cases (and matches most other things you'd be doing in the shell).

Regardless of where the target is relative to, absolute paths would make it much easier to use.

Also, were this adopted, a default filter of . would be nice to go alongside it- but I suspect that is where it gets complicated.

@AWare
Copy link
Contributor Author

AWare commented Jul 19, 2022

@shellscape did you have any objections to this?

@shellscape
Copy link
Contributor

Apologies. I've been sick this past week and have not been able to get back to this.

@AWare
Copy link
Contributor Author

AWare commented Jul 19, 2022

Hope you're feeling better soon.

@AWare
Copy link
Contributor Author

AWare commented Jul 25, 2022

Would it be preferred if the change just allowed absolute paths to be used instead of changing the base path?

@AWare
Copy link
Contributor Author

AWare commented Jul 27, 2022

@zkochan / @shellscape is there anything that I can do to help get #5026 reviewed & approved? the comments so far seem generally in favour, and I believe that I have addressed any objections satisfactorily. I'd really like to start using deploy in my projects at work, and am currently held up on this.

zkochan added a commit that referenced this issue Jul 27, 2022
)

* fix: plugin-commands-deploy use path resolve on deploy target directory (#4980)

Previously the deploy target directory was specified as a relative path
to the workspace project root. This meant that absolute paths could not be used.
Now this uses the current working directory and allows absolute paths,
this is more in line with users expectations of unix command behaivour.

close #4980

* fix: allow both absolute and relative

* docs: update changesets

Co-authored-by: Zoltan Kochan <z@kochan.io>
@AWare
Copy link
Contributor Author

AWare commented Jul 27, 2022

thanks @zkochan 👍

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

Successfully merging a pull request may close this issue.

6 participants