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

feat(cli): allow the ability to specify package manager in init command #6820

Merged
merged 4 commits into from
May 31, 2024

Conversation

binoy14
Copy link
Contributor

@binoy14 binoy14 commented May 30, 2024

Description

Adds --package-manager flag to the init command. If passed and valid, it will use this flag as the package manager when installing dependencies.

Note: I have not touched the nextjs init package manager choosing piece not sure if it should or not.

What to review

Changes and copy makes sense. You can still create new projects with and without this flag.

Testing

I manually tested different scenarios, this PR will unblock future PRs for testing the init command

Notes for release

  • Adds --package-manager flag to init command to choose a package manager

Copy link

vercel bot commented May 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 31, 2024 3:36pm
performance-studio ✅ Ready (Inspect) Visit Preview May 31, 2024 3:36pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 31, 2024 3:36pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 31, 2024 3:36pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 31, 2024 3:36pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview May 31, 2024 3:36pm

Copy link
Contributor Author

binoy14 commented May 30, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @binoy14 and the rest of your teammates on Graphite Graphite

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented May 30, 2024

Component Testing Report Updated May 31, 2024 3:41 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 39s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 7s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 31s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 15s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 3s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 21s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 30s 12 0 0

rexxars
rexxars previously approved these changes May 30, 2024
Copy link
Member

@rexxars rexxars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Left a small suggestion, but feel free to ignore.

Comment on lines 6 to 8
import {type PackageManager} from '../../packageManager/packageManagerChoice'
import {type CliCommandDefinition} from '../../types'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import {type PackageManager} from '../../packageManager/packageManagerChoice'
import {type CliCommandDefinition} from '../../types'
import {ALLOWED_PACKAGE_MANAGERS, type PackageManager} from '../../packageManager/packageManagerChoice'
import {type CliCommandDefinition} from '../../types'
const allowedPms = ALLOWED_PACKAGE_MANAGERS.map(pm => `"${pm}"`).join(' | ')

Then use ${allowedPms} in the help string, maybe?

Would help keep them in line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, I can make the change

// If the user has specified a package manager, and it's allowed use that
if (packageManager && ALLOWED_PACKAGE_MANAGERS.includes(packageManager)) {
pkgManager = packageManager
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like if the user specifies a disallowed package manager then we silently fall back to an allowed one. Should we warn the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can, what would the copy look like?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this?

output.print(`Given package manager "${packageManager}" isn't supported. Supported package managers are ${allowedPms}.`)
output.print(`Continuing using ${pkgManager}...`)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make sense?

Screenshot 2024-05-31 at 10 12 26 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good to me!

(However, we should consider supporting dog).

juice49
juice49 previously approved these changes May 31, 2024
Copy link
Contributor

@juice49 juice49 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

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

Successfully merging this pull request may close these issues.

None yet

3 participants