mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Add custom file support to new docs
This commit is contained in:
@@ -6,9 +6,9 @@ const categories = {};
|
|||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
file.category = file.category.toLowerCase();
|
file.category = file.category.toLowerCase();
|
||||||
if (!categories[file.category]) {
|
if (!categories[file.category]) {
|
||||||
categories[file.category] = {};
|
categories[file.category] = [];
|
||||||
}
|
}
|
||||||
categories[file.category][file.name] = file.data;
|
categories[file.category].push(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = categories;
|
module.exports = categories;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"GEN_VERSION": 11,
|
"GEN_VERSION": 12,
|
||||||
"COMPRESS": false
|
"COMPRESS": false
|
||||||
}
|
}
|
||||||
@@ -8,10 +8,11 @@ const DocumentedEvent = require('./types/DocumentedEvent');
|
|||||||
const GEN_VERSION = require('./config.json').GEN_VERSION;
|
const GEN_VERSION = require('./config.json').GEN_VERSION;
|
||||||
|
|
||||||
class Documentation {
|
class Documentation {
|
||||||
constructor(items) {
|
constructor(items, custom) {
|
||||||
this.classes = new Map();
|
this.classes = new Map();
|
||||||
this.interfaces = new Map();
|
this.interfaces = new Map();
|
||||||
this.typedefs = new Map();
|
this.typedefs = new Map();
|
||||||
|
this.custom = custom;
|
||||||
this.parse(items);
|
this.parse(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +105,7 @@ class Documentation {
|
|||||||
classes: Array.from(this.classes.values()).map(c => c.serialize()),
|
classes: Array.from(this.classes.values()).map(c => c.serialize()),
|
||||||
interfaces: Array.from(this.interfaces.values()).map(i => i.serialize()),
|
interfaces: Array.from(this.interfaces.values()).map(i => i.serialize()),
|
||||||
typedefs: Array.from(this.typedefs.values()).map(t => t.serialize()),
|
typedefs: Array.from(this.typedefs.values()).map(t => t.serialize()),
|
||||||
|
custom: this.custom,
|
||||||
};
|
};
|
||||||
return serialized;
|
return serialized;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ const DocumentationScanner = require('./doc-scanner');
|
|||||||
const Documentation = require('./documentation');
|
const Documentation = require('./documentation');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
|
const custom = require('../custom/index');
|
||||||
|
|
||||||
const docScanner = new DocumentationScanner(this);
|
const docScanner = new DocumentationScanner(this);
|
||||||
|
|
||||||
function parseDocs(json) {
|
function parseDocs(json) {
|
||||||
console.log(`${json.length} items found`);
|
console.log(`${json.length} items found`);
|
||||||
const documentation = new Documentation(json);
|
const documentation = new Documentation(json, custom);
|
||||||
console.log('serializing');
|
console.log('serializing');
|
||||||
let output = JSON.stringify(documentation.serialize(), null, 0);
|
let output = JSON.stringify(documentation.serialize(), null, 0);
|
||||||
if (compress) {
|
if (compress) {
|
||||||
|
|||||||
Reference in New Issue
Block a user