Closed anikethsaha closed 4 years ago
How may i help?
hey, @khobabc , thanks for responding. Maybe you can create a doc site for this using any of the doc site generators like docusaurus, docz, etc and I will host it. Or you can help with the existing documentation with more information on it. Please reach out to me if you have any doubts or suggestions. You can give your suggestions here too.
@anikethsaha I would go ahead with docusaurus and a doc site. I'll open PR once done or I hope I can ping you if I have some questions.
Great. Yeah sure do ping me anytime. My twitter Handle @anik220798
@anikethsaha I got busy with my job and personal stuff and do not see myself completing this in foreseeable future. Please feel free to assign it to anybody else.
@khobabc no issue man !. Will keep it open this for a while !
Hi @anikethsaha , I'd be interested in helping out. Actually, I tried to follow both existing setup directions and wasn't able to get the project to build locally, so I would have a few questions first :)
That's strange 😕 please ask your questions!.
You can simply clone and di npm install
after I clone and do npm install, then I try npm run build, but I get this error:
ERROR in ./src/common/components/app.jsx
Module not found: Error: Can't resolve '../../client/redux' in '/Users/angelicao/projects/MERN-Boilerplate/src/common/components'
@ ./src/common/components/app.jsx 9:0-43 31:15-20
@ ./src/server/controller/ssr.js
@ ./src/server/index.js
Have you seen it before? Maybe I'm missing something.
and I haven't used the create-web-app before this so I'm not familiar with it, but when I try the steps exactly in the readme, I get this:
ERROR No command specified.
Run $ cwa --help
for more info.
I tried to play around with other steps based on a very quick read of the docs. I tried cwa run MERN-Boilerplate --src
but I get this:
FINDING Finding your project MERN-Boilerplate in
ERROR [src] doesn't exist
Do you know the right steps here?
Thanks in advance!!
Don't use cwa
with this now.....actually, that is a different project which is using a copy of this project.
Actually, as per your logs, this seems a bug....there must be some import/export mismatched Thanks, @omaiyea for pointing out!
If you can fix that it would be really helpful. Just need to check with the import directories.... You can submit a separate PR for that too. Else I will try to fix it as soon as I get some free time !
Hey @anikethsaha
I was trying to bootstrap your app, Found the getting started section of readme very much misleading 🤔. But, somehow, I managed to get the "Hello" text printed in the web browser 🙂.
Following things were missing:
cross-env
and nodemon
- not mentioned in devDependencies
of package.json but are being used as commands in npm scripts.npm run build
to start watching the UI code via the webpack server in development mode.npm run client:dev
to start the nodemon server.If you think all the above makes sense, let me know so that I can send the Pull Request (containing the fix and the updated readme) which fixes the repo's setup for others to start contributing in even a better manner 😇.
Thanks a lot for pointing those errors. Yeah I got some export/import mismatch as well
Your suggestions looks good to me , Just few corrections
The export statement in the server's index.js is not required as it causes an error when starting the nodemon server
I guess exporting apps should not create nodemon err. And we need that app in order to tests the server. So I guess you can leave this.
The path to the redux store was incorrect and wrongly placed for store initialization.
Yea this is an issue, go for it 👍
cross-env and nodemon - not mentioned in devDependencies of package.json but are being used as commands in npm scripts.
Yeah add them in the devDependecies 👍
npm run client:dev
to start the nodemon server.
it's server:dev
not client:dev
. 👍
About the last point you can mention that -
npm run server:dev
this will start the development node+express server and will render the client in the mentioned portnpm run watch
command, and start making changes in src/client
, src/server
and src/common
folders. (I changed the build
cmd to watch
cmd, check this https://github.com/anikethsaha/MERN-Boilerplate/commit/2a23b8691a4e716fe35b2c54302595a98a19c8cf)npm run server:prod
You can add these points to the npm scripts description.
1st Priority It will be to fix those exports errors.
Hey, @anikethsaha I was occupied yesterday. I'll pick this up today.
Yeah sure, no hurries :+1:
Hey @anikethsaha
cross-env and nodemon - not mentioned in devDependencies of package.json but are being used as commands in npm scripts.
I think cross-env
can be moved to dependencies
of package.json while still keeping nodemon
in the devDependencies
as cross-env is a part of production mode script while nodemon is being used in development mode script only.
The export statement in the server's index.js is not required as it causes an error when starting the nodemon server.
The error was being caused because we were using the import and module.exports in the same file. Check this out
Also, do I push the changes in public/ or bin/ because I am not sure how these need to be updated when sending a PR?
as cross-env is a part of production mode script while
Actually those script will be running from developer's terminal so I guess it can be used in devdependencies . While in production. Only public
(for frontend) and bin
(for server) folder will be shipped. And they should not be hacing any dev-dep. we need dep only related to code. and may be a advance production supporting node runtime wrapper like forever
or PM2
. So in the server:prod
script it can be changed to these. But Still I would Iike to have a discussion upon them.
server:prod
will be runned on the hosted server 's terminal not in the user's terminal !. and that script is wrong it has to be bin/server/server.js
Also, do I push the changes in public/ or bin/ because I am not sure how these need to be updated when sending a PR?
Also leave the bundled output. Anyway I am going to remove public/js
folder. no need of uploading in the repo. Cause it gonna be change
The error was being caused because we were using the import and module.exports in the same file. Check this out
Yea I guess that can be the reason. You can create a separate PR we can discuss there
server:prod will be runned on the hosted server 's terminal not in the user's terminal !. and that script is wrong it has to be bin/server/server.js
ok, 👍
Also leave the bundled output. Anyway I am going to remove public/js folder. no need of uploading in the repo. Cause it gonna be change
👍
Yea I guess that can be the reason. You can create a separate PR we can discuss there.
This fix is available in #102
Yea I guess that can be the reason. You can create a separate PR we can discuss there
Ok, i am removing the change from #102 and creating a separate PR for this.
Also, i'll squash the commits when the PR #102 is reviewed and changes are reflected successfully.
I am going to keep this open as we can have docs + tutorial site for this along with the demo #103 of this.
PS:
I tried to add this in @CodeSandbox but I faced some issues regarding the ports may, IDK why !. Also for MongoDB, if @CodeSandbox has mongodb enabled in any of there port say 27017
then we can use using localhost itself but I dont think they have installed or not. I tried to use mongodb cloud and I kept the password in the @CodeSandbox secret which can be accessed by node's env variable but I guess it won't be safe as we can console.log the env variables and it will be logged.
Any other suggestions ?
Docs
The present documentation is fine but not so good and beginner friendly as most of the boilerplates are used as references by beginners.
It would have been better if it's more information-rich, more emojis (for friendly experience), more supporting links, better looks.
I have a plan to make a better doc using any doc creating tools or any library. Would Love to get help in this too
😃
Thanks