Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aligned to ckeditor5-dev ESM changes #189

Merged
merged 4 commits into from
Oct 3, 2024
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
18 changes: 9 additions & 9 deletions package.json
psmyrek marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"postinstall": "node ./scripts/postinstall.js",
"build": "webpack --mode production",
"dev": "webpack --mode development --watch",
"changelog": "node ./scripts/changelog.js",
"release:prepare-packages": "node ./scripts/preparepackages.js",
"release:publish-packages": "node ./scripts/publishpackages.js",
"changelog": "node ./scripts/changelog.mjs",
"release:prepare-packages": "node ./scripts/preparepackages.mjs",
"release:publish-packages": "node ./scripts/publishpackages.mjs",
"test": "node ./scripts/test.js",
"lint": "eslint --quiet \"**/*.js\""
"lint": "eslint --quiet \"**/*.{js,mjs}\""
},
"repository": {
"type": "git",
Expand All @@ -39,10 +39,10 @@
"@ckeditor/ckeditor5-autoformat": "^35.0.0",
"@ckeditor/ckeditor5-basic-styles": "^35.0.0",
"@ckeditor/ckeditor5-block-quote": "^35.0.0",
"@ckeditor/ckeditor5-dev-bump-year": "^38.0.0",
"@ckeditor/ckeditor5-dev-ci": "^38.4.0",
"@ckeditor/ckeditor5-dev-release-tools": "^38.0.0",
"@ckeditor/ckeditor5-dev-utils": "^38.0.0",
"@ckeditor/ckeditor5-dev-bump-year": "^44.0.0",
"@ckeditor/ckeditor5-dev-ci": "^44.0.0",
"@ckeditor/ckeditor5-dev-release-tools": "^44.0.0",
"@ckeditor/ckeditor5-dev-utils": "^44.0.0",
"@ckeditor/ckeditor5-editor-decoupled": "^35.0.0",
"@ckeditor/ckeditor5-essentials": "^35.0.0",
"@ckeditor/ckeditor5-heading": "^35.0.0",
Expand Down Expand Up @@ -109,7 +109,7 @@
"semver": "^7.0.0"
},
"lint-staged": {
"**/*.js": [
"**/*.{js,mjs}": [
"eslint --quiet"
]
},
Expand Down
37 changes: 0 additions & 37 deletions scripts/bump-year.js

This file was deleted.

38 changes: 38 additions & 0 deletions scripts/bump-year.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env node

/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/

/* eslint-env node */

/*

Usage:
node scripts/bump-year.mjs

And after reviewing the changes:
git commit -am "Internal: Bumped the year." && git push

*/

import { bumpYear } from '@ckeditor/ckeditor5-dev-bump-year';

bumpYear( {
cwd: process.cwd(),
globPatterns: [
{ // LICENSE.md, .eslintrc.js, etc.
pattern: '*',
options: {
dot: true
}
},
{
pattern: '.husky/*'
},
{
pattern: '!(coverage|.nyc_output|build)/**'
}
]
} );
16 changes: 0 additions & 16 deletions scripts/changelog.js

This file was deleted.

10 changes: 10 additions & 0 deletions scripts/changelog.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env node

/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/

import { generateChangelogForSinglePackage } from '@ckeditor/ckeditor5-dev-release-tools';

generateChangelogForSinglePackage();
11 changes: 6 additions & 5 deletions scripts/preparepackages.js → scripts/preparepackages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

/* eslint-env node */

'use strict';
import { createRequire } from 'module';
import { Listr } from 'listr2';
import * as releaseTools from '@ckeditor/ckeditor5-dev-release-tools';
import * as devUtils from '@ckeditor/ckeditor5-dev-utils';

const { Listr } = require( 'listr2' );
const releaseTools = require( '@ckeditor/ckeditor5-dev-release-tools' );
const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );
const require = createRequire( import.meta.url );

const latestVersion = releaseTools.getLastFromChangelog();
const versionChangelog = releaseTools.getChangesForVersion( latestVersion );
Expand All @@ -36,7 +37,7 @@ const tasks = new Listr( [
{
title: 'Running build command.',
task: () => {
return tools.shExec( 'yarn run build', { async: true, verbosity: 'silent' } );
return devUtils.tools.shExec( 'yarn run build', { async: true, verbosity: 'silent' } );
}
},
{
Expand Down
11 changes: 4 additions & 7 deletions scripts/publishpackages.js → scripts/publishpackages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@

/* eslint-env node */

'use strict';

const { Listr } = require( 'listr2' );
const releaseTools = require( '@ckeditor/ckeditor5-dev-release-tools' );
const { provideToken } = require( '@ckeditor/ckeditor5-dev-release-tools/lib/utils/cli' );
const parseArguments = require( './utils/parsearguments' );
import { Listr } from 'listr2';
import * as releaseTools from '@ckeditor/ckeditor5-dev-release-tools';
import parseArguments from './utils/parsearguments.mjs';

const cliArguments = parseArguments( process.argv.slice( 2 ) );
const latestVersion = releaseTools.getLastFromChangelog();
Expand Down Expand Up @@ -61,7 +58,7 @@ const tasks = new Listr( [

( async () => {
try {
githubToken = await provideToken();
githubToken = await releaseTools.provideToken();

await tasks.run();
} catch ( err ) {
Expand Down
9 changes: 6 additions & 3 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
const getKarmaConfig = require( './utils/getkarmaconfig' );
const { Server, config } = require( 'karma' );

const parsedConfig = config.parseConfig( null, getKarmaConfig() );
const server = new Server( parsedConfig );
( async () => {
const parsedConfig = config.parseConfig( null, await getKarmaConfig() );
const server = new Server( parsedConfig );

server.start();
} )();

server.start();
4 changes: 2 additions & 2 deletions scripts/utils/getkarmaconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
const path = require( 'path' );
const options = parseArguments( process.argv.slice( 2 ) );

module.exports = function getKarmaConfig() {
module.exports = async function getKarmaConfig() {
const basePath = process.cwd();
const coverageDir = path.join( basePath, 'coverage' );

const webpackConfig = require( '../../webpack.config.js' )( {}, {
const webpackConfig = ( await import( '../../webpack.config.mjs' ) ).default( {}, {
mode: 'development'
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@

/* eslint-env node */

'use strict';

const minimist = require( 'minimist' );
import minimist from 'minimist';

/**
* @param {Array.<String>} cliArguments
* @returns {ReleaseOptions} options
*/
module.exports = function parseArguments( cliArguments ) {
export default function parseArguments( cliArguments ) {
const config = {
string: [
'npm-tag'
Expand All @@ -30,7 +28,7 @@ module.exports = function parseArguments( cliArguments ) {
delete options[ 'npm-tag' ];

return options;
};
}

/**
* @typedef {Object} ReleaseOptions
Expand Down
14 changes: 9 additions & 5 deletions webpack.config.js → webpack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@

/* eslint-env node */

const { getLastFromChangelog } = require( '@ckeditor/ckeditor5-dev-release-tools' );
const TerserPlugin = require( 'terser-webpack-plugin' );
const webpack = require( 'webpack' );
const path = require( 'path' );
import path from 'path';
import webpack from 'webpack';
import { fileURLToPath } from 'url';
import TerserPlugin from 'terser-webpack-plugin';
import { getLastFromChangelog } from '@ckeditor/ckeditor5-dev-release-tools';

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

const LIBRARY_TO_FILE_NAMES = {
CKEditorInspector: 'inspector.js',
MiniCKEditorInspector: 'miniinspector.js'
};

module.exports = ( env, argv ) => {
export default ( env, argv ) => {
const devMode = argv.mode === 'development';

return {
Expand Down
Loading