Skip to content

Commit

Permalink
Migrate project to wp-scripts and fix lodash deps (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
thedebian authored Nov 22, 2023
1 parent 2bc9d9b commit bf24b41
Show file tree
Hide file tree
Showing 9 changed files with 16,239 additions and 6,278 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.svn
.idea
.DS_Store
dist/
build/
node_modules
/vendor/
/*.zip
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@ When making changes to the block:

* Run `npm start` to build a development version with file watching.
* Run `npm run build` to build a minified production file.

For more details, see [ahmadawais/create-guten-block](https://github.com/ahmadawais/create-guten-block) which is the project that this plugin uses to manage block building.
22,460 changes: 16,210 additions & 6,250 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "syntaxhighlighter",
"version": "3.6.2",
"version": "3.7.0",
"description": "Easily post syntax-highlighted code to your WordPress site without having to modify the code at all.",
"homepage": "https://alex.blog/wordpress-plugins/syntaxhighlighter/",
"author": "Alex Mills (Viper007Bond)",
Expand All @@ -13,21 +13,18 @@
"url": "https://github.com/Viper007Bond/syntaxhighlighter/issues"
},
"scripts": {
"start": "cgb-scripts start",
"start": "wp-scripts start",
"build": "npm run build:assets && npm run archive",
"build:assets": "cgb-scripts build",
"distclean": "rm -rf node_modules && rm -rf dist",
"preinstall": "npx npm-force-resolutions",
"build:assets": "wp-scripts build && npm run create-dist",
"create-dist": "mkdir -p dist && mv build/index.js dist/blocks.build.js && mv build/index.css dist/blocks.editor.build.css && mv build/style-index.css dist/blocks.style.build.css",
"distclean": "rm -rf node_modules && rm -rf dist && rm -rf build",
"archive": "composer archive --file=$npm_package_name --format=zip"
},
"dependencies": {
"@wordpress/escape-html": "1.9.0",
"cgb-scripts": "1.23.0",
"classnames": "2.2.6",
"lodash.unescape": "4.0.1",
"npm-force-resolutions": "0.0.3"
},
"resolutions": {
"mem": "4.0.0"
"@wordpress/escape-html": "^2.46.0",
"@wordpress/create-block": "^4.30.0",
"@wordpress/scripts": "^26.17.0",
"lodash.unescape": "^4.0.1",
"lodash.flow": "^3.5.0"
}
}
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://alex.blog/2019/03/13/in-memory-of-alex-donation-link-update
Tags: code, source, sourcecode, php, syntax highlighting, syntax, highlight, highlighting, highlighter, WordPress.com
Requires at least: 5.7
Tested up to: 6.2
Stable tag: 3.6.2
Stable tag: 3.7.0

Easily post syntax-highlighted code to your site without having to modify the code at all. As seen on WordPress.com.

Expand Down Expand Up @@ -40,6 +40,12 @@ Try excluding this plugin's Javascript from any performance optimizations your s

== ChangeLog ==

= Version 3.7.0 =

* Update npm dependencies
* Migrate project from cgb-scripts to wp-scripts
* Fix lodash dependencies issue

= Version 3.6.2 =

* New: Add syntax highlight for Swift. #232
Expand Down
File renamed without changes.
14 changes: 6 additions & 8 deletions src/toolbar-dropdown/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import classnames from 'classnames';
import {
Button,
Dropdown,
Expand Down Expand Up @@ -42,9 +41,7 @@ const ToolbarDropdown = ( {
isAlternate: true,
position: 'bottom right left',
focusOnMount: true,
className: classnames(
'syntaxhighlighter-toolbar-dropdown__popover'
),
className: 'syntaxhighlighter-toolbar-dropdown__popover',
} }
renderToggle={ ( { isOpen, onToggle } ) => (
<Button
Expand All @@ -63,15 +60,16 @@ const ToolbarDropdown = ( {
{ options.map( ( option ) => {
const isSelected =
option.value === selectedOption.value;
let itemClassNames = 'syntaxhighlighter-toolbar-dropdown__option';
if ( isSelected ) {
itemClassNames += ' is-selected';
}
return (
<MenuItem
key={ option.value }
role="menuitemradio"
isSelected={ isSelected }
className={ classnames(
'syntaxhighlighter-toolbar-dropdown__option',
{ 'is-selected': isSelected },
) }
className={ itemClassNames }
onClick={ () => {
onChange( option.value );
onClose();
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { flow } from 'lodash';
import flow from 'lodash.flow';

/**
* WordPress dependencies
Expand Down
6 changes: 3 additions & 3 deletions syntaxhighlighter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
Plugin Name: SyntaxHighlighter Evolved
Plugin URI: https://alex.blog/wordpress-plugins/syntaxhighlighter/
Version: 3.6.2
Version: 3.7.0
Description: Easily post syntax-highlighted code to your site without having to modify the code at all. Uses Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a>. Includes a new editor block.
Author: Alex Mills (Viper007Bond)
Author URI: https://alex.blog/
Text Domain: syntaxhighlighter
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Requires at least: 5.7
Tested up to: 6.2
Tested up to: 6.4
Requires PHP: 7.0
**************************************************************************/

class SyntaxHighlighter {
// All of these variables are private. Filters are provided for things that can be modified.
public $pluginver = '3.6.2'; // Plugin version
public $pluginver = '3.7.0'; // Plugin version
public $agshver = false; // Alex Gorbatchev's SyntaxHighlighter version (dynamically set below due to v2 vs v3)
public $shfolder = false; // Controls what subfolder to load SyntaxHighlighter from (v2 or v3)
public $settings = array(); // Contains the user's settings
Expand Down

0 comments on commit bf24b41

Please sign in to comment.