-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fixes withastro/astro#7793 astro add cli pass down arguments to install cmd #7794
Conversation
🦋 Changeset detectedLatest commit: 613cad9 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
You could test locally and see if it works as expected:
That's how I usually test the CLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your fix! The changelog is missing and should be added
@@ -18666,7 +18666,6 @@ packages: | |||
resolution: {directory: packages/astro, type: directory} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes should be reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's caused by the latest pnpm version
const inheritedFlags = Object.entries(flags) | ||
.map(([flag, value]) => { | ||
if (flag == '_') return; | ||
|
||
return [`-${flag}`, value.toString()]; | ||
}) | ||
.filter(Boolean) | ||
.flat(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should pass everything down. To be safe, we can scope to --save-dev
, -D
etc only. In case we support more options in the future, this part won't be glossed over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why we should only pass those down. It's essentially giving back the normal functionality with flags to the cli. It will work as pnpm without the astro add
wrapper. Please let me know if I am missing something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think astro add
shouldn't be seen as pnpm add
but smarter. It does a lot more like editing configs, adding integration-specific configs etc. The installation phase is one of the steps for astro add
. So passing the args directly to that single step is a bit off to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @bluwy that we should only support --save-dev
and -D
for now.
@ematipico Yes I did test it locally, sorry I wasn't clear enough, I meant no unit tests. I'll make the changelog tomorrow |
Could you please update the template, then? It's important to state that you tested the feature. Even a manual test is important. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good but I'd also like to reduce the scope of this change to only allow -D
and --save-dev
for now.
Also if you could remove/resolve the lockfile changes, that would be great.
const inheritedFlags = Object.entries(flags) | ||
.map(([flag, value]) => { | ||
if (flag == '_') return; | ||
|
||
return [`-${flag}`, value.toString()]; | ||
}) | ||
.filter(Boolean) | ||
.flat(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @bluwy that we should only support --save-dev
and -D
for now.
I'm working on the pr, and I'm thinking that we could allow all flags supported by
|
Closing in favor of #8032 so we can get this merged! Unfortunately I wasn't able to push to your fork so I had to push your commits to one of our branches. |
Changes
astro add
cliTesting
I tested it locally, running
astro add astro-compress -D
ranpnpm add astro-compress -D true
Docs
I think it should be in the docs
/cc @withastro/maintainers-docs for feedback!