Skip to content

Commit d40dae0

Browse files
authored
Merge pull request #443 from ckeditor/ci/3772
Internal: Aligned to ckeditor5-dev ESM changes.
2 parents 1cd8016 + 959624a commit d40dae0

11 files changed

+2473
-2503
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ jobs:
171171
# Do not fail if the Node script ends with non-zero exit code.
172172
set +e
173173
174-
node scripts/ci/is-project-ready-to-release.js
174+
node scripts/ci/is-project-ready-to-release.mjs
175175
EXIT_CODE=$( echo $? )
176176
177177
if [ ${EXIT_CODE} -eq 1 ];

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"test:e2e": "cypress run",
1313
"test:e2e:ci": "start-server-and-test 'yarn run start' http://localhost:4200/ 'yarn run test:e2e --quiet'",
1414
"coverage": "ng test --watch=false --code-coverage",
15-
"lint": "eslint \"*/**/*.+(js|ts)\"",
16-
"changelog": "node ./scripts/changelog.js",
15+
"lint": "eslint \"*/**/*.+(js|mjs|ts)\"",
16+
"changelog": "node ./scripts/changelog.mjs",
1717
"build-package": "ng-packagr -p src/ckeditor/ng-package.json",
18-
"release:prepare-packages": "node scripts/preparepackages.js",
19-
"release:publish-packages": "node scripts/publishpackages.js"
18+
"release:prepare-packages": "node scripts/preparepackages.mjs",
19+
"release:publish-packages": "node scripts/publishpackages.mjs"
2020
},
2121
"dependencies": {
2222
"@angular/animations": "^16",
@@ -38,10 +38,10 @@
3838
"@angular/cli": "^16",
3939
"@angular/compiler-cli": "^16",
4040
"@angular/language-service": "^16",
41-
"@ckeditor/ckeditor5-dev-bump-year": "^40.2.0",
42-
"@ckeditor/ckeditor5-dev-ci": "^40.2.0",
43-
"@ckeditor/ckeditor5-dev-release-tools": "^40.2.0",
44-
"@ckeditor/ckeditor5-dev-utils": "^40.2.0",
41+
"@ckeditor/ckeditor5-dev-bump-year": "^44.0.0",
42+
"@ckeditor/ckeditor5-dev-ci": "^44.0.0",
43+
"@ckeditor/ckeditor5-dev-release-tools": "^44.0.0",
44+
"@ckeditor/ckeditor5-dev-utils": "^44.0.0",
4545
"@types/jasminewd2": "^2.0.10",
4646
"@types/node": "^14.11.8",
4747
"@typescript-eslint/eslint-plugin": "~5.43.0",
@@ -94,7 +94,7 @@
9494
"url": "https://github.com/ckeditor/ckeditor5-angular.git"
9595
},
9696
"lint-staged": {
97-
"**/*.+(js|ts)": [
97+
"**/*.+(js|mjs|ts)": [
9898
"eslint --quiet"
9999
]
100100
},

scripts/bump-year.js

-46
This file was deleted.

scripts/bump-year.mjs

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
5+
* For licensing, see LICENSE.md.
6+
*/
7+
8+
/* eslint-env node */
9+
10+
/*
11+
12+
Usage:
13+
node scripts/bump-year.mjs
14+
15+
And after reviewing the changes:
16+
git commit -am "Internal: Bumped the year." && git push
17+
18+
*/
19+
20+
import { bumpYear } from '@ckeditor/ckeditor5-dev-bump-year';
21+
22+
bumpYear( {
23+
cwd: process.cwd(),
24+
globPatterns: [
25+
{ // LICENSE.md, .eslintrc.js, etc.
26+
pattern: '*',
27+
options: {
28+
dot: true
29+
}
30+
},
31+
{
32+
pattern: '.husky/*'
33+
},
34+
{
35+
pattern: '!(coverage|.nyc_output|dist)/**',
36+
options: {
37+
ignore: [
38+
'**/build/**',
39+
'src/**'
40+
]
41+
}
42+
},
43+
{
44+
pattern: 'src/ckeditor/**'
45+
}
46+
]
47+
} );

scripts/changelog.js scripts/changelog.mjs

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
* For licensing, see LICENSE.md.
44
*/
55

6-
'use strict';
7-
86
/* eslint-env node */
97

10-
const parseArguments = require( './utils/parsearguments' );
8+
import { generateChangelogForSinglePackage } from '@ckeditor/ckeditor5-dev-release-tools';
9+
import parseArguments from './utils/parsearguments.mjs';
1110

1211
const cliArguments = parseArguments( process.argv.slice( 2 ) );
1312

14-
require( '@ckeditor/ckeditor5-dev-release-tools' ).generateChangelogForSinglePackage( {
13+
generateChangelogForSinglePackage( {
1514
releaseBranch: cliArguments.branch
1615
} );

scripts/ci/is-project-ready-to-release.js scripts/ci/is-project-ready-to-release.mjs

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88
/* eslint-env node */
99

10-
'use strict';
10+
import { createRequire } from 'module';
11+
import * as releaseTools from '@ckeditor/ckeditor5-dev-release-tools';
1112

12-
const releaseTools = require( '@ckeditor/ckeditor5-dev-release-tools' );
13+
const require = createRequire( import.meta.url );
1314
const { name: packageName } = require( '../../package.json' );
1415

1516
const changelogVersion = releaseTools.getLastFromChangelog();

scripts/preparepackages.js scripts/preparepackages.mjs

+13-11
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77

88
/* eslint-env node */
99

10-
'use strict';
11-
12-
const { Listr } = require( 'listr2' );
13-
const releaseTools = require( '@ckeditor/ckeditor5-dev-release-tools' );
14-
const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );
15-
const upath = require( 'upath' );
16-
const fs = require( 'fs-extra' );
17-
const parseArguments = require( './utils/parsearguments' );
18-
const getListrOptions = require( './utils/getlistroptions' );
10+
import fs from 'fs-extra';
11+
import upath from 'upath';
12+
import { Listr } from 'listr2';
13+
import { fileURLToPath } from 'url';
14+
import * as releaseTools from '@ckeditor/ckeditor5-dev-release-tools';
15+
import * as devUtils from '@ckeditor/ckeditor5-dev-utils';
16+
import parseArguments from './utils/parsearguments.mjs';
17+
import getListrOptions from './utils/getlistroptions.mjs';
18+
19+
const __filename = fileURLToPath( import.meta.url );
20+
const __dirname = upath.dirname( __filename );
1921

2022
const latestVersion = releaseTools.getLastFromChangelog();
2123
const versionChangelog = releaseTools.getChangesForVersion( latestVersion );
@@ -69,7 +71,7 @@ const tasks = new Listr( [
6971
{
7072
title: 'Generating the `dist` directory.',
7173
task: () => {
72-
return tools.shExec( 'yarn run build-package', { async: true, verbosity: 'silent' } );
74+
return devUtils.tools.shExec( 'yarn run build-package', { async: true, verbosity: 'silent' } );
7375
}
7476
},
7577
{
@@ -81,7 +83,7 @@ const tasks = new Listr( [
8183
{
8284
title: 'Updating the `#version` field in the `package.json` in the release directory',
8385
task: () => {
84-
return tools.updateJSONFile(
86+
return devUtils.tools.updateJSONFile(
8587
upath.join( RELEASE_ANGULAR_DIR, 'package.json' ),
8688
packageJson => {
8789
packageJson.version = latestVersion;

scripts/publishpackages.js scripts/publishpackages.mjs

+5-8
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77

88
/* eslint-env node */
99

10-
'use strict';
11-
12-
const { Listr } = require( 'listr2' );
13-
const releaseTools = require( '@ckeditor/ckeditor5-dev-release-tools' );
14-
const { provideToken } = require( '@ckeditor/ckeditor5-dev-release-tools/lib/utils/cli' );
15-
const parseArguments = require( './utils/parsearguments' );
16-
const getListrOptions = require( './utils/getlistroptions' );
10+
import { Listr } from 'listr2';
11+
import * as releaseTools from '@ckeditor/ckeditor5-dev-release-tools';
12+
import parseArguments from './utils/parsearguments.mjs';
13+
import getListrOptions from './utils/getlistroptions.mjs';
1714

1815
const cliArguments = parseArguments( process.argv.slice( 2 ) );
1916
const latestVersion = releaseTools.getLastFromChangelog();
@@ -94,7 +91,7 @@ const tasks = new Listr( [
9491
if ( process.env.CKE5_RELEASE_TOKEN ) {
9592
githubToken = process.env.CKE5_RELEASE_TOKEN;
9693
} else {
97-
githubToken = await provideToken();
94+
githubToken = await releaseTools.provideToken();
9895
}
9996

10097
await tasks.run();

scripts/utils/getlistroptions.js scripts/utils/getlistroptions.mjs

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55

66
/* eslint-env node */
77

8-
'use strict';
9-
108
/**
119
* @param {ReleaseOptions} cliArguments
1210
* @returns {Object}
1311
*/
14-
module.exports = function getListrOptions( cliArguments ) {
12+
export default function getListrOptions( cliArguments ) {
1513
return {
1614
renderer: cliArguments.verbose ? 'verbose' : 'default'
1715
};
18-
};
16+
}

scripts/utils/parsearguments.js scripts/utils/parsearguments.mjs

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55

66
/* eslint-env node */
77

8-
'use strict';
9-
10-
const minimist = require( 'minimist' );
8+
import minimist from 'minimist';
119

1210
/**
1311
* @param {Array.<String>} cliArguments
1412
* @returns {ReleaseOptions} options
1513
*/
16-
module.exports = function parseArguments( cliArguments ) {
14+
export default function parseArguments( cliArguments ) {
1715
const config = {
1816
boolean: [
1917
'verbose',
@@ -48,7 +46,7 @@ module.exports = function parseArguments( cliArguments ) {
4846
}
4947

5048
return options;
51-
};
49+
}
5250

5351
/**
5452
* @typedef {Object} ReleaseOptions

0 commit comments

Comments
 (0)