From 9e2b0642a7ff2040ec51ac70c18873ac9568e1b0 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 10 Dec 2020 21:00:53 +0530 Subject: [PATCH] cleanup --- domains/awan.json | 2 +- domains/eldinesh.json | 20 ++++++++++---------- domains/elf.json | 4 ++-- domains/kobeff.json | 2 +- domains/mrkos.json | 4 ++-- domains/ray.json | 2 +- domains/sabil.json | 2 +- domains/samuel.json | 2 +- domains/yusuf-rawat.json | 2 +- utils/get-domain.js | 11 ++++++++--- 10 files changed, 28 insertions(+), 23 deletions(-) diff --git a/domains/awan.json b/domains/awan.json index b475e41a30..79c6eb4a2e 100644 --- a/domains/awan.json +++ b/domains/awan.json @@ -8,4 +8,4 @@ "record": { "CNAME": "awanshrestha.github.io" } -} +} \ No newline at end of file diff --git a/domains/eldinesh.json b/domains/eldinesh.json index 112841ecfc..782369913a 100644 --- a/domains/eldinesh.json +++ b/domains/eldinesh.json @@ -1,11 +1,11 @@ { - "description": "Dinesh Kumar's personal developer website", - "repo": "https://github.com/eldinesh/eldinesh.github.io", - "owner": { - "username": "eldinesh", - "email": "dseera6@gmail.com" - }, - "record": { - "CNAME": "eldinesh.github.io" - } - } \ No newline at end of file + "description": "Dinesh Kumar's personal developer website", + "repo": "https://github.com/eldinesh/eldinesh.github.io", + "owner": { + "username": "eldinesh", + "email": "dseera6@gmail.com" + }, + "record": { + "CNAME": "eldinesh.github.io" + } +} \ No newline at end of file diff --git a/domains/elf.json b/domains/elf.json index 9545ac8352..4e5f6cca2d 100644 --- a/domains/elf.json +++ b/domains/elf.json @@ -4,8 +4,8 @@ "owner": { "username": "Elflanded", "email": "elflanded@gmail.com" -}, + }, "record": { "CNAME": "elflanded.github.io" } -} +} \ No newline at end of file diff --git a/domains/kobeff.json b/domains/kobeff.json index 8dd2b077d7..0152fdf10a 100644 --- a/domains/kobeff.json +++ b/domains/kobeff.json @@ -8,4 +8,4 @@ "record": { "URL": "https://its.kobeff.repl.co" } -} +} \ No newline at end of file diff --git a/domains/mrkos.json b/domains/mrkos.json index 640f08ac03..b2e4331a6d 100644 --- a/domains/mrkos.json +++ b/domains/mrkos.json @@ -3,9 +3,9 @@ "repo": "https://github.com/mrkOS1210/mrkos1210.github.io", "owner": { "username": "mrkOS1210", - "email": "72011329+mrkOS1210@users.noreply.github.com", + "email": "72011329+mrkOS1210@users.noreply.github.com" }, "record": { "CNAME": "mrkOS1210.github.io" } -} +} \ No newline at end of file diff --git a/domains/ray.json b/domains/ray.json index 235d928e4f..e35d44e753 100644 --- a/domains/ray.json +++ b/domains/ray.json @@ -8,4 +8,4 @@ "record": { "CNAME": "b0ab519e-38d4-41f0-a0ca-912ac3b6dfac.repl.co" } -} +} \ No newline at end of file diff --git a/domains/sabil.json b/domains/sabil.json index 915f78bcd1..5e18cf9bec 100644 --- a/domains/sabil.json +++ b/domains/sabil.json @@ -8,4 +8,4 @@ "record": { "CNAME": "sabil62.github.io" } -} +} \ No newline at end of file diff --git a/domains/samuel.json b/domains/samuel.json index 0ae3a79695..a4718ddb39 100644 --- a/domains/samuel.json +++ b/domains/samuel.json @@ -8,4 +8,4 @@ "record": { "CNAME": "sisbest.github.io" } -} +} \ No newline at end of file diff --git a/domains/yusuf-rawat.json b/domains/yusuf-rawat.json index 1cc3c25649..b7ae8af00b 100644 --- a/domains/yusuf-rawat.json +++ b/domains/yusuf-rawat.json @@ -7,4 +7,4 @@ "record": { "URL": "https://github.com/Yusuf007R" } -} +} \ No newline at end of file diff --git a/utils/get-domain.js b/utils/get-domain.js index e932aafff7..af6ba5ec10 100644 --- a/utils/get-domain.js +++ b/utils/get-domain.js @@ -1,11 +1,16 @@ const fs = require('fs'); const path = require('path'); const R = require('ramda'); -const { DOMAINS_PATH } = require('./constants'); +const {DOMAINS_PATH} = require('./constants'); const toDomain = str => path.join(DOMAINS_PATH, str); -const toDomainData = R.compose(JSON.parse, R.toString, fs.readFileSync, toDomain); +const parseDomain = str => { + try {return JSON.parse(str);} + catch (e) {throw new Error("Error: Cant parse " + str);} +}; + +const toDomainData = R.compose(parseDomain, R.toString, fs.readFileSync, toDomain); const getDomains = () => fs.promises.readdir(DOMAINS_PATH, {}) @@ -14,4 +19,4 @@ const getDomains = () => name: name.replace(/\.json$/, ''), }))); -module.exports = { getDomains }; +module.exports = {getDomains};