Loading core/package.json +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ "vendor-update": "node ./scripts/js/vendor-update.js", "watch:ckeditor5": "webpack --config ./modules/ckeditor5/webpack.config.js --watch", "build:ckeditor5": "webpack --config ./modules/ckeditor5/webpack.config.js", "check:ckeditor5": "node ./scripts/js/ckeditor5-check-plugins.js", "build:ckeditor5-types": "node ./scripts/js/ckeditor5-types-documentation.js" }, "devDependencies": { Loading core/scripts/dev/commit-code-check.sh +29 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,10 @@ # - core/.stylelintrc.json STYLELINT_CONFIG_FILE_CHANGED=0 # This variable will be set when a Drupal-specific CKEditor 5 plugin has changed # it is used to make sure the compiled JS is valid. CKEDITOR5_PLUGINS_CHANGED=0 # Build up a list of absolute file names. ABS_FILES= for FILE in $FILES; do Loading Loading @@ -156,6 +160,10 @@ ESLINT_CONFIG_PASSING_FILE_CHANGED=1; STYLELINT_CONFIG_FILE_CHANGED=1; fi; if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.js$ ]] && [[ $FILE =~ ^core/modules/ckeditor5/js/build || $FILE =~ ^core/modules/ckeditor5/js/ckeditor5_plugins ]]; then CKEDITOR5_PLUGINS_CHANGED=1; fi; done # Exit early if there are no files. Loading Loading @@ -285,6 +293,27 @@ printf "\n" fi # When a Drupal-specific CKEditor 5 plugin changed ensure that it is compiled # properly. Only check on DrupalCI, since we're concerned about the build being # run with the expected package versions and making sure the result of the build # is in sync and conform to expectations. if [[ "$DRUPALCI" == "1" ]] && [[ $CKEDITOR5_PLUGINS_CHANGED == "1" ]]; then cd "$TOP_LEVEL/core" yarn run -s check:ckeditor5 if [ "$?" -ne "0" ]; then # If there are failures set the status to a number other than 0. FINAL_STATUS=1 printf "\nDrupal-specific CKEditor 5 plugins: ${red}failed${reset}\n" else printf "\nDrupal-specific CKEditor 5 plugins: ${green}passed${reset}\n" fi cd $TOP_LEVEL # Add a separator line to make the output easier to read. printf "\n" printf -- '-%.0s' {1..100} printf "\n" fi for FILE in $FILES; do STATUS=0; # Print a line to separate spellcheck output from per file output. Loading core/scripts/js/ckeditor5-check-plugins.js 0 → 100644 +39 −0 Original line number Diff line number Diff line /** * @file * * Provides the `check:ckeditor5` command. * * Check that the plugins are built with the appropriate dependencies. This is * only run on DrupalCI. * * @internal This file is part of the core JavaScript build process and is only * meant to be used in that context. */ "use strict"; const glob = require("glob"); const log = require("./log"); const fs = require("fs").promises; const child_process = require("child_process"); async function getContents(files) { return Object.fromEntries( await Promise.all( files.map(async (file) => [file, (await fs.readFile(file)).toString()]) ) ); } (async () => { const files = glob.sync("./modules/ckeditor5/js/build/*.js"); const pluginsBefore = await getContents(files); // Execute the plugin build script. child_process.execSync("yarn run build:ckeditor5"); const pluginsAfter = await getContents(files); if (JSON.stringify(pluginsBefore) !== JSON.stringify(pluginsAfter)) { process.exitCode = 1; } })(); Loading
core/package.json +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ "vendor-update": "node ./scripts/js/vendor-update.js", "watch:ckeditor5": "webpack --config ./modules/ckeditor5/webpack.config.js --watch", "build:ckeditor5": "webpack --config ./modules/ckeditor5/webpack.config.js", "check:ckeditor5": "node ./scripts/js/ckeditor5-check-plugins.js", "build:ckeditor5-types": "node ./scripts/js/ckeditor5-types-documentation.js" }, "devDependencies": { Loading
core/scripts/dev/commit-code-check.sh +29 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,10 @@ # - core/.stylelintrc.json STYLELINT_CONFIG_FILE_CHANGED=0 # This variable will be set when a Drupal-specific CKEditor 5 plugin has changed # it is used to make sure the compiled JS is valid. CKEDITOR5_PLUGINS_CHANGED=0 # Build up a list of absolute file names. ABS_FILES= for FILE in $FILES; do Loading Loading @@ -156,6 +160,10 @@ ESLINT_CONFIG_PASSING_FILE_CHANGED=1; STYLELINT_CONFIG_FILE_CHANGED=1; fi; if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.js$ ]] && [[ $FILE =~ ^core/modules/ckeditor5/js/build || $FILE =~ ^core/modules/ckeditor5/js/ckeditor5_plugins ]]; then CKEDITOR5_PLUGINS_CHANGED=1; fi; done # Exit early if there are no files. Loading Loading @@ -285,6 +293,27 @@ printf "\n" fi # When a Drupal-specific CKEditor 5 plugin changed ensure that it is compiled # properly. Only check on DrupalCI, since we're concerned about the build being # run with the expected package versions and making sure the result of the build # is in sync and conform to expectations. if [[ "$DRUPALCI" == "1" ]] && [[ $CKEDITOR5_PLUGINS_CHANGED == "1" ]]; then cd "$TOP_LEVEL/core" yarn run -s check:ckeditor5 if [ "$?" -ne "0" ]; then # If there are failures set the status to a number other than 0. FINAL_STATUS=1 printf "\nDrupal-specific CKEditor 5 plugins: ${red}failed${reset}\n" else printf "\nDrupal-specific CKEditor 5 plugins: ${green}passed${reset}\n" fi cd $TOP_LEVEL # Add a separator line to make the output easier to read. printf "\n" printf -- '-%.0s' {1..100} printf "\n" fi for FILE in $FILES; do STATUS=0; # Print a line to separate spellcheck output from per file output. Loading
core/scripts/js/ckeditor5-check-plugins.js 0 → 100644 +39 −0 Original line number Diff line number Diff line /** * @file * * Provides the `check:ckeditor5` command. * * Check that the plugins are built with the appropriate dependencies. This is * only run on DrupalCI. * * @internal This file is part of the core JavaScript build process and is only * meant to be used in that context. */ "use strict"; const glob = require("glob"); const log = require("./log"); const fs = require("fs").promises; const child_process = require("child_process"); async function getContents(files) { return Object.fromEntries( await Promise.all( files.map(async (file) => [file, (await fs.readFile(file)).toString()]) ) ); } (async () => { const files = glob.sync("./modules/ckeditor5/js/build/*.js"); const pluginsBefore = await getContents(files); // Execute the plugin build script. child_process.execSync("yarn run build:ckeditor5"); const pluginsAfter = await getContents(files); if (JSON.stringify(pluginsBefore) !== JSON.stringify(pluginsAfter)) { process.exitCode = 1; } })();