feat: Integrate the common library - #590
Merged
Merged
Conversation
|
Coverage report for commit: c1da626 Summary - Lines: 100.00% ⏹️ | Methods: 100.00% ⏹️ | Branches: 100.00% ⏹️
🤖 comment via lucassabreu/comment-coverage-clover |
||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
N / A
PR Type
Description
Adopts
@p5-wrapper/commonas the source of truth for the shared p5 contracts, lifecycle utilities, and
constants that were previously duplicated in this repository. The React
package keeps only what is genuinely React-specific: the
P5Canvascomponenttree and the
P5CanvasPropscontract that binds common'sOutputNodetypeparameter to
ReactNode.This is the first adoption of the new shared package within the organisation.
Proposed Changes
@p5-wrapper/common@^0.1.0as a runtime dependency and removedmicrodiff(it now lives inside common; this package's runtime dependenciesare
@p5-wrapper/commonandreact-error-boundary)(
p5,SketchProps,Sketch,P5CanvasInstance,Updater,CanvasContainer,CanvasContainerRef,P5CanvasInstanceRef,P5CanvasInternalProps), theCanvasContainerClassNameconstant, the utils(
createP5CanvasInstance,updateP5CanvasInstance,removeP5CanvasInstance,propsAreEqual,logErrorBoundaryError), andtheir test files
src/components/P5Canvas.tsxnow passes common'spropsAreEqualdirectlyinto
React.memo— no local wrappersrc/contracts/P5CanvasProps.tsis the only remaining local contract: itbinds common's
P5CanvasProps<Props, OutputNode>toReactNode, keepingthe public type structurally identical to the previous local definition
src/main.tsxre-exports the shared contracts and constant from@p5-wrapper/common; the public API surface (names and shapes) is unchangedconfig/vite/library.tsadds@p5-wrapper/commonto the Rollup externalsand globals so it is never bundled into
dist/componentpnpm-workspace.yamladds@p5-wrapper/common@0.1.0tominimumReleaseAgeExclude— the package was published within the release-agewindow and could not otherwise be resolved under
minimumReleaseAgeStrict(this exclusion can be dropped once 0.1.0 ages pastthe window)
tests/components/);shared-surface tests (exports guard, constants, utils) are now owned by
@p5-wrapper/common's own suiteAGENTS.mdupdated throughout: dependency contract, code philosophy, layerarchitecture, testing structure, file organisation, build externals,
guardrails, and future topics now reflect the common adoption
How Has This Been Tested?
pnpm integrate(format:check → lint → test → build, the local CI mirror)passes fully: 22 passed + 2 pre-existing skipped tests, with
@p5-wrapper/commoncorrectly externalised in the ESM and CJS outputs indist/component. Manual checks confirmed the publicexportsmap, entryfilenames (
main.mjs/main.cjs), and bundled types are unchanged, and thatno shared module is bundled into the library output.
Screenshots/Recordings
Not applicable — no user-facing behaviour change.
Breaking Changes
The public API (
P5Canvas,CanvasContainerClassName, and the exportedtypes) keeps the same names and structurally identical shapes. Consumers are
unaffected; the only visible difference is that
@p5-wrapper/commonis nowinstalled transitively as a runtime dependency.
Checklist
Additional Notes
covered code that now lives in
@p5-wrapper/common, where it is tested bythat package's own suite
it.skiploading-UI tests are pre-existing and remain skipped,tracked in Future Topics
@utils/*and@constants/*path aliases, migrating@p5-wrapper/nextand@p5-wrapper/custom-elementonto common, anddropping the
minimumReleaseAgeExcludeentry once 0.1.0 maturesImportant: This can be deployed as a
patchdeployment since the exposed API surface is 1:1 but the idea is that in future, we can remove the dependency of the common library as a major release which consumers would then install alongside the react library, for example.