Skip to content

Commit

Permalink
Merge pull request #640 from ckeditor/i/608
Browse files Browse the repository at this point in the history
Feature (env): Support for multi-entries messages in the single commit and scoped changes. Closes [ckeditor/ckeditor5#7207](ckeditor/ckeditor5#7207). Closes [ckeditor/ckeditor5#7171](ckeditor/ckeditor5#7171). See https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/git-commit-message-convention.html.

Feature (env): Added new utils that help to collect commits, parsing them, and generating the changelog.

*   The util for generating changelog from commits (those must be specified as an argument). See `/lib/release-tools/utils/generatechangelog.js`
*   The util for collecting commits. See `/lib/release-tools/utils/getcommits.js`
*   The util for suggesting new version based on commits. See `/lib/release-tools/utils/getnewversiontype.js`

Feature (env): Task `generateChangelogForSinglePackage()` supports new options: `from` - a commit or tag for collecting commits since the last release, `highlightsPlaceholder` - whether to add "Release highlights" placeholder in the changelog, `collaborationFeatures` - whether to add a URL to collaboration features changelog.

Fix (env): The `getChangedFilesForCommit()` util filters files returned by the Git command. It won't return an empty string anymore.

Other (env): Commits in the changelog will display the word `commit` instead of the first 7 characters from the commit's hash. In big repositories (the number of commits is huge), 7 characters are not unique anymore.

Other (env): `Closes` references will be merged into a single entry. Github does not support such references (`Closes x, y`) but it can be simplified during the commit's transformation.

Other (env): The `provideVersion()` util from `lib/release-tools/utils/cli.js` allows disabling returning `skip` version by setting its option `disableSkipVersion` to `true`.

Other: Removed `lerna` and all its files from the project. Now the release process is handled by our tools. The entire repository will follow the same rules as `ckeditor5.` Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html.

MAJOR BREAKING CHANGES (env): Removed `generateChangelogForSubPackages()` task. Use `generateChangelogForMonoRepository()` instead.

MAJOR BREAKING CHANGES (env): Removed `generateChangelogForSubRepositories()` task. Use `generateChangelogForMonoRepository()` instead if your repository is a monorepository.

MINOR BREAKING CHANGES (env): The util `getPackagesPaths()` does not check whether packages are defined as `dependencies` in `package.json` in the main repository.

MINOR BREAKING CHANGES (env): Task `generateChangelogForSinglePackage()` does not accept options: `newVersion`, `disableMajorBump`, `isInternalRelease`, `indentLevel`, `useExplicitBreakingChangeGroups` anymore. The task should be used for generating the changelog for the single repository.

MAJOR BREAKING CHANGES (env): Removed `generateSummaryChangelog()` task.

MINOR BREAKING CHANGES (env): Removed `hasMajorBreakingChanges()` and `hasMinorBreakingChanges()` utils from `/lib/release-tools/utils/changelog.js` helper.

MINOR BREAKING CHANGES (env): Removed `getSubPackagesPaths()` util.

MINOR BREAKING CHANGES (env): Removed the `getNewReleaseType()` util. Use `getCommits()` and `getNewVersionType()` instead.

MINOR BREAKING CHANGES (env): Removed support for the `NOTE` type of commit's notes.

MINOR BREAKING CHANGES (env): Moved all utils from `/lib/release-tools/utils/transform-commit` to `/lib/release-tools/utils`.

MINOR BREAKING CHANGES (env): Renamed `getSubRepositoriesPaths()` util to `getPackagesPaths()`.
  • Loading branch information
mlewand authored May 20, 2020
2 parents 6a4dfb2 + 6cc03c9 commit 0f19f52
Show file tree
Hide file tree
Showing 88 changed files with 4,754 additions and 9,226 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

**/node_modules/**
coverage/**
lerna-debug.log
npm-debug.log
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ cache:
cache:
- node_modules
before_install:
- npm i -g yarn lerna
- npm i -g yarn
install:
- lerna bootstrap
- yarn install
script:
- yarn run lint
- yarn run coverage
Expand Down
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,37 @@ Code coverage:
yarn run coverage
```

## Releasing
## Releasing packages

### Changelog

1. Fetch all changes and switch to `master`!
1. Execute `yarn run changelog`.
* This task checks what changed in each package and bumps the version accordingly. If nothing changed at all, it won't create a new changelog entry. If changes were irrelevant (e.g. only depedencies) it will create an "internal changes" entry.
* Scan the logs which are printed by the tool in search for errors (incorrect changelog entries). Incorrect entries (e.g. ones without the type) are being ignored. You may need to create entries for them manually. This is done directly in `CHANGELOG.md` of the specific package. Make sure to verify the proposed version after you modify the changelog.
* When unsure what has really changed in this version of a specific package, use `git diff <hash of previous release> packages/ckeditor5-dev-<name>/`.
1. After reviewing the changelog and committing all changes do `git push`.
1. Now, you can release the changed packages by using `lerna publish`.
* Lerna may propose to release more packages than you'd want – e.g. one of the packages might have some totally irrelevant change which you don't want to release now. You can do that by calling e.g.: `lerna publish --scope="@ckeditor/ckeditor5-dev-?(env|utils|webpack-plugin)"`. However, this means that if one of ignored packages depends on one of the release ones it won't have a version bump... so **usually it's better to just release everything**.
* Lerna will propose to release more packages than the one in which new changelog entries were generated – those are packages which depend on the ones which were really updated. That's fine.
* You need to pick version number of every package that Lerna wants to release. Do that based on what `yarn run changelog` proposed.
* Finally, Lerna says it will publish also `ckeditor5-dev` itself. This isn't true as its a private package, but it will be tagged anyway. **Whenever there's a major release in any of the sub packages, make sure to pick major release of `ckeditor5-dev` too**. Thanks to that it's possible later to get back to the previous stable releases e.g. if a hot fix is needed.
1. Your job's done. You can go now to `ckeditor5`, remove `yarn.lock`, potentially update something in `package.json`, run `yarn install` and commit that as `"Internal: Updated dependencies."`.
2. Execute `yarn run changelog`:
* This task checks what changed in each package and bumps the version accordingly. If nothing changed at all, it won't create a new changelog entry. If changes were irrelevant (e.g. only depedencies) it will create an "internal changes" entry.
* Scan the logs which are printed by the tool in search for errors (incorrect changelog entries). Incorrect entries (e.g. ones without the type) are being ignored. You may need to create entries for them manually. This is done directly in `CHANGELOG.md` (in the root directory). Make sure to verify the proposed version after you modify the changelog.
* When unsure what has really changed in this version of a specific package, use `git diff <hash of previous release> packages/ckeditor5-dev-<name>/`.

### Publishing

After generating the changelog, you are able to release the package.

First, you need to bump the version:

```bash
yarn run release:bump-version
```

You can also use the `--dry-run` option in order to see what this task does.

After bumping the version, you can publish the changes:

```bash
yarn run release:publish
```

As in the previous task, the `--dry-run` option is also available.

Your job's done. You can go now to `ckeditor5`, remove `yarn.lock`, potentially update something in `package.json`, run `yarn install` and commit that as `"Internal: Updated dependencies."`.

## License

Expand Down
13 changes: 0 additions & 13 deletions lerna.json

This file was deleted.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"eslint-config-ckeditor5": "^2.1.0",
"husky": "^0.14.3",
"istanbul": "^0.4.4",
"lerna": "^3.4.0",
"lint-staged": "^7.3.0",
"mocha": "^6.1.4"
},
Expand All @@ -23,11 +22,17 @@
"author": "CKSource (http://cksource.com/)",
"license": "GPL-2.0-or-later",
"bugs": "https://github.com/ckeditor/ckeditor5-dev/issues",
"repository": {
"type": "git",
"url": "https://github.com/ckeditor/ckeditor5-dev.git"
},
"homepage": "https://github.com/ckeditor/ckeditor5-dev#readme",
"scripts": {
"test": "mocha packages/*/tests --recursive --timeout 5000",
"coverage": "istanbul cover _mocha packages/*/tests -- --recursive --timeout 5000",
"changelog": "node ./scripts/changelog.js",
"release:bump-version": "node ./scripts/bump-versions.js",
"release:publish": "node ./scripts/publish.js",
"lint": "eslint --quiet '**/*.js'",
"precommit": "lint-staged"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/ckeditor5-dev-docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

All changes in the package are documented in the main repository. See: https://github.com/ckeditor/ckeditor5-dev/blob/master/CHANGELOG.md.

Changes for the past releases are available below.

## [11.0.13](https://github.com/ckeditor/ckeditor5-dev/compare/@ckeditor/ckeditor5-dev-docs@11.0.11...@ckeditor/ckeditor5-dev-docs@11.0.13) (2020-02-26)

Internal changes only (updated dependencies, documentation, etc.).
Expand Down
6 changes: 5 additions & 1 deletion packages/ckeditor5-dev-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@
"license": "GPL-2.0-or-later",
"homepage": "https://github.com/ckeditor/ckeditor5-dev/tree/master/packages/ckeditor5-dev-docs",
"bugs": "https://github.com/ckeditor/ckeditor5-dev/issues",
"repository": "https://github.com/ckeditor/ckeditor5-dev"
"repository": {
"type": "git",
"url": "https://github.com/ckeditor/ckeditor5-dev.git",
"directory": "packages/ckeditor5-dev-docs"
}
}
4 changes: 4 additions & 0 deletions packages/ckeditor5-dev-env/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

All changes in the package are documented in the main repository. See: https://github.com/ckeditor/ckeditor5-dev/blob/master/CHANGELOG.md.

Changes for the past releases are available below.

## [18.0.0](https://github.com/ckeditor/ckeditor5-dev/compare/@ckeditor/ckeditor5-dev-env@17.1.4...@ckeditor/ckeditor5-dev-env@18.0.0) (2020-04-23)

### BREAKING CHANGES
Expand Down
12 changes: 2 additions & 10 deletions packages/ckeditor5-dev-env/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,8 @@ const tasks = {
return require( './release-tools/tasks/generatechangelogforsinglepackage' )( ...args );
},

generateChangelogForSubPackages( ...args ) {
return require( './release-tools/tasks/generatechangelogforsubpackages' )( ...args );
},

generateChangelogForSubRepositories( ...args ) {
return require( './release-tools/tasks/generatechangelogforsubrepositories' )( ...args );
},

generateSummaryChangelog( ...args ) {
return require( './release-tools/tasks/generatesummarychangelog' )( ...args );
generateChangelogForMonoRepository( ...args ) {
return require( './release-tools/tasks/generatechangelogformonorepository' )( ...args );
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const displaySkippedPackages = require( '../utils/displayskippedpackages' );
const executeOnPackages = require( '../utils/executeonpackages' );
const getPackageJson = require( '../utils/getpackagejson' );
const getPackagesToRelease = require( '../utils/getpackagestorelease' );
const getSubPackagesPaths = require( '../utils/getsubpackagespaths' );
const getPackagesPaths = require( '../utils/getpackagespaths' );
const updateDependenciesVersions = require( '../utils/updatedependenciesversions' );
const validatePackageToRelease = require( '../utils/validatepackagetorelease' );

Expand Down Expand Up @@ -44,7 +44,7 @@ module.exports = function bumpVersions( options ) {

const dryRun = Boolean( options.dryRun );

const pathsCollection = getSubPackagesPaths( {
const pathsCollection = getPackagesPaths( {
cwd: options.cwd,
packages: options.packages,
skipPackages: options.skipPackages || [],
Expand Down
Loading

0 comments on commit 0f19f52

Please sign in to comment.