A section in https://redwoodjs.com/
That goes though how to create packages for redwood specifically. Like for example redwood-auth
, what it takes to build both api side as well the frontend and maybe how to create generators.
A section in https://redwoodjs.com/
That goes though how to create packages for redwood specifically. Like for example redwood-auth
, what it takes to build both api side as well the frontend and maybe how to create generators.
This is a great idea Not sure if our team has the bandwidth quite yet to do this now, but itās definitely on our radar.
For now if anyone is looking to dig into package development and how we handle things, you could start by with this doc (below) and attempt to get your local dev setup working.
Has anyone else already tried this and experienced success or challenges? If so, care to share your stories?
I think yarn build
needs to be emphasized more. Particularly after cloning redwoodjs/redwood
and running yarn install
. Right now, CONTRIBUTING.md doesnāt explicitly say to do this:
Assuming youāve already cloned
redwoodjs/redwood
locally and runyarn install
, navigate to thepackages/cli
directory and run the following command:yarn link
When trying to run chmod +x node_modules/.bin/redwood && yarn redwood generate page home /
(I didnāt generate scaffold MyModel
as written in CONTRIBUTING.mdāI assumed it would fail since I didnāt have a table named MyModel) in my testing app, I kept getting this error:
Cannot find module '/home/dominic/projects/redwood/redwood/node_modules/@redwoodjs/internal/dist/main.js'. Please verify that the package.json has a valid "main" entry
After actually reading the error message, I realized main.js
didnāt exist because I didnāt run yarn build
inside redwood/internal
. The only thing I built out was packages/cli
.
Amending that aforementioned paragraph in CONTRIBUTING.md would prevent this from being an issue:
Assuming youāve already cloned
redwoodjs/redwood
locally and runyarn install
andyarn build
, navigate to thepackages/cli
directory and run the following command:yarn link
100%, could you open a PR and mention that?
Speaking of yarn build
. I was wondering if itās possible to yarn link dependencies to the src
of the package. Then including these packages in the webpack babel-loader. This way thereās no need for yarn build
+ your local project linking to the redwood package would hot-reload on changes in the package!
Iām not sure if itās easy to do this. Iāve tried doing this with @redwoodjs/web
and it Almost Worksā¢
Weāre doing a similar thing at the company Iām working at. Except we donāt use yarn link
, but we just alias @com/package
to ../local-package
in our webpack.dev.config.js
@peterp @thedavid You think this is something worth looking into?
@Robert worth thinking about == yes, please!! This is something that comes up at least once a day. The local dev workflow between packages and the App is just, well, painful. I just got done with some work on my Windows virtual machine and about threw my physical machine out the window
Our thinking has been a bit different, but the webpack approach is really intriguing. Some early thinking was scribbled down in Issue #109 And @peterp recently started (then stopped) some work on this PR:
@peterp Curious to see what idea I gave you
If this is not a priority for the core team at the moment Iād be happy to give it a shot if you think itās something I can pick up
EDIT: I couldnāt stop myself from playing around with this and I got it to work with this commit: https://github.com/RobertBroersma/redwood/commit/e4f668f0f7d90cb19082479483589a820c527c45
This allows you to run yarn rw dev
in your project that has core
and router
symlinked and your project will hot-reload on editing files in the router
package.
I know this probably breaks a couple of things when releasing, but I thought Iād share it in case itās helpful!