mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-21 22:24:07 +00:00
Update raw-api.js
This commit is contained in:
+8
-7
@@ -2,16 +2,17 @@ const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const directoryPath = path.join(__dirname, "../domains");
|
||||
const reserved = require(path.join(__dirname, "reserved.json"));
|
||||
const internal = require(path.join(__dirname, "internal.json"));
|
||||
const outputDir = path.join(__dirname, "../raw-api");
|
||||
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
}
|
||||
|
||||
let v1 = [];
|
||||
let v2 = [];
|
||||
const internal = require(path.join(__dirname, "internal.json"));
|
||||
const reserved = require(path.join(__dirname, "reserved.json"));
|
||||
|
||||
const v1 = [];
|
||||
const v2 = [];
|
||||
|
||||
for (const subdomain of internal) {
|
||||
const commonData = {
|
||||
@@ -101,15 +102,15 @@ fs.readdir(directoryPath, function (err, files) {
|
||||
|
||||
processedCount++;
|
||||
if (processedCount === files.length) {
|
||||
fs.writeFile("raw-api/index.json", JSON.stringify(v1, null, 2), (err) => {
|
||||
fs.writeFile("raw-api/index.json", JSON.stringify(v1), (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
fs.writeFile("raw-api/v1.json", JSON.stringify(v1, null, 2), (err) => {
|
||||
fs.writeFile("raw-api/v1.json", JSON.stringify(v1), (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
fs.writeFile("raw-api/v2.json", JSON.stringify(v2, null, 2), (err) => {
|
||||
fs.writeFile("raw-api/v2.json", JSON.stringify(v2), (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user