Skip to content

Commit

Permalink
feat(automated release chain): wip
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Apr 20, 2018
1 parent 898ede3 commit b5ccb11
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 36 deletions.
4 changes: 2 additions & 2 deletions chore/scripts/release.js
Expand Up @@ -20,8 +20,8 @@ return Promise.resolve()
//.then(() => ciCheck())
// .then(() => refresh())
//.then(() => build())
.then(() => changelog())
//.then(() => versionBump())
//.then(() => changelog())
.then(() => versionBump())
//.then(() => releaseGithub())
//.then(() => releaseNpm())
.catch((err) => console.info('release error'.red, err.red))
4 changes: 2 additions & 2 deletions chore/scripts/tasks/changelog.js
Expand Up @@ -29,10 +29,10 @@ function changelog () {
return (detectedPreset === config.validPreset) ? Promise.resolve(detectedPreset) : Promise.reject(detectedPreset)
})
// ensures that a bump type was detected
.then(() => utils.getBump())
.then(utils.getBump)
.then(
(bump) => {
detectedBump = bump
detectedBump = bump
console.info('detectedBump'.gray, detectedBump)
return (detectedBump) ? Promise.resolve(detectedBump) : Promise.reject(detectedBump)
})
Expand Down
68 changes: 36 additions & 32 deletions chore/scripts/utils.js
@@ -1,26 +1,26 @@
'use strict'

const colors = require('colors')
const fs = require('fs');
const path = require('path');
const util = require('util');
const exec = util.promisify(require('child_process').exec);

const config = require('../config');
const utils = {};

utils.exec = exec;
utils.deleteFile = deleteFile;
utils.copyFile = copyFile;
utils.copyFilePromise = copyFilePromise;
utils.copyMultiFilePromise = copyMultiFilePromise;
utils.backupPackageJson = backupPackageJson;
utils.restorePackageJson = restorePackageJson;
utils.getPreset = getCommitConvention;
utils.getBump = getBump;
utils.getPackageVersion = getPackageVersion;

module.exports = utils;
const fs = require('fs')
const path = require('path')
const util = require('util')
const exec = util.promisify(require('child_process').exec)

const config = require('../config')
const utils = {}

utils.exec = exec
utils.deleteFile = deleteFile
utils.copyFile = copyFile
utils.copyFilePromise = copyFilePromise
utils.copyMultiFilePromise = copyMultiFilePromise
utils.backupPackageJson = backupPackageJson
utils.restorePackageJson = restorePackageJson
utils.getPreset = getCommitConvention
utils.getBump = getBump
utils.getPackageVersion = getPackageVersion

module.exports = utils

function deleteFile (source) {
console.info('start deleting ', source)
Expand Down Expand Up @@ -126,18 +126,22 @@ function getCommitConvention () {
})
}

function getBump (preset) {
// Detect the recommended bump type by the conventional-commit standard
// source: https://github.com/conventional-changelog-archived-repos/conventional-recommended-bump/blob/master/README.md
return exec('conventional-recommended-bump -p ' + preset, {cwd: __base})
.then((bumpRes) => {

if (!bumpRes.stdout || bumpRes.stderr) {
return Promise.reject(bumpRes.stderr || false)
} else {
const bump = bumpRes.stdout.split('\n')[0]
return Promise.resolve(bump)
}
function getBump () {
return utils.getPreset()
.then(function (preset) {
// Detect the recommended bump type by the conventional-commit standard
// source: https://github.com/conventional-changelog-archived-repos/conventional-recommended-bump/blob/master/README.md
return exec('conventional-recommended-bump -p ' + preset, {cwd: __base})
.then((bumpRes) => {

if (!bumpRes.stdout || bumpRes.stderr) {
return Promise.reject(bumpRes.stderr || false)
} else {
const bump = bumpRes.stdout.split('\n')[0]
return Promise.resolve(bump)
}
})
.catch(console.log)
})
}

Expand Down

0 comments on commit b5ccb11

Please sign in to comment.