Skip to content

Commit

Permalink
Merge pull request #30 from lion92/main
Browse files Browse the repository at this point in the history
Projet react a nettoyer encore un peu
  • Loading branch information
GoupilJeremy committed Jun 28, 2023
2 parents 4758645 + b55e3b5 commit 37d415b
Show file tree
Hide file tree
Showing 71 changed files with 2,221 additions and 17 deletions.
32 changes: 15 additions & 17 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": [
"build-storybook"
]
"cacheableOperations": ["build-storybook"]
}
}
},
Expand Down Expand Up @@ -44,11 +42,7 @@
},
"targetDefaults": {
"test": {
"inputs": [
"default",
"^default",
"{workspaceRoot}/jest.preset.js"
]
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"]
},
"lint": {
"inputs": [
Expand All @@ -58,21 +52,25 @@
]
},
"build": {
"inputs": [
"production",
"^production"
]
"inputs": ["production", "^production"]
},
"build-storybook": {
"inputs": ["default", "^production", "!{projectRoot}/.storybook/**/*"]
},
"e2e": {
"inputs": ["default", "^production"]
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": [],
"production": [
"default"
"default",
"!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)",
"!{projectRoot}/.storybook/**/*",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json"
]
}
}
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@
"zone.js": "~0.12.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.23.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^8.0.5",
"react-router-dom": "^5.3.0",
"react-scripts": "4.0.3",
"reducers": "^3.0.0-alpha",
"redux": "^4.2.1",
"redux-devtools-extension": "^2.13.9",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.4.2",
"web-vitals": "^1.0.1",
"@angular-devkit/build-angular": "~15.2.0",
"@angular-devkit/core": "~15.2.0",
"@angular-devkit/schematics": "~15.2.0",
Expand Down
10 changes: 10 additions & 0 deletions react-todo-kriss-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}
8 changes: 8 additions & 0 deletions react-todo-kriss-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

export default defineConfig({
e2e: nxE2EPreset(__dirname, {
bundler: 'vite',
}),
});
33 changes: 33 additions & 0 deletions react-todo-kriss-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "react-todo-kriss-e2e",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "react-todo-kriss-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "react-todo-kriss-e2e/cypress.config.ts",
"devServerTarget": "react-todo-kriss:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "react-todo-kriss:serve:production"
},
"ci": {
"devServerTarget": "react-todo-kriss:serve-static"
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["react-todo-kriss-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["react-todo-kriss"]
}
13 changes: 13 additions & 0 deletions react-todo-kriss-e2e/src/e2e/app.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('react-todo-kriss', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome react-todo-kriss');
});
});
4 changes: 4 additions & 0 deletions react-todo-kriss-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}
1 change: 1 addition & 0 deletions react-todo-kriss-e2e/src/support/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
33 changes: 33 additions & 0 deletions react-todo-kriss-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************

// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions react-todo-kriss-e2e/src/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';
10 changes: 10 additions & 0 deletions react-todo-kriss-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
}
18 changes: 18 additions & 0 deletions react-todo-kriss/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
12 changes: 12 additions & 0 deletions react-todo-kriss/build/action/user.actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import axios from "axios";

export const GET_USER = "GET_USER";
export const getUser = (uid) => {
return (dispatch) => {
return axios
.get('http://localhost:3000/')
.then((res) => {
dispatch({type: GET_USER, payload: res.data})
}).catch((err)=>console.log(err))
}
}
21 changes: 21 additions & 0 deletions react-todo-kriss/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"files": {
"main.css": "/static/css/main.39b381ee.chunk.css",
"main.js": "/static/js/main.1ff280ff.chunk.js",
"main.js.map": "/static/js/main.1ff280ff.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.0f4fd79e.js",
"runtime-main.js.map": "/static/js/runtime-main.0f4fd79e.js.map",
"static/js/2.3c44336f.chunk.js": "/static/js/2.3c44336f.chunk.js",
"static/js/2.3c44336f.chunk.js.map": "/static/js/2.3c44336f.chunk.js.map",
"index.html": "/index.html",
"static/css/main.39b381ee.chunk.css.map": "/static/css/main.39b381ee.chunk.css.map",
"static/js/2.3c44336f.chunk.js.LICENSE.txt": "/static/js/2.3c44336f.chunk.js.LICENSE.txt",
"static/media/App.css": "/static/media/fondTodo.832260d3.png"
},
"entrypoints": [
"static/js/runtime-main.0f4fd79e.js",
"static/js/2.3c44336f.chunk.js",
"static/css/main.39b381ee.chunk.css",
"static/js/main.1ff280ff.chunk.js"
]
}
Binary file added react-todo-kriss/build/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions react-todo-kriss/build/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><link href="/static/css/main.39b381ee.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,l,f=t[0],i=t[1],a=t[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(t);s.length;)s.shift()();return u.push.apply(u,a||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,f=1;f<r.length;f++){var i=r[f];0!==o[i]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return e}var n={},o={1:0},u=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="/";var f=this.webpackJsonptodo=this.webpackJsonptodo||[],i=f.push.bind(f);f.push=t,f=f.slice();for(var a=0;a<f.length;a++)t(f[a]);var p=i;r()}([])</script><script src="/static/js/2.3c44336f.chunk.js"></script><script src="/static/js/main.1ff280ff.chunk.js"></script></body></html>
Binary file added react-todo-kriss/build/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added react-todo-kriss/build/logo512.png
Loading
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 react-todo-kriss/build/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"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"
}
7 changes: 7 additions & 0 deletions react-todo-kriss/build/reducer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {combineReducers} from "redux";
import userreducer from "./user.reducer";


export default combineReducers(
userreducer
)
12 changes: 12 additions & 0 deletions react-todo-kriss/build/reducer/user.reducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {GET_USER} from "../action/user.actions";

const initialState = {};
export default function userreducer(state = initialState, action) {
switch (action.type) {
case GET_USER:
return action.payload
default:
return state

}
}
3 changes: 3 additions & 0 deletions react-todo-kriss/build/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
2 changes: 2 additions & 0 deletions react-todo-kriss/build/static/css/main.39b381ee.chunk.css

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

Loading

0 comments on commit 37d415b

Please sign in to comment.