Skip to content

Commit

Permalink
Merge pull request #64 from gtramontina/fix-build
Browse files Browse the repository at this point in the history
Build package prior to installing
  • Loading branch information
Kent C. Dodds committed Mar 30, 2016
2 parents dec2590 + 37c381b commit ff20d44
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
24 changes: 22 additions & 2 deletions bin/install
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
#!/usr/bin/env node
const install = require('../dist/install')
install()
const exists = require('path-exists')
const exec = require('execa')

function isBuilt() {
return exists('./dist')
}

function build() {
return exec('npm', ['run', 'build'])
}

function install() {
require('../dist/install')()
}

isBuilt().then(function built(yes) {
if (yes) {
install()
} else {
build().then(install)
}
})
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@
"report-coverage": "cat ./coverage/lcov.info | codecov",
"validate": "npm t && npm run check-coverage",
"commit": "git-cz",
"install": "opt --out ghooks-install --exec \"[ ! -d \"./dist\" ] && npm run build; node ./bin/install\"",
"install": "opt --out ghooks-install --exec \"node ./bin/install\"",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"dependencies": {
"execa": "^0.2.2",
"findup": "0.1.5",
"lodash.clone": "4.3.2",
"manage-path": "2.0.0",
"opt-cli": "1.4.0",
"path-exists": "^2.1.0",
"spawn-command": "0.0.2"
},
"devDependencies": {
Expand Down

0 comments on commit ff20d44

Please sign in to comment.