const path = require('path')
const locker = require('./lock/locker')

function lock (argv) {
  argv._handled = true
  const pkgJSON = require(path.join(process.env.PWD, 'package.json'))
  const lock = {
    name: pkgJSON.name,
    version: pkgJSON.version,
    lockfileVersion: 1
  }
  locker(lock)
}

module.exports = {
  command: 'lock',
  describe: 'Generate package-lock.json',
  handler: lock,
  aliases: ['l']
}

@@ -22,16 +22,63 @@
 'path')%0A
+const resolver = require('./install/resolver')%0A
 const lo
@@ -110,16 +110,46 @@
 cker')%0A%0A
+global.dependenciesTree = %7B%7D%0A%0A
 function
@@ -268,111 +268,609 @@
 nst 
-lock = %7B%0A    name: pkgJSON.name,%0A    version: pkgJSON.version,%0A    lockfileVersion: 1%0A  %7D%0A  locker(lock
+dependencies = pkgJSON.dependencies %7C%7C %7B%7D%0A  const devDependencies = pkgJSON.devDependencies %7C%7C %7B%7D%0A  const optionalDependencies = pkgJSON.optionalDependencies %7C%7C %7B%7D%0A  const lock = %7B%0A    name: pkgJSON.name,%0A    version: pkgJSON.version,%0A    lockfileVersion: 1%0A  %7D%0A  const allDependencies = Object.assign(%0A    optionalDependencies,%0A    devDependencies,%0A    dependencies%0A  )%0A  const deps = allDependencies%0A  const list = resolver(deps)%0A  Promise.all(list).then(() =%3E %7B%0A    lock.dependencies = global.dependenciesTree%0A    locker(lock)%0A    process.stdout.write(%0A      %60created package-lock.json%5Cn%60%0A    )%0A  %7D
 )%0A%7D%0A

add dep lock