Skip to content
Snippets Groups Projects
Commit f177898d authored by Jean-Christophe's avatar Jean-Christophe
Browse files

initial commit

parent 51f121ba
No related branches found
No related tags found
No related merge requests found
# Created by https://www.gitignore.io/api/node,emacs,windows
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
projectile-bookmarks.eld
# directory configuration
.dir-locals.el
# saveplace
places
# url cache
url/cache/
# cedet
ede-projects.el
# smex
smex-items
# company-statistics
company-statistics-cache.el
# anaconda-mode
anaconda-mode/
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/node,emacs,windows
# ajouts
dist/
package-lock.json
\ No newline at end of file
# intro-react # Introduction à React
Ce dépôt contient le code utilisé en exemple dans le cours [https://www.fil.univ-lille.fr/~routier/enseignement/licence/js-s4/html/react.html](https://www.fil.univ-lille.fr/~routier/enseignement/licence/js-s4/html/react.html).
Plusieurs versions progressives du dépôt pour accompagner le cours.
## Getting started ## Mise en place
* récupérer le dépôt
To make it easy for you to get started with GitLab, here's a list of recommended next steps. * installer les paquets *Node.js* :
```bash
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! $ npm install
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
``` ```
cd existing_repo * démarrer le serveur de développement de *Webpack*
git remote add origin https://gitlab.univ-lille.fr/javascript/intro-react.git ```bash
git branch -M main $ npm run dev-server
git push -uf origin main
``` ```
## Integrate with your tools ## Les versions
- [ ] [Set up project integrations](https://gitlab.univ-lille.fr/javascript/intro-react/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. Il faut charger une version avec
## Suggestions for a good README ```bash
$ git checkout **tag**
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. ```
`tag` peut prendre comme valeur :
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License Faire ```git checkout main``` pour revenir à la version finale.
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
{
"name": "react-intro",
"description": "introduction to React",
"author": "JC Routier",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"build": "webpack",
"watch": "webpack --watch",
"dev-server": "webpack serve"
},
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/plugin-transform-runtime": "^7.23.7",
"@babel/preset-env": "^7.23.8",
"@babel/preset-react": "^7.23.3",
"babel-loader": "^9.1.3",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.9.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.6.0",
"style-loader": "^3.3.4",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
<!DOCTYPE html>
<html>
<head>
<title>Introduction to React</title>
<link rel="stylesheet" href="style/style.css" type="text/css">
<!--
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
-->
<script src="./vendor/react.development.js"></script>
<script src="./vendor/react-dom.development.js"></script>
</head>
<body>
<h1>Introduction to React</h1>
<p>Elements generated by React.js code are added below : </p>
<div id="insertReactHere"><!-- insertion point = element used as parent for react generated content --></div>
</body>
</html>
\ No newline at end of file
import React from 'react';
import { createRoot } from 'react-dom/client';
const bootstrapReact = () => {
const root = createRoot(document.getElementById('insertReactHere')); // parent for created element = "insertion point"
root.render(
React.createElement('h3', null, 'I am a simple component generated with React'), // element created by react // DOM existing parent for insertion
);
}
window.addEventListener('DOMContentLoaded', bootstrapReact);
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
color: #00B7FF;
}
#insertReactHere {
background-color : rgb(230,230,230);
border : solid thin rgb(200,200,200);
margin : 20px;
padding : 20px;
}
#insertReactHere article {
background-color : rgb(250,250,250);
padding : 10px;
}
This diff is collapsed.
This diff is collapsed.
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const PRODUCTION = false;
const DIST_FOLDER = 'dist';
module.exports = {
entry: path.resolve(__dirname, 'src', 'scripts', 'main.js'),
output: {
path: path.resolve(__dirname, DIST_FOLDER),
filename: 'scripts/bundle.js'
},
mode: (PRODUCTION ? 'production' : 'development'),
devtool: (PRODUCTION ? undefined : 'eval-source-map'),
devServer: {
static: {
publicPath: path.resolve(__dirname, DIST_FOLDER),
watch: true
},
host: 'localhost',
port: 9000,
open: true
},
module: {
rules: [
{
test: /\.(m?js$|jsx)/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
'@babel/preset-react'
],
plugins: [
'@babel/transform-runtime'
]
}
}
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|jpg|gif)/i,
use: {
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'images'
}
}
}
]
},
plugins: [
new webpack.ProgressPlugin(),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src', 'index.html'),
filename: './index.html',
hash: true,
}),
new CopyPlugin({
patterns: [
{
context: path.resolve(__dirname, 'src', 'html'),
from: "**/*.html",
to: 'html',
noErrorOnMissing: true,
globOptions: {}
},
{
context: path.resolve(__dirname, 'src', 'images'),
from: '**/*',
to: 'images/[name][ext]',
noErrorOnMissing: true,
},
{
context: path.resolve(__dirname, 'src', 'style'),
from: '**/*.css',
to: 'style/[name][ext]',
noErrorOnMissing: true,
},
{
context: path.resolve(__dirname, 'vendor'),
from: '**/*.js',
to: 'vendor/[name][ext]',
noErrorOnMissing: true
}
]
}),
],
// gestion de bibliothèques externes à exclure du bundle, ici cas de React
externals: {
react: 'React',
'react-dom/client': 'ReactDOM'
},
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment