Skip to content

Commit

Permalink
Merged master.
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2ciek committed Jul 21, 2020
2 parents d5f4f77 + f0e184d commit da187fb
Show file tree
Hide file tree
Showing 11 changed files with 393 additions and 153 deletions.
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,52 @@
Changelog
=========

## [22.0.0](https://github.com/ckeditor/ckeditor5-dev/compare/v21.0.0...v22.0.0) (2020-07-20)

### MAJOR BREAKING CHANGES [ℹ️](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html#major-and-minor-breaking-changes)

* **[env](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-env)**: Task `generateChangelogForMonoRepository()` will generate the changelog uses the same version for all packages.

### Features

* **[tests](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-tests)**: Added `sinon-chai` to automated tests. Closes https://github.com/ckeditor/ckeditor5/issues/7456. ([commit](https://github.com/ckeditor/ckeditor5-dev/commit/e82040e6a17e87bae6b450df29e5ac7084b5e5be))

### Bug fixes

* **[env](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-env)**: The `getCommit()` util will return a proper array with commits if the release branch in the project is other than `master`. Due to `--first-parent` flag which is used for collecting the commits, when the release branch is other than `master`, commits made on `master` could not be collected directly from the branch. Now those commits are collected in two ranges: from the last tag to the [base commit](https://git-scm.com/docs/git-merge-base) and from the base commit to HEAD and merged together. Closes [ckeditor/ckeditor5#7492](https://github.com/ckeditor/ckeditor5/issues/7492). ([commit](https://github.com/ckeditor/ckeditor5-dev/commit/e18db62d33c11dbe2a98a845e46cbde73186fa9d))
* **[env](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-env)**: Scoped breaking changes notes won't be duplicated in the changelog. Closes [ckeditor/ckeditor5#7495](https://github.com/ckeditor/ckeditor5/issues/7495). ([commit](https://github.com/ckeditor/ckeditor5-dev/commit/e4eefa669bce9a8d1ccca6ce1c92914a17151825))
* **[env](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-env)**: Commit and note groups should be sorted properly. Closes [ckeditor/ckeditor5#7496](https://github.com/ckeditor/ckeditor5/issues/7496). ([commit](https://github.com/ckeditor/ckeditor5-dev/commit/a08020cbb29bf62cabc28a71926278abe32f54bf))

### Other changes

* **[env](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-env)**: The `generateChangelogForMonoRepository()` task supports `options.releaseBranch` that is passed directly to the `getCommit()` util. See [ckeditor/ckeditor5#7492](https://github.com/ckeditor/ckeditor5/issues/7492). ([commit](https://github.com/ckeditor/ckeditor5-dev/commit/e18db62d33c11dbe2a98a845e46cbde73186fa9d))
* **[env](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-env)**: The changelog generator for mono repository will use the same version for all packages. On the screen, a user will see all changes: `MAJOR BREAKING CHANGES`, `MINOR BREAKING CHANGES`, and all commits since the last release. The user must review it and provide the version. Closes [ckeditor/ckeditor5#7323](https://github.com/ckeditor/ckeditor5/issues/7323). ([commit](https://github.com/ckeditor/ckeditor5-dev/commit/4036b6e359238db764be695f7491e7e3e85901bd))
* **[env](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-env)**: Merge commits between `stable/release/master` branches will be ignored when generating the changelog, to reduce the noise. Closes [ckeditor/ckeditor5#7489](https://github.com/ckeditor/ckeditor5/issues/7489). ([commit](https://github.com/ckeditor/ckeditor5-dev/commit/cedc53f350aef74621f80f8a2e953d18892f5c52))

### Released packages

Check out the [Versioning policy](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html) guide for more information.

<details>
<summary>Released packages (summary)</summary>

Major releases (contain major breaking changes):

* [@ckeditor/ckeditor5-dev-env](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-env): v21.0.0 => v22.0.0

Releases containing new features:

* [@ckeditor/ckeditor5-dev-tests](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-tests): v21.0.0 => v22.0.0

Other releases:

* [@ckeditor/ckeditor5-dev-docs](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-docs): v21.0.0 => v22.0.0
* [@ckeditor/ckeditor5-dev-utils](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-utils): v21.0.0 => v22.0.0
* [@ckeditor/ckeditor5-dev-webpack-plugin](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-webpack-plugin): v21.0.0 => v22.0.0
* [@ckeditor/jsdoc-plugins](https://www.npmjs.com/package/@ckeditor/jsdoc-plugins): v21.0.0 => v22.0.0
</details>


## [21.0.0](https://github.com/ckeditor/ckeditor5-dev/compare/v20.2.1...v21.0.0) (2020-06-22)

### MAJOR BREAKING CHANGES [ℹ️](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html#major-and-minor-breaking-changes)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ckeditor5-dev",
"version": "21.0.0",
"version": "22.0.0",
"private": true,
"dependencies": {
"glob": "^7.1.6",
Expand Down
6 changes: 3 additions & 3 deletions packages/ckeditor5-dev-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@ckeditor/ckeditor5-dev-docs",
"version": "21.0.0",
"version": "22.0.0",
"description": "Tasks used to build documentation for CKEditor 5.",
"keywords": [],
"main": "lib/index.js",
"dependencies": {
"@ckeditor/ckeditor5-dev-utils": "^21.0.0",
"@ckeditor/jsdoc-plugins": "^21.0.0",
"@ckeditor/ckeditor5-dev-utils": "^22.0.0",
"@ckeditor/jsdoc-plugins": "^22.0.0",
"fast-glob": "^3.2.4",
"jsdoc": "ckeditor/jsdoc#fixed-trailing-comment-doclets",
"tmp": "^0.2.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const noteInfo = `[ℹ️](${ VERSIONING_POLICY_URL }#major-and-minor-breaking-c
*
* @param {Boolean} [options.collaborationFeatures=false] Whether to add a note about collaboration features.
*
* @param {String} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages.
*
* @returns {Promise}
*/
module.exports = function generateChangelogForMonoRepository( options ) {
Expand Down Expand Up @@ -96,7 +98,8 @@ module.exports = function generateChangelogForMonoRepository( options ) {
const packagesPaths = new Map();

const commitOptions = {
from: options.from ? options.from : 'v' + pkgJson.version
from: options.from ? options.from : 'v' + pkgJson.version,
releaseBranch: options.releaseBranch
};

return getCommits( transformCommit, commitOptions )
Expand Down
113 changes: 76 additions & 37 deletions packages/ckeditor5-dev-env/lib/release-tools/utils/getcommits.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,95 @@ const conventionalCommitsFilter = require( 'conventional-commits-filter' );
const gitRawCommits = require( 'git-raw-commits' );
const concat = require( 'concat-stream' );
const parserOptions = require( './parseroptions' );
const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );

/**
* Returns a promise that resolves an array of commits since the last tag specified as `options.from`.
*
* @param {Function} transformCommit
* @param {Object} options
* @param {String} [options.from] A commit or tag name that will be the first param of the range of commits to collect.
* @param {String} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages.
* @param {String} [options.mainBranch='master'] A name of the main branch in the repository.
* @returns {Promise.<Array.<Commit>>}
*/
module.exports = function getCommits( transformCommit, options = {} ) {
const gitRawCommitsOpts = {
format: '%B%n-hash-%n%H',
from: options.from,
merges: undefined,
firstParent: true
};
const releaseBranch = options.releaseBranch || 'master';
const mainBranch = options.mainBranch || 'master';

return new Promise( ( resolve, reject ) => {
const stream = gitRawCommits( gitRawCommitsOpts )
.on( 'error', err => {
/* istanbul ignore else */
if ( err.message.match( /'HEAD': unknown/ ) ) {
reject( new Error( 'Given repository is empty.' ) );
} else if ( err.message.match( new RegExp( `'${ options.from }\\.\\.HEAD': unknown` ) ) ) {
reject( new Error(
`Cannot find tag or commit "${ options.from }" in given repository.`
) );
} else {
reject( err );
}
} );
const currentBranch = exec( 'git rev-parse --abbrev-ref HEAD' ).trim();

stream.pipe( conventionalCommitsParser( parserOptions ) )
.pipe( concat( data => {
const commits = conventionalCommitsFilter( data )
.map( commit => transformCommit( commit ) )
.reduce( ( allCommits, commit ) => {
if ( Array.isArray( commit ) ) {
allCommits.push( ...commit );
} else {
allCommits.push( commit );
}
// Check whether current branch is the same as the release branch.
if ( currentBranch !== releaseBranch ) {
return Promise.reject( new Error(
`Expected to be checked out on the release branch ("${ releaseBranch }") instead of "${ currentBranch }". Aborting.`
) );
}

return allCommits;
}, [] )
.filter( commit => commit );
// If the release branch is the same as the main branch, we can collect all commits directly from the branch.
if ( releaseBranch === mainBranch ) {
return findCommits( { from: options.from } );
} else {
// Otherwise, (release branch is other than the main branch) we need to merge arrays of commits.
// See: https://github.com/ckeditor/ckeditor5/issues/7492.
const baseCommit = exec( `git merge-base ${ releaseBranch } ${ mainBranch }` ).trim();

stream.destroy();
const commitPromises = [
// 1. Commits from the last release and to the point where the release branch was created (the merge-base commit).
findCommits( { from: options.from, to: baseCommit } ),
// 2. Commits from the merge-base commit to HEAD.
findCommits( { from: baseCommit } )
];

return resolve( commits );
} ) );
} );
return Promise.all( commitPromises )
.then( commits => [].concat( ...commits ) );
}

function findCommits( gitRawCommitsOptions ) {
const gitRawCommitsOpts = Object.assign( {}, gitRawCommitsOptions, {
format: '%B%n-hash-%n%H',
merges: undefined,
firstParent: true
} );

return new Promise( ( resolve, reject ) => {
const stream = gitRawCommits( gitRawCommitsOpts )
.on( 'error', err => {
/* istanbul ignore else */
if ( err.message.match( /'HEAD': unknown/ ) ) {
reject( new Error( 'Given repository is empty.' ) );
} else if ( err.message.match( new RegExp( `'${ options.from }\\.\\.HEAD': unknown` ) ) ) {
reject( new Error(
`Cannot find tag or commit "${ options.from }" in given repository.`
) );
} else {
reject( err );
}
} );

stream.pipe( conventionalCommitsParser( parserOptions ) )
.pipe( concat( data => {
const commits = conventionalCommitsFilter( data )
.map( commit => transformCommit( commit ) )
.reduce( ( allCommits, commit ) => {
if ( Array.isArray( commit ) ) {
allCommits.push( ...commit );
} else {
allCommits.push( commit );
}

return allCommits;
}, [] )
.filter( commit => commit );

stream.destroy();

return resolve( commits );
} ) );
} );
}

function exec( command ) {
return tools.shExec( command, { verbosity: 'error' } );
}
};
4 changes: 2 additions & 2 deletions packages/ckeditor5-dev-env/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@ckeditor/ckeditor5-dev-env",
"version": "21.0.0",
"version": "22.0.0",
"description": "Tasks used during development of CKEditor 5.",
"keywords": [],
"main": "lib/index.js",
"dependencies": {
"@ckeditor/ckeditor5-dev-utils": "^21.0.0",
"@ckeditor/ckeditor5-dev-utils": "^22.0.0",
"@octokit/rest": "^17.9.2",
"chalk": "^4.0.0",
"compare-func": "^2.0.0",
Expand Down
Loading

0 comments on commit da187fb

Please sign in to comment.