@ipfn/ts-neuron-gen
Version:
[](http://github.com/ipfn) [](https://www.npmjs.com/package/@ipfn/ts-neuron-gen
23 lines (22 loc) • 898 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const typedoc_1 = require("typedoc");
const neurons_pb_1 = require("@ipfn/neurons-pb");
const converter_1 = require("../src/converter");
// Start typedocs CLI application
// It will create `typedoc.json` file
new typedoc_1.CliApplication({
json: 'typedoc.json',
});
// Read `typedoc.json` file and parse JSON
const typedoc = JSON.parse(fs.readFileSync('typedoc.json', { encoding: 'utf-8' }));
// Remove `typedoc.json` file
fs.unlinkSync('typedoc.json');
// Convert `typedoc` to `neurons`
const neurons = converter_1.default(typedoc);
// Create `neurons.json` file
fs.writeFileSync('neurons.json', JSON.stringify(neurons, undefined, 2));
// Create `neurons.pb` file
fs.writeFileSync('neurons.pb', neurons_pb_1.default.NeuronsDescriptors.encode({ descriptors: neurons }));