|  | @ -37,11 +37,13 @@ class OAO { | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | } |  |  | } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  | const copyright_disclaimer = `/*
 |  |  | const copyright_disclaimer = ` | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | /** | 
			
		
	
		
		
			
				
					|  |  |  * This file is part of the jps-like-websites lib |  |  |  * This file is part of the jps-like-websites lib | 
			
		
	
		
		
			
				
					|  |  |  * URL: https://git.labos.goip.de/chris/jpc-like-websites
 |  |  |  * URL: https://git.labos.goip.de/chris/jpc-like-websites
 | 
			
		
	
		
		
			
				
					|  |  |  * @copyright by its creator Christian Martin  |  |  |  * @copyright by its creator Christian Martin  | 
			
		
	
		
		
			
				
					|  |  |  */  |  |  |  */  | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | `;
 |  |  | `;
 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | let fileOrder = Object.assign(new OAO(), require('./fileOrder.json')); |  |  | let fileOrder = Object.assign(new OAO(), require('./fileOrder.json')); | 
			
		
	
	
		
		
			
				
					|  | @ -118,20 +120,45 @@ function resolveDependencyOrder(oao) { | 
			
		
	
		
		
			
				
					|  |  | } |  |  | } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  | function appendContent(srcFile, targetFile) { |  |  | /** | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |     return fs.readFile(srcFile, 'utf8') |  |  |  *  | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         .then(content => { |  |  |  * @param {string} srcFile path to src file | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |  * @param {string} targetFile path of target file that will contain all scripts | 
			
		
	
		
		
			
				
					|  |  |  |  |  |  */ | 
			
		
	
		
		
			
				
					|  |  |  |  |  | async function appendContent(srcFile, targetFile) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     try { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         let content = await fs.readFile(srcFile, 'utf8'); | 
			
		
	
		
		
			
				
					|  |  |         console.log(`Processing '${srcFile}'`); |  |  |         console.log(`Processing '${srcFile}'`); | 
			
		
	
		
		
			
				
					
					|  |  |             console.log(`           READ: successfully!`) |  |  |         console.log(`           READ: successfully!`); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             console.log(`           Attepting to append`); |  |  |         console.log(`           Adding Copyright disclaimer!`); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             return fs.appendFile(targetFile, content); |  |  |         console.log(`           Attepting to append to default script variant`); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         }) |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         .then(() => { |  |  |         content = [ | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |             ...copyright_disclaimer.split('\r\n'), | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             ...content.split('\r\n') | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         ]; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         await fs.appendFile(targetFile, content.join('\r\n')); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         console.log(`           Adding export to "modulize"!`); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         /** | 
			
		
	
		
		
			
				
					|  |  |  |  |  |          * Checks weither the given line starts with any of the exportable values. | 
			
		
	
		
		
			
				
					|  |  |  |  |  |          * @param {string} line | 
			
		
	
		
		
			
				
					|  |  |  |  |  |          * @returns {boolean} | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         */ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         const isExpStarter = line => ["function", "const", "let", "class"].some(starter => line.startsWith(starter)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         console.log(`           Attepting to append to module variant`); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         await fs.appendFile( | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             targetFileModule, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             content | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 .map(l => (isExpStarter(l) ? "export " : "") + l) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 .join('\r\n') | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         ); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |         console.log(`           Append/Write: successfully!`); |  |  |         console.log(`           Append/Write: successfully!`); | 
			
		
	
		
		
			
				
					
					|  |  |         }) |  |  |     } catch (error) { | 
			
				
				
			
		
	
		
		
			
				
					|  |  |         .catch(error => { |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  |         console.error(`Error reading/writing files: ${error.message}`); |  |  |         console.error(`Error reading/writing files: ${error.message}`); | 
			
		
	
		
		
			
				
					
					|  |  |         }) |  |  |     } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | } |  |  | } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -150,11 +177,13 @@ let orderedJoinList = fileOrder.keys | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | const targetFile = "./jpc-like-websites.js"; |  |  | const targetFile = "./jpc-like-websites.js"; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | const targetFileModule = "./jpc-like-websites.module.js"; | 
			
		
	
		
		
			
				
					|  |  | console.log("(Re-) Creating target file: '" + targetFile + "'"); |  |  | console.log("(Re-) Creating target file: '" + targetFile + "'"); | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | /* EMPTY (create?) TARGET FILE */ |  |  | /* EMPTY (create?) TARGET FILE */ | 
			
		
	
		
		
			
				
					
					|  |  | fs.writeFile(targetFile, "", err => { }) |  |  | fs.writeFile(targetFile, "", err => { }); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | fs.writeFile(targetFileModule, "", err => { }); | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | orderedJoinList |  |  | orderedJoinList | 
			
		
	
		
		
			
				
					|  |  |     .reduce((prevPromise, filePath) => prevPromise |  |  |     .reduce((prevPromise, filePath) => prevPromise | 
			
		
	
	
		
		
			
				
					|  | 
 |