diff --git a/build.js b/build.js index 56588f3776a5ddbbf2c35fe8570f08d50d9da20a..1e0c84dee36b9f54704a7eab10f6487f2945fe4a 100644 --- a/build.js +++ b/build.js @@ -163,6 +163,18 @@ function getPageHtml(pageName, pageMeta) { return html; } +function deletePageDirectory(path) { + try { + const nestedFiles = fs.readdirSync(path); + for (const nf of nestedFiles) { + fs.unlinkSync(`${path}/${nf}`); + } + fs.rmdirSync(path); + } catch (error) { + console.error(error); + } +} + function createPages(rootdir, destdir) { const pages = fs.readdirSync(rootdir); @@ -186,6 +198,12 @@ function createPages(rootdir, destdir) { if (fs.existsSync(`${fPath}/subpages`)) { createPages(`${fPath}/subpages`, targetDirPath); + } else { + for (const d of fs.readdirSync(targetDirPath).filter(f => { + return fs.statSync(`${targetDirPath}/${f}`).isDirectory() + })) { + deletePageDirectory(`${targetDirPath}/${d}`) + } } } @@ -196,16 +214,7 @@ function createPages(rootdir, destdir) { return stats.isDirectory(); })) { if (!pages.includes(dir)) { - const dPath = `${destdir}/${dir}`; - try { - const nestedFiles = fs.readdirSync(dPath); - for (const nf of nestedFiles) { - fs.unlinkSync(`${dPath}/${nf}`); - } - fs.rmdirSync(dPath); - } catch (error) { - console.error(error); - } + deletePageDirectory(`${destdir}/${dir}`) } } } diff --git a/public/education/gamedev/gamedev.js b/public/education/gamedev/gamedev.js deleted file mode 100644 index 3f699d870dd172ac3d42210ceec7bd42b6147d04..0000000000000000000000000000000000000000 --- a/public/education/gamedev/gamedev.js +++ /dev/null @@ -1,555 +0,0 @@ -(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ -function getServerUrl() { - return `${location.origin}${ - location.origin.charAt(location.origin.length - 1) !== "/" ? "/" : "" - }`; -} - -module.exports = { - getServerUrl, - website_title: "Kuadrado website template", - build: { - protected_dirs: ["assets", "style", "articles"], - default_meta_keys: ["title", "description", "image", "open_graph", "json_ld"], - }, -}; - -},{}],2:[function(require,module,exports){ -const { getServerUrl } = require("./config"); - -module.exports = { - images_url: `${getServerUrl()}assets/images/`, - articles_url: `${getServerUrl()}articles/`, -}; - -},{"./config":1}],3:[function(require,module,exports){ -"use strict"; - -module.exports = { - setRenderCycleRoot(renderCycleRoot) { - this.renderCycleRoot = renderCycleRoot; - }, - objectToHtml: function objectToHtml(obj) { - const { tag } = obj; - - const node = document.createElement(tag); - const excludeKeys = ["tag", "contents", "style_rules", "state"]; - - Object.keys(obj) - .filter(attr => !excludeKeys.includes(attr)) - .forEach(attr => { - if (attr === "class") { - node.classList.add(...obj[attr].split(" ").filter(s => s !== "")); - } else { - node[attr] = obj[attr]; - } - }); - if (obj.contents && typeof obj.contents === "string") { - node.innerHTML = obj.contents; - } else { - obj.contents && - obj.contents.length > 0 && - obj.contents.forEach(el => { - switch (typeof el) { - case "string": - node.innerHTML = el; - break; - case "object": - node.appendChild(objectToHtml(el)); - break; - } - }); - } - - if (obj.style_rules) { - Object.keys(obj.style_rules).forEach(rule => { - node.style[rule] = obj.style_rules[rule]; - }); - } - - return node; - }, - renderCycle: function () { - this.subRender(this.renderCycleRoot.render(), document.getElementsByTagName("main")[0], { - mode: "replace", - }); - }, - subRender(object, htmlNode, options = { mode: "append" }) { - const insert = this.objectToHtml(object); - switch (options.mode) { - case "append": - htmlNode.appendChild(insert); - break; - case "override": - htmlNode.innerHTML = ""; - htmlNode.appendChild(insert); - break; - case "insert-before": - htmlNode.insertBefore(insert, htmlNode.childNodes[options.insertIndex]); - break; - case "adjacent": - /** - * options.insertLocation must be one of: - * - * afterbegin - * afterend - * beforebegin - * beforeend - */ - htmlNode.insertAdjacentHTML(options.insertLocation, insert); - break; - case "replace": - htmlNode.parentNode.replaceChild(insert, htmlNode); - break; - case "remove": - htmlNode.remove(); - break; - } - }, -}; - -},{}],4:[function(require,module,exports){ -"use strict"; - -class WebPage { - constructor(args) { - Object.assign(this, args); - } -} - -module.exports = WebPage; -},{}],5:[function(require,module,exports){ -"use strict"; - -const { images_url } = require("../../../../../constants"); -const WebPage = require("../../../../lib/web-page"); - -const GAMEDEV_THEMES = [ - { - title: "Dessin et création 2D", - image: "learning_theme_2d.png", - details: [ - "Création de décors et de personnages", - "Dessin sur ordinateur, pixel art, vectoriel", - "Animations 2D", - ], - }, - { - title: "Musique et sons", - image: "learning_theme_sound.png", - details: ["Logiciels de son et synthétiseurs", "Composition", "Prise de son", "Mixage"], - }, - { - title: "Écriture", - image: "learning_theme_write.png", - details: [ - "Écrire une histoire, construire une narration", - "Imaginer des mondes et des personnages", - ], - }, - { - title: "Conception", - image: "learning_theme_conception.png", - details: [ - "Concevoir les différents éléments qui composent le jeu", - "Développer les mécanismes de gameplay", - ], - }, - { - title: "Programmation", - image: "learning_theme_coding.png", - details: [ - "Apprendre pas à pas à coder avec différents langages de programmation", - "Découvrir les bases du web en créant des mini-jeux en lignes", - ], - }, - { - title: "Mathématiques", - image: "learning_theme_math.png", - comment: - "<em>Créer un jeu vidéo c'est l'occasion de découvrir plein de sujets en maths et en physique tout en s'amusant !</em>", - details: [ - "Algorithmie", - "Logique (algèbre booléen)", - "Géométrie", - "Trigonométrie", - "Algèbre linéaire", - "Repères 2D / 3D", - "Vecteurs 2D / 3D", - "Newton", - "...", - ], - }, - { - title: "Travail d'équipe", - image: "learning_theme_team.png", - comment: ` - <em> - Faire son jeu tout seul c'est bien mais ça peut être long ! - <br />Créer des jeux c'est aussi l'occasion de se mettre à plusieurs pour tirer le meilleur parti des différents talents de chacun. - </em>`, - details: ["Gestion de projet", "Méthodologie", "Communication"], - }, - { - title: "Logiciels libres, GNU/Linux", - image: "learning_theme_linux.png", - comment: - "<em>Nous utilisons essentiellement des logiciels libres sur Linux.<br />C'est donc une bonne occasion de découvrir et démystifier tout ça en douceur !</em>", - details: ["Ubuntu / Debian", "GIMP", "LMMS", "Audacity", "Pencil2d", "..."], - }, -]; - -class GameStudioClub { - render() { - return { - tag: "section", - typeof: "EducationalOrganization", - contents: [ - { - tag: "div", - class: "title-banner game-banner", - contents: [{ tag: "h2", contents: "Game Studio Club", property: "name" }], - }, - { - tag: "div", - class: "section-contents page-contents-center", - contents: [ - { - tag: "div", - class: "full-row", - contents: [ - { - tag: "h3", - class: "big", - contents: - "Apprendre à créer un <blue>jeu vidéo</blue> de A à Z", - property: "headline", - }, - { - tag: "strong", - contents: - "La création d'un jeu vidéo c'est l'occasion d'aborder plein de choses différentes !", - }, - { - tag: "p", - contents: - "<em><b><blue>Aucun prérequis nécessaire</blue></b>. Pas besoin d'être fort en maths ou en informatique, le but est d'apprendre et se détendre !</em>", - }, - ], - }, - { - tag: "div", - class: "list-wrapper", - property: "hasPart", - contents: [ - { - tag: "ul", - class: "learning-themes", - contents: GAMEDEV_THEMES.map(li => { - return { - tag: "li", - class: "learning-theme", - typeof: "ListItem", - contents: [ - { - tag: "strong", - class: "title", - contents: li.title, - property: "name", - }, - { - tag: "img", - alt: `learning theme image ${li.title}`, - src: `${images_url}${li.image}`, - property: "image", - }, - { - tag: "div", - class: "details", - property: "description", - contents: [ - li.comment && { - tag: "div", - class: "comment", - contents: li.comment, - }, - { - tag: "ul", - contents: li.details.map(d => { - return { - tag: "li", - contents: d, - }; - }), - }, - ], - }, - ], - }; - }), - }, - ], - }, - ], - }, - ], - }; - } -} - - -class GamedevPage extends WebPage { - - render() { - return { - tag: "div", - id: "game-studio-club-page", - contents: [ - new GameStudioClub().render(), - ], - }; - } -} - -module.exports = GamedevPage; - -},{"../../../../../constants":2,"../../../../lib/web-page":4}],6:[function(require,module,exports){ -"use strict"; - -const runPage = require("../../../../run-page"); -const GamedevPage = require("./gamedev-page"); -runPage(GamedevPage); - -},{"../../../../run-page":7,"./gamedev-page":5}],7:[function(require,module,exports){ -"use strict"; - -const objectHtmlRenderer = require("./lib/object-html-renderer"); -const Template = require("./template/template"); - -module.exports = function runPage(PageComponent) { - const template = new Template({ page: new PageComponent() }); - objectHtmlRenderer.setRenderCycleRoot(template); - objectHtmlRenderer.renderCycle(); -}; - -},{"./lib/object-html-renderer":3,"./template/template":9}],8:[function(require,module,exports){ -"use strict"; - -const { images_url } = require("../../../constants"); - -const NAV_MENU_ITEMS = [ - { url: "/games/", text: "Jeux" }, - { - url: "/education/", - text: "Pédagogie", - // submenu: [ - // { url: "/gamedev", text: "Création de jeux vidéo" }, - // ] - }, - { url: "/software-development/", text: "Software" } -]; - -class NavBar { - constructor() { - this.initEventHandlers(); - } - - handleBurgerClick() { - document.getElementById("nav-menu-list").classList.toggle("responsive-show"); - } - - initEventHandlers() { - window.addEventListener("click", event => { - if ( - event.target.id !== "nav-menu-list" && - !event.target.classList.contains("burger") && - !event.target.parentNode.classList.contains("burger") - ) { - document.getElementById("nav-menu-list").classList.remove("responsive-show"); - } - }); - } - - renderHome() { - return { - tag: "div", - class: "home", - contents: [ - { - tag: "a", - href: "/", - contents: [ - { - tag: "img", - alt: "Logo Kuadrado", - src: `${images_url}logo_kuadrado.svg`, - }, - { - tag: "img", - alt: "Kuadrado Software", - class: "logo-text", - src: `${images_url}logo_kuadrado_txt.svg`, - }, - ], - }, - ], - }; - } - - renderMenu(menuItemsArray, isSubmenu = false, parentUrl = "") { - return { - tag: "ul", - id: "nav-menu-list", - class: isSubmenu ? "submenu" : "", - contents: menuItemsArray.map(item => { - const { url, text, submenu } = item; - const href = `${parentUrl}${url}`; - return { - tag: "li", - class: !isSubmenu && window.location.pathname === href ? "active" : "", - contents: [ - { - tag: "a", - href, - contents: text, - }, - ].concat(submenu ? [this.renderMenu(submenu, true, url)] : []), - }; - }), - }; - } - - renderResponsiveBurger() { - return { - tag: "div", - class: "burger", - onclick: this.handleBurgerClick.bind(this), - contents: [{ tag: "span", contents: "···" }], - }; - } - - render() { - return { - tag: "nav", - contents: [ - this.renderHome(), - this.renderResponsiveBurger(), - this.renderMenu(NAV_MENU_ITEMS), - ], - }; - } -} - -module.exports = NavBar; - -},{"../../../constants":2}],9:[function(require,module,exports){ -"use strict"; - -const { in_construction } = require("../../config"); -const { images_url } = require("../../constants"); -const NavBar = require("./components/navbar"); - -class Template { - constructor(props) { - this.props = props; - } - render() { - return { - tag: "main", - contents: [ - { - tag: "header", - contents: [new NavBar().render()], - }, - in_construction && { - tag: "section", - class: "warning-banner", - contents: [ - { - tag: "strong", - class: "page-contents-center", - contents: "Site en construction ...", - }, - ], - }, - { - tag: "section", - id: "page-container", - contents: [this.props.page.render()], - }, - { - tag: "footer", - contents: [ - { - tag: "div", - class: "logo", - contents: [ - { - tag: "img", - alt: `logo Kuadrado`, - src: `${images_url}logo_kuadrado.svg`, - }, - { - tag: "img", - class: "text-logo", - alt: "Kuadrado Software", - src: `${images_url}logo_kuadrado_txt.svg`, - }, - ], - }, - { - tag: "span", - contents: "32 rue Simon Vialet, 07240 Vernoux en Vivarais. Ardèche, France", - }, - { - tag: "div", - contents: [ - { tag: "strong", contents: "<blue>Contact : </blue>" }, - { - tag: "a", - href: "mailto:contact@kuadrado-software.fr", - contents: "contact@kuadrado-software.fr", - }, - ], - }, - { - tag: "div", - class: "social", - contents: [ - { - tag: "strong", - contents: "<blue>Sur les réseaux : </blue>", - }, - { - tag: "a", - href: "https://www.linkedin.com/company/kuadrado-software", - target: "_blank", - contents: "in", - title: "Linkedin", - }, - { - tag: "a", - href: "https://twitter.com/KuadradoSoft", - target: "_blank", - contents: "t", - title: "Twitter", - style_rules: { fontFamily: "serif" }, - }, - ], - }, - { - tag: "span", - contents: `Copyright © ${new Date() - .getFullYear()} Kuadrado Software | - Toutes les images du site ont été réalisées par mes soins et peuvent être réutilisées pour un usage personnel.`, - }, - ], - }, - ], - }; - } -} - -module.exports = Template; - -},{"../../config":1,"../../constants":2,"./components/navbar":8}]},{},[6]); diff --git a/public/education/gamedev/index.html b/public/education/gamedev/index.html deleted file mode 100644 index 4ae9e1f17b52a02f5586c12f4ec9737f5032c061..0000000000000000000000000000000000000000 --- a/public/education/gamedev/index.html +++ /dev/null @@ -1,35 +0,0 @@ -<!DOCTYPE html> -<html lang="fr" prefix="og: https://ogp.me/ns#"> - <head> - <meta charset="utf-8" /> - <title>Kuadrado Software | Game Studio Club</title> - <meta name="description" content="Apprendre à créer un jeu vidéo de A à Z"/> - <meta name="author" content="Kuadrado Software" /> - <meta name="image" content="https://kuadrado-software.fr/assets/images/brain.png"/> - - <!-- Open Graph Protocol meta data --> - <meta property="og:title" content="Kuadrado Software | Game Studio Club"/> - <meta property="og:description" content="Apprendre à créer un jeu vidéo de A à Z"/> - <meta property="og:type" content="website" /> - <meta property="og:url" content="https://kuadrado-software.fr/gamedev"/> - <meta property="og:image" content="https://kuadrado-software.fr/assets/images/brain.png"/> - <meta property="twitter:image" content="https://kuadrado-software.fr/assets/images/brain.png"/> - <meta property="og:locale" content="fr_FR"/> - <meta property="og:site_name" content="Kuadrado Software" /> - - <!-- English translation not ready yet --> - <!-- <meta property="og:locale:alternate" content="en_GB" /> --> - - <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" /> - <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> - <link href="/style/style.css" rel="stylesheet" /> - <script type="application/ld+json">{"@context":"https://schema.org","type":"WebPage","description":"Apprendre à créer un jeu vidéo de A à Z","image":["https://kuadrado-software.fr/assets/images/brain.svg","https://kuadrado-software.fr/assets/images/brain.png","https://kuadrado-software.fr/assets/images/game_studio_banner.png","https://kuadrado-software.fr/assets/images/popularization_banner.png"],"keywords":"Apprendre informatique jeu vidéo, gamedev, code","name":"Kuadrado Software - Game Studio Club","url":"https://kuadrado-software.fr/education/game-studio/club"}</script> - </head> - <!-- The vocab attribute defines the standard vocabulary used for RDFa standard. - The DOM may contain properties such as "typeof" and "property" accordinly to the schema.org vocabulary --> - <body vocab="https://schema.org/"> - <!-- The H1 tag will be never seen but it's necessary for SEO --> - <main><h1 style="visibility: hidden">Kuadrado Software | Game Studio Club</h1></main> - </body> - <script type="text/javascript" src="./gamedev.js"></script> -</html>