This content originally appeared on Bits and Pieces - Medium and was authored by Eden Ella
How to Efficiently Edit Shared Modules and See the Effects on Dependent Projects
Bit is a widely used tool for managing shared components and modules across multiple projects. Bit components are essentially standard packages that can be independently maintained without the hassle of dedicated repositories or complex setups.
This allows for quick edits and updates to shared components without sifting through vast codebases or hopping between repositories. To ensure updates are compatible across dependent components and consumer projects, a CI system must validate and propagate these changes.
Let’s see how Bit makes this process quick and efficient.
Updating components and testing their impact on direct and indirect dependent components
Bit components are stored in access-controlled scopes on the Bit Platform, with each component having its own page displaying documentation, an API reference, a visual dependency graph, and other key information.
An ‘Edit component’ button in the top-right corner lets you quickly modify components directly within the browser.
Once changes are made, you can either version and release the component or mark it as a pre-release for further review.
Multiple component updates can be grouped into a ‘lane,’ allowing you to review, build, test, and release them as a single, cohesive update.
“Lanes” are often used even for a single component change as they pack with them many features that make it easier to review the component and test its effect on its dependents.
You can also simulate the impact of changes in a lane by building and testing dependent components, even those owned by other teams or users.
Testing changes in Bit and non-Bit projects
Pre-release versions of shared components can be tested by installing their pre-release builds. Unlike ‘release versions,’ which follow SemVer tagging (e.g., 1.2.3), pre-released components are assigned a unique hash for versioning
For example, to install a pre-release version of the previously updated “button” component, in a Bit project:
bit install @bitdesign/sparks.actions.button@0.0.0-b5de15077e636192a6ceed332e8f356bd70d395e
In non-Bit projects you can use other package manager, such as npm:
npm install @bitdesign/sparks.actions.button@0.0.0-b5de15077e636192a6ceed332e8f356bd70d395e
Bit offers a range of CI integrations that automatically update projects with pre-release component versions within a single lane.
For example, you can assess the impact of changes made to multiple shared components on your project by running a CI task that creates a new branch with the updated versions and executes tests.
# A Github action that tests the impact of changes to multiple shared components
name: Verify Lane In Consumer
on:
workflow_dispatch:
inputs:
lane-id:
description: 'The ID of the lane to install from in the format: org.scope/lane'
required: true
default: ''
permissions:
contents: write
jobs:
build:
// ...
steps:
// ...
- name: Verify Lane In Consumer
uses: bit-tasks/verify-lane-in-consumer@v1
with:
lane-id: ${{ github.event.inputs.lane-id }}
package-manager: 'npm'
test-command: 'npm test'
Conclusion
Bit offers a seamless and efficient way to manage and update shared components across multiple projects, simplifying the process of testing their impact on dependent components.
With features like Lanes, Ripple CI, Cloud Workspaces, and the ability to integrate with popular CI/CD pipelines, teams can confidently make updates and ensure compatibility across their codebase.
The ability to quickly edit components, run tests, and assess the effect of changes in Bit and non-Bit projects means that developers can maintain agility without sacrificing stability. By leveraging Bit’s robust infrastructure, you can streamline your package update workflow, ultimately improving collaboration and reducing the complexity of managing shared modules across your organization.
Learn More
- Bit. Composable software platform.
- Create and Edit Shared Modules in The Cloud
- Hope AI: A Code Assistant for Composable Software
Make Instant Package Updates and Test Impact on Dependent Projects was originally published in Bits and Pieces on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Bits and Pieces - Medium and was authored by Eden Ella
Eden Ella | Sciencx (2024-09-17T21:59:08+00:00) Make Instant Package Updates and Test Impact on Dependent Projects. Retrieved from https://www.scien.cx/2024/09/17/make-instant-package-updates-and-test-impact-on-dependent-projects/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.