Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function initCmd (cwd) {
const initFile = path.resolve(config.home, '.ied-init')
init(cwd, initFile, (err) => {
if (err) {
if (err.message === 'canceled') {
console.log('init canceled!')
return
}
throw err
}
})
}
function init (args, cb) {
var dir = process.cwd()
log.pause()
npm.spinner.stop()
var initFile = npm.config.get("init-module")
if (!initJson.yes(npm.config)) {
console.log(
["This utility will walk you through creating a package.json file."
,"It only covers the most common items, and tries to guess sensible defaults."
,""
,"See `npm help json` for definitive documentation on these fields"
,"and exactly what they do."
,""
,"Use `npm install --save` afterwards to install a package and"
,"save it as a dependency in the package.json file."
,""
,"Press ^C at any time to quit."
].join("\n"))
}
initJson(dir, initFile, npm.config, function (er, data) {
log.resume()
log.silly("package data", data)
)
err.code = 'EUNSUPPORTED'
throw err
}
}
var npxArgs = [process.argv0, '[fake arg]', '--always-spawn', packageName, ...process.argv.slice(4)]
var parsed = npx.parseArgs(npxArgs, NPM_PATH)
return npx(parsed)
.then(() => cb())
.catch(cb)
}
var dir = process.cwd()
log.pause()
var initFile = npm.config.get('init-module')
if (!initJson.yes(npm.config)) {
output([
'This utility will walk you through creating a package.json file.',
'It only covers the most common items, and tries to guess sensible defaults.',
'',
'See `npm help json` for definitive documentation on these fields',
'and exactly what they do.',
'',
'Use `npm install ` afterwards to install a package and',
'save it as a dependency in the package.json file.',
'',
'Press ^C at any time to quit.'
].join('\n'))
}
initJson(dir, initFile, npm.config, noProgressTillDone(function (er, data) {
log.resume()
log.silly('package data', data)