-
Notifications
You must be signed in to change notification settings - Fork 1k
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): Setup command which uses an npm package #8920
Conversation
Made it easier to test and could be useful to third parties in the future.
I marked this as |
I rebuilt the fixture yesterday. It failed on the first try. But running again it got all the way through |
Okay @jtoar I think I've addressed the points you raised when we talked about this. It should be in a state for review now. There's less of the uncaught erroring out but I can't say the UI of this is great right now. I think this is likely just difficult because I feel we lack a consistent style or approach to CLI output at the moment. When it comes to testing it out the package I published has a few different depencency ranges which you can see from the packument here: https://registry.npmjs.org/@joshgmw/rw-setup-example. That and manipulating your package.json @redwoodjs/core version should hopefully let you test the various cases. Happy to iterate on this further if you feel things are quite right with it. |
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.
@Josh-Walker-GM awesome work! thanks for providing a published package to test it out with. and love the tests! here's what i've got so far. will probably review one more time.
this kind of error seems unrecoverable right? if we continue, it's just going to fail. maybe we should just exit and skip the prompt? you can't run something that's not published:

@jtoar I've updated based on your feedback thanks! I was happy to swiftly exit when the package doesn't have the version or tag requested - as you said it'll error out a few seconds later anyway. |
**Problem** We want to allow users to run arbitary setup commands that come from npm packages. This is similar to the functionality of `npx` or `dlx` but we want to allow additional redwood specific behaviour. Specifically for now we want to ensure version compatibility between the setup package and the redwood version of the user's project. **Notes** I published the package `@joshgmw/rw-setup-example` as a means of testing the functionality in this PR. **Changes** 1. Adds a `yarn rw setup package <npm-package>` command which will: 1. Find the provided package on npm and check version compatibility 2. Run `yarn dlx` with that package at the user project root **Notes** The UI of this isn't amazing but I don't really know what our consistent design for the CLI is. The naming of the command or where it sits in the command hierarchy is something I'm happy to change if we feel the further need to.
**Problem** I left in a console.log in #8920 which should have been removed before merging **Changes** 1. Removes the offending console.log
**Problem** I left in a console.log in #8920 which should have been removed before merging **Changes** 1. Removes the offending console.log
Problem
We want to allow users to run arbitary setup commands that come from npm packages. This is similar to the functionality of
npx
ordlx
but we want to allow additional redwood specific behaviour. Specifically for now we want to ensure version compatibility between the setup package and the redwood version of the user's project.Notes
I published the package
@joshgmw/rw-setup-example
as a means of testing the functionality in this PR.Changes
yarn rw setup package <npm-package>
command which will:yarn dlx
with that package at the user project rootNotes
The UI of this isn't amazing but I don't really know what our consistent design for the CLI is.
The naming of the command or where it sits in the command hierarchy is something I'm happy to change if we feel the further need to.