Skip to content

Commit

Permalink
Refactoring du projet en NodeJS + ajout de docker et réorganisation g…
Browse files Browse the repository at this point in the history
…énérale
  • Loading branch information
a-dera committed Jun 16, 2021
1 parent 748de1c commit d3e7180
Show file tree
Hide file tree
Showing 21 changed files with 5,268 additions and 849 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dockerignore
node_modules
.vscode
.idea
.readmes
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules/*
15 changes: 15 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
extends:
- 'eslint:recommended'
- 'plugin:node/recommended'
- prettier
plugins:
- node
- prettier
rules:
prettier/prettier: error
block-scoped-var: error
eqeqeq: error
no-warning-comments: warn
no-var: error
prefer-const: error
3 changes: 3 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bracketSpacing: false
singleQuote: true
trailingComma: es5
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use the official lightweight Node.js 12 image.
# https://hub.docker.com/_/node
FROM node:16-slim

# Create and change to the app directory.
WORKDIR /usr/src/app

# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY package*.json ./

# Install dependencies.
# If you add a package-lock.json speed your build by switching to 'npm ci'.
# RUN npm ci --only=production
RUN npm install --production

# Copy local code to the container image.
COPY . ./

# Run the web service on container startup.
CMD ["node", "index.js"]
9 changes: 4 additions & 5 deletions core/cdabot.js → assets/core/cdabot.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
var botui = new BotUI('cdabot'); // initialistion de BotUI

//importation
document.write("<script language='JavaScript' src='core/droits.js'></script>");
document.write("<script language='JavaScript' src='core/french/main.js'></script>");
document.write("<script language='JavaScript' src='core/english/main.js'></script>");
document.write("<script language='JavaScript' src='core/pular/main.js'></script>");
document.write("<script language='JavaScript' src='assets/core/french/main.js'></script>");
document.write("<script language='JavaScript' src='assets/core/english/main.js'></script>");
document.write("<script language='JavaScript' src='assets/core/pular/main.js'></script>");

botui.message.bot({
content: 'Bonjour 👋!'
Expand Down Expand Up @@ -72,7 +71,7 @@ var start = function(){
mainEnglish();
} else if(res.value == 'pular') {
mainPular();
} else if(res.value == 'pular') {
} else if(res.value == 'french') {
mainFrench();
} else {
mainFrench();
Expand Down
File renamed without changes.
52 changes: 26 additions & 26 deletions core/english/main.js → assets/core/english/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ var mainEnglish = function() {
}]
}).then(function (res) {
if(res.value == 'cda') {
presentation();
presentationEnglish();
} else if(res.value == 'adhesion') {
adhesion();
adhesionEnglish();
} else if(res.value == 'search') {
chitchat();
chitchatEnglish();
} else {
start();
}
Expand All @@ -57,7 +57,7 @@ var mainEnglish = function() {


/*------ -------------Section Informations générales sur CDA-------*/
var presentation = function() {
var presentationEnglish = function() {

botui.message.bot({ // TODO #2 #1 Correction des icones
delay: 500,
Expand Down Expand Up @@ -103,11 +103,11 @@ var presentation = function() {
}]
}).then(function (res) {
if(res.value == 'gouvernance') {
gouvernance();
gouvernanceEnglish();
} else if(res.value == 'bureau') {
bureau();
bureauEnglish();
} else if(res.value == 'team') {
team();
teamEnglish();
} else {
mainEnglish();
}
Expand All @@ -116,7 +116,7 @@ var presentation = function() {

}

var gouvernance = function() {
var gouvernanceEnglish = function() {
botui.message.bot({
delay: 500,
type:'html',
Expand Down Expand Up @@ -153,14 +153,14 @@ var gouvernance = function() {
})
}).then(function (res) {
if(res.value == 'skip') {
presentation();
presentationEnglish();
} else{
presentation();
presentationEnglish();
}
});
}

var bureau = function() {
var bureauEnglish = function() {
botui.message.bot({
delay: 500,
type:'html',
Expand All @@ -181,9 +181,9 @@ var bureau = function() {
})
}).then(function (res) {
if(res.value == 'skip') {
presentation();
presentationEnglish();
} else{
presentation();
presentationEnglish();
}
});
}
Expand All @@ -206,17 +206,17 @@ var team = function() {
})
}).then(function (res) {
if(res.value == 'skip') {
presentation();
presentationEnglish();
} else{
presentation();
presentationEnglish();
}
});
}



/*------ -------------Section Renseignement pour adhérer--------*/
var adhesion = function() {
var adhesionEnglish = function() {
botui.action.button({
delay: 1000,
action: [{
Expand Down Expand Up @@ -256,25 +256,25 @@ var adhesion = function() {
}]
}).then(function (res) {
if(res.value == 'how') {
comment();
commentEnglish();
} else if(res.value == 'why') {
pourquoi();
pourquoiEnglish();
} else if(res.value == 'conditions') {
condions();
condionsEnglish();
} else {
mainEnglish();
}
});

}

var comment = function() {
var commentEnglish = function() {



}

var pourquoi = function() {
var pourquoiEnglish = function() {

botui.message.bot({ // TODO #2 #1 Correction des icones
delay: 500,
Expand All @@ -299,14 +299,14 @@ var pourquoi = function() {
})
}).then(function (res) {
if(res.value == 'conditions') {
conditions();
conditionsEnglish();
} else{
adhesion();
adhesionEnglish();
}
});
}

var conditions = function() {
var conditionsEnglish = function() {
botui.message.bot({
delay: 500,
type:'html',
Expand All @@ -324,9 +324,9 @@ var conditions = function() {
})
}).then(function (res) {
if(res.value == 'skip') {
adhesion();
adhesionEnglish();
} else{
adhesion();
adhesionEnglish();
}
});
}
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d3e7180

Please sign in to comment.