mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13: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) {
|
||||
file.category = file.category.toLowerCase();
|
||||
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;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"GEN_VERSION": 11,
|
||||
"GEN_VERSION": 12,
|
||||
"COMPRESS": false
|
||||
}
|
||||
@@ -8,10 +8,11 @@ const DocumentedEvent = require('./types/DocumentedEvent');
|
||||
const GEN_VERSION = require('./config.json').GEN_VERSION;
|
||||
|
||||
class Documentation {
|
||||
constructor(items) {
|
||||
constructor(items, custom) {
|
||||
this.classes = new Map();
|
||||
this.interfaces = new Map();
|
||||
this.typedefs = new Map();
|
||||
this.custom = custom;
|
||||
this.parse(items);
|
||||
}
|
||||
|
||||
@@ -104,6 +105,7 @@ class Documentation {
|
||||
classes: Array.from(this.classes.values()).map(c => c.serialize()),
|
||||
interfaces: Array.from(this.interfaces.values()).map(i => i.serialize()),
|
||||
typedefs: Array.from(this.typedefs.values()).map(t => t.serialize()),
|
||||
custom: this.custom,
|
||||
};
|
||||
return serialized;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@ const DocumentationScanner = require('./doc-scanner');
|
||||
const Documentation = require('./documentation');
|
||||
const fs = require('fs-extra');
|
||||
const zlib = require('zlib');
|
||||
const custom = require('../custom/index');
|
||||
|
||||
const docScanner = new DocumentationScanner(this);
|
||||
|
||||
function parseDocs(json) {
|
||||
console.log(`${json.length} items found`);
|
||||
const documentation = new Documentation(json);
|
||||
const documentation = new Documentation(json, custom);
|
||||
console.log('serializing');
|
||||
let output = JSON.stringify(documentation.serialize(), null, 0);
|
||||
if (compress) {
|
||||
|
||||
Reference in New Issue
Block a user