This command-line tool allows you to generate React projects with TypeScript, pre-configured with dependency injection and the observable pattern for a robust and scalable state management. It is based on the Plume framework philosophy.
- React with TypeScript: Start your project with a solid foundation.
- Dependency Injection: Write modular and testable code.
- Observable Pattern: Manage your application's state in a predictable way.
- Two templates available:
frontandadminto fit your needs. - Ready for production: Pre-configured with Sonar and GitLab CI.
To create a new project, run one of the following commands in your terminal:
yarn dlx create-plume-react-project --template admin --projectName my-awesome-project
npx create-plume-react-project@latest --template admin --projectName my-awesome-project
Note: We recommend using
yarn dlxas it is generally more reliable for executing package binaries.
Once the project is created, you can run it with:
yarnto install the dependencies.yarn startto launch the development server.
You can customize the project generation by passing options to the command:
npx create-plume-react-project@latest --[optionName] [value]
| Option | Default Value | Available Values | Description |
|---|---|---|---|
template |
front |
front, admin |
The template to use for your project. |
projectName |
my-project |
Any string | The name of your project. It will be used in package.json and index.html. |
verbose |
false |
true, false |
Set to true to display additional debug information during the project creation process. |
targetDirectory |
Current directory | Any valid absolute path | The directory where the project will be initialized. |
templateDirectory |
The CLI's build/templates directory |
Any valid absolute path | A custom directory from which to load the templates. |
After creating your project, you may need to perform some additional configuration steps.
To set up SonarQube analysis, edit the sonar-project-frontend.properties file with your project's information:
# Example
sonar.projectKey=my-project-front-ui
sonar.projectName=My Awesome Project - Front UIA .gitlab-ci.yml file is included in the project with pre-configured jobs to build and analyze your application.
If you are using this frontend project within a Plume backend project, you should:
-
Copy the content of the frontend's
.gitlab-ci.ymlinto the backend's GitLab CI file. -
In each job, add a
cd <frontend_directory>command as the first step of thescriptsection.# Example Front UI build: # ... script: - cd my-awesome-project # ...
-
Delete the frontend's
.gitlab-ci.ymlfile.
If you want to contribute to this project, you can set up a development environment with the following steps:
yarnto install the dependencies.yarn buildto build the project.npm linkto create a symbolic link to the package.
You can then open a new terminal and test your changes by running:
npx create-plume-react-project@latest --template admin --projectName my-test-project
Important: Always use the
@latesttag to ensure you are using the latest version of the CLI and not a cached one.
To apply your changes, you will need to run yarn build after each modification.
Here are some ideas for future improvements:
- Interactive CLI: Use a library like
enquirerto ask for the options interactively. - More template options: Add modules for
i18n,material-ui,forms, andsession management. - Improved terminal output: Use a library like
chalkto add colors to the terminal output. - Automatic dependency installation: Use
execaorpkg-installto automatically install the dependencies after the project creation.
Contributions are welcome!