forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request react-bootstrap#565 from react-bootstrap/dry-run
Dry run and verbose flags for release process
- Loading branch information
Showing
17 changed files
with
143 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import path from 'path'; | ||
|
||
const repoRoot = path.resolve(__dirname, '../../'); | ||
const repoRoot = path.resolve(__dirname, '../'); | ||
|
||
const bowerRepo = '[email protected]:react-bootstrap/react-bootstrap-bower.git'; | ||
const docsRepo = '[email protected]:react-bootstrap/react-bootstrap.github.io.git'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import 'colors'; | ||
import _ from 'lodash'; | ||
import { exec } from 'child-process-promise'; | ||
|
||
let executionOptions = { | ||
dryRun: false, | ||
verbose: false | ||
}; | ||
|
||
function logWithPrefix(prefix, message) { | ||
let formattedMessage = message.trim().split('\n') | ||
.reduce((acc, line) => `${acc}${ acc !== '' ? '\n' : '' }${prefix} ${line}`, ''); | ||
|
||
console.log(formattedMessage); | ||
} | ||
|
||
function execWrapper(command, options = {}) { | ||
let proc = exec(command, options); | ||
let title = options.title || command; | ||
let log = message => logWithPrefix(`[${title}]`.grey, message); | ||
|
||
if (executionOptions.verbose) { | ||
let output = (data, type) => { | ||
logWithPrefix(`[${title}] ${type}:`.grey, data.toString()); | ||
}; | ||
proc = proc.progress(({stdout, stderr}) => { | ||
stdout.on('data', data => output(data, 'stdout')); | ||
stderr.on('data', data => output(data, 'stderr')); | ||
}) | ||
.then(result => { | ||
log('Complete'.cyan); | ||
return result; | ||
}) | ||
.catch(err => { | ||
log(`ERROR: ${err.toString()}`.red); | ||
throw err; | ||
}); | ||
} | ||
|
||
return proc; | ||
} | ||
|
||
function safeExec(command, options = {}) { | ||
let title = options.title || command; | ||
|
||
if (executionOptions.dryRun) { | ||
logWithPrefix(`[${title}]`.grey, 'DRY RUN'.magenta); | ||
return Promise.resolve(); | ||
} | ||
|
||
return execWrapper(command, options); | ||
} | ||
|
||
function setExecOptions(options) { | ||
executionOptions = _.extend({}, executionOptions, options); | ||
} | ||
|
||
export default { | ||
exec: execWrapper, | ||
safeExec, | ||
setExecOptions | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import 'colors'; | ||
import path from 'path'; | ||
import { exec } from 'child-process-promise'; | ||
import { exec, safeExec } from '../exec'; | ||
|
||
export default (repoRoot, version) => { | ||
return exec(`node_modules/.bin/changelog -t v${version}`) | ||
.then(() => exec(`git add ${path.join(repoRoot, 'CHANGELOG.md')}`)) | ||
.then(() => safeExec(`git add ${path.join(repoRoot, 'CHANGELOG.md')}`)) | ||
.then(() => console.log('Generated Changelog'.cyan)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { exec } from 'child-process-promise'; | ||
import { safeExec } from '../exec'; | ||
import tag from './tag'; | ||
|
||
export default (version) => { | ||
console.log('Releasing: '.cyan + 'npm module'.green); | ||
|
||
return tag() | ||
.then(() => exec('npm publish')) | ||
return tag(version) | ||
.then(() => safeExec('npm publish')) | ||
.then(() => console.log('Released: '.cyan + 'npm module'.green)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { exec } from 'child-process-promise'; | ||
import { safeExec } from '../exec'; | ||
|
||
export default (version) => { | ||
console.log('Tagging: '.cyan + `v${version}`.green); | ||
|
||
return exec(`git tag -a --message=v${version} v${version}`) | ||
.then(() => exec(`git push`)) | ||
.then(() => exec(`git push --tags`)) | ||
return safeExec(`git tag -a --message=v${version} v${version}`) | ||
.then(() => safeExec(`git push`)) | ||
.then(() => safeExec(`git push --tags`)) | ||
.then(() => console.log('Tagged: '.cyan + `v${version}`.green)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters