MCPcopy
hub / github.com/expressjs/generator / main

Function main

bin/express-cli.js:447–485  ·  view source on GitHub ↗

* Main program.

()

Source from the content-addressed store, hash-verified

445 */
446
447function main () {
448 // Path
449 var destinationPath = program.args.shift() || '.'
450
451 // App name
452 var appName = createAppName(path.resolve(destinationPath)) || 'hello-world'
453
454 // View engine
455 if (program.view === true) {
456 if (program.ejs) program.view = 'ejs'
457 if (program.hbs) program.view = 'hbs'
458 if (program.hogan) program.view = 'hjs'
459 if (program.pug) program.view = 'pug'
460 }
461
462 // Default view engine
463 if (program.view === true) {
464 warning('the default view engine will not be jade in future releases\n' +
465 "use `--view=jade' or `--help' for additional options")
466 program.view = 'jade'
467 }
468
469 // Generate application
470 emptyDirectory(destinationPath, function (empty) {
471 if (empty || program.force) {
472 createApplication(appName, destinationPath)
473 } else {
474 confirm('destination is not empty, continue? [y/N] ', function (ok) {
475 if (ok) {
476 process.stdin.destroy()
477 createApplication(appName, destinationPath)
478 } else {
479 console.error('aborting')
480 exit(1)
481 }
482 })
483 }
484 })
485}
486
487/**
488 * Make the given dir relative to base.

Callers 1

express-cli.jsFile · 0.85

Calls 6

createAppNameFunction · 0.85
warningFunction · 0.85
emptyDirectoryFunction · 0.85
createApplicationFunction · 0.85
confirmFunction · 0.85
exitFunction · 0.85

Tested by

no test coverage detected