Skip to content

Instantly share code, notes, and snippets.

@Nekall
Last active March 19, 2023 13:56
Show Gist options
  • Save Nekall/67580512e3c55d4389cd7d59ef04804f to your computer and use it in GitHub Desktop.
Save Nekall/67580512e3c55d4389cd7d59ef04804f to your computer and use it in GitHub Desktop.
echo Welcome to the automatic setup of a Reactjs app by Neka ✨
echo ⚠️ The name of your application must be in miniscule and the words separated by dashes, for example: my-app
echo What do you want to name your application ?
read name
echo Creation of the $name application, in progress 🛠️
npx create-react-app $name --template typescript && cd $name/ && npm uninstall web-vitals && npm uninstall @testing-library/jest-dom && npm uninstall @testing-library/react && npm uninstall @testing-library/user-event && npm i react-router-dom && sed -i '/eject/d' package.json && sed -i '/test/d' package.json && sed -i '/jest/d' package.json && sed -i '/reportWebVitals/d' src/index.tsx && sed -i '/CRA-vitals/d' src/index.tsx && sed -i '/measuring performance/d' src/index.tsx && sed -i '/"build": "react-scripts build",/c\ "build": "react-scripts build"' package.json && sed -i '/"react-app",/c\ "react-app"' package.json && npm i sass && mkdir src/assets && mkdir src/assets/fonts && mkdir src/assets/images && mkdir src/components && mkdir src/pages && mkdir src/styles && mkdir src/styles/pages && touch src/styles/pages/Home.module.scss && echo '.__home{display: flex;justify-content: center;align-items: center;height: 100vh;animation: pulse 3s ease-in-out infinite;}@keyframes pulse {0% {opacity: 0;}50% {opacity: 1;}100% {opacity: 0;}}' >> src/styles/pages/Home.module.scss && mkdir src/helpers && mkdir src/pages/Home && touch src/pages/Home/index.tsx && touch src/styles/globals.scss && cd src/ && cp index.css index.scss && rm index.css && rm setupTests.ts && rm reportWebVitals.ts && rm App.test.tsx && rm logo.svg && rm App.css && rm App.tsx && rm index.tsx && touch index.tsx && echo 'import React from "react";import ReactDOM from "react-dom/client";import { BrowserRouter as Router, Routes, Route } from "react-router-dom";/* Pages */import Home from "./pages/Home";/* Styles */import "./index.scss";const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);root.render(<React.StrictMode><Router><Routes><Route path="/" element={<Home />} /></Routes></Router></React.StrictMode>);' >> index.tsx && echo 'import styles from "../../styles/pages/Home.module.scss";const Home = () => <main className={styles.__home}><h1>Home Page</h1></main>; export default Home;' >> pages/Home/index.tsx && cd .. && clear && echo "✔️ Clean install of CRA completed !" && echo "\n📁 Folders created :" && echo " - pages" && echo " - helpers" && echo " - styles" && echo " - assets" && echo " - assets/images" && echo " - assets/fonts" && echo "\n🗃️ Packages installed :" && echo " - ReactRouterDom" && echo " - Sass" && echo " - Typescript" && echo "\n🤖 Scripts available :" && echo " - npm run start" && echo " - npm run build" && echo "\n\n Have a nice dev !" && echo " Neka 💙"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment