style: Update style for Prettier 1.8.0

This commit is contained in:
Pierre Vanduynslager 2017-11-07 00:17:05 -05:00
parent 470697c01d
commit 17a600672f
8 changed files with 48 additions and 40 deletions

View File

@ -59,7 +59,7 @@
"npm-registry-couchapp": "^2.6.12", "npm-registry-couchapp": "^2.6.12",
"nyc": "^11.2.1", "nyc": "^11.2.1",
"p-map-series": "^1.0.0", "p-map-series": "^1.0.0",
"prettier": "^1.8.0", "prettier": "~1.8.0",
"proxyquire": "^1.8.0", "proxyquire": "^1.8.0",
"rimraf": "^2.5.0", "rimraf": "^2.5.0",
"sinon": "^4.0.0", "sinon": "^4.0.0",

View File

@ -68,13 +68,13 @@ module.exports = async ({version, gitHead}, branch) => {
} }
Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}}); Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}});
const commits = (await getStream.array( const commits = (await getStream.array(gitLogParser.parse({_: `${gitHead ? gitHead + '..' : ''}HEAD`}))).map(
gitLogParser.parse({_: `${gitHead ? gitHead + '..' : ''}HEAD`}) commit => {
)).map(commit => { commit.message = commit.message.trim();
commit.message = commit.message.trim(); commit.gitTags = commit.gitTags.trim();
commit.gitTags = commit.gitTags.trim(); return commit;
return commit; }
}); );
logger.log('Found %s commits since last release', commits.length); logger.log('Found %s commits since last release', commits.length);
debug('Parsed commits: %o', commits); debug('Parsed commits: %o', commits);
return {commits, lastRelease: {version, gitHead}}; return {commits, lastRelease: {version, gitHead}};
@ -85,18 +85,24 @@ function noGitHeadMessage(branch, version) {
This means semantic-release can not extract the commits between now and then. This means semantic-release can not extract the commits between now and then.
This is usually caused by releasing from outside the repository directory or with innaccessible git metadata. This is usually caused by releasing from outside the repository directory or with innaccessible git metadata.
You can recover from this error by creating a tag for the version "${version}" on the commit corresponding to this release: You can recover from this error by creating a tag for the version "${
version
}" on the commit corresponding to this release:
$ git tag -f v${version} <commit sha1 corresponding to last release> $ git tag -f v${version} <commit sha1 corresponding to last release>
$ git push -f --tags origin ${branch} $ git push -f --tags origin ${branch}
`; `;
} }
function notInHistoryMessage(gitHead, branch, version) { function notInHistoryMessage(gitHead, branch, version) {
return `The commit the last release of this package was derived from is not in the direct history of the "${branch}" branch. return `The commit the last release of this package was derived from is not in the direct history of the "${
branch
}" branch.
This means semantic-release can not extract the commits between now and then. This means semantic-release can not extract the commits between now and then.
This is usually caused by force pushing, releasing from an unrelated branch, or using an already existing package name. This is usually caused by force pushing, releasing from an unrelated branch, or using an already existing package name.
You can recover from this error by restoring the commit "${gitHead}" or by creating a tag for the version "${version}" on the commit corresponding to this release: You can recover from this error by restoring the commit "${gitHead}" or by creating a tag for the version "${
version
}" on the commit corresponding to this release:
$ git tag -f v${version || '<version>'} <commit sha1 corresponding to last release> $ git tag -f v${version || '<version>'} <commit sha1 corresponding to last release>
$ git push -f --tags origin ${branch} $ git push -f --tags origin ${branch}
`; `;

View File

@ -7,9 +7,9 @@ module.exports = {
log(...args) { log(...args) {
const [format, ...rest] = args; const [format, ...rest] = args;
console.log( console.log(
`${chalk.grey('[Semantic release]:')}${typeof format === 'string' `${chalk.grey('[Semantic release]:')}${
? ` ${format.replace(/%[^%]/g, seq => chalk.magenta(seq))}` typeof format === 'string' ? ` ${format.replace(/%[^%]/g, seq => chalk.magenta(seq))}` : ''
: ''}`, }`,
...(typeof format === 'string' ? [] : [format]).concat(rest) ...(typeof format === 'string' ? [] : [format]).concat(rest)
); );
}, },

View File

@ -13,13 +13,13 @@ import pMapSeries from 'p-map-series';
*/ */
/** /**
* Create a temporary git repository and change the current working directory to the repository root. * Create a temporary git repository and change the current working directory to the repository root.
* *
* @method gitCommits * @method gitCommits
* @param {Array<Commit>} commits the created commits. * @param {Array<Commit>} commits the created commits.
* *
* @return {string} The path of the repository. * @return {string} The path of the repository.
*/ */
export async function gitRepo() { export async function gitRepo() {
const dir = tempy.directory(); const dir = tempy.directory();

View File

@ -408,7 +408,9 @@ test.serial('Create a tag as a recovery solution for "ENOTINHISTORY" error', asy
t.regex( t.regex(
stderr, stderr,
new RegExp( new RegExp(
`You can recover from this error by restoring the commit "${head}" or by creating a tag for the version "${version}" on the commit corresponding to this release` `You can recover from this error by restoring the commit "${head}" or by creating a tag for the version "${
version
}" on the commit corresponding to this release`
) )
); );