Skip to content

Commit

Permalink
prep build 03/14
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Mar 14, 2024
2 parents ee2e7e1 + 87d3d4f commit be03bfa
Show file tree
Hide file tree
Showing 124 changed files with 1,327 additions and 442 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7
- uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
with:
# `.ruby-version` file location
working-directory: packages/react-native-editor/ios
Expand Down
60 changes: 11 additions & 49 deletions bin/generate-php-sync-issue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ const MAX_MONTHS_TO_QUERY = 4;

// The following paths will be ignored when generating the issue content.
const IGNORED_PATHS = [
'init.php', // plugin specific code.
'lib/load.php', // plugin specific code.
'lib/experiments-page.php', // experiments are plugin specific.
'packages/e2e-tests/plugins', // PHP files related to e2e tests only.
'packages/block-library', // this is handled automatically.
'packages/block-library', // packages are synced to WP Core via npm packages.
];

// PRs containing the following labels will be ignored when generating the issue content.
const LABELS_TO_IGNORE = [ 'Backport from WordPress Core' ];
const LABELS_TO_IGNORE = [
'Backport from WordPress Core', // PRs made "upstream" in Core that were synced back into Gutenberg.
'Backported to WP Core', // PRs that were synced into Core during a previous release.
];

const MAX_NESTING_LEVEL = 3;

Expand Down Expand Up @@ -72,28 +76,6 @@ async function main() {
process.exit( 1 );
}

const lastRcDateArg = getArg( 'lastrcdate' );
let lastRcDate;

if ( lastRcDateArg ) {
if (
validateDate( lastRcDateArg ) &&
isAfter( lastRcDateArg, since )
) {
lastRcDate = lastRcDateArg;
} else {
console.error(
`Error: The --lastrcdate argument must be a date after the --since date.`
);
process.exit( 1 );
}
} else {
console.error(
`Error: The --lastrcdate argument is required (e.g. YYYY-MM-DD).`
);
process.exit( 1 );
}

console.log( 'Welcome to the PHP Sync Issue Generator!' );

console.log( '--------------------------------' );
Expand Down Expand Up @@ -126,11 +108,7 @@ async function main() {
commits.map( async ( commit ) => {
const commitData = await fetchCommit( commit.sha );

// In the future we will want to exclude PRs based on label
// so we will need to fetch the full PR data for each commit.
// For now we can just set this to null.
const fullPRData = null;
// const fullPRData = getPullRequestDataForCommit( commit.sha );
const fullPRData = await getPullRequestDataForCommit( commit.sha );

// Our Issue links to the PRs associated with the commits so we must
// provide this data. We could also get the PR data from the commit data,
Expand All @@ -156,18 +134,6 @@ async function main() {
return null;
}

// This is temporarily required because PRs merged between Beta 1 (since)
// and the final RC may have already been manually backported to Core.
// This is however no reliable way to identify these PRs as the `Backport to WP beta/RC`
// label is manually removed once the PR has been backported.
// In future releases we will add a **new** label `Backported`
// to indicate the PR was backported to Core.
// As a result, in the future we will be able to exclude any PRs that have
// already been backported using the `Backported` label.
if ( isAfter( lastRcDate, commitData.commit.committer.date ) ) {
commitData.isBeforeLastRCDate = true;
}

return commitData;
} )
);
Expand Down Expand Up @@ -426,12 +392,8 @@ function processCommits( commits ) {
return result;
}

function formatPRLine( { pullRequest: pr, isBeforeLastRCDate } ) {
return `- [ ] ${ pr.url } - @${
pr.creator
} | Trac ticket | Core backport PR ${
isBeforeLastRCDate ? '(⚠️ Check for existing WP Core backport)' : ''
}\n`;
function formatPRLine( { pullRequest: pr } ) {
return `- [ ] ${ pr.url } - @${ pr.creator } | Trac ticket | Core backport PR \n`;
}

function formatHeading( level, key ) {
Expand Down Expand Up @@ -466,7 +428,7 @@ function generateIssueContent( result, level = 1 ) {
}

async function fetchAllCommits( since, path ) {
return await octokitPaginate( 'GET /repos/{owner}/{repo}/commits', {
return octokitPaginate( 'GET /repos/{owner}/{repo}/commits', {
since,
per_page: 30,
path,
Expand All @@ -481,7 +443,7 @@ async function fetchCommit( sha ) {

// eslint-disable-next-line no-unused-vars
async function getPullRequestDataForCommit( commitSha ) {
const pullRequests = octokitRequest(
const pullRequests = await octokitRequest(
'GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls',
{
commit_sha: commitSha,
Expand Down
46 changes: 33 additions & 13 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,28 +581,46 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {
$child_layout_declarations['flex-grow'] = '1';
}

if ( isset( $block['attrs']['style']['layout']['columnSpan'] ) ) {
$column_span = $block['attrs']['style']['layout']['columnSpan'];
$column_start = isset( $block['attrs']['style']['layout']['columnStart'] ) ? $block['attrs']['style']['layout']['columnStart'] : null;
$column_span = isset( $block['attrs']['style']['layout']['columnSpan'] ) ? $block['attrs']['style']['layout']['columnSpan'] : null;
if ( $column_start && $column_span ) {
$child_layout_declarations['grid-column'] = "$column_start / span $column_span";
} elseif ( $column_start ) {
$child_layout_declarations['grid-column'] = "$column_start";
} elseif ( $column_span ) {
$child_layout_declarations['grid-column'] = "span $column_span";
}
if ( isset( $block['attrs']['style']['layout']['rowSpan'] ) ) {
$row_span = $block['attrs']['style']['layout']['rowSpan'];

$row_start = isset( $block['attrs']['style']['layout']['rowStart'] ) ? $block['attrs']['style']['layout']['rowStart'] : null;
$row_span = isset( $block['attrs']['style']['layout']['rowSpan'] ) ? $block['attrs']['style']['layout']['rowSpan'] : null;
if ( $row_start && $row_span ) {
$child_layout_declarations['grid-row'] = "$row_start / span $row_span";
} elseif ( $row_start ) {
$child_layout_declarations['grid-row'] = "$row_start";
} elseif ( $row_span ) {
$child_layout_declarations['grid-row'] = "span $row_span";
}

$child_layout_styles[] = array(
'selector' => ".$container_content_class",
'declarations' => $child_layout_declarations,
);

$minimum_column_width = isset( $block['attrs']['style']['layout']['minimumColumnWidth'] ) ? $block['attrs']['style']['layout']['minimumColumnWidth'] : null;
$column_count = isset( $block['attrs']['style']['layout']['columnCount'] ) ? $block['attrs']['style']['layout']['columnCount'] : null;

/*
* If columnSpan is set, and the parent grid is responsive, i.e. if it has a minimumColumnWidth set,
* the columnSpan should be removed on small grids. If there's a minimumColumnWidth, the grid is responsive.
* But if the minimumColumnWidth value wasn't changed, it won't be set. In that case, if columnCount doesn't
* exist, we can assume that the grid is responsive.
* If columnSpan or columnStart is set, and the parent grid is responsive, i.e. if it has a minimumColumnWidth set,
* the columnSpan should be removed once the grid is smaller than the span, and columnStart should be removed
* once the grid has less columns than the start.
* If there's a minimumColumnWidth, the grid is responsive. But if the minimumColumnWidth value wasn't changed, it won't be set.
* In that case, if columnCount doesn't exist, we can assume that the grid is responsive.
*/
if ( isset( $block['attrs']['style']['layout']['columnSpan'] ) && ( isset( $block['parentLayout']['minimumColumnWidth'] ) || ! isset( $block['parentLayout']['columnCount'] ) ) ) {
$column_span_number = floatval( $block['attrs']['style']['layout']['columnSpan'] );
$parent_column_width = isset( $block['parentLayout']['minimumColumnWidth'] ) ? $block['parentLayout']['minimumColumnWidth'] : '12rem';
if ( ( $column_span || $column_start ) && ( $minimum_column_width || ! $column_count ) ) {
$column_span_number = floatval( $column_span );
$column_start_number = floatval( $column_start );
$highest_number = max( $column_span_number, $column_start_number );
$parent_column_width = $minimum_column_width ? $minimum_column_width : '12rem';
$parent_column_value = floatval( $parent_column_width );
$parent_column_unit = explode( $parent_column_value, $parent_column_width );

Expand All @@ -627,14 +645,16 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {
* viable to use in the computation of the container query value.
*/
$default_gap_value = 'px' === $parent_column_unit ? 24 : 1.5;
$container_query_value = $column_span_number * $parent_column_value + ( $column_span_number - 1 ) * $default_gap_value;
$container_query_value = $highest_number * $parent_column_value + ( $highest_number - 1 ) * $default_gap_value;
$container_query_value = $container_query_value . $parent_column_unit;
// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.
$grid_column_value = $column_span ? '1/-1' : 'auto';

$child_layout_styles[] = array(
'rules_group' => "@container (max-width: $container_query_value )",
'selector' => ".$container_content_class",
'declarations' => array(
'grid-column' => '1/-1',
'grid-column' => $grid_column_value,
),
);
}
Expand Down
14 changes: 9 additions & 5 deletions lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,20 @@ function wp_interactivity_process_directives_of_interactive_blocks( array $parse
};

/*
* Uses a priority of 20 to ensure that other filters can add additional
* directives before the processing starts.
*/
add_filter( 'render_block_' . $block_name, $process_interactive_blocks, 20, 2 );
* Uses a priority of 100 to ensure that other filters can add additional
* directives before the processing starts.
*/
add_filter( 'render_block_' . $block_name, $process_interactive_blocks, 100, 2 );
}
}

return $parsed_block;
}
add_filter( 'render_block_data', 'wp_interactivity_process_directives_of_interactive_blocks' );
/*
* Uses a priority of 100 to ensure that other filters can edit $parsed_block
* without crashing the SSR.
*/
add_filter( 'render_block_data', 'wp_interactivity_process_directives_of_interactive_blocks', 100, 1 );
}

if ( ! function_exists( 'wp_interactivity' ) ) {
Expand Down
78 changes: 28 additions & 50 deletions package-lock.json

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

Loading

0 comments on commit be03bfa

Please sign in to comment.