cra-template-bod
Version:
The advanced TypeScript template for Bod CLI.
112 lines (74 loc) • 4.03 kB
Markdown
# cra-template-bod
[](https://github.com/sabertazimi)
[](https://raw.githubusercontent.com/sabertazimi/bod/main/LICENSE)
[](https://www.npmjs.com/package/cra-template-bod)
[](https://www.npmjs.com/package/cra-template-bod)
[](https://cdn.jsdelivr.net/npm/cra-template-bod@latest/)
[](https://github.com/sabertazimi/bod/actions/workflows/ci.yml)
[](https://codecov.io/gh/sabertazimi/bod)
[](https://github.com/sabertazimi/bod/actions/workflows/ci.yml)
This is the official React template for [**Bod CLI**](https://github.com/sabertazimi/bod).
Based on templates:
- [React](https://github.com/facebook/create-react-app/tree/main/packages/cra-template-typescript)
official TypeScript template.
- [Redux](https://github.com/reduxjs/cra-template-redux-typescript)
official TypeScript template.
## Bod CLI
This template is shipped with
[**Bod CLI**](https://github.com/sabertazimi/bod) out of box:
```bash
# Select option `React Framework`
npx bod create my-app
```
## Development
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://create-react-app.dev/docs/running-tests)
for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode
and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://cra.link/deployment) for more information.
#### Building for Relative Paths
Specify the `homepage` in your `package.json`:
```json
{
"homepage": "http://mywebsite.com/relativepath"
}
```
Change `basename` of `Router`:
```tsx
<BrowserRouter basename="/calendar"/>
<Link to="/today"/> // renders <a href="/calendar/today">
```
See more details [https://create-react-app.dev/docs/deployment/#building-for-relative-paths].
## Create React App
To use this template with Create React App,
add
`--template bod --scripts-version @sabertazimi/react-scripts`
when creating a new app.
For example:
```bash
npx create-react-app my-app --template bod --scripts-version @sabertazimi/react-scripts
```
```bash
yarn create react-app my-app --template bod --scripts-version @sabertazimi/react-scripts
```
## Reference
You can learn more in the
[Bod](https://github.com/sabertazimi/bod) GitHub repository.
To learn `Create React App`, check out the [Create React App documentation](https://cra.link).
To learn `React`, check out the [React documentation](https://react.dev).
## Contact
[](mailto:sabertazimi@gmail.com)
[](https://twitter.com/sabertazimi)
[](https://github.com/sabertazimi)