UNPKG

publish-please

Version:

Safe and highly functional replacement for `npm publish`.

20 lines (17 loc) 653 B
'use strict'; const exec = require('cp-sugar').exec; const confirm = require('../utils/inquires').confirm; module.exports = { option: 'uncommittedChanges', statusText: 'Checking for the uncommitted changes', defaultParam: true, configurator(currentVal) { return confirm('Would you like to verify that there are no uncommitted changes in your working tree before publishing?', currentVal); }, canRun: () => true, run() { return exec('git status --porcelain').then(result => { if (/^([ADRM]| [ADRM])/m.test(result)) throw 'There are uncommitted changes in the working tree.'; }); } };