|
|
@@ -9,18 +9,19 @@
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
-// This scripts updates version of CKEditor 5 in the `@ckeditor/ckeditor5-utils/src/version` module.
|
|
|
+// This script updates the version of CKEditor 5 in the `@ckeditor/ckeditor5-utils/src/version` module.
|
|
|
// It should be called as a post hook, after generating changelogs.
|
|
|
|
|
|
const fs = require( 'fs' );
|
|
|
const path = require( 'path' );
|
|
|
const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );
|
|
|
+const versionUtils = require( '@ckeditor/ckeditor5-dev-env/lib/release-tools/utils/versions' );
|
|
|
|
|
|
const CWD = process.cwd();
|
|
|
const UTILS_PACKAGE_PATH = path.join( CWD, 'packages', 'ckeditor5-utils' );
|
|
|
const UTILS_MODULE_PATH = path.join( UTILS_PACKAGE_PATH, 'src', 'version.js' );
|
|
|
|
|
|
-const { version } = require( path.join( CWD, 'package.json' ) );
|
|
|
+const version = versionUtils.getLastFromChangelog();
|
|
|
|
|
|
const fileContent = fs.readFileSync( UTILS_MODULE_PATH, 'utf-8' )
|
|
|
.replace( /const version = '\d+\.\d+\.\d+';/, `const version = '${ version }';` );
|