1.0.3 • Published 7 years ago
compile_main_file v1.0.3
#compile_main_file iterates all subdirectories in a directory writes a module.exports line for each file containd in each sub directories
example
####say you have a directory called "./lib_dir/"
./lib_dir/
| |
---|---|---
|TEST1/|
| |file_1.js
| |file_2.json
|TEST2/|
| |file_3.js
CAUTION: provided file_name variable will be overwritten in the main directory,
each file must have a unique name; an error will throw if this occurs, your compile file will be broken until you fix the error and rerun
let compile_main_file = require(compile_main_file)
compile_main_file("./lib_dir/", "index")
####index.js will compiled to look like this
module.exports.file_1=require('./lib_dir/TEST1/file_1.js')
module.exports.file_2=require('./lib_dir/TEST1/file_2.json')
module.exports.file_3=require('./lib_dir/TEST2/file_3.js')