-
Notifications
You must be signed in to change notification settings - Fork 970
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
Add workflows for local development #429
Conversation
@peterp Thanks for this! I tried it out on my PR (#423) and everything Just-Works. The one hitch I ran into was that there wasn't a Here's some of my thoughts so far:
|
@peterp I’m coordinating with Dominic on some other Documentation efforts, so chiming in here. But of course please correct/add as needed.
^^ Correct, this will show up in the next release. You did the correct process for testing/using now.
^^ I think this is fine for now. But 100% agree it’s probably not perfect. For development-specific tooling, though, we have a lot more margin for making adjustments and breaking changes as we go right now. I’d say ship as is.
^^ One important aspect is to not include it in the list when you type “yarn rw —help”, which would be confusing to people developing (and not contributing). (note for @peterp I believe there is a Yargs method of hiding a command, but then we have other problems… so I like overall the direction to make tooling commands their own set.)
^^ Ah, I see your confusion here. First off, there are two different ways Peter is stating that you can set up local development 1) Watch and copy and 2) Emulating package publishing. Number 1 is a bit “easier” and/or “lightweight”, but it does not work in all cases. Number 2 is more of a “heavy lift” but will always work (it’s just not always needed). If your focus is code changes or additions (including files), then Number 1 will work. If you are making any changes or running tests that include Package-level concerns -- e.g. new version, add package, remove package, etc. — you have to use workflow Number 2. |
I initially called it |
For me, "dev" is confusing between contributing vs. application development. So "tools" is more intuitive on my end. Maybe "redwood-tools" with the alias "rwt"? |
Totes, @thedavidprice, could you handle the rename and alias? |
@peterp Some more thoughts as I'm using it more: What do you think of this structure: When a path isn't supplied to
Maybe it should say something like
When I supply a false RW_PATH (here,
Ideally it should fail right? I can try to tackle any of these changes--lemme know what you think. |
Totally, that makes 100% more sense. Could you add an alias The path errors would be great too! with the wrong path it is kinda difficult to determine when it is a redwood project, but maybe you could import package.json and look at the name? |
Local development
When contributing to Redwood you'll often want to add, fix, or change something in the Redwood Framework's monorepo, and see the implementation "running "live" in your own side project or one of our example apps.
We offer two workflows for making that possible: "watch and copy" with some restrictions, and "emulate npm" without restrictions. The consideration for using the "emulate npm" workflow is if you've installed or upgraded a dependency, otherwise the "watch and copy" workflow should be fine.
Watch and copy
The first step is to watch files for changes and build those changes in the Redwood framework:
The second step is to watch and copy those changes into your Redwood project:
You can also create a
RW_PATH
env var and then you don't have to specify the path in the watch command.Now any changes that are made in the framework are copied into your project.
Emulating package publishing
Sometimes you'll want to test the full development flow from building and publishing our packages, to installing them in your project. We facilitate this using a local NPM registry called Verdaccio.
Setting up and running a local NPM registry
This starts Verdaccio (http://localhost:4873) with our configuration file.
Publishing a package
./tasks/publish-local
will build, unpublish, and publish all the Redwood packages to your local NPM registry with a "dev" tag, for the curious it is the equivalent of running:You can build a particular package by specifying the path to the package:
./tasks/publish-local ./packages/api
.Installing published packages
Redwood installs
rwdev
a companion CLI development tool that makes installing local npm packages easy:yarn rwdev install @redwoodjs/dev-server
.This is equivilant to running: