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

Add script to compile usage of experimental APIs #51341

Merged
merged 3 commits into from
Jun 10, 2023

Conversation

mcsf
Copy link
Contributor

@mcsf mcsf commented Jun 8, 2023

Context: #47196

What?

Add a shell script that generates a Markdown-formatted list of experimental APIs found across our packages and lib. Here, "experimental API" means any string match for __experimental.... For each such match, output a link to a GitHub search page for that match.

Why?

Experimental APIs must be regularly audited, particularly in the context of major WordPress releases. Typically, release leads would run their own scripts as shared in comments in #47196. This PR offers one such implementation.

This came about in conversation with @ntsekouras, who had shared a Bash script that had become more difficult to maintain. /cc @tellthemachines

How?

I wrote an alternative in POSIX sh (well, with the exception of git ls-files, it's as POSIX as I can tell) that should perform better and be readily understandable, since it works by transforming a single stream rather than dealing with loops and state.

This script's output differs from that found in the description of the audit issue, mostly because it traverses matches in a different order. This matters because the scripts ascribe experimental APIs to the first package in which they were found. This is particularly noticeable when comparing the APIs listed under lib.

Testing Instructions

Run ./bin/list-experimental-api-matches.sh and inspect the results. Note that the output differs from that produced by previous scripts.

Generated output

List of experimental APIs

lib

__experimentalBorder
__experimentalDefault
__experimentalDuotone
__experimentalEnableColorRandomizer
__experimentalEnableGroupGridVariation
__experimentalEnableListBlockV2
__experimentalEnablePatternEnhancements
__experimentalEnableQuoteBlockV2
__experimentalEnableZoomedOutView
__experimentalFeatures
__experimentalFontFamily
__experimentalFontStyle
__experimentalFontWeight
__experimentalInteractivityAPI
__experimentalLayout
__experimentalLetterSpacing
__experimentalSelector
__experimentalSettings
__experimentalStyle
__experimentalStyles
__experimentalTextDecoration
__experimentalTextTransform

packages/annotations

__experimentalAddAnnotation
__experimentalCreateOnChangeEditableValue
__experimentalCreatePrepareEditableTree
__experimentalGetAllAnnotationsForBlock
__experimentalGetAnnotations
__experimentalGetAnnotationsForBlock
__experimentalGetAnnotationsForRichText
__experimentalGetPropsForEditableTreeChangeHandler
__experimentalGetPropsForEditableTreePreparation
__experimentalRemoveAnnotation
__experimentalRemoveAnnotationsBySource
__experimentalUpdateAnnotationRange

packages/block-directory

__experimentalIsFocusable

packages/block-editor

__experimentalAlignmentMatrixControl
__experimentalAppenderTagName
__experimentalBlockAlignmentMatrixControl
__experimentalBlockDirectory
__experimentalBlockFullHeightAligmentControl
__experimentalBlockPatternCategories
__experimentalBlockPatternSetup
__experimentalBlockPatterns
__experimentalBlockPatternsList
__experimentalBlockVariationPicker
__experimentalBlockVariationTransforms
__experimentalBorderBoxControl
__experimentalBorderRadiusControl
__experimentalBoxControl
__experimentalCanUserUseUnfilteredHTML
__experimentalCaptureToolbars
__experimentalCloneSanitizedBlock
__experimentalColorGradientControl
__experimentalColorGradientSettingsDropdown
__experimentalConvertBlockToStatic
__experimentalDateFormatPicker
__experimentalDefaultBlock
__experimentalDefaultControls
__experimentalDirectInsert
__experimentalDisableBlockOverlay
__experimentalDragComponent
__experimentalDropdownContentWrapper
__experimentalDuotoneControl
__experimentalExposeControlsToChildren
__experimentalFetchLinkSuggestions
__experimentalFetchReusableBlocks
__experimentalFetchRichUrlData
__experimentalFilterValue
__experimentalFirstVisibleItemClass
__experimentalFontAppearanceControl
__experimentalFontFamilyControl
__experimentalGetAccessibleBlockLabel
__experimentalGetActiveBlockIdByBlockNames
__experimentalGetAllowedBlocks
__experimentalGetAllowedPatterns
__experimentalGetBlockAttributesNamesByRole
__experimentalGetBlockLabel
__experimentalGetBlockListSettingsForBlocks
__experimentalGetBorderClassesAndStyles
__experimentalGetColorClassesAndStyles
__experimentalGetDirectInsertBlock
__experimentalGetElementClassName
__experimentalGetGapCSSValue
__experimentalGetGlobalBlocksByName
__experimentalGetGradientClass
__experimentalGetGradientObjectByGradientValue
__experimentalGetLastBlockAttributeChanges
__experimentalGetMatchingVariation
__experimentalGetParsedPattern
__experimentalGetPatternTransformItems
__experimentalGetPatternsByBlockTypes
__experimentalGetReusableBlockTitle
__experimentalGetSpacingClassesAndStyles
__experimentalGlobalStylesBaseStyles
__experimentalGrid
__experimentalGroup
__experimentalHStack
__experimentalHandleURLSuggestions
__experimentalHasContentRoleAttribute
__experimentalHasSplitBorders
__experimentalHeading
__experimentalHideChildBlockControls
__experimentalHint
__experimentalImageEditor
__experimentalImageSizeControl
__experimentalImageURLInputUI
__experimentalInitialIndex
__experimentalInitialPosition
__experimentalInsertionIndex
__experimentalInspectorPopoverHeader
__experimentalIsDefinedBorder
__experimentalIsQuick
__experimentalIsRenderedInSidebar
__experimentalItem
__experimentalItemGroup
__experimentalLabel
__experimentalLastVisibleItemClass
__experimentalLayoutStyle
__experimentalLetterSpacingControl
__experimentalLibrary
__experimentalLinkControl
__experimentalLinkControlSearchInput
__experimentalLinkControlSearchItem
__experimentalLinkControlSearchResults
__experimentalListView
__experimentalMetadata
__experimentalMinHeight
__experimentalNavigatorBackButton
__experimentalNavigatorButton
__experimentalNavigatorProvider
__experimentalNavigatorScreen
__experimentalNumberControl
__experimentalOnIndexChange
__experimentalOnlyMediaLibrary
__experimentalPadding
__experimentalPanelColorGradientSettings
__experimentalParentSelector
__experimentalParseQuantityAndUnitFromRawValue
__experimentalPopoverLegacyPositionToPlacement
__experimentalPreferPatternsOnRoot
__experimentalPreferredStyleVariations
__experimentalPreviewOptions
__experimentalPublishDateTimePicker
__experimentalRecursionProvider
__experimentalRenderControl
__experimentalRenderSuggestions
__experimentalResponsiveBlockControl
__experimentalReusableBlocks
__experimentalRichText
__experimentalRole
__experimentalSelectBlock
__experimentalSetIsInserterOpened
__experimentalShareWithChildBlocks
__experimentalShouldInsertAtTheTop
__experimentalShowInitialSuggestions
__experimentalShowSelectedHint
__experimentalSkipSerialization
__experimentalSlashInserter
__experimentalSpacer
__experimentalSpacingSizesControl
__experimentalStyleProvider
__experimentalText
__experimentalTextDecorationControl
__experimentalTextTransformControl
__experimentalToggleGroupControl
__experimentalToggleGroupControlOption
__experimentalToggleGroupControlOptionIcon
__experimentalToolbar
__experimentalToolbarContext
__experimentalToolsPanel
__experimentalToolsPanelContext
__experimentalToolsPanelItem
__experimentalTransferDataType
__experimentalTreeGrid
__experimentalTreeGridCell
__experimentalTreeGridItem
__experimentalTreeGridRow
__experimentalTruncate
__experimentalUndo
__experimentalUnitControl
__experimentalUpdateSelection
__experimentalUpdateSettings
__experimentalUseBlockOverlayActive
__experimentalUseBlockPreview
__experimentalUseBorderProps
__experimentalUseColorProps
__experimentalUseCustomSides
__experimentalUseCustomUnits
__experimentalUseDropZone
__experimentalUseFixedWindowList
__experimentalUseGradient
__experimentalUseHasRecursion
__experimentalUseMultipleOriginColorsAndGradients
__experimentalUseResizeCanvas
__experimentalUseSlotFills
__experimentalVStack
__experimentalVersion
__experimentalView
__experimentalZStack
__experimentaluseLayoutClasses
__experimentaluseLayoutStyles

packages/block-library

__experimentalConvert
__experimentalDiscussionSettings
__experimentalGetCoreBlocks
__experimentalGetDefaultTemplatePartAreas
__experimentalInputControl
__experimentalIsEditingReusableBlock
__experimentalOnEnter
__experimentalRegisterExperimentalCoreBlocks
__experimentalShowHowTo
__experimentalShowTooltip
__experimentalTooltipProps

packages/blocks

__experimentalGetUnprocessedBlockTypes
__experimentalReapplyBlockTypeFilters
__experimentalRegisterBlockType
__experimentalSanitizeBlockAttributes

packages/commands

__experimentalHideHeader

packages/components

__experimentalApplyValueToSides
__experimentalAutoSelectFirstMatch
__experimentalBorderControl
__experimentalConfirmDialog
__experimentalDimensionControl
__experimentalDivider
__experimentalElevation
__experimentalExpandOnFocus
__experimentalInputControlPrefixWrapper
__experimentalInputControlSuffixWrapper
__experimentalInvalid
__experimentalIsEmptyBorder
__experimentalNavigation
__experimentalNavigationBackButton
__experimentalNavigationGroup
__experimentalNavigationItem
__experimentalNavigationMenu
__experimentalNavigatorToParentButton
__experimentalPaletteEdit
__experimentalRadio
__experimentalRadioGroup
__experimentalRenderItem
__experimentalScrollable
__experimentalSurface
__experimentalTheme
__experimentalToggleGroupControlOptionBase
__experimentalUseDialog
__experimentalUseDragging
__experimentalUseFocusOutside
__experimentalUseNavigator
__experimentalUseSlot
__experimentalValidateInput

packages/compose

__experimentalWidthProvider

packages/core-data

__experimentalBatch
__experimentalFetchUrlData
__experimentalGetCurrentGlobalStylesId
__experimentalGetCurrentThemeBaseGlobalStyles
__experimentalGetCurrentThemeGlobalStylesVariations
__experimentalGetDirtyEntityRecords
__experimentalGetEntitiesBeingSaved
__experimentalGetEntityRecordNoResolver
__experimentalGetTemplateForLink
__experimentalNoFetch
__experimentalReceiveCurrentGlobalStylesId
__experimentalReceiveThemeBaseGlobalStyles
__experimentalReceiveThemeGlobalStyleVariations
__experimentalSaveSpecifiedEntityEdits
__experimentalUseEntityRecord
__experimentalUseEntityRecords
__experimentalUseResourcePermissions

packages/customize-widgets

__experimentalGetInsertionPoint

packages/date

__experimentalGetSettings

packages/dependency-extraction-webpack-plugin

__experimentalInjectInteractivityRuntime

packages/e2e-test-utils

__experimentalActivatePlugin
__experimentalDeactivatePlugin
__experimentalRest

packages/edit-post

__experimentalFullscreenModeClose
__experimentalGetPreviewDeviceType
__experimentalMainDashboardButton
__experimentalSetPreviewDeviceType

packages/edit-site

__experimentalAdditionalBlockPatternCategories
__experimentalAdditionalBlockPatterns
__experimentalDashboardLink
__experimentalGetDefaultTemplateTypes
__experimentalGetTemplateInfo

packages/editor

__experimentalCreatePageEntity
__experimentalGetDefaultTemplateType
__experimentalTearDownEditor
__experimentalUserCanCreatePages

packages/reusable-blocks

__experimentalConvertBlocksToReusable
__experimentalDeleteReusableBlock
__experimentalSetEditingReusableBlock

@mcsf mcsf added the Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts label Jun 8, 2023
@github-actions
Copy link

github-actions bot commented Jun 8, 2023

Flaky tests detected in c7a4ebb.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5229008186
📝 Reported issues:

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together! It's working as expected in testing: it outputs each instance only once, in the first package it was found in.

I like that it specifies file types to look in and excludes tests, so we don't end up with things like __experimentalFoo in the list 😄

It's also great to not have ripgrep as a dependency.

There doesn't seem to be an obvious place in the repo docs to document this. This handbook entry on the editor tech lead tasks would be good to update and add a reference to this script, not sure if there's anywhere else where it would make sense to mention it?

@mcsf
Copy link
Contributor Author

mcsf commented Jun 10, 2023

Thanks for the review!

There doesn't seem to be an obvious place in the repo docs to document this. This handbook entry on the editor tech lead tasks would be good to update and add a reference to this script, not sure if there's anywhere else where it would make sense to mention it?

Good idea. I can't think of any other place, so I'll edit it in there. :)

@mcsf mcsf enabled auto-merge (squash) June 10, 2023 11:39
@mcsf mcsf merged commit 7c3ea72 into trunk Jun 10, 2023
@mcsf mcsf deleted the add/list-experimental-api-matches branch June 10, 2023 12:13
@github-actions github-actions bot added this to the Gutenberg 16.1 milestone Jun 10, 2023
sethrubenstein pushed a commit to pewresearch/gutenberg that referenced this pull request Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants