"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/init.js" (8 Mar 2017, 1223 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // initialize a package.json file
    2 
    3 module.exports = init
    4 
    5 var log = require('npmlog')
    6 var npm = require('./npm.js')
    7 var initJson = require('init-package-json')
    8 var output = require('./utils/output.js')
    9 
   10 init.usage = 'npm init [--force|-f|--yes|-y]'
   11 
   12 function init (args, cb) {
   13   var dir = process.cwd()
   14   log.pause()
   15   log.disableProgress()
   16   var initFile = npm.config.get('init-module')
   17   if (!initJson.yes(npm.config)) {
   18     output([
   19       'This utility will walk you through creating a package.json file.',
   20       'It only covers the most common items, and tries to guess sensible defaults.',
   21       '',
   22       'See `npm help json` for definitive documentation on these fields',
   23       'and exactly what they do.',
   24       '',
   25       'Use `npm install <pkg> --save` afterwards to install a package and',
   26       'save it as a dependency in the package.json file.',
   27       '',
   28       'Press ^C at any time to quit.'
   29     ].join('\n'))
   30   }
   31   initJson(dir, initFile, npm.config, function (er, data) {
   32     log.resume()
   33     log.silly('package data', data)
   34     if (er && er.message === 'canceled') {
   35       log.warn('init', 'canceled')
   36       return cb(null, data)
   37     }
   38     log.info('init', 'written successfully')
   39     cb(er, data)
   40   })
   41 }