build script + editor + other things

This commit is contained in:
2023-06-16 19:20:44 +02:00
parent 15c33ce2c5
commit b6fb8ef294
8 changed files with 176 additions and 169 deletions

View File

@@ -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 );
}

View File

@@ -9,16 +9,7 @@
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"dependencies": {
"markdown-it": "^13.0.1",
"prompt-sync": "^4.2.0"
}
},
"node_modules/ansi-regex": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
"engines": {
"node": ">=6"
"markdown-it": "^13.0.1"
}
},
"node_modules/argparse": {
@@ -65,25 +56,6 @@
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
},
"node_modules/prompt-sync": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/prompt-sync/-/prompt-sync-4.2.0.tgz",
"integrity": "sha512-BuEzzc5zptP5LsgV5MZETjDaKSWfchl5U9Luiu8SKp7iZWD5tZalOxvNcZRwv+d2phNFr8xlbxmFNcRKfJOzJw==",
"dependencies": {
"strip-ansi": "^5.0.0"
}
},
"node_modules/strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dependencies": {
"ansi-regex": "^4.1.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
@@ -91,11 +63,6 @@
}
},
"dependencies": {
"ansi-regex": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g=="
},
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -131,22 +98,6 @@
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
},
"prompt-sync": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/prompt-sync/-/prompt-sync-4.2.0.tgz",
"integrity": "sha512-BuEzzc5zptP5LsgV5MZETjDaKSWfchl5U9Luiu8SKp7iZWD5tZalOxvNcZRwv+d2phNFr8xlbxmFNcRKfJOzJw==",
"requires": {
"strip-ansi": "^5.0.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"requires": {
"ansi-regex": "^4.1.0"
}
},
"uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",

View File

@@ -4,7 +4,7 @@
"description": "The website of libreevent",
"main": "build.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "node build.js"
},
"repository": {
"type": "git",
@@ -17,7 +17,6 @@
},
"homepage": "https://libreevent.janishutz.com",
"dependencies": {
"markdown-it": "^13.0.1",
"prompt-sync": "^4.2.0"
"markdown-it": "^13.0.1"
}
}

View File