Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .changelog/.gitkeep
Empty file.
33 changes: 29 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
### Suggested merge commit message ([convention](https://github.com/ckeditor/ckeditor5-design/wiki/Git-commit-message-convention))
<!--

Type: Message. Closes #000.
This repository uses Markdown files to define changelog entries. If the changes in this pull request are **user-facing**, please create a changelog entry by running the following command:

yarn run nice

This will generate a `*.md` file in the `.changelog/` directory for your description. You can create as many as you need.

**Note:**
If your PR is internal-only (e.g., tests, tooling, docs), you can skip this step - just mention it below.

-->

### 🚀 Summary

*A brief summary of what this PR changes.*

---

### 📌 Related issues

<!--

Although changelog entries list connected issues, GitHub requires listing them here to automatically link and close them.

-->

* Closes #000

---

### Additional information
### 💡 Additional information

*For example – encountered issues, assumptions you had to make, other affected tickets, etc.*
*Optional: Notes on decisions, edge cases, or anything helpful for reviewers.*
4 changes: 0 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/bin/bash

# @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
# For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options

. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,14 @@ Before you start, you need to prepare the changelog entries.

1. Make sure the `#master` branch is up-to-date: `git fetch && git checkout master && git pull`.
1. Prepare a release branch: `git checkout -b release-[YYYYMMDD]` where `YYYYMMDD` is the current day.
1. Generate the changelog entries: `yarn run changelog --branch release-[YYYYMMDD] [--from [GIT_TAG]]`.
* By default, the changelog generator uses the latest published tag as a starting point for collecting commits to process.

The `--from` modifier option allows overriding the default behavior. It is required when preparing the changelog entries for the next stable release while the previous one was marked as a prerelease, e.g., `@alpha`.

**Example**: Let's assume that the `v40.5.0-alpha.0` tag is our latest and that we want to release it on a stable channel. The `--from` modifier should be equal to `--from v40.4.0`.
* This task checks what changed in each package and bumps the version accordingly. It won't create a new changelog entry if nothing changes at all. If changes were irrelevant (e.g., only dependencies), it would make an "_internal changes_" entry.
* Scan the logs printed by the tool to search for errors (incorrect changelog entries). Incorrect entries (e.g., ones without the type) should be addressed. 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.
1. Generate the changelog entries: `yarn run release:prepare-changelog`.
* You can specify the release date by passing the `--date` option, e.g., `--date=2025-06-11`.
* By passing the `--dry-run` option, you can check what the script will do without actually modifying the files.
* Read all the entries, correct poor wording and other issues, wrap code names in backticks to format them, etc.
* Add the missing `the/a` articles, `()` to method names, "it's" -> "its", etc.
* A newly introduced feature should have just one changelog entry – something like "The initial implementation of the FOO feature." with a description of what it does.
1. Commit all changes and prepare a new pull request targeting the `#master` branch.
1. Ping the `@ckeditor/ckeditor-5-devops` team to review the pull request and trigger the release process.
1. Ping the `@ckeditor/ckeditor-5-platform` team to review the pull request and trigger the release process.

## License

Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@
"react": "^16.13.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-dev-bump-year": "^49.0.0",
"@ckeditor/ckeditor5-dev-ci": "^49.0.0",
"@ckeditor/ckeditor5-dev-release-tools": "^49.0.0",
"@ckeditor/ckeditor5-dev-utils": "^49.0.0",
"@ckeditor/ckeditor5-dev-bump-year": "^50.0.0",
"@ckeditor/ckeditor5-dev-changelog": "^50.0.0",
"@ckeditor/ckeditor5-dev-ci": "^50.0.0",
"@ckeditor/ckeditor5-dev-release-tools": "^50.0.0",
"@ckeditor/ckeditor5-dev-utils": "^50.0.0",
"@testing-library/dom": "^10.3.1",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
Expand All @@ -56,7 +57,7 @@
"eslint-plugin-ckeditor5-rules": "^10.0.0",
"eslint-plugin-react": "^7.37.5",
"globals": "^16.1.0",
"husky": "^8.0.2",
"husky": "^9.1.7",
"lint-staged": "^10.2.11",
"listr2": "^6.5.0",
"minimist": "^1.2.5",
Expand All @@ -74,6 +75,7 @@
"semver": "^7.0.0",
"typescript": "^5.0.0",
"typescript-eslint": "^8.32.1",
"upath": "^2.0.1",
"vite": "^5.3.1",
"vitest": "^2.1.9",
"webdriverio": "^9.12.7"
Expand All @@ -88,6 +90,7 @@
"node": ">=22.0.0"
},
"scripts": {
"nice": "ckeditor5-dev-changelog-create-entry",
"dev": "echo \"Use 'dev:16', 'dev:17', 'dev:18', or 'dev:19' depending on the version of React you want to test\"",
"dev:16": "REACT_VERSION=16 vite",
"dev:17": "REACT_VERSION=17 vite",
Expand All @@ -99,7 +102,7 @@
"test:check:types": "tsc --noEmit -p ./tests/tsconfig.json",
"lint": "eslint",
"postinstall": "node ./scripts/postinstall.js",
"changelog": "node ./scripts/changelog.js",
"release:prepare-changelog": "node ./scripts/preparechangelog.js",
"release:prepare-packages": "node ./scripts/preparepackages.js",
"release:publish-packages": "node ./scripts/publishpackages.js"
},
Expand Down
16 changes: 0 additions & 16 deletions scripts/changelog.js

This file was deleted.

15 changes: 5 additions & 10 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/

import { fileURLToPath } from 'url';
import { join, dirname } from 'path';
import upath from 'upath';
import { existsSync } from 'fs';

const ROOT_DIRECTORY = join(
dirname( fileURLToPath( import.meta.url ) ),
'..'
);
import { ROOT_DIRECTORY } from './utils/constants.js';

main()
.catch( err => {
Expand All @@ -20,9 +15,9 @@ main()
async function main() {
// When installing a repository as a dependency, the `.git` directory does not exist.
// In such a case, husky should not attach its hooks as npm treats it as a package, not a git repository.
if ( existsSync( join( ROOT_DIRECTORY, '.git' ) ) ) {
const { install } = await import( 'husky' );
if ( existsSync( upath.join( ROOT_DIRECTORY, '.git' ) ) ) {
const { default: husky } = await import( 'husky' );

install();
husky();
}
}
26 changes: 26 additions & 0 deletions scripts/preparechangelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/

import { generateChangelogForSingleRepository } from '@ckeditor/ckeditor5-dev-changelog';
import { ROOT_DIRECTORY } from './utils/constants.js';
import parseArguments from './utils/parsearguments.js';

const cliOptions = parseArguments( process.argv.slice( 2 ) );

const changelogOptions = {
cwd: ROOT_DIRECTORY,
disableFilesystemOperations: cliOptions.dryRun
};

if ( cliOptions.date ) {
changelogOptions.date = cliOptions.date;
}

generateChangelogForSingleRepository( changelogOptions )
.then( maybeChangelog => {
if ( maybeChangelog ) {
console.log( maybeChangelog );
}
} );
13 changes: 13 additions & 0 deletions scripts/utils/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/

import { fileURLToPath } from 'url';
import upath from 'upath';

const __filename = fileURLToPath( import.meta.url );
const __dirname = upath.dirname( __filename );

export const RELEASE_DIRECTORY = 'release';
export const ROOT_DIRECTORY = upath.join( __dirname, '..', '..' );
41 changes: 34 additions & 7 deletions scripts/utils/parsearguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ export default function parseArguments( cliArguments ) {
boolean: [
'verbose',
'compile-only',
'ci'
'ci',
'dry-run'
],

string: [
'branch',
'from',
'npm-tag'
'npm-tag',
'date'
],

default: {
Expand All @@ -34,11 +36,11 @@ export default function parseArguments( cliArguments ) {

const options = minimist( cliArguments, config );

options.compileOnly = options[ 'compile-only' ];
delete options[ 'compile-only' ];

options.npmTag = options[ 'npm-tag' ];
delete options[ 'npm-tag' ];
replaceKebabCaseWithCamelCase( options, [
'npm-tag',
'compile-only',
'dry-run'
] );

if ( process.env.CI ) {
options.ci = true;
Expand All @@ -47,6 +49,27 @@ export default function parseArguments( cliArguments ) {
return options;
}

function replaceKebabCaseWithCamelCase( options, keys ) {
for ( const key of keys ) {
const camelCaseKey = toCamelCase( key );

options[ camelCaseKey ] = options[ key ];
delete options[ key ];
}
}

function toCamelCase( value ) {
return value.split( '-' )
.map( ( item, index ) => {
if ( index == 0 ) {
return item.toLowerCase();
}

return item.charAt( 0 ).toUpperCase() + item.slice( 1 ).toLowerCase();
} )
.join( '' );
}

/**
* @typedef {Object} ReleaseOptions
*
Expand All @@ -59,4 +82,8 @@ export default function parseArguments( cliArguments ) {
* @property {Boolean} [verbose=false]
*
* @property {Boolean} [ci=false]
*
* @property {Boolean} [dryRun=false]
*
* @property {String} [date]
*/
Loading