Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LesiaUKR committed Feb 3, 2024
0 parents commit ca137d8
Show file tree
Hide file tree
Showing 30 changed files with 25,555 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8

[*.md]
trim_trailing_whitespace = false
24 changes: 24 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and deploy to GitHub Pages

on:
push:
branches: [main]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2.3.1

- name: Install, lint, build 🔧
run: |
npm install
npm run lint:js
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
with:
branch: gh-pages
folder: build
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

#Junk
.vscode/
.idea/

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
12 changes: 12 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"proseWrap": "always"
}
94 changes: 94 additions & 0 deletions README.RO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Model pentru un proiect React

Acest proiect a fost creat cu ajutorul
[Create React App](https://github.com/facebook/create-react-app). Pentru prezentări
și configurarea de funcții suplimentare
[consultă documentația](https://facebook.github.io/create-react-app/docs/getting-started).

## Crearea unui repository în baza modelului

Utilizează acest repository al organizației GoIT ca model pentru crearea unui repository
pentru proiectul tău. Pentru a face acest lucru, dă click pe "Use this template" și selectează opțiunea
`Create a new repository`, după cum se prezintă în imagine.

![Creating repo from a template step 1](./assets/template-step-1.png)

Următorul pas va deschide pagina de creare a unui nou repository. Completează câmpul
pentru numele acestuia, asigură-te că repository-ul este public, apoi dă click pe `Create repository from template`.

![Creating repo from a template step 2](./assets/template-step-2.png)

Odată ce repository-ul a fost creat, trebuie să accesezi setările repository-ului creat în fila `Settings > Actions > General`, după cum se prezintă în imagine.

![Settings GitHub Actions permissions step 1](./assets/gh-actions-perm-1.png)

După ce ai derulat până la sfârșitul paginii, în secțiunea `Workflow permissions`, selectează `Read and write permissions`, (Permisiuni de citire și scriere) și bifează caseta. Acest lucru
este necesar pentru a automatiza procesul de lansare a proiectului.

![Settings GitHub Actions permissions step 2](./assets/gh-actions-perm-2.png)

Avei acum un repository personal de proiecte, cu o structură de fișiere și foldere.

Lucrează apoi cu acesta așa cum ai face-o cu orice alt repository personal,
clonează-l pe computerul tău, scrie cod, confirmă-l și încarcă-l pe
GitHub.

## Pregătirea pentru muncă

1. Asigură-te că ai versiunea LTS a Node.js instalată pe computerul personal.
[Descarcă și instalează](https://nodejs.org/en/) dacă este necesar.
2. Instalează dependențele de bază ale proiectului cu comanda `npm install`.
3. Pornește modul de dezvoltare utilizând comanda `npm start`.
4. Accesează [http://localhost:3000](http://localhost:3000) în browser-ul tău.
Această pagină se va reîncărca automat după salvarea modificărilor în fișierele proiectului.

## Deploy

Versiunea de producție a proiectului va trece automat prin procesul de linting, va fi asamblată și implementată pe GitHub Pages, în ramura `gh-pages`, de fiecare dată când ramura `main` este actualizată. De exemplu, după un push direct sau o cerere de pull-request acceptată.

Pentru a face acest lucru, trebuie să editeezi câmpul "homepage" din fișierul package.json, înlocuind "your_username" și "your_repo_name" cu detaliile tale, apoi să trimiți aceste modificări pe GitHub.

json
"homepage": "https://your_username.github.io/your_repo_name/"

În continuare, mergi la setările repository-ului GitHub (`Settings` > `Pages`) și setează distribuirea versiunii de producție a fișierelor în folderul `/root` al ramurii `gh-pages`, dacă acest lucru nu a fost făcut în mod automat.

![GitHub Pages settings](./assets/repo-settings.png)

### Deployment status

Starea de implementare a celui mai recent commit este afișat printr-o iconiță lângă ID-ului acestuia.

- **Galben** - proiectul este în curs de asamblare și de implementare.
- **Verde** - implementarea a fost finalizată cu succes.
- **Roșu** - a apărut o eroare în timpul procesului de linting, asamblării sau implementării.

Pentru a obține informații mai detaliate despre starea implementării, poți da click pe iconița corespunzătoare și apoi accesează link-ul "Details" din fereastra pop-up care se deschide.

![Deployment status](./assets/deploy-status.png)

### Pagina live

După un anumit interval de timp, de obicei câteva minute, poți vizualiza pagina live la adresa indicată în proprietatea "homepage" editată. De exemplu, iată un link către versiunea live pentru acest repository:
[https://goitacademy.github.io/react-homework-template](https://goitacademy.github.io/react-homework-template).

Dacă se deschide o pagină goală, asigură-te că în fila "Console" nu există erori legate de căi greșite către fișierele CSS și JS ale proiectului (**Eroare 404**). Cel mai probabil, valoarea proprietății "homepage" din fișierul package.json este incorectă.

### Rutarea

Dacă aplicația utilizează biblioteca react-router-dom pentru rutare,
trebuie să configurezi suplimentar componenta `<BrowserRouter>`, trecând în prop-ul "basename" numele exact al repository-ului tău. Bara oblică la începutul șirului este obligatorie.

jsx
<BrowserRouter basename="/your_repo_name">
<App />
</BrowserRouter>


## Cum funcționează

![How it works](./assets/how-it-works.png)

1. După fiecare "push" în ramura `main` a repository-ului GitHub, se va crea un fișier special script (GitHub Action) din fișierul `.github/workflows/deploy.yml`.
2. Toate fișierele din repository sunt copiate pe server, unde proiectul este inițializat, este efectuat linting-ul și asamblarea înainte de implementare.
3. Dacă toți pașii sunt finalizați cu succes, versiunea asamblată în producție a fișierelor proiectului este trimisă în ramura `gh-pages`. În caz contrar, în jurnalul (log) de execuție al scriptului vor fi indicate problemele întâlnite.
105 changes: 105 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# React homework template

This project was created with
[Create React App](https://github.com/facebook/create-react-app). To get
acquainted and configure additional features
[refer to documentation](https://facebook.github.io/create-react-app/docs/getting-started).

## Creating a repository by template

Use this GoIT repository as a template for creating a repository
of your project. To use it just tap the `«Use this template»` button and choose
`«Create a new repository»` option, as you can see on the image below.

![Creating repo from a template step 1](./assets/template-step-1.png)

The page for creating a new repository will open on the next step. Fill out
the Name field and make sure the repository is public, then click
`«Create repository from template»` button.

![Creating repo from a template step 2](./assets/template-step-2.png)

You now have a personal project repository, having a repository-template file
and folder structure. After that, you can work with it as you would with any
other private repository: clone it on your computer, write code, commit, and
send it to GitHub.

## Preparing for coding

1. Make sure you have an LTS version of Node.js installed on your computer.
[Download and install](https://nodejs.org/en/) if needed.
2. Install the project's base dependencies with the `npm install` command.
3. Start development mode by running the `npm start` command.
4. Go to [http://localhost:3000](http://localhost:3000) in your browser. This
page will automatically reload after saving changes to the project files.

## Deploy

The production version of the project will automatically be linted, built, and
deployed to GitHub Pages, in the `gh-pages` branch, every time the `main` branch
is updated. For example, after a direct push or an accepted pull request. To do
this, you need to edit the `homepage` field in the `package.json` file,
replacing `your_username` and `your_repo_name` with your own, and submit the
changes to GitHub.

```json
"homepage": "https://your_username.github.io/your_repo_name/"
```

Next, you need to go to the settings of the GitHub repository (`Settings` >
`Pages`) and set the distribution of the production version of files from the
`/root` folder of the `gh-pages` branch, if this was not done automatically.

![GitHub Pages settings](./assets/repo-settings.png)

### Deployment status

The deployment status of the latest commit is displayed with an icon next to its
ID.

- **Yellow color** - the project is being built and deployed.
- **Green color** - deployment completed successfully.
- **Red color** - an error occurred during linting, build or deployment.

More detailed information about the status can be viewed by clicking on the
icon, and in the drop-down window, follow the link `Details`.

![Deployment status](./assets/deploy-status.png)

### Live page

After some time, usually a couple of minutes, the live page can be viewed at the
address specified in the edited `homepage` property. For example, here is a link
to a live version for this repository
[https://goitacademy.github.io/react-homework-template](https://goitacademy.github.io/react-homework-template).

If a blank page opens, make sure there are no errors in the `Console` tab
related to incorrect paths to the CSS and JS files of the project (**404**). You
most likely have the wrong value for the `homepage` property in the
`package.json` file.

### Routing

If your application uses the `react-router-dom` library for routing, you must
additionally configure the `<BrowserRouter>` component by passing the exact name
of your repository in the `basename` prop. Slashes at the beginning and end of
the line are required.

```jsx
<BrowserRouter basename="/your_repo_name/">
<App />
</BrowserRouter>
```

## How it works

![How it works](./assets/how-it-works.png)

1. After each push to the `main` branch of the GitHub repository, a special
script (GitHub Action) is launched from the `.github/workflows/deploy.yml`
file.
2. All repository files are copied to the server, where the project is
initialized and linted and built before deployment.
3. If all steps are successful, the built production version of the project
files is sent to the `gh-pages` branch. Otherwise, the script execution log
will indicate what the problem is.
105 changes: 105 additions & 0 deletions README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# React homework template

Este proyecto fue creado con la ayuda de
[Create React App](https://github.com/facebook/create-react-app).
[Consulte la documentación](https://facebook.github.io/create-react-app/docs/getting-started)
para familiarizarse con las funciones opcionales y configurarlas.

## Crear un repositorio desde una plantilla

Usa este repositorio de la organización GoIT como plantilla para crear el repositorio de tu proyecto.
Para hacer esto, haz clic en `«Use this template»` y selecciona la opción
`«Create a new repository»`, tal como se muestra en la imagen.

![Creating repo from a template step 1](./assets/template-step-1.png)

Para el siguiente paso deberás abrir la página para crear un nuevo repositorio.
Ponle nombre, asegúrate de que el repositorio sea público y haz clic en el botón
`«Create repository from template»`.

![Creating repo from a template step 2](./assets/template-step-2.png)

Ahora ya tienes un repositorio de proyecto personal, junto a una estructura de
archivos y carpetas del repositorio de plantillas. Luego trabaja con esto, así
como con cualquier otro repositorio personal, realiza una copia en tu computadora
y súbelo a GitHub.

## Prepararse para el trabajo

1. Asegúrate de que la versión LTS de Node.js está instalada en tu computador.
[Descárguela e instálela](https://nodejs.org/en/) de ser necesario.
2. Instala las dependencias base del proyecto con el comando `npm install`.
3. Inicia el modo de desarrollo ejecutando el comando `npm start`.
4. En tu navegador, ve a la dirección
[http://localhost:3000](http://localhost:3000). Esta página se recargará
automáticamente después de guardar los cambios en los archivos del proyecto.

## Implementación

La versión de producción del proyecto se verificará, compilará y desplegará
automáticamente en GitHub Pages, en la rama `gh-pages`, cada vez que se
actualice la rama `main`. Por ejemplo, después de un Push directo o de una
Pool-request aceptada. Para ello, edita el campo `homepage` del archivo
`package.json`, sustituyendo `your_username` y `your_repo_name` por los tuyos
propios, y envía los cambios a GitHub.

```json
"homepage": "https://your_username.github.io/your_repo_name/"
```

A continuación, ve a la configuración del repositorio de GitHub (`Settings` >
`Pages`) y selecciona distribuir la versión de producción de los archivos desde
la carpeta `/root` de la rama `gh-pages`, si no se ha hecho automáticamente.

![GitHub Pages settings](./assets/repo-settings.png)

### Estado de la implantación

El estado del último commit se indica con un icono junto al ID del commit.

- **Color amarillo** - el proyecto está compilado e implementado.
- **Color verde** - La implementación se completó con éxito.
- **Color rojo** - Se ha producido un error durante la verificación, la
compilación o la implementación

Se puede ver información de estado más detallada haciendo clic en el icono y en
la ventana desplegable del enlace `Detalles`.

![Deployment status](./assets/deploy-status.png)

### Página activa

Después de un tiempo, normalmente un par de minutos, la página real se puede ver
en la dirección especificada en la propiedad `homepage`. Por ejemplo, aquí está
el enlace a la versión activa de este repositorio
[https://goitacademy.github.io/react-homework-template](https://goitacademy.github.io/react-homework-template).

Si se abre una página en blanco, asegúrate de que no haya errores en la pestaña
`Console` relacionados con rutas incorrectas de archivos CSS y JS del proyecto
(**404**). Probablemente tienes un valor incorrecto para la propiedad `homepage`
en el archivo `package.json`.

### Enrutamiento

Si la aplicación utiliza la librería `react-router-dom` para el enrutamiento, el
componente `<BrowserRouter>` debe ser configurado adicionalmente pasando en la
prop `basename`, el nombre exacto de tu repositorio. Las barras inclinadas al
principio y al final de la cadena son obligatorias.

```jsx
<BrowserRouter basename="/your_repo_name/">
<App />
</BrowserRouter>
```

## ¿Cómo funciona?

![How it works](./assets/how-it-works.png)

1. Después de cada push a la rama `main` del repositorio GitHub, se ejecuta un
script especial (GitHub Action) del archivo `.github/workflows/deploy.yml`.
2. Todos los archivos del repositorio se copian en el servidor, donde el
proyecto se inicializa, se verifica y se compila antes de ser implementado.
3. Si todos los pasos tienen éxito, la versión de producción compilada de los
archivos del proyecto se envía a la rama `gh-pages`. De lo contrario, el
registro de ejecución del script indicará cuál es el problema.
Loading

0 comments on commit ca137d8

Please sign in to comment.