@ckeditor/ckeditor5-dev-release-tools 50.0.0 → 50.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -3,6 +3,8 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
+ import { npm, workspaces } from '@ckeditor/ckeditor5-dev-utils';
7
+
6
8
  export { default as generateChangelogForSinglePackage } from './tasks/generatechangelogforsinglepackage.js';
7
9
  export { default as generateChangelogForMonoRepository } from './tasks/generatechangelogformonorepository.js';
8
10
  export { default as updateDependencies } from './tasks/updatedependencies.js';
@@ -30,8 +32,35 @@ export { default as getChangelog } from './utils/getchangelog.js';
30
32
  export { default as saveChangelog } from './utils/savechangelog.js';
31
33
  export { default as executeInParallel } from './utils/executeinparallel.js';
32
34
  export { default as validateRepositoryToRelease } from './utils/validaterepositorytorelease.js';
33
- export { default as checkVersionAvailability } from './utils/checkversionavailability.js';
34
35
  export { default as getNpmTagFromVersion } from './utils/getnpmtagfromversion.js';
35
36
  export { default as isVersionPublishableForTag } from './utils/isversionpublishablefortag.js';
36
37
  export { default as provideToken } from './utils/providetoken.js';
37
- export { default as findPathsToPackages } from './utils/findpathstopackages.js';
38
+
39
+ // Backwards compatibility for the old API.
40
+ export const checkVersionAvailability = ( ...args ) => {
41
+ process.emitWarning(
42
+ 'The `checkVersionAvailability()` function has been moved and will be removed in the upcoming release (v51). ' +
43
+ 'Use the `npm` namespace from `@ckeditor/ckeditor5-dev-utils` instead.',
44
+ {
45
+ type: 'DeprecationWarning',
46
+ code: 'DEP0002',
47
+ detail: 'https://github.com/ckeditor/ckeditor5-dev/blob/master/DEPRECATIONS.md#dep0002-checkversionavailability'
48
+ }
49
+ );
50
+
51
+ return npm.checkVersionAvailability( ...args );
52
+ };
53
+
54
+ export const findPathsToPackages = ( ...args ) => {
55
+ process.emitWarning(
56
+ 'The `findPathsToPackages()` function has been moved and will be removed in the upcoming release (v51). ' +
57
+ 'Use the `workspaces` namespace from `@ckeditor/ckeditor5-dev-utils` instead.',
58
+ {
59
+ type: 'DeprecationWarning',
60
+ code: 'DEP0003',
61
+ detail: 'https://github.com/ckeditor/ckeditor5-dev/blob/master/DEPRECATIONS.md#dep0003-findpathstopackages'
62
+ }
63
+ );
64
+
65
+ return workspaces.findPathsToPackages( ...args );
66
+ };
@@ -6,7 +6,7 @@
6
6
  import fs from 'fs-extra';
7
7
  import upath from 'upath';
8
8
  import { glob } from 'glob';
9
- import findPathsToPackages from '../utils/findpathstopackages.js';
9
+ import { workspaces } from '@ckeditor/ckeditor5-dev-utils';
10
10
 
11
11
  /**
12
12
  * The purpose of the script is to clean all packages prepared for the release. The cleaning consists of two stages:
@@ -30,7 +30,7 @@ import findPathsToPackages from '../utils/findpathstopackages.js';
30
30
  */
31
31
  export default async function cleanUpPackages( options ) {
32
32
  const { packagesDirectory, packageJsonFieldsToRemove, preservePostInstallHook, cwd } = parseOptions( options );
33
- const packageJsonPaths = await findPathsToPackages( cwd, packagesDirectory, { includePackageJson: true } );
33
+ const packageJsonPaths = await workspaces.findPathsToPackages( cwd, packagesDirectory, { includePackageJson: true } );
34
34
 
35
35
  for ( const packageJsonPath of packageJsonPaths ) {
36
36
  const packagePath = upath.dirname( packageJsonPath );
@@ -6,13 +6,10 @@
6
6
  import upath from 'upath';
7
7
  import { glob } from 'glob';
8
8
  import { simpleGit } from 'simple-git';
9
-
10
- const { toUnix } = upath;
11
-
12
- const CHUNK_LENGTH_LIMIT = 4000;
9
+ import { tools } from '@ckeditor/ckeditor5-dev-utils';
13
10
 
14
11
  /**
15
- * Creates a commit and a tag for specified version.
12
+ * Creates a commit and a tag for the specified version.
16
13
  *
17
14
  * @param {object} options
18
15
  * @param {string} options.version The commit will contain this param in its message and the tag will have a `v` prefix.
@@ -30,51 +27,38 @@ export default async function commitAndTag( {
30
27
  skipCi = true,
31
28
  dryRun = false
32
29
  } ) {
33
- const normalizedCwd = toUnix( cwd );
30
+ const normalizedCwd = upath.toUnix( cwd );
34
31
  const filePathsToAdd = await glob( files, { cwd: normalizedCwd, absolute: true, nodir: true } );
35
32
 
36
33
  if ( !filePathsToAdd.length ) {
37
34
  return;
38
35
  }
39
36
 
40
- const git = simpleGit( {
41
- baseDir: normalizedCwd
42
- } );
43
-
44
- const { all: availableTags } = await git.tags();
45
- const tagForVersion = availableTags.find( tag => tag.endsWith( version ) );
46
-
47
- const makeCommit = async () => {
48
- for ( const chunk of splitPathsIntoChunks( filePathsToAdd ) ) {
49
- await git.add( chunk );
50
- }
51
-
52
- return git.commit( `Release: v${ version }.${ skipCi ? ' [skip ci]' : '' }` );
53
- };
37
+ const message = `Release: v${ version }.${ skipCi ? ' [skip ci]' : '' }`;
54
38
 
55
39
  if ( dryRun ) {
56
- const lastCommit = await git.log( [ '-1' ] );
57
-
58
- await makeCommit();
59
- await git.reset( [ lastCommit.latest.hash ] );
60
- } else if ( !tagForVersion ) {
61
- // Commit and create a tag if it does not exist yet. It might happen when a release job is restarted.
62
- await makeCommit();
63
- await git.addAnnotatedTag( `v${ version }`, `Release: v${ version }.` );
40
+ return tools.commit( {
41
+ cwd: normalizedCwd,
42
+ message,
43
+ dryRun: true,
44
+ files: filePathsToAdd
45
+ } );
64
46
  }
65
- }
66
47
 
67
- function splitPathsIntoChunks( filePathsToAdd ) {
68
- return filePathsToAdd.reduce( ( chunks, path ) => {
69
- const lastChunk = chunks.at( -1 );
70
- const newLength = [ ...lastChunk, path ].join( ' ' ).length;
48
+ const gitInstance = simpleGit( {
49
+ baseDir: normalizedCwd
50
+ } );
71
51
 
72
- if ( newLength < CHUNK_LENGTH_LIMIT ) {
73
- lastChunk.push( path );
74
- } else {
75
- chunks.push( [ path ] );
76
- }
52
+ const { all: availableTags } = await gitInstance.tags();
53
+ const tagForVersion = availableTags.find( tag => tag.endsWith( version ) );
77
54
 
78
- return chunks;
79
- }, [ [] ] );
55
+ // Commit and create a tag if it does not exist yet. It might happen when a release job is restarted.
56
+ if ( !tagForVersion ) {
57
+ await tools.commit( {
58
+ cwd: normalizedCwd,
59
+ message,
60
+ files: filePathsToAdd
61
+ } );
62
+ await gitInstance.addAnnotatedTag( `v${ version }`, `Release: v${ version }.` );
63
+ }
80
64
  }
@@ -3,12 +3,10 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
+ import { workspaces } from '@ckeditor/ckeditor5-dev-utils';
6
7
  import { Octokit } from '@octokit/rest';
7
- import * as transformCommitUtils from '../utils/transformcommitutils.js';
8
8
  import getNpmTagFromVersion from '../utils/getnpmtagfromversion.js';
9
9
 
10
- const { getRepositoryUrl } = transformCommitUtils;
11
-
12
10
  /**
13
11
  * Create a GitHub release.
14
12
  *
@@ -32,7 +30,7 @@ export default async function createGithubRelease( options ) {
32
30
  auth: `token ${ token }`
33
31
  } );
34
32
 
35
- const repositoryUrl = getRepositoryUrl( cwd );
33
+ const repositoryUrl = workspaces.getRepositoryUrl( cwd );
36
34
  const [ repositoryName, repositoryOwner ] = repositoryUrl.split( '/' ).reverse();
37
35
 
38
36
  if ( await shouldCreateRelease( github, repositoryOwner, repositoryName, version ) ) {
@@ -5,14 +5,13 @@
5
5
 
6
6
  import fs from 'fs';
7
7
  import path from 'path';
8
- import { tools, logger } from '@ckeditor/ckeditor5-dev-utils';
8
+ import { tools, logger, workspaces } from '@ckeditor/ckeditor5-dev-utils';
9
9
  import compareFunc from 'compare-func';
10
10
  import chalk from 'chalk';
11
11
  import semver from 'semver';
12
12
  import displayCommits from '../utils/displaycommits.js';
13
13
  import displaySkippedPackages from '../utils/displayskippedpackages.js';
14
14
  import generateChangelog from '../utils/generatechangelog.js';
15
- import getPackageJson from '../utils/getpackagejson.js';
16
15
  import getPackagesPaths from '../utils/getpackagespaths.js';
17
16
  import getCommits from '../utils/getcommits.js';
18
17
  import getNewVersionType from '../utils/getnewversiontype.js';
@@ -22,7 +21,6 @@ import getChangelog from '../utils/getchangelog.js';
22
21
  import saveChangelog from '../utils/savechangelog.js';
23
22
  import truncateChangelog from '../utils/truncatechangelog.js';
24
23
  import transformCommitFactory from '../utils/transformcommitfactory.js';
25
- import { getRepositoryUrl } from '../utils/transformcommitutils.js';
26
24
  import provideNewVersionForMonoRepository from '../utils/providenewversionformonorepository.js';
27
25
  import { CHANGELOG_FILE, CHANGELOG_HEADER, CLI_INDENT_SIZE } from '../utils/constants.js';
28
26
 
@@ -70,7 +68,7 @@ const noteInfo = `[ℹ️](${ VERSIONING_POLICY_URL }#major-and-minor-breaking-c
70
68
  export default async function generateChangelogForMonoRepository( options ) {
71
69
  const log = logger();
72
70
  const cwd = process.cwd();
73
- const rootPkgJson = getPackageJson( options.cwd );
71
+ const rootPkgJson = workspaces.getPackageJson( options.cwd );
74
72
  const skipFileSave = options.skipFileSave || false;
75
73
 
76
74
  logProcess( 'Collecting paths to packages...' );
@@ -119,7 +117,7 @@ export default async function generateChangelogForMonoRepository( options ) {
119
117
  packagesVersion.set( rootPkgJson.name, nextVersion );
120
118
 
121
119
  for ( const packagePath of pathsCollection.matched ) {
122
- const packageJson = getPackageJson( packagePath );
120
+ const packageJson = workspaces.getPackageJson( packagePath );
123
121
 
124
122
  currentPackagesVersion.set( packageJson.name, packageJson.version );
125
123
  packagesPaths.set( packageJson.name, packagePath );
@@ -283,7 +281,7 @@ export default async function generateChangelogForMonoRepository( options ) {
283
281
  // Find the highest version in all packages.
284
282
  const [ packageHighestVersion, highestVersion ] = [ ...pathsCollection.matched ]
285
283
  .reduce( ( currentHighest, repositoryPath ) => {
286
- const packageJson = getPackageJson( repositoryPath );
284
+ const packageJson = workspaces.getPackageJson( repositoryPath );
287
285
 
288
286
  currentPackagesVersion.set( packageJson.name, packageJson.version );
289
287
 
@@ -317,7 +315,7 @@ export default async function generateChangelogForMonoRepository( options ) {
317
315
  // Update the version for all packages.
318
316
  for ( const packagePath of pathsCollection.matched ) {
319
317
  promise = promise.then( () => {
320
- const pkgJson = getPackageJson( packagePath );
318
+ const pkgJson = workspaces.getPackageJson( packagePath );
321
319
 
322
320
  packagesPaths.set( pkgJson.name, packagePath );
323
321
  packagesVersion.set( pkgJson.name, nextVersion );
@@ -417,7 +415,7 @@ export default async function generateChangelogForMonoRepository( options ) {
417
415
  const writerContext = {
418
416
  version,
419
417
  commit: 'commit',
420
- repoUrl: getRepositoryUrl( options.cwd ),
418
+ repoUrl: workspaces.getRepositoryUrl( options.cwd ),
421
419
  currentTag: 'v' + version,
422
420
  previousTag: options.from ? options.from : 'v' + rootPkgJson.version,
423
421
  isPatch: semver.diff( version, rootPkgJson.version ) === 'patch',
@@ -4,16 +4,14 @@
4
4
  */
5
5
 
6
6
  import fs from 'fs';
7
- import { tools, logger } from '@ckeditor/ckeditor5-dev-utils';
7
+ import { tools, logger, workspaces } from '@ckeditor/ckeditor5-dev-utils';
8
8
  import chalk from 'chalk';
9
9
  import semver from 'semver';
10
10
  import displayCommits from '../utils/displaycommits.js';
11
11
  import generateChangelog from '../utils/generatechangelog.js';
12
- import getPackageJson from '../utils/getpackagejson.js';
13
12
  import getNewVersionType from '../utils/getnewversiontype.js';
14
13
  import getCommits from '../utils/getcommits.js';
15
14
  import getWriterOptions from '../utils/getwriteroptions.js';
16
- import { getRepositoryUrl } from '../utils/transformcommitutils.js';
17
15
  import transformCommitFactory from '../utils/transformcommitfactory.js';
18
16
  import getFormattedDate from '../utils/getformatteddate.js';
19
17
  import saveChangelog from '../utils/savechangelog.js';
@@ -45,7 +43,7 @@ const SKIP_GENERATE_CHANGELOG = 'Typed "skip" as a new version. Aborting.';
45
43
  */
46
44
  export default async function generateChangelogForSinglePackage( options = {} ) {
47
45
  const log = logger();
48
- const pkgJson = getPackageJson();
46
+ const pkgJson = workspaces.getPackageJson();
49
47
 
50
48
  logProcess( chalk.bold( `Generating changelog for "${ chalk.underline( pkgJson.name ) }"...` ) );
51
49
 
@@ -106,7 +104,7 @@ export default async function generateChangelogForSinglePackage( options = {} )
106
104
  const writerContext = {
107
105
  version,
108
106
  commit: 'commit',
109
- repoUrl: getRepositoryUrl(),
107
+ repoUrl: workspaces.getRepositoryUrl(),
110
108
  currentTag: 'v' + version,
111
109
  previousTag: options.from ? options.from : 'v' + pkgJson.version,
112
110
  isPatch: semver.diff( version, pkgJson.version ) === 'patch',
@@ -11,8 +11,7 @@ import assertNpmTag from '../utils/assertnpmtag.js';
11
11
  import assertFilesToPublish from '../utils/assertfilestopublish.js';
12
12
  import executeInParallel from '../utils/executeinparallel.js';
13
13
  import publishPackageOnNpmCallback from '../utils/publishpackageonnpmcallback.js';
14
- import checkVersionAvailability from '../utils/checkversionavailability.js';
15
- import findPathsToPackages from '../utils/findpathstopackages.js';
14
+ import { workspaces, npm } from '@ckeditor/ckeditor5-dev-utils';
16
15
 
17
16
  /**
18
17
  * The purpose of the script is to publish the prepared packages. However, before, it executes a few checks that
@@ -72,7 +71,7 @@ export default async function publishPackages( options ) {
72
71
  await assertNpmAuthorization( npmOwner );
73
72
 
74
73
  // Find packages that would be published...
75
- const packagePaths = await findPathsToPackages( cwd, packagesDirectory );
74
+ const packagePaths = await workspaces.findPathsToPackages( cwd, packagesDirectory );
76
75
 
77
76
  // ...and filter out those that have already been processed.
78
77
  // In other words, check whether a version per package (it's read from a `package.json` file)
@@ -80,7 +79,7 @@ export default async function publishPackages( options ) {
80
79
  await removeAlreadyPublishedPackages( packagePaths );
81
80
 
82
81
  // Once again, find packages to publish after the filtering operation.
83
- const packagesToProcess = await findPathsToPackages( cwd, packagesDirectory );
82
+ const packagesToProcess = await workspaces.findPathsToPackages( cwd, packagesDirectory );
84
83
 
85
84
  if ( !packagesToProcess.length ) {
86
85
  listrTask.output = 'All packages have been published.';
@@ -132,7 +131,7 @@ export default async function publishPackages( options ) {
132
131
  async function removeAlreadyPublishedPackages( packagePaths ) {
133
132
  for ( const absolutePackagePath of packagePaths ) {
134
133
  const pkgJson = await fs.readJson( upath.join( absolutePackagePath, 'package.json' ) );
135
- const isAvailable = await checkVersionAvailability( pkgJson.version, pkgJson.name );
134
+ const isAvailable = await npm.checkVersionAvailability( pkgJson.version, pkgJson.name );
136
135
 
137
136
  if ( !isAvailable ) {
138
137
  await fs.remove( absolutePackagePath );
@@ -3,9 +3,9 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
+ import { workspaces } from '@ckeditor/ckeditor5-dev-utils';
6
7
  import fs from 'fs-extra';
7
8
  import upath from 'upath';
8
- import findPathsToPackages from '../utils/findpathstopackages.js';
9
9
 
10
10
  const { normalizeTrim } = upath;
11
11
 
@@ -40,7 +40,7 @@ export default async function updateDependencies( options ) {
40
40
  cwd = process.cwd()
41
41
  } = options;
42
42
 
43
- const pkgJsonPaths = await findPathsToPackages(
43
+ const pkgJsonPaths = await workspaces.findPathsToPackages(
44
44
  cwd,
45
45
  packagesDirectory ? normalizeTrim( packagesDirectory ) : null,
46
46
  {
@@ -3,10 +3,10 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
+ import { workspaces } from '@ckeditor/ckeditor5-dev-utils';
6
7
  import upath from 'upath';
7
8
  import fs from 'fs-extra';
8
9
  import semver from 'semver';
9
- import findPathsToPackages from '../utils/findpathstopackages.js';
10
10
 
11
11
  const { normalizeTrim } = upath;
12
12
 
@@ -38,7 +38,7 @@ export default async function updateVersions( options ) {
38
38
  cwd = process.cwd()
39
39
  } = options;
40
40
 
41
- const pkgJsonPaths = await findPathsToPackages(
41
+ const pkgJsonPaths = await workspaces.findPathsToPackages(
42
42
  cwd,
43
43
  packagesDirectory ? normalizeTrim( packagesDirectory ) : null,
44
44
  {
@@ -3,9 +3,8 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
+ import { logger, workspaces } from '@ckeditor/ckeditor5-dev-utils';
6
7
  import chalk from 'chalk';
7
- import { logger } from '@ckeditor/ckeditor5-dev-utils';
8
- import getPackageJson from './getpackagejson.js';
9
8
  import { CLI_INDENT_SIZE } from './constants.js';
10
9
 
11
10
  /**
@@ -19,9 +18,12 @@ export default function displaySkippedPackages( skippedPackagesPaths ) {
19
18
  }
20
19
 
21
20
  const indent = ' '.repeat( CLI_INDENT_SIZE );
22
-
23
21
  const packageNames = Array.from( skippedPackagesPaths )
24
- .map( packagePath => getPackageJson( packagePath ).name );
22
+ .map( packagePath => {
23
+ const { name } = workspaces.getPackageJson( packagePath );
24
+
25
+ return name;
26
+ } );
25
27
 
26
28
  let message = indent + chalk.bold.underline( 'Packages listed below have been skipped:' ) + '\n';
27
29
  message += packageNames.map( line => indent + ` * ${ line }` ).join( '\n' );
@@ -9,7 +9,7 @@ import os from 'os';
9
9
  import fs from 'fs/promises';
10
10
  import { Worker } from 'worker_threads';
11
11
  import { registerAbortController, deregisterAbortController } from './abortcontroller.js';
12
- import findPathsToPackages from './findpathstopackages.js';
12
+ import { workspaces } from '@ckeditor/ckeditor5-dev-utils';
13
13
 
14
14
  const WORKER_SCRIPT = new URL( './parallelworker.js', import.meta.url );
15
15
 
@@ -47,7 +47,7 @@ export default async function executeInParallel( options ) {
47
47
  } = options;
48
48
 
49
49
  const concurrencyAsInteger = Math.floor( concurrency ) || 1;
50
- const packagesToProcess = await findPathsToPackages( cwd, packagesDirectory, {
50
+ const packagesToProcess = await workspaces.findPathsToPackages( cwd, packagesDirectory, {
51
51
  packagesDirectoryFilter
52
52
  } );
53
53
 
@@ -5,8 +5,7 @@
5
5
 
6
6
  import path from 'path';
7
7
  import { minimatch } from 'minimatch';
8
- import { tools } from '@ckeditor/ckeditor5-dev-utils';
9
- import getPackageJson from './getpackagejson.js';
8
+ import { tools, workspaces } from '@ckeditor/ckeditor5-dev-utils';
10
9
 
11
10
  /**
12
11
  * Returns an object with two collections of paths to packages which are located in single repository.
@@ -49,7 +48,7 @@ export default function getPackagesPaths( options ) {
49
48
  const dependencyPath = path.join( packagesPath, directory );
50
49
 
51
50
  try {
52
- const dependencyName = getPackageJson( dependencyPath ).name;
51
+ const { name: dependencyName } = workspaces.getPackageJson( dependencyPath );
53
52
 
54
53
  if ( isValidPackage( dependencyName ) ) {
55
54
  pathsCollection.matched.add( dependencyPath );
@@ -3,8 +3,8 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
+ import { npm } from '@ckeditor/ckeditor5-dev-utils';
6
7
  import semver from 'semver';
7
- import { manifest } from './pacotecacheless.js';
8
8
 
9
9
  /**
10
10
  * This util aims to verify if the given `packageName` can be published with the given `version` on the `npmTag`.
@@ -15,9 +15,9 @@ import { manifest } from './pacotecacheless.js';
15
15
  * @returns {Promise.<boolean>}
16
16
  */
17
17
  export default async function isVersionPublishableForTag( packageName, version, npmTag ) {
18
- const npmVersion = await manifest( `${ packageName }@${ npmTag }` )
18
+ const npmVersion = await npm.manifest( `${ packageName }@${ npmTag }` )
19
19
  .then( ( { version } ) => version )
20
- // An `npmTag` does not exist, or it's a first release of a package.
20
+ // An `npmTag` does not exist, or it's the first release of a package.
21
21
  .catch( () => null );
22
22
 
23
23
  if ( npmVersion && semver.lte( version, npmVersion ) ) {
@@ -7,7 +7,7 @@ import inquirer from 'inquirer';
7
7
  import semver from 'semver';
8
8
  import chalk from 'chalk';
9
9
  import { CLI_INDENT_SIZE } from './constants.js';
10
- import checkVersionAvailability from './checkversionavailability.js';
10
+ import { npm } from '@ckeditor/ckeditor5-dev-utils';
11
11
 
12
12
  /**
13
13
  * Asks a user for providing the new version for a major release.
@@ -50,7 +50,7 @@ export default async function provideNewVersionForMonoRepository( options ) {
50
50
  return `Provided version must be higher than "${ version }".`;
51
51
  }
52
52
 
53
- const isAvailable = await checkVersionAvailability( input, packageName );
53
+ const isAvailable = await npm.checkVersionAvailability( input, packageName );
54
54
 
55
55
  if ( !isAvailable ) {
56
56
  return 'Given version is already taken.';
@@ -7,7 +7,7 @@ import inquirer from 'inquirer';
7
7
  import semver from 'semver';
8
8
  import chalk from 'chalk';
9
9
  import { CLI_INDENT_SIZE } from './constants.js';
10
- import checkVersionAvailability from './checkversionavailability.js';
10
+ import { npm } from '@ckeditor/ckeditor5-dev-utils';
11
11
 
12
12
  /**
13
13
  * Asks a user for providing the new version.
@@ -66,7 +66,7 @@ export default function provideVersion( options ) {
66
66
  return 'Please provide a valid version.';
67
67
  }
68
68
 
69
- const isAvailable = await checkVersionAvailability( input, packageName );
69
+ const isAvailable = await npm.checkVersionAvailability( input, packageName );
70
70
 
71
71
  if ( !isAvailable ) {
72
72
  return 'Given version is already taken.';
@@ -3,6 +3,7 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
+ import { workspaces } from '@ckeditor/ckeditor5-dev-utils';
6
7
  import { cloneDeepWith } from 'es-toolkit/compat';
7
8
  import * as utils from './transformcommitutils.js';
8
9
  import getChangedFilesForCommit from './getchangedfilesforcommit.js';
@@ -117,7 +118,7 @@ export default function transformCommitFactory( options = {} ) {
117
118
  }
118
119
 
119
120
  commit.files = getChangedFilesForCommit( commit.hash ) || [];
120
- commit.repositoryUrl = utils.getRepositoryUrl();
121
+ commit.repositoryUrl = workspaces.getRepositoryUrl();
121
122
 
122
123
  if ( commit.isPublicCommit ) {
123
124
  // Remove [skip ci] from the commit subject.
@@ -3,7 +3,7 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
- import getPackageJson from './getpackagejson.js';
6
+ import { workspaces } from '@ckeditor/ckeditor5-dev-utils';
7
7
 
8
8
  /**
9
9
  * A regexp for extracting additional changelog entries from the single commit.
@@ -85,7 +85,7 @@ export function linkToGithubIssue( comment ) {
85
85
  return `[${ maybeRepository }#${ issueId }](https://github.com/${ maybeRepository }/issues/${ issueId })`;
86
86
  }
87
87
 
88
- const repositoryUrl = getRepositoryUrl();
88
+ const repositoryUrl = workspaces.getRepositoryUrl();
89
89
 
90
90
  // But if doesn't, let's add it.
91
91
  return `[#${ issueId }](${ repositoryUrl }/issues/${ issueId })`;
@@ -128,31 +128,3 @@ export function truncate( sentence, length ) {
128
128
 
129
129
  return sentence.slice( 0, length - 3 ).trim() + '...';
130
130
  }
131
-
132
- /**
133
- * Returns a URL to the repository whether the commit is being parsed.
134
- *
135
- * @param {string} [cwd=process.cwd()]
136
- * @returns {string}
137
- */
138
- export function getRepositoryUrl( cwd = process.cwd() ) {
139
- const packageJson = getPackageJson( cwd );
140
-
141
- // Due to merging our issue trackers, `packageJson.bugs` will point to the same place for every package.
142
- // We cannot rely on this value anymore. See: https://github.com/ckeditor/ckeditor5/issues/1988.
143
- // Instead of we can take a value from `packageJson.repository` and adjust it to match to our requirements.
144
- let repositoryUrl = ( typeof packageJson.repository === 'object' ) ? packageJson.repository.url : packageJson.repository;
145
-
146
- if ( !repositoryUrl ) {
147
- throw new Error( `The package.json for "${ packageJson.name }" must contain the "repository" property.` );
148
- }
149
-
150
- // If the value ends with ".git", we need to remove it.
151
- repositoryUrl = repositoryUrl.replace( /\.git$/, '' );
152
-
153
- // Remove "/issues" suffix as well.
154
- repositoryUrl = repositoryUrl.replace( /\/issues/, '' );
155
-
156
- return repositoryUrl;
157
- }
158
-
@@ -3,8 +3,8 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
+ import { workspaces } from '@ckeditor/ckeditor5-dev-utils';
6
7
  import { CHANGELOG_HEADER } from './constants.js';
7
- import { getRepositoryUrl } from './transformcommitutils.js';
8
8
  import saveChangelog from './savechangelog.js';
9
9
  import getChangelog from './getchangelog.js';
10
10
 
@@ -33,7 +33,7 @@ export default function truncateChangelog( length, cwd = process.cwd() ) {
33
33
  const truncatedEntries = entries.slice( 0, length );
34
34
 
35
35
  const changelogFooter = entries.length > truncatedEntries.length ?
36
- `\n\n---\n\nTo see all releases, visit the [release page](${ getRepositoryUrl( cwd ) }/releases).\n` :
36
+ `\n\n---\n\nTo see all releases, visit the [release page](${ workspaces.getRepositoryUrl( cwd ) }/releases).\n` :
37
37
  '\n';
38
38
 
39
39
  const truncatedChangelog = CHANGELOG_HEADER + truncatedEntries.join( '\n' ).trim() + changelogFooter;
@@ -3,10 +3,8 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
- import { tools } from '@ckeditor/ckeditor5-dev-utils';
7
- import { packument } from './pacotecacheless.js';
6
+ import { npm, tools, workspaces } from '@ckeditor/ckeditor5-dev-utils';
8
7
  import getChangelog from './getchangelog.js';
9
- import getPackageJson from './getpackagejson.js';
10
8
 
11
9
  /**
12
10
  * Returns a last created version in changelog file.
@@ -43,9 +41,9 @@ export function getLastFromChangelog( cwd = process.cwd() ) {
43
41
  * @returns {Promise.<string|null>}
44
42
  */
45
43
  export function getLastPreRelease( releaseIdentifier, cwd = process.cwd() ) {
46
- const packageName = getPackageJson( cwd ).name;
44
+ const { name: packageName } = workspaces.getPackageJson( cwd );
47
45
 
48
- return packument( packageName )
46
+ return npm.packument( packageName )
49
47
  .then( result => {
50
48
  const lastVersion = Object.keys( result.versions )
51
49
  .filter( version => {
@@ -147,7 +145,7 @@ export function getLastTagFromGit() {
147
145
  * @returns {string}
148
146
  */
149
147
  export function getCurrent( cwd = process.cwd() ) {
150
- return getPackageJson( cwd ).version;
148
+ return workspaces.getPackageJson( cwd ).version;
151
149
  }
152
150
 
153
151
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-release-tools",
3
- "version": "50.0.0",
3
+ "version": "50.1.0",
4
4
  "description": "Tools used for releasing CKEditor 5 and related packages.",
5
5
  "keywords": [],
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -22,7 +22,7 @@
22
22
  "lib"
23
23
  ],
24
24
  "dependencies": {
25
- "@ckeditor/ckeditor5-dev-utils": "^50.0.0",
25
+ "@ckeditor/ckeditor5-dev-utils": "^50.1.0",
26
26
  "@octokit/rest": "^22.0.0",
27
27
  "chalk": "^5.0.0",
28
28
  "cli-columns": "^4.0.0",
@@ -38,7 +38,6 @@
38
38
  "glob": "^11.0.2",
39
39
  "inquirer": "^12.5.2",
40
40
  "minimatch": "^10.0.1",
41
- "pacote": "^21.0.0",
42
41
  "semver": "^7.6.3",
43
42
  "shell-escape": "^0.2.0",
44
43
  "simple-git": "^3.27.0",
@@ -1,27 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import { manifest } from './pacotecacheless.js';
7
-
8
- /**
9
- * Checks if the provided version for the package exists in the npm registry.
10
- *
11
- * Returns a promise that resolves to `true` if the provided version does not exist or resolves the promise to `false` otherwise.
12
- *
13
- * @param {string} version
14
- * @param {string} packageName
15
- * @returns {Promise}
16
- */
17
- export default async function checkVersionAvailability( version, packageName ) {
18
- return manifest( `${ packageName }@${ version }` )
19
- .then( () => {
20
- // If `manifest` resolves, a package with the given version exists.
21
- return false;
22
- } )
23
- .catch( () => {
24
- // When throws, the package does not exist.
25
- return true;
26
- } );
27
- }
@@ -1,78 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import upath from 'upath';
7
- import { glob } from 'glob';
8
-
9
- /**
10
- * Returns an array containing paths to packages found in the `packagesDirectory` directory.
11
- *
12
- * @param {string} cwd
13
- * @param {string|null} packagesDirectory
14
- * @param {object} [options={}]
15
- * @param {boolean} [options.includePackageJson=false]
16
- * @param {boolean} [options.includeCwd=false]
17
- * @param {PackagesDirectoryFilter|null} [options.packagesDirectoryFilter=null]
18
- * @returns {Array.<string>}
19
- */
20
- export default async function findPathsToPackages( cwd, packagesDirectory, options = {} ) {
21
- const {
22
- includePackageJson = false,
23
- includeCwd = false,
24
- packagesDirectoryFilter = null
25
- } = options;
26
-
27
- const packagePaths = await getPackages( cwd, packagesDirectory, includePackageJson );
28
-
29
- if ( includeCwd ) {
30
- if ( includePackageJson ) {
31
- packagePaths.push( upath.join( cwd, 'package.json' ) );
32
- } else {
33
- packagePaths.push( cwd );
34
- }
35
- }
36
-
37
- const normalizedPaths = packagePaths.map( item => upath.normalize( item ) );
38
-
39
- if ( packagesDirectoryFilter ) {
40
- return normalizedPaths.filter( item => packagesDirectoryFilter( item ) );
41
- }
42
-
43
- return normalizedPaths;
44
- }
45
-
46
- /**
47
- * @param {string} cwd
48
- * @param {string|null} packagesDirectory
49
- * @param {boolean} includePackageJson
50
- * @returns {Promise.<Array.<string>>}
51
- */
52
- function getPackages( cwd, packagesDirectory, includePackageJson ) {
53
- if ( !packagesDirectory ) {
54
- return [];
55
- }
56
-
57
- const globOptions = {
58
- cwd: upath.join( cwd, packagesDirectory ),
59
- absolute: true
60
- };
61
-
62
- let pattern = '*/';
63
-
64
- if ( includePackageJson ) {
65
- pattern += 'package.json';
66
- globOptions.nodir = true;
67
- }
68
-
69
- return glob( pattern, globOptions );
70
- }
71
-
72
- /**
73
- * @callback PackagesDirectoryFilter
74
- *
75
- * @param {string} packageJsonPath An absolute path to a `package.json` file.
76
- *
77
- * @returns {boolean} Whether to include (`true`) or skip (`false`) processing the given directory/package.
78
- */
@@ -1,26 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import fs from 'fs';
7
- import upath from 'upath';
8
-
9
- /**
10
- * Returns object from `package.json`.
11
- *
12
- * This function is helpful for testing the whole process. Allows mocking the file
13
- * instead of create the fixtures.
14
- *
15
- * @param {string} [cwd=process.cwd()] Where to look for package.json.
16
- * @returns {object}
17
- */
18
- export default function getPackageJson( cwd = process.cwd() ) {
19
- let pkgJsonPath = cwd;
20
-
21
- if ( !pkgJsonPath.endsWith( 'package.json' ) ) {
22
- pkgJsonPath = upath.join( cwd, 'package.json' );
23
- }
24
-
25
- return JSON.parse( fs.readFileSync( pkgJsonPath, 'utf-8' ) );
26
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import os from 'os';
7
- import { randomUUID } from 'crypto';
8
- import upath from 'upath';
9
- import fs from 'fs-extra';
10
- import pacote from 'pacote';
11
-
12
- export const manifest = cacheLessPacoteFactory( pacote.manifest );
13
- export const packument = cacheLessPacoteFactory( pacote.packument );
14
-
15
- function cacheLessPacoteFactory( callback ) {
16
- return async ( description, options = {} ) => {
17
- const uuid = randomUUID();
18
- const cacheDir = upath.join( os.tmpdir(), `pacote--${ uuid }` );
19
-
20
- await fs.ensureDir( cacheDir );
21
-
22
- try {
23
- return await callback( description, {
24
- ...options,
25
- cache: cacheDir,
26
- memoize: false,
27
- preferOnline: true
28
- } );
29
- } finally {
30
- await fs.remove( cacheDir );
31
- }
32
- };
33
- }