Skip to content

feature/custom-react-template #3

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "cra-template",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"eslint": "^8.23.1",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^29.0.3",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1",
"react-test-renderer": "^18.2.0",
"typescript": "^4.8.3",
"web-vitals": "^3.0.2"
}
}
27 changes: 27 additions & 0 deletions template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"package": {
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"web-vitals": "^3.0.2",
"typescript": "^4.8.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"@types/jest": "^29.0.3",
"@types/node": "^18.7.18",
"@types/react": "^18.0.20",
"@types/react-dom": "^18.0.6"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": ["react-app", "react-app/jest"]
}
}
}
1 change: 1 addition & 0 deletions template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CRA Codempire Template
15 changes: 15 additions & 0 deletions template/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# dependencies

/node_modules
/.pnp

# build

/build

# misc

/.DS_Store
.env*
yarn-debug.log*
yarn-error.log*
39 changes: 39 additions & 0 deletions template/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Codempire CRA template"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Codempire Creat-React-App template</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
9 changes: 9 additions & 0 deletions template/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"short_name": "React App",
"name": "Codempire Create React App",
"icons": [],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
7 changes: 7 additions & 0 deletions template/src/components/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import react from 'react';

export const App = () => {
return (
<h1>Codempire React template</h1>
)
}
1 change: 1 addition & 0 deletions template/src/components/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './app';
20 changes: 20 additions & 0 deletions template/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import { createRoot } from "react-dom/client";

import { App } from "./components";

import reportWebVitals from "./reportWebVitals";

const container = document.getElementById("root")!;
const root = createRoot(container);

root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
15 changes: 15 additions & 0 deletions template/src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ReportHandler } from 'web-vitals';

const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};

export default reportWebVitals;
27 changes: 27 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"jsx": "react",
"outDir": "dist",
"allowJs": false,
"sourceMap": true,
"target": "ES2015",
"module": "commonjs",
"skipLibCheck": false,
"alwaysStrict": true, // "use strict" for each source file
"noImplicitAny": true, // ts will issue an error whenever if would interfered any
"removeComments": true, // strips all the comments from the .ts
"noUnusedLocals": true, // throw an error when there unused local variables
"strictNullChecks": true, // do not ignore null and undefined by language
"noImplicitReturns": true, // check all code paths to ensure, that they return value
"preserveConstEnums": true,
"noImplicitOverride": true, // check for override modifier in inherited classes
"noUnusedParameters": true, // throw an error when there unused parameters
"strictFunctionTypes": true, // better type checking for functions
"allowUnreachableCode": false, // raise compiler error on unreachable error
"exactOptionalPropertyTypes": true, // do not allow silently ignore union types, only what defined can be asssignet
"noFallthroughCasesInSwitch": false, // all fall through in switch-case
"allowSyntheticDefaultImports": true,
},
"include": ["src/**/*"],
"exclude": ["node_modules/"]
}
Loading