diff --git a/package.json b/package.json index 2f6abfcd..99a16265 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "check-coverage": "istanbul check-coverage --statements 80 --branches 80 --functions 80 --lines 80 ", "commit": "git-cz", "report-coverage": "cat ./coverage/lcov.info | codecov", + "semantic-release": "semantic-release pre && npm publish && semantic-release post", "start": "npm run test:watch", "test": "istanbul cover -x ./test _mocha -- -R spec test/tests/index.js --compilers js:babel/register", "test:watch": "nodemon -q --exec \"$(npm bin)/mocha test/tests/index.js --watch --compilers js:babel/register\" --" @@ -41,7 +42,7 @@ "author": "Jim Cummins (https://github.com/jimthedev)", "license": "MIT", "devDependencies": { - "chai": "3.3.0", + "chai": "3.4.0", "codecov.io": "0.1.6", "ghooks": "0.3.2", "istanbul": "0.3.22", @@ -52,20 +53,20 @@ "dependencies": { "babel": "5.8.23", "chalk": "1.1.1", + "cz-conventional-changelog": "1.1.4", "dedent": "0.4.0", "find-node-modules": "1.0.1", "glob": "5.0.15", "gulp": "3.9.0", - "gulp-git": "1.5.0", + "gulp-git": "1.6.0", "inquirer": "0.10.1", "json": "9.0.3", "minimist": "1.2.0", "node-uuid": "1.4.3", - "nodemon": "1.7.2", + "nodemon": "1.7.3", "rimraf": "2.4.3", "semver": "5.0.3", "shelljs": "0.5.3", - "strip-json-comments": "1.0.4", - "cz-conventional-changelog": "1.1.4" + "strip-json-comments": "1.0.4" } } diff --git a/src/cli/strategies/git-cz.js b/src/cli/strategies/git-cz.js index 13e2b679..0e743a9b 100644 --- a/src/cli/strategies/git-cz.js +++ b/src/cli/strategies/git-cz.js @@ -51,10 +51,12 @@ function gitCz(rawGitArgs, environment, adapterConfig) { if(stagingIsClean) { console.error('Error: No files added to staging! Did you forget to run git add?') } else { + + // OH GOD IM SORRY FOR THIS SECTION let adapterPackageJson = getParsedPackageJsonFromPath(resolvedAdapterConfigPath); let cliPackageJson = getParsedPackageJsonFromPath(environment.cliPath); console.log(`cz-cli@${cliPackageJson.version}, ${adapterPackageJson.name}@${adapterPackageJson.version}\n`); - commit(sh, inquirer, process.cwd(), prompter, {args: parsedGitCzArgs, disableAppendPaths:true}, function() { + commit(sh, inquirer, process.cwd(), prompter, {args: parsedGitCzArgs, disableAppendPaths:true, emitData:true, quiet:false}, function() { // console.log('commit happened'); }); diff --git a/src/git/commit.js b/src/git/commit.js index 8f518647..d69677d2 100644 --- a/src/git/commit.js +++ b/src/git/commit.js @@ -1,6 +1,7 @@ import git from 'gulp-git'; import gulp from 'gulp'; import dedent from 'dedent'; +import {isString} from '../../common/util'; export { commit }; @@ -9,21 +10,38 @@ export { commit }; */ function commit(sh, repoPath, message, options, done) { + var alreadyEnded = false; + // Get a gulp stream based off the config gulp.src(repoPath) // Format then commit .pipe(git.commit(dedent(message), options)) - + + // Write progress to the screen + .on('data',function(data) { + if(!options.quiet) { + if(isString(data)) + { + process.stdout.write(data); + } + } + }) + // Handle commit success .on('end', function() { - done(); + // TODO: Bug? Done is fired twice :( + if(!alreadyEnded) + { + done(); + alreadyEnded=true; + } }) // Handle commit failure - .on('error', function (error) { - console.error(error); - done(error); + .on('error', function (err) { + console.error(err); + done(err); }); } \ No newline at end of file diff --git a/test/tests/commit.js b/test/tests/commit.js index 9fc205d4..bccc0678 100644 --- a/test/tests/commit.js +++ b/test/tests/commit.js @@ -64,7 +64,7 @@ describe('commit', function() { // Pass in inquirer but it never gets used since we've mocked out a different // version of prompter. - commitizenCommit(sh, inquirer, repoConfig.path, prompter, {disableAppendPaths:true, quiet:true}, function() { + commitizenCommit(sh, inquirer, repoConfig.path, prompter, {disableAppendPaths:true, quiet:true, emitData:true}, function() { log(repoConfig.path, function(logOutput) { expect(logOutput).to.have.string(dummyCommitMessage); done();