hunk.code_window:         npmRun('preinstall', ctx.root, opts.userAgent)
         }
         await installInContext(installType, specs, optionalDeps, ctx, installCtx, opts)
         if (scripts['postinstall']) {
           npmRun('postinstall', ctx.root, opts.userAgent)
         }
         if (scripts['prepublish']) {
  
hunk.labels: keep keep keep replace keep keep keep keep keep
hunk.after_edit:       await installInContext(installType, specs, optionalDeps, [], ctx, installCtx, opts)
  
hunk.file_path: src/api/install.ts
hunk.type: replace
file: import {resolve} from 'path'
  import * as path from 'path'
  import readPkg from '../fs/readPkg'
  import {
    PackageSpec,
    ResolveOptions,
    TarballResolution,
    DirectoryResolution,
    ResolveResult,
  } from '.'
  import fs = require('mz/fs')
  
  /**
   * Resolves a package hosted on the local filesystem
   */
  export default async function resolveLocal (spec: PackageSpec, opts: ResolveOptions): Promise<ResolveResult> {
    const dependencyPath = resolve(opts.root, spec.fetchSpec)
  
    if (spec.type === 'file') {
      const resolution: TarballResolution = {
        tarball: `file:${dependencyPath}`,
      }
      return {
        id: createLocalPkgId(dependencyPath),
        resolution,
      }
    }
  
    const localPkg = await readPkg(dependencyPath)
    const resolution: DirectoryResolution = {
      type: 'directory',
      root: dependencyPath,
    }
    return {
      id: createLocalPkgId(dependencyPath),
      resolution,
    }
  }
  
  function createLocalPkgId (dependencyPath: string): string {
    return 'local/' + encodeURIComponent(dependencyPath)
  }
  