mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 05:14:23 +00:00
build script + editor + other things
This commit is contained in:
@@ -7,19 +7,48 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const prompt = require( 'prompt-sync' );
|
||||
const markdownIt = require( 'markdown-it' );
|
||||
const md2html = new markdownIt();
|
||||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
buildNav( buildDocs() );
|
||||
|
||||
if ( prompt( 'Do you want to rebuild the ' ).toLowercase === 'y' ) {
|
||||
buildDocs();
|
||||
buildNav();
|
||||
}
|
||||
|
||||
function buildNav () {
|
||||
function buildNav ( pathObject ) {
|
||||
console.log( 'building nav ' + pathObject );
|
||||
}
|
||||
|
||||
function buildDocs () {
|
||||
let directoriesToScan = [];
|
||||
let files = fs.readdirSync( path.join( __dirname + '/src/' ) );
|
||||
for ( let file in files ) {
|
||||
if ( files[ file ].substring( files[ file ].length - 3 ) == '.md' ) {
|
||||
handleMD( files[ file ] );
|
||||
} else {
|
||||
directoriesToScan.push( files[ file ] );
|
||||
}
|
||||
}
|
||||
|
||||
let count = directoriesToScan.length;
|
||||
|
||||
while ( count > 0 ) {
|
||||
for ( let missing in directoriesToScan ) {
|
||||
let files = fs.readdirSync( path.join( __dirname + '/src/' + directoriesToScan[ missing ] ) );
|
||||
count -= 1;
|
||||
for ( let file in files ) {
|
||||
if ( files[ file ].substring( files[ file ].length - 3 ) == '.md' ) {
|
||||
handleMD( files[ file ] );
|
||||
} else {
|
||||
directoriesToScan.push( directoriesToScan[ missing ] + '/' + files[ file ] );
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
md2html.render( '#Test' );
|
||||
return 'Hi';
|
||||
}
|
||||
|
||||
function handleMD ( path ) {
|
||||
console.log( 'md file', path );
|
||||
}
|
||||
Reference in New Issue
Block a user