Merge branch 'main' into block

This commit is contained in:
Daniel Waxweiler 2021-12-14 17:54:47 +01:00
commit 876c3e3840
33 changed files with 18 additions and 19 deletions

View File

@ -10,11 +10,11 @@ const FOLDER_BUILD = './build'
function injectMetadata() { function injectMetadata() {
return src( return src(
[ [
FOLDER_BUILD + '/' + PACKAGE.name + '/front/events-loader.js', FOLDER_BUILD + '/front/block-events-loader.js',
FOLDER_BUILD + '/' + PACKAGE.name + '/front/block-events-loader.js', FOLDER_BUILD + '/front/events-loader.js',
FOLDER_BUILD + '/' + PACKAGE.name + '/' + PACKAGE.name + '.php', FOLDER_BUILD + '/' + PACKAGE.name + '.php',
FOLDER_BUILD + '/' + PACKAGE.name + '/includes/constants.php', FOLDER_BUILD + '/includes/constants.php',
FOLDER_BUILD + '/' + PACKAGE.name + '/readme.txt', FOLDER_BUILD + '/readme.txt',
], ],
{ base: './' } { base: './' }
) )

View File

@ -8,20 +8,23 @@ const NAME = '<wordpress-name>'
registerBlockType(NAME + '/events-list', { registerBlockType(NAME + '/events-list', {
title: __('Events List', '<wordpress-name>'), title: __('Events List', '<wordpress-name>'),
description: __('A list of the upcoming events of the connected Mobilizon instance.', '<wordpress-name>'), description: __(
'A list of the upcoming events of the connected Mobilizon instance.',
'<wordpress-name>'
),
icon: 'list-view', icon: 'list-view',
category: 'widgets', category: 'widgets',
attributes: { attributes: {
eventsCount: { eventsCount: {
type: 'number', type: 'number',
default: 3 default: 3,
}, },
groupName: { groupName: {
type: 'string' type: 'string',
} },
}, },
supports: { supports: {
html: false html: false,
}, },
edit, edit,
save, save,

View File

@ -3,20 +3,16 @@ const path = require('path')
const CopyPlugin = require('copy-webpack-plugin') const CopyPlugin = require('copy-webpack-plugin')
const PACKAGE = require('./package.json')
const FOLDER_SOURCE = './source' const FOLDER_SOURCE = './source'
module.exports = { module.exports = {
entry: { entry: {
'block-events-loader': 'block-events-loader': FOLDER_SOURCE + '/front/block-events-loader.js',
FOLDER_SOURCE + '/' + PACKAGE.name + '/front/block-events-loader.js', 'events-loader': FOLDER_SOURCE + '/front/events-loader.js',
'events-loader':
FOLDER_SOURCE + '/' + PACKAGE.name + '/front/events-loader.js',
}, },
output: { output: {
filename: '[name].js', filename: '[name].js',
path: path.resolve(__dirname, 'build/' + PACKAGE.name + '/front'), path: path.resolve(__dirname, 'build/front'),
}, },
module: { module: {
rules: [ rules: [
@ -33,12 +29,12 @@ module.exports = {
new CopyPlugin({ new CopyPlugin({
patterns: [ patterns: [
{ {
context: FOLDER_SOURCE + '/' + PACKAGE.name, context: FOLDER_SOURCE,
from: '**/*.php', from: '**/*.php',
to: '../', to: '../',
}, },
{ {
context: FOLDER_SOURCE + '/' + PACKAGE.name, context: FOLDER_SOURCE,
from: '**/*.txt', from: '**/*.txt',
to: '../', to: '../',
}, },