Skip to content

Commit

Permalink
fix(scripts): add handling dat-node
Browse files Browse the repository at this point in the history
  • Loading branch information
watilde committed Aug 5, 2017
1 parent fb1bc71 commit dc16b74
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/install.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const exec = require('child_process').exec
const execFile = require('child_process').execFile
const path = require('path')
const fs = require('fs')
const execPath = process.execPath
const binPath = path.dirname(execPath)
const nodeModules = path.join(execPath, '../../lib/node_modules/dep')
const datNode = path.join(nodeModules, 'node_modules/dat-node')
const repository = 'https://github.com/watilde/dep.git'
const bin = path.join(nodeModules, 'bin/dep.js')

Expand All @@ -16,6 +18,10 @@ exec('git clone ' + repository + ' ' + nodeModules, (e) => {
process.stdout.write(' => ' + path.join(binPath, 'dep') + '\n')
fs.link(bin, path.join(binPath, 'dep'), (e) => {
if (e) throw e
process.stdout.write('dep was installed successfully\n')
process.stdout.write('install: dat-node\n')
execFile(bin, ['install'], {cwd: datNode}, (e) => {
if (e) throw e
process.stdout.write('dep was installed successfully\n')
})
})
})

0 comments on commit dc16b74

Please sign in to comment.