Skip to content

Commit

Permalink
Add necessary libraries, update README and minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shreeyash07 committed Jan 9, 2025
1 parent bbe3839 commit b9eff4b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 166 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts=true
76 changes: 0 additions & 76 deletions CHECKLIST.md

This file was deleted.

103 changes: 18 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,24 @@
# React Base App
# Tc Global Notes Dashboard

React base app with some oompf
Dashboard for all the notes of togglecorp

## What is included?
## Built with
[![React][react-shields]][react-url] [![Vite][vite-shields]][vite-url] [![Typescript][typescript-shields]][typescript-url]

### Vite
### Prerequisites

- Sourcemaps are generated on production build
- `tsc`, `eslint` and `stylelint` are run on production build.
- All of the assets will be compressed on production build.
- The build is be placed under `build/` directory
To begin, ensure you have network access. Then, you'll need the following:

### React
1. [Git](https://git-scm.com/)
2. [Node.JS](https://nodejs.org/en/) version >=18 / 20+
3. [Pnpm](https://pnpm.io/)
4. Alternatively, you can use [Docker](https://www.docker.com/) to build the application.

- Vite is configured with React Refresh
- SWC is used instead of Babel

### PostCSS

PostCSS is configured with the following plugins:

- Preset Env
- Nested CSS
- Normalize CSS
- Autoprefixer
- CSS Modules

### Web Fonts

- Web fonts are downloaded and bundled in the production build.
- Valid web font providers are:
- Google Fonts
- Bunny Fonts
- Fontshare

### SVG Imports

- SVGR handles all type of SVG and transforms it into a React component.

### Absolute Imports

- Vite is configured to resolve absolute imports defined on `tsconfig.json`

### Environment Variables

Only environment variables prefixed by `APP_` will be passed to the application

Variables can be defined using:

- `.env` file
- Use `.env` file to define secrets.
- `docker-compose` file
- Use `docker-compose` file to define rest of the env variables.

The user defined environment variables are validated using the configuration at `./env.ts`
The typings for environment variables are defined at `./src/declarations/env.d.ts`.

### Git Revision

The commit hash is passed to the application through the environment variable `APP_COMMIT_HASH`

### Test

- `vitest` is used to run tests

### Checks

- `stylelint` is used to lint css files
- `eslint` is used to lint javascript and typescript files
- `tsc` is used to typecheck typescript files
- `knip` to used to detect unused javascript and typescript files

### Docker

Docker is setup to run vite on port 3000

### Github Actions

- A workflow is setup to run when:
- new commit is pushed to develop branch
- or a pull request to develop branch is opened
- It checks for unused files, lint issues, failed tests and failed builds.

### Pull Request Template

- A generic pull request template is included.

## What needs to be included?

[Checklist](CHECKLIST.md)
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[react-shields]: https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB
[react-url]: https://reactjs.org/
[vite-shields]: https://img.shields.io/badge/vite-%23646CFF.svg?style=for-the-badge&logo=vite&logoColor=white
[vite-url]: https://vitejs.dev/
[typescript-shields]: https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white
[typescript-url]: https://www.typescriptlang.org/
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
build: .
command: sh -c 'yarn install && yarn dev --host'
environment:
APP_TITLE: ${APP_TITLE:-React Base App}
APP_TITLE: ${APP_TITLE:-TC Global Notes}
volumes:
- .:/code
ports:
Expand Down
7 changes: 5 additions & 2 deletions env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { defineConfig, Schema } from '@julr/vite-plugin-validate-env';
import {
defineConfig,
Schema,
} from '@julr/vite-plugin-validate-env';

export default defineConfig({
APP_TITLE: Schema.string.optional(),
})
});
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "react-base-app",
"name": "tc-global-notes",
"private": true,
"version": "0.0.0",
"type": "module",
Expand All @@ -20,12 +20,14 @@
},
"dependencies": {
"@togglecorp/fujs": "^2.0.0",
"@julr/vite-plugin-validate-env": "^1.1.1",
"@togglecorp/toggle-form": "^2.0.4",
"@togglecorp/toggle-ui": "^0.18.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.11.1"
},
"devDependencies": {
"@julr/vite-plugin-validate-env": "^1.1.1",
"@types/node": "^20.1.3",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
Expand Down

0 comments on commit b9eff4b

Please sign in to comment.