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

Update examples to use wp-scripts 5.0.0 #89

Merged
merged 4 commits into from
Sep 19, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions 01-basic-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-element', 'wp-polyfill'), 'version' => 'fc93c4a9675c108725227db345898bcc');
1 change: 0 additions & 1 deletion 01-basic-esnext/build/index.deps.json

This file was deleted.

12 changes: 5 additions & 7 deletions 01-basic-esnext/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Gutenberg Examples Basic EsNext
* Plugin URI: https://github.com/WordPress/gutenberg-examples
* Description: This is a plugin demonstrating how to register new blocks for the Gutenberg editor.
* Version: 1.0.2
* Version: 1.1.0
* Author: the Gutenberg Team
*
* @package gutenberg-examples
Expand All @@ -29,16 +29,14 @@ function gutenberg_examples_01_esnext_load_textdomain() {
*/
function gutenberg_examples_01_esnext_register_block() {

if ( ! function_exists( 'register_block_type' ) ) {
// Gutenberg is not active.
return;
}
// automatically load dependencies and version
$depver = include( plugin_dir_path( __FILE__ ) . 'build/index.asset.php');

wp_register_script(
'gutenberg-examples-01-esnext',
plugins_url( 'build/index.js', __FILE__ ),
array( 'wp-blocks', 'wp-i18n', 'wp-element' ),
filemtime( plugin_dir_path( __FILE__ ) . 'build/index.js' )
$depver['dependencies'],
$depver['version']
);

register_block_type( 'gutenberg-examples/example-01-basic-esnext', array(
Expand Down
4 changes: 2 additions & 2 deletions 01-basic-esnext/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "01-basic-esnext",
"version": "1.0.0",
"version": "1.1.0",
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^3.4.0"
"@wordpress/scripts": "^5.0.0"
},
"scripts": {
"start": "wp-scripts start",
Expand Down
6 changes: 3 additions & 3 deletions 01-basic-esnext/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global wp */
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;

import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';

const blockStyle = {
backgroundColor: '#900',
Expand Down
2 changes: 1 addition & 1 deletion 01-basic/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Gutenberg Examples Basic
* Plugin URI: https://github.com/WordPress/gutenberg-examples
* Description: This is a plugin demonstrating how to register new blocks for the Gutenberg editor.
* Version: 1.0.2
* Version: 1.1.0
* Author: the Gutenberg Team
*
* @package gutenberg-examples
Expand Down
2 changes: 1 addition & 1 deletion 02-stylesheets/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Gutenberg Examples Stylesheets
* Plugin URI: https://github.com/WordPress/gutenberg-examples
* Description: This is a plugin demonstrating how to register new blocks for the Gutenberg editor.
* Version: 1.0.2
* Version: 1.1.0
* Author: the Gutenberg Team
*
* @package gutenberg-examples
Expand Down
1 change: 1 addition & 0 deletions 03-editable-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'b75d1699b4b5965b3ba33750409e0168');
1 change: 0 additions & 1 deletion 03-editable-esnext/build/index.deps.json

This file was deleted.

2 changes: 1 addition & 1 deletion 03-editable-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions 03-editable-esnext/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Gutenberg Examples Editable EsNext
* Plugin URI: https://github.com/WordPress/gutenberg-examples
* Description: This is a plugin demonstrating how to register new blocks for the Gutenberg editor.
* Version: 1.0.2
* Version: 1.1.0
* Author: the Gutenberg Team
*
* @package gutenberg-examples
Expand All @@ -29,16 +29,14 @@ function gutenberg_examples_03_esnext_load_textdomain() {
*/
function gutenberg_examples_03_esnext_register_block() {

if ( ! function_exists( 'register_block_type' ) ) {
// Gutenberg is not active.
return;
}
// automatically load dependencies and version
$depver = include( plugin_dir_path( __FILE__ ) . 'build/index.asset.php');

wp_register_script(
'gutenberg-examples-03-esnext',
plugins_url( 'build/index.js', __FILE__ ),
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ),
filemtime( plugin_dir_path( __FILE__ ) . 'build/index.js' )
$depver['dependencies'],
$depver['version']
);

wp_register_style(
Expand Down
4 changes: 2 additions & 2 deletions 03-editable-esnext/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "03-editable-esnext",
"version": "1.0.0",
"version": "1.1.0",
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^3.4.0"
"@wordpress/scripts": "^5.0.0"
},
"scripts": {
"start": "wp-scripts start",
Expand Down
8 changes: 4 additions & 4 deletions 03-editable-esnext/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global wp */
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const { RichText } = wp.editor;

import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import { RichText } from '@wordpress/block-editor';

registerBlockType( 'gutenberg-examples/example-03-editable-esnext', {
title: __( 'Example: Editable (ESNext)', 'gutenberg-examples' ),
Expand Down
2 changes: 1 addition & 1 deletion 03-editable/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Gutenberg Examples Editable
* Plugin URI: https://github.com/WordPress/gutenberg-examples
* Description: This is a plugin demonstrating how to register new blocks for the Gutenberg editor.
* Version: 1.0.2
* Version: 1.1.0
* Author: the Gutenberg Team
*
* @package gutenberg-examples
Expand Down
1 change: 1 addition & 0 deletions 04-controls-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '20b2b3e4b79e1e243a699e81ad954911');
1 change: 0 additions & 1 deletion 04-controls-esnext/build/index.deps.json

This file was deleted.

2 changes: 1 addition & 1 deletion 04-controls-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions 04-controls-esnext/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Gutenberg Examples Controls EsNext
* Plugin URI: https://github.com/WordPress/gutenberg-examples
* Description: This is a plugin demonstrating how to register new blocks for the Gutenberg editor.
* Version: 1.0.2
* Version: 1.1.0
* Author: the Gutenberg Team
*
* @package gutenberg-examples
Expand All @@ -29,16 +29,14 @@ function gutenberg_examples_04_esnext_load_textdomain() {
*/
function gutenberg_examples_04_esnext_register_block() {

if ( ! function_exists( 'register_block_type' ) ) {
// Gutenberg is not active.
return;
}
// automatically load dependencies and version
$depver = include( plugin_dir_path( __FILE__ ) . 'build/index.asset.php');

wp_register_script(
'gutenberg-examples-04-esnext',
plugins_url( 'build/index.js', __FILE__ ),
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ),
filemtime( plugin_dir_path( __FILE__ ) . 'build/index.js' )
$depver['dependencies'],
$depver['version']
);

wp_register_style(
Expand Down
4 changes: 2 additions & 2 deletions 04-controls-esnext/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "04-controls-esnext",
"version": "1.0.0",
"version": "1.1.0",
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^3.4.0"
"@wordpress/scripts": "^5.0.0"
},
"scripts": {
"start": "wp-scripts start",
Expand Down
12 changes: 6 additions & 6 deletions 04-controls-esnext/src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* global wp */
const { __ } = wp.i18n;
const {

import { __ } from '@wordpress/i18n';
import {
registerBlockType,
} = wp.blocks;
} from '@wordpress/blocks';

const {
import {
RichText,
AlignmentToolbar,
BlockControls,
} = wp.editor;
} from '@wordpress/block-editor';

registerBlockType( 'gutenberg-examples/example-04-controls-esnext', {
title: __( 'Example: Controls (ESNext)', 'gutenberg-examples' ),
Expand Down
2 changes: 1 addition & 1 deletion 04-controls/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Gutenberg Examples Controls
* Plugin URI: https://github.com/WordPress/gutenberg-examples
* Description: This is a plugin demonstrating how to register new blocks for the Gutenberg editor.
* Version: 1.0.2
* Version: 1.1.0
* Author: the Gutenberg Team
*
* @package gutenberg-examples
Expand Down
1 change: 1 addition & 0 deletions 05-recipe-card-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '90824b35b3b97a34d30c4e73039d5243');
1 change: 0 additions & 1 deletion 05-recipe-card-esnext/build/index.deps.json

This file was deleted.

2 changes: 1 addition & 1 deletion 05-recipe-card-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.