Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 10 months ago

Last modified 7 months ago

#8457 closed task (fixed)

Migrate to @wordpress/scripts

Reported by: imath's profile imath Owned by: imath's profile imath
Milestone: 12.0.0 Priority: normal
Severity: normal Version: 6.0.0
Component: Build/Test Tools Keywords: has-patch
Cc:

Description (last modified by imath)

Unfortunately unlike Parcel v1, Parcel v2 is not yet supporting library builds (using a global window object for a script). We need this possibility for our shared BP Block components an data store.

We can’t wait longer as v1 is no more maintained and contains node modules with security issues.

I’ve been testing the @wordpress/scripts package for the BP Block Activity Editor feature as a plugin as well as custom Webpack config for the BP Blocks plugin. To fully enjoy the v2 of the block API, I will work on a migration process.

Previous description

Parcel v1 is no longer maintained. I'm going to update it to the last 1.x version. But we'll need to migrate to v2 during next dev cycle.

See https://v2.parceljs.org/getting-started/migration

Change History (16)

#1 @imath
3 years ago

  • Description modified (diff)

#2 @imath
3 years ago

In 12889:

Update Parcel Bundler to v1.12.5

See #8457

#3 @imath
3 years ago

  • Milestone changed from Up Next to 10.0.0

Let's try to progress on it during 10.0.0 dev cycle.

#4 @imath
2 years ago

We can't migrate until this feature is not migrated into Parcel v2

#5 @imath
2 years ago

  • Milestone changed from 10.0.0 to Up Next

We'll have to wait a bit more!

#6 @imath
14 months ago

  • Milestone changed from Up Next to 12.0.0

#7 @imath
12 months ago

  • Description modified (diff)
  • Keywords needs-patch added
  • Summary changed from Migrate to Parcel.js v2 to Migrate to @wordpress/scripts

#8 @imath
11 months ago

In 13440:

BP Blocks: introduce a new $metadata argument to use WP Block API v2

The bp_register_block() array of arguments now accepts a $metadata
argument to inform about the path to a block block.json dir path. If
it's used this function is now is simple wrapper of WordPress's
register_block_type_from_metadata() function.

Closes https://github.com/buddypress/buddypress/pull/76
See #8842
See #8457
Fixes #8855

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


10 months ago

This ticket was mentioned in PR #92 on buddypress/buddypress by @imath.


10 months ago
#10

  • Keywords has-patch added; needs-patch removed
  • Remove our dependency to ParcelJS
  • Add a dependency to @wordpress/scripts
  • Reorganize BP Blocks directories: they are now located and built into each bp-{component-name}/blocks directory.
  • Reorganize src/js directory: Admin source JS are located in src/js/admin and Blocks source JS are located in src/js/blocks
  • Create a specific webpack.config.js file for Admin scripts and each BP Blocks scripts.
  • Upgrade each BP Block to WP Block API v2 and update all PHP registration code.
  • Update Grunt tasks

Trac ticket: https://buddypress.trac.wordpress.org/ticket/8457

#11 @imath
10 months ago

In 13462:

Migrate from ParcelJS to @wordpress/scripts (Webpack)

  • Remove our dependency to ParcelJS.
  • Add a dependency to @wordpress/scripts
  • Update Grunt tasks in favor of building Modern JS using

@wordpress/scripts

See #8457

#12 @imath
10 months ago

In 13463:

Use @wordpress/scripts to build BP Blocks and other Modern JS files

  • Reorganize the src/js directory so that all blocks are moved inside a

src/js/blocks/bp-{component-name} directory and all WP Admin scripts
moved inside a src/js/admin/bp-{component-name} directory

  • Create a specific webpack.config.js file for each component’s blocks

and for all scripts used inside the WP Administration.

  • Do not migrate BP Widget blocks transforms functions as Legacy widgets

will be moved from BuddyPress 12.0 to the BP Classic plugin.

  • Update all BP Blocks to use the WP Block API v2.
  • Add a new BP Block collection.
  • Built JavaScript files for blocks are now located inside a blocks

subdirectory of corresponding component's src directories

  • Built JavaScript files for WP Admin scripts are located at the same

place than before.

See #8457

#13 @imath
10 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 13464:

Update all BP Blocks & Modern JS PHP registration code

  • Use the metadata argument of the bp_register_block() function to load all BP Blocks JSON files.
  • Get BP Blocks dependencies using the @wordpress/scripts index.asset.php generated files.
  • Although the BP Blocks category has been replaced by the BP Blocks collection, leave the no more used bp_block_category() function in place in case some third party plugins are using it for their custom blocks.
  • PHPUnit tests: make sure to unregister all BP Blocks when using the BP_UnitTestCase->go_to() method.

See #8842
Fixes #8457
Closes https://github.com/buddypress/buddypress/pull/92

#14 @imath
10 months ago

In 13465:

Build/tests: add built blocks CSS files to excluded CSS in Grunt tasks

See #8457

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


10 months ago

#16 @imath
7 months ago

In 13535:

BP Blocks: define embedScriptURL property of bp.blockData object

This property was missed during the @wordpress/scripts migration process.

See #8457
Fixes #8958
Closes https://github.com/buddypress/buddypress/pull/144

Note: See TracTickets for help on using tickets.