Skip to content

Commit ecaf7e3

Browse files
chore: tweaks
1 parent 0620fcb commit ecaf7e3

8 files changed

+30
-31
lines changed

Diff for: Gruntfile.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,18 @@ module.exports = function( grunt ) {
8585
flags: ''
8686
},
8787
src: [ 'plugins/otter-pro/otter-pro.php' ]
88-
}
88+
},
89+
readmetxt: {
90+
options: {
91+
prefix: 'Stable tag:\\s*'
92+
},
93+
src: [
94+
'readme.txt',
95+
'plugins/blocks-animation/readme.txt',
96+
'plugins/blocks-css/readme.txt',
97+
'plugins/blocks-export-import/readme.txt',
98+
]
99+
},
89100
},
90101
wp_readme_to_markdown: {
91102
plugin: {

Diff for: bin/dist.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ fi
2525
# Take all the files, filter the dev ones (e.g. node_modules, src), and save the result to './dist'
2626
rsync -rc --exclude-from ".distignore" "./" "dist/$DIST_FOLDER"
2727

28+
# Update stable version for readme.txt
29+
npm run grunt:version
30+
2831
# Change the individual sub-text-domain for the included sub-plugins in the main one.
29-
composer run format-dist -- "dist/$DIST_FOLDER"
32+
composer run format-dist -- "./dist/$DIST_FOLDER"
3033

3134
cd dist
3235

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"format": "phpcbf",
4040
"phpunit": "phpunit",
4141
"phpstan": "phpstan analyse --memory-limit 2G",
42-
"format-dist": "phpcbf --standard=phpcs.export.xml $1"
42+
"format-dist": "phpcbf --standard=phpcs.export.xml"
4343
},
4444
"prefer-stable": true,
4545
"config": {

Diff for: inc/class-blocks-animation.php

+6-16
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function init() {
4444
if ( ! defined( 'BLOCKS_ANIMATION_URL' ) ) {
4545
define( 'BLOCKS_ANIMATION_URL', OTTER_BLOCKS_URL );
4646
define( 'BLOCKS_ANIMATION_PATH', OTTER_BLOCKS_PATH );
47+
define( 'BLOCKS_ANIMATION_OTTER', true );
4748
}
4849

4950
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_editor_assets' ) );
@@ -63,7 +64,8 @@ public function init() {
6364
* @access public
6465
*/
6566
public function enqueue_editor_assets() {
66-
$asset_file = include BLOCKS_ANIMATION_PATH . '/build/animation/index.asset.php';
67+
$asset_file = include BLOCKS_ANIMATION_PATH . '/build/animation/index.asset.php';
68+
$is_using_otter_files = defined( 'BLOCKS_ANIMATION_OTTER' );
6769

6870
wp_enqueue_style(
6971
'otter-animation',
@@ -92,11 +94,7 @@ public function enqueue_editor_assets() {
9294
)
9395
);
9496

95-
if ( ! defined( 'BLOCKS_ANIMATION_URL' ) ) {
96-
wp_set_script_translations( 'otter-animation', 'otter-blocks' );
97-
} else {
98-
wp_set_script_translations( 'otter-animation', 'blocks-animation' );
99-
}
97+
wp_set_script_translations( 'otter-animation', $is_using_otter_files ? 'otter-blocks' : 'blocks-animation' );
10098

10199
$asset_file = include BLOCKS_ANIMATION_PATH . '/build/animation/anim-count.asset.php';
102100
wp_enqueue_script(
@@ -109,11 +107,7 @@ public function enqueue_editor_assets() {
109107

110108
wp_script_add_data( 'otter-count', 'defer', true );
111109

112-
if ( ! defined( 'BLOCKS_ANIMATION_URL' ) ) {
113-
wp_set_script_translations( 'otter-count', 'otter-blocks' );
114-
} else {
115-
wp_set_script_translations( 'otter-count', 'blocks-animation' );
116-
}
110+
wp_set_script_translations( 'otter-count', $is_using_otter_files ? 'otter-blocks' : 'blocks-animation' );
117111

118112
wp_enqueue_script(
119113
'otter-typing',
@@ -125,11 +119,7 @@ public function enqueue_editor_assets() {
125119

126120
wp_script_add_data( 'otter-typing', 'defer', true );
127121

128-
if ( ! defined( 'BLOCKS_ANIMATION_URL' ) ) {
129-
wp_set_script_translations( 'otter-typing', 'otter-blocks' );
130-
} else {
131-
wp_set_script_translations( 'otter-typing', 'blocks-animation' );
132-
}
122+
wp_set_script_translations( 'otter-typing', $is_using_otter_files ? 'otter-blocks' : 'blocks-animation' );
133123
}
134124

135125
/**

Diff for: inc/class-blocks-css.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function init() {
2626
if ( ! defined( 'BLOCKS_CSS_URL' ) ) {
2727
define( 'BLOCKS_CSS_URL', OTTER_BLOCKS_URL );
2828
define( 'BLOCKS_CSS_PATH', OTTER_BLOCKS_PATH );
29+
define( 'BLOCKS_CSS_OTTER', true );
2930
}
3031

3132
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_editor_assets' ), 1 );
@@ -86,11 +87,7 @@ public function enqueue_editor_assets() {
8687
)
8788
);
8889

89-
if ( ! defined( 'BLOCKS_CSS_URL' ) ) {
90-
wp_set_script_translations( 'otter-css', 'otter-blocks' );
91-
} else {
92-
wp_set_script_translations( 'otter-css', 'blocks-css' );
93-
}
90+
wp_set_script_translations( 'otter-css', defined( 'BLOCKS_CSS_OTTER' ) ? 'otter-blocks' : 'blocks-css' );
9491

9592
wp_enqueue_style(
9693
'otter-css',

Diff for: inc/class-blocks-export-import.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function init() {
2626
if ( ! defined( 'BLOCKS_EXPORT_IMPORT_URL' ) ) {
2727
define( 'BLOCKS_EXPORT_IMPORT_URL', OTTER_BLOCKS_URL );
2828
define( 'BLOCKS_EXPORT_IMPORT_PATH', OTTER_BLOCKS_PATH );
29+
define( 'BLOCKS_EXPORT_OTTER', true );
2930
}
3031

3132
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_editor_assets' ), 1 );
@@ -48,11 +49,7 @@ public function enqueue_editor_assets() {
4849
true
4950
);
5051

51-
if ( ! defined( 'BLOCKS_EXPORT_IMPORT_URL' ) ) {
52-
wp_set_script_translations( 'blocks-export-import', 'otter-blocks' );
53-
} else {
54-
wp_set_script_translations( 'blocks-export-import', 'blocks-export-import' );
55-
}
52+
wp_set_script_translations( 'blocks-export-import', defined( 'BLOCKS_EXPORT_OTTER' ) ? 'otter-blocks' : 'blocks-export-import' );
5653
}
5754

5855
/**

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"prod:lite": "wp-scripts build --config webpack.config.js",
88
"prod:pro": "wp-scripts build --config webpack.config.pro.js",
99
"prod:grunt": "grunt build",
10+
"grunt:version": "npm run grunt version",
1011
"start": "rm -rf build && npm-run-all --parallel dev:*",
1112
"dev:lite": "wp-scripts start --config webpack.config.js",
1213
"dev:pro": "wp-scripts start --config webpack.config.pro.js",

Diff for: src/animation/editor.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ function AnimationControls({
457457
>
458458
<img
459459
src={ typingPlaceholder }
460-
alt={ _( 'Using Count Animation in the Block Editor', 'blocks-animation' ) }
460+
alt={ __( 'Using Count Animation in the Block Editor', 'blocks-animation' ) }
461461
className="otter-animations-count-image"
462462
/>
463463

@@ -470,7 +470,7 @@ function AnimationControls({
470470
>
471471
<img
472472
src={ countPlaceholder }
473-
alt={ _( 'Using Typing Animation in the Block Editor', 'blocks-animation' ) }
473+
alt={ __( 'Using Typing Animation in the Block Editor', 'blocks-animation' ) }
474474
className="otter-animations-count-image"
475475
/>
476476

0 commit comments

Comments
 (0)