Skip to content

Commit

Permalink
feat: add year key to the projects and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Tauhoo committed Oct 3, 2020
1 parent dd68938 commit 19a07d1
Show file tree
Hide file tree
Showing 26 changed files with 150 additions and 106 deletions.
11 changes: 6 additions & 5 deletions 10-sec-clicker/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "10 sec clicker!",
"description": "Let's click",
"author": "safesuk",
"facebook": "https://www.facebook.com/nattapat.sukpootanan"
}
"name": "10 sec clicker!",
"description": "Let's click",
"author": "safesuk",
"facebook": "https://www.facebook.com/nattapat.sukpootanan",
"year": 2019
}
11 changes: 6 additions & 5 deletions 5-rps/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Rock Paper Scissor Spock Lizard",
"description": "Just a rock paper scissor (only with 5 ways)",
"author": "Yuttakhan Baingen",
"facebook": "https://www.facebook.com/yuttakhan.baingen"
}
"name": "Rock Paper Scissor Spock Lizard",
"description": "Just a rock paper scissor (only with 5 ways)",
"author": "Yuttakhan Baingen",
"facebook": "https://www.facebook.com/yuttakhan.baingen",
"year": 2019
}
11 changes: 6 additions & 5 deletions Aleph Zero/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Aleph Zero",
"description": "ℵ0 ℵ1 ℵ2...",
"author": "aomKhunpanitchot",
"facebook": "https://www.facebook.com/AomKhunpanitchot"
}
"name": "Aleph Zero",
"description": "ℵ0 ℵ1 ℵ2...",
"author": "aomKhunpanitchot",
"facebook": "https://www.facebook.com/AomKhunpanitchot",
"year": 2019
}
11 changes: 6 additions & 5 deletions BNK48-Guess-the-name/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "BNK48 Guess the name",
"description": "Guess the current members name",
"author": "NOEI",
"facebook": "https://www.facebook.com/sarayut.booytawee"
}
"name": "BNK48 Guess the name",
"description": "Guess the current members name",
"author": "NOEI",
"facebook": "https://www.facebook.com/sarayut.booytawee",
"year": 2019
}
11 changes: 6 additions & 5 deletions Breakout!/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Breakout!",
"description": "Just destroy all bricks and win!",
"author": "Pimanus Kutragoon",
"facebook": "https://www.facebook.com/earthgy.pimanus"
}
"name": "Breakout!",
"description": "Just destroy all bricks and win!",
"author": "Pimanus Kutragoon",
"facebook": "https://www.facebook.com/earthgy.pimanus",
"year": 2019
}
3 changes: 2 additions & 1 deletion TheDIIIIIV/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "The DIIIIIV",
"description": "Click 'Close' until you can Click 'Go to Next Level'",
"author": "Jakkapat Boonroj",
"facebook": "https://www.facebook.com/boonroj"
"facebook": "https://www.facebook.com/boonroj",
"year": 2019
}
3 changes: 2 additions & 1 deletion android-war/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Android War",
"description": "Fire the Android for save the humanity.",
"author": "Jabont Chamikorn",
"facebook": "https://www.facebook.com/ijabont"
"facebook": "https://www.facebook.com/ijabont",
"year": 2019
}
3 changes: 2 additions & 1 deletion avenger-puzzle/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "The Avenger Puzzle",
"description": "Complete The Avenger to save the world.",
"author": "Jabont Chamikorn",
"facebook": "https://www.facebook.com/ijabont"
"facebook": "https://www.facebook.com/ijabont",
"year": 2019
}
3 changes: 2 additions & 1 deletion beat-me-if-you-can/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Beat Me If You can",
"description": "The game that you can't win",
"author": "Nitipoom Unrrom",
"facebook": "https://fb.me/nitipoom.unrorm"
"facebook": "https://fb.me/nitipoom.unrorm",
"year": 2019
}
64 changes: 44 additions & 20 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,61 @@
const fs = require('fs');
const path = require('path');
const fs = require('fs')
const path = require('path')

const excludes = [".git", ".idea", "node_modules"];
const directories = [];
const excludes = ['.git', '.idea', 'node_modules']
const directories = []

const { years } = require('./config')

fs.readdirSync(path.join(__dirname)).forEach(file => {
if (fs.lstatSync(path.join(__dirname, file)).isDirectory()) {
if (!excludes.includes(file)) {
directories.push(file);
}
if (fs.lstatSync(path.join(__dirname, file)).isDirectory()) {
if (!excludes.includes(file)) {
directories.push(file)
}
});

let gameTemplate = ``;
}
})

let gameTemplateMap = {}

for (const { year, header, description } of years) {
gameTemplateMap[year] = `
<div>
<h1 class="heading">${header}</h1>
<p class="desc">${description}</p>
<a
class="hacking"
href="https://github.com/chunza2542/noobtoberfest"
target="_blank"
>START HACKING</a>
</div>
<br />
<hr />
`
}

directories.forEach(directory => {
let info = fs.readFileSync(path.join(__dirname, directory, "info.json"));
info = JSON.parse(info.toString());
let info = fs.readFileSync(path.join(__dirname, directory, 'info.json'))
info = JSON.parse(info.toString())

const template = `
const template = `
<div class="game">
<a class="head" href="/${directory}" target="_blank"><h3>${info.name}</h3></a>
<p style="color: #ccc">${info.description}</p>
<a href="${info.facebook}" target="_blank" class="author">${info.author}</a>
</div>`

gameTemplate += template;
});
gameTemplateMap[info.year] += template
})

const totalTemplate = years
.map(({ year }) => gameTemplateMap[year])

let htmlTemplate = fs.readFileSync(path.join(__dirname, "template.html")).toString();
htmlTemplate = htmlTemplate.replace("#include-template", gameTemplate);
.join()

fs.writeFileSync("index.html", htmlTemplate);
console.log("Done~");
let htmlTemplate = fs
.readFileSync(path.join(__dirname, 'template.html'))
.toString()

htmlTemplate = htmlTemplate.replace('#include-template', totalTemplate)

fs.writeFileSync('index.html', htmlTemplate)
console.log('Done~')
14 changes: 14 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
years: [
{
year: 2020,
header: 'Noobtoberfest 2020',
description: `Game-coding challenge for everyone who wants to contribute to an open-source project for Hacktoberfest 2020`,
},
{
year: 2019,
header: 'Noobtoberfest 2019',
description: `Game-coding challenge for everyone who wants to contribute to an open-source project for Hacktoberfest 2019`,
},
],
}
11 changes: 6 additions & 5 deletions dream-time/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Dream Time",
"description": "Click button to plant the flower.",
"author": "Kanokpit Yowaratch",
"facebook": "https://www.facebook.com/kanokpit.y"
}
"name": "Dream Time",
"description": "Click button to plant the flower.",
"author": "Kanokpit Yowaratch",
"facebook": "https://www.facebook.com/kanokpit.y",
"year": 2019
}
11 changes: 6 additions & 5 deletions fruit-vegetable/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Fruit or Vegetable",
"description": "Test your knowledge!",
"author": "pugkung",
"facebook": "https://www.facebook.com/axid.pugkung"
}
"name": "Fruit or Vegetable",
"description": "Test your knowledge!",
"author": "pugkung",
"facebook": "https://www.facebook.com/axid.pugkung",
"year": 2019
}
3 changes: 2 additions & 1 deletion good-night-dear/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Good night, dear.",
"description": "Maybe, Skoy bedtime story is not okay for your kids.",
"author": "Suthep Chanchuphol",
"facebook": "https://fb.me/mumu.universe"
"facebook": "https://fb.me/mumu.universe",
"year": 2019
}
3 changes: 2 additions & 1 deletion math-master/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Math Master",
"description": "Choose between 2-12 numbers and let the monster hit with all the numbers that can divide by given number.",
"author": "Jabont Chamikorn",
"facebook": "https://www.facebook.com/ijabont"
"facebook": "https://www.facebook.com/ijabont",
"year": 2019
}
11 changes: 6 additions & 5 deletions predict-number/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Predict number",
"description": "Prediction number start predict went counter more than 5",
"author": "Phumai Chanphunga",
"facebook": "https://www.facebook.com/phumisito"
}
"name": "Predict number",
"description": "Prediction number start predict went counter more than 5",
"author": "Phumai Chanphunga",
"facebook": "https://www.facebook.com/phumisito",
"year": 2019
}
11 changes: 6 additions & 5 deletions pressffornoreason/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Press F for no reason",
"description": "just press F (or r for reset on keyboard)",
"author": "Chayapatr Archiwaranguprok",
"facebook": "https://www.facebook.com/chayapatr"
}
"name": "Press F for no reason",
"description": "just press F (or r for reset on keyboard)",
"author": "Chayapatr Archiwaranguprok",
"facebook": "https://www.facebook.com/chayapatr",
"year": 2019
}
3 changes: 2 additions & 1 deletion quick-thai-name/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Quick Thai Name",
"description": "Name after first letter and gender.",
"author": "Kittinan Srithaworn",
"facebook": "https://www.facebook.com/lu7urg"
"facebook": "https://www.facebook.com/lu7urg",
"year": 2019
}
4 changes: 2 additions & 2 deletions roulette/info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

{
"name": "Roulette",
"description": "Spin to green box, and you will get reward. if not score will decrease.",
"author": "Supawit Ruen",
"facebook": "https://www.facebook.com/supawit.ruen"
"facebook": "https://www.facebook.com/supawit.ruen",
"year": 2019
}
3 changes: 2 additions & 1 deletion shoot-me-if-you-can/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Shoot me if you can",
"description": "Shoot (Click) the item on the screen, If you miss 3 you will die.",
"author": "Chun Rapeepat",
"facebook": "https://www.facebook.com/chun42"
"facebook": "https://www.facebook.com/chun42",
"year": 2019
}
3 changes: 2 additions & 1 deletion spot-the-difference/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Spot The Difference",
"description": "The game to find the different characters in 60 seconds",
"author": "Punn Siriphanthong",
"facebook": "https://www.facebook.com/aunpun.punn"
"facebook": "https://www.facebook.com/aunpun.punn",
"year": 2019
}
16 changes: 0 additions & 16 deletions template.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,6 @@
</head>
<body>
<div class="main-container">
<div>
<h1 class="heading">Noobtoberfest 2019</h1>
<p class="desc">
Game-coding challenge for everyone who wants to contribute to an
open-source project for Hacktoberfest 2019
</p>
<a
class="hacking"
href="https://github.com/chunza2542/noobtoberfest"
target="_blank"
>START HACKING</a
>
</div>
<br />
<hr />

#include-template
<div class="credit">
Made with ❤️ by NoobProgrammer Thailand Community
Expand Down
9 changes: 5 additions & 4 deletions trob./info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "tic tac toe",
"description": "Attempted to start tic tac toe in HTML. ",
"author": "T. Rob.",
"facebook": "N/A"
"name": "tic tac toe",
"description": "Attempted to start tic tac toe in HTML. ",
"author": "T. Rob.",
"facebook": "N/A",
"year": 2019
}
9 changes: 5 additions & 4 deletions trob/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "tic tac toe",
"description": "Attempted to start tic tac toe in HTML. ",
"author": "T. Rob.",
"facebook": "N/A"
"name": "tic tac toe",
"description": "Attempted to start tic tac toe in HTML. ",
"author": "T. Rob.",
"facebook": "N/A",
"year": 2019
}
3 changes: 2 additions & 1 deletion turn-dark/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Turn dark",
"description": "Turn all the light off",
"author": "Mackie Ngamsomsakskul",
"facebook": "https://www.facebook.com/mackunz.mac"
"facebook": "https://www.facebook.com/mackunz.mac",
"year": 2019
}
11 changes: 6 additions & 5 deletions type-in-1-sec/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "type in 1 sec",
"description": "let's type",
"author": "safesuk",
"facebook": "https://www.facebook.com/nattapat.sukpootanan"
}
"name": "type in 1 sec",
"description": "let's type",
"author": "safesuk",
"facebook": "https://www.facebook.com/nattapat.sukpootanan",
"year": 2019
}

0 comments on commit 19a07d1

Please sign in to comment.