UNPKG

@ipfn/ts-neuron-gen

Version:

[![IPFN project](https://img.shields.io/badge/project-IPFN-blue.svg?style=flat-square)](http://github.com/ipfn) [![npm](https://img.shields.io/npm/v/@ipfn/ts-neuron-gen.svg?maxAge=86400&style=flat-square)](https://www.npmjs.com/package/@ipfn/ts-neuron-gen

23 lines (22 loc) 898 B
#!/usr/bin/env node "use strict"; 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 }));