Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup React App #3

Merged
merged 1 commit into from May 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions README.md
Expand Up @@ -18,22 +18,29 @@ Review the [commit history](https://github.com/cloud-city-crafted/react-typescri

1. [Initialize Project](https://github.com/cloud-city-crafted/react-typescript-webpack-template/pull/1)
2. [Setup TypeScript](https://github.com/cloud-city-crafted/react-typescript-webpack-template/pull/2)
3. Setup React
3. [Setup React](https://github.com/cloud-city-crafted/react-typescript-webpack-template/pull/3)
4. Setup Jest
5. Setup Webpack

## ⚛️ What?

This project template only uses the dependencies and configurations needed to:

- Develop using TypeScript (using `.tsx` files)
- Create a React Web Application
- Develop React Components using TypeScript (using `.tsx` files)

The final state is a React app equivalent to the starting point of [Create React App](https://create-react-app.dev/).

### 🛠 Tooling
- [React](https://reactjs.org): An open source JavaScript library for building UIs
- [react](https://www.npmjs.com/package/react): Core React library
- [@types/react](https://www.npmjs.com/package/@types/react): Type definitions for `React`
- [react-dom](https://www.npmjs.com/package/react-dom): Renders React to DOM
- [@types/react-dom](https://www.npmjs.com/package/@types/react-dom): Type definitions for `ReactDOM`
- [TypeScript](https://www.typescriptlang.org/): A strongly typed language built on top of JavaScript.
- [typescript](https://www.npmjs.com/package/typescript): Core TypeScript programming language
- [ts-node](https://www.npmjs.com/package/ts-node): TypeScript execution engine for Node.js
- [@types/node](https://www.npmjs.com/package/@types/node): Type definitions for Node.js

## 🪪 License

This project template is [MIT licensed](https://github.com/cloud-city-crafted/react-typescript-webpack-template/blob/main/LICENSE).
171 changes: 169 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-typescript-webpack-template",
"version": "0.2.0",
"version": "0.3.0",
"description": "A React + TypeScript + Webpack Project Template",
"private": true,
"repository": {
Expand All @@ -26,7 +26,13 @@
"homepage": "https://github.com/cloud-city-crafted/react-typescript-webpack-template#readme",
"devDependencies": {
"@types/node": "^17.0.36",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.5",
"ts-node": "^10.8.0",
"typescript": "^4.7.2"
},
"dependencies": {
"react": "^18.1.0",
"react-dom": "^18.1.0"
}
}
40 changes: 40 additions & 0 deletions src/app.css
@@ -0,0 +1,40 @@
/* Modified from the create-react-app TypeScript template */
/* See: https://github.com/facebook/create-react-app/blob/main/packages/cra-template-typescript/template/src/App.css */
.app {
text-align: center;
}

.app-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.app-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.app-logo {
animation: app-logo-spin infinite 20s linear;
}
}

@keyframes app-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

.app-link {
color: #61dafb;
}
30 changes: 30 additions & 0 deletions src/app.tsx
@@ -0,0 +1,30 @@
// Modified from the create-react-app TypeScript template
// See: https://github.com/facebook/create-react-app/blob/main/packages/cra-template-typescript/template/src/App.tsx
import React from 'react';

import './app.css';

import logo from './icons/logo.svg';

export default class App extends React.Component {
render() {
return (
<div className="app" role="main">
<header className="app-header">
<img src={logo} className="app-logo" alt="logo" />
<p>
Edit <code>src/app.tsx</code> and save to reload.
</p>
<a
className="app-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
}
4 changes: 4 additions & 0 deletions src/custom.d.ts
@@ -0,0 +1,4 @@
declare module "*.svg" {
const content: any;
export default content;
}
Binary file added src/icons/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions src/icons/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/logo192.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/logo512.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/icons/manifest.json
@@ -0,0 +1,25 @@
{
"short_name": "React Template",
"name": "React Web App Template",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}