Skip to content

Commit bf24b41

Browse files
authored
Migrate project to wp-scripts and fix lodash deps (#269)
1 parent 2bc9d9b commit bf24b41

File tree

9 files changed

+16239
-6278
lines changed

9 files changed

+16239
-6278
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.svn
22
.idea
3+
.DS_Store
34
dist/
5+
build/
46
node_modules
57
/vendor/
68
/*.zip

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@ When making changes to the block:
1818

1919
* Run `npm start` to build a development version with file watching.
2020
* Run `npm run build` to build a minified production file.
21-
22-
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.

package-lock.json

Lines changed: 16210 additions & 6250 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "syntaxhighlighter",
3-
"version": "3.6.2",
3+
"version": "3.7.0",
44
"description": "Easily post syntax-highlighted code to your WordPress site without having to modify the code at all.",
55
"homepage": "https://alex.blog/wordpress-plugins/syntaxhighlighter/",
66
"author": "Alex Mills (Viper007Bond)",
@@ -13,21 +13,18 @@
1313
"url": "https://github.com/Viper007Bond/syntaxhighlighter/issues"
1414
},
1515
"scripts": {
16-
"start": "cgb-scripts start",
16+
"start": "wp-scripts start",
1717
"build": "npm run build:assets && npm run archive",
18-
"build:assets": "cgb-scripts build",
19-
"distclean": "rm -rf node_modules && rm -rf dist",
20-
"preinstall": "npx npm-force-resolutions",
18+
"build:assets": "wp-scripts build && npm run create-dist",
19+
"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",
20+
"distclean": "rm -rf node_modules && rm -rf dist && rm -rf build",
2121
"archive": "composer archive --file=$npm_package_name --format=zip"
2222
},
2323
"dependencies": {
24-
"@wordpress/escape-html": "1.9.0",
25-
"cgb-scripts": "1.23.0",
26-
"classnames": "2.2.6",
27-
"lodash.unescape": "4.0.1",
28-
"npm-force-resolutions": "0.0.3"
29-
},
30-
"resolutions": {
31-
"mem": "4.0.0"
24+
"@wordpress/escape-html": "^2.46.0",
25+
"@wordpress/create-block": "^4.30.0",
26+
"@wordpress/scripts": "^26.17.0",
27+
"lodash.unescape": "^4.0.1",
28+
"lodash.flow": "^3.5.0"
3229
}
3330
}

readme.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://alex.blog/2019/03/13/in-memory-of-alex-donation-link-update
44
Tags: code, source, sourcecode, php, syntax highlighting, syntax, highlight, highlighting, highlighter, WordPress.com
55
Requires at least: 5.7
66
Tested up to: 6.2
7-
Stable tag: 3.6.2
7+
Stable tag: 3.7.0
88

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

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

4141
== ChangeLog ==
4242

43+
= Version 3.7.0 =
44+
45+
* Update npm dependencies
46+
* Migrate project from cgb-scripts to wp-scripts
47+
* Fix lodash dependencies issue
48+
4349
= Version 3.6.2 =
4450

4551
* New: Add syntax highlight for Swift. #232
File renamed without changes.

src/toolbar-dropdown/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import classnames from 'classnames';
21
import {
32
Button,
43
Dropdown,
@@ -42,9 +41,7 @@ const ToolbarDropdown = ( {
4241
isAlternate: true,
4342
position: 'bottom right left',
4443
focusOnMount: true,
45-
className: classnames(
46-
'syntaxhighlighter-toolbar-dropdown__popover'
47-
),
44+
className: 'syntaxhighlighter-toolbar-dropdown__popover',
4845
} }
4946
renderToggle={ ( { isOpen, onToggle } ) => (
5047
<Button
@@ -63,15 +60,16 @@ const ToolbarDropdown = ( {
6360
{ options.map( ( option ) => {
6461
const isSelected =
6562
option.value === selectedOption.value;
63+
let itemClassNames = 'syntaxhighlighter-toolbar-dropdown__option';
64+
if ( isSelected ) {
65+
itemClassNames += ' is-selected';
66+
}
6667
return (
6768
<MenuItem
6869
key={ option.value }
6970
role="menuitemradio"
7071
isSelected={ isSelected }
71-
className={ classnames(
72-
'syntaxhighlighter-toolbar-dropdown__option',
73-
{ 'is-selected': isSelected },
74-
) }
72+
className={ itemClassNames }
7573
onClick={ () => {
7674
onChange( option.value );
7775
onClose();

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* External dependencies
33
*/
4-
import { flow } from 'lodash';
4+
import flow from 'lodash.flow';
55

66
/**
77
* WordPress dependencies

syntaxhighlighter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
55
Plugin Name: SyntaxHighlighter Evolved
66
Plugin URI: https://alex.blog/wordpress-plugins/syntaxhighlighter/
7-
Version: 3.6.2
7+
Version: 3.7.0
88
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.
99
Author: Alex Mills (Viper007Bond)
1010
Author URI: https://alex.blog/
1111
Text Domain: syntaxhighlighter
1212
License: GPL2
1313
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1414
Requires at least: 5.7
15-
Tested up to: 6.2
15+
Tested up to: 6.4
1616
Requires PHP: 7.0
1717
1818
**************************************************************************/
1919

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

0 commit comments

Comments
 (0)