Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderGugel committed Sep 7, 2016
1 parent f9516c0 commit 9186736
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/install_cmd.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path'

import {EmptyObservable} from 'rxjs/observable/EmptyObservable'
import {concatStatic} from 'rxjs/operator/concat'
import {map} from 'rxjs/operator/map'
import {mergeStatic} from 'rxjs/operator/merge'
Expand All @@ -9,7 +10,7 @@ import {skip} from 'rxjs/operator/skip'
import fetchAll from './fetch_all'
import linkAll from './link_all'
import resolveAll from './resolve_all'
import {fromArgv, fromFs} from './pkg_json'
import {fromArgv, fromFs, save} from './pkg_json'
import {init as initCache} from './cache'

function installAll (dir) {
Expand All @@ -24,14 +25,23 @@ const parseArgv = ({_, production}) => ({
isProd: production
})

const shouldSave = argv =>
!!(argv.save || argv['save-dev'] || argv['save-optional'])

export default config => (cwd, argv) => {
const {isExplicit, isProd} = parseArgv(argv)
const dir = path.join(cwd, 'node_modules')
const target = '..'

// generate the "source" package.json file from which dependencies are being
// parsed and installed.
const srcPkgJson = isExplicit ? fromArgv(cwd, argv) : fromFs(cwd)
const srcPkgJson = isExplicit
? fromArgv(cwd, argv)
: fromFs(cwd)

const savedPkgJson = shouldSave(argv)
? srcPkgJson::save(cwd)
: EmptyObservable.create()

const installedAll = srcPkgJson
::map(pkgJson => ({
Expand All @@ -47,6 +57,7 @@ export default config => (cwd, argv) => {

return concatStatic(
initCache(),
installedAll
installedAll,
savedPkgJson
)
}
File renamed without changes.

0 comments on commit 9186736

Please sign in to comment.