Thinking about getting involved with the generator? Great!
Following these guidelines helps to communicate the core ideas and the purpose of the project. Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
The generator structure is based on the same idea as Create React App. We created a full boilerplate and we are using react-scripts
to run our development server and create the build.
We are using react-scripts because it is fully supported by the community and includes the best and most up to date react standards.
The purpose of this tool is to generate an opinionated template with the Jam3's standards and best practices. This template doesn't have configurations or prompts like yeoman or nyg
We included in the project the most commonly used components and directory structure, it doesn't mean you need to use all of it and in that case our strategy is to delete those files instead of having a massive configuration file with many different cases, as this is usually hard to maintain. Probably in the future we decide to fork react-scripts
but hasn't been decided.
Instead of letting the user specify the entry filename, we always assume it to be src/index.js
. Rather than letting the user specify the output bundle name, we generate it, but make sure to include the content hash in it. Whenever possible, we want to leverage convention to make good choices for the user, especially in cases where it’s easy to misconfigure something.
One of the core ideas of the generator is to create a project template that is easy to maintain, one of the ways to achieve that is to reduce the amount of variable replacements when the project is being generated.
This project is using nyg
and it does provide ways to add prompts, however we are trying to avoid any kind of prompt, or at the very least only add ones that are important and won't affect the maintenance of the project.
No rules are perfect. Sometimes we may introduce flags or configuration if we believe the value is high enough to justify the mental cost. For example, we know that apps may be hosted on paths different from the root, and we need to support this use case. However, we still try to fall back to heuristics when possible. In this example, we ask that you specify homepage
in package.json
, and infer the correct path based on it. We also nudge the user to fill out the homepage
after the build, so the user becomes aware that the feature exists.
Good pull requests, such as patches, improvements, and new features, are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
Please ask first if somebody else is already working on this or the core developers think your feature is in-scope for Create React App. Generally always have a related issue with discussions for whatever you are including.
Once you know you are the only one working on this, please assign the issue to yourself.
Please also provide a test plan, i.e. specify how you verified that your addition works.
Don't forget to document in the repository your new change or patch. You should use the README.md DEVELOPER_GUIDE.md or FEATURES.md
After a PR is merged, you should:
- Update the CHANGELOG.md file
- Bump the package.json version (major, minor, patch)
- Create a tag (release in github)
templates
: It contains the files and folders needed to generate the app.test
: After runningnpm test
it will copy the app into theoutput
directory
The entry point of the generator is index.js
, this file is in charge of:
- Copying the
templates
directory into theoutput
directory - Runs
npm install
once it has copied all the files - Runs the post-install tasks
- Updates the node version inside
.nvmrc
- Updates the node version inside
- Clone the repo with
git clone https://github.com/Jam3/nyg-jam3.git
- Here you can start contributing with:
- The generator, modifing the
index.js
- The template that will be generated inside
templates/*
- The generator, modifing the
Because the whole template is self-contained in the templates
directory, you have total control over it.
You can run the project using npm start
or if you wanna try the build, run npm run build
To test the whole generator installation, exactly how it will happen when the users execute it, run npm test
. You can find the generated project in test/output