index.js 745 B

123456789101112131415161718192021222324
  1. const chalk = require('chalk');
  2. const fs = require('fs');
  3. const path = require('path');
  4. const module_loader = require('./src/module_loader');
  5. const figures = require('figures');
  6. module.exports.start = function(system) {
  7. system.modules = [];
  8. system.log = function(text){
  9. console.log(text);
  10. }
  11. system.logUpdate = function(text){
  12. if (process.stdout.isTTY) {
  13. process.stdout.clearLine(0);
  14. process.stdout.cursorTo(0);
  15. process.stdout.write(text + '\r');
  16. }
  17. }
  18. system.logSymbols = figures;
  19. system.log(`Starting the ${chalk.bold('Modular Web System')}`);
  20. system.chalk = chalk;
  21. system.module_loader = module_loader;
  22. system.module_loader.load_all(system);
  23. }