Skip to Content
FrontendBundlesHow to Contribute to a Bundle

How to Contribute to a Bundle

In the Bundle Repository

Clone the Repository

git clone https://github.com/phpcreation/bundle-repo.git

Create or Add a Feature Following the Standard Structure

  • Create and check out a new branch in the bundle repository for the feature.

  • Add the file to the appropriate folder in the bundle.

  • components: UI components of the bundle (e.g., Button, Input, etc.).

  • containers: Pages or sections of the bundle (e.g., Home, About, Contact, Status, etc.).

  • contexts: Contexts used within the bundle (e.g., ThemeContext, ComponentsContext, etc.).

  • messages: Translation files for localization (e.g., en.json, fr.json, etc.).

  • libs: Libraries used in the bundle (e.g., axios, lodash, authentication, etc.).

  • utils: Utility functions and helpers.

Always make sure to add an export in the index.ts file of the folder where you add a file. The index.ts file serves as the entry point for the folder and exports all files within it.

Install Dependencies

npm i

Build the Bundle

npm run build

In a Standard Project or App

To Test the Feature

The example below demonstrates how to test the feature in a standard project, where bundles are tested and documented. The process applies to any project.

To test the feature, you need to install the bundle locally.

Clone the Repository

git clone https://github.com/PHPCreation/presentation-frontend-standard-react-nextjs.git
  • If you have the project locally, specify the path to the bundle in the package.json file:
"dependencies": { "@phpcreation/bundle": "file:../../path/to/bundle" }
  • If you don’t have the bundle locally, you need to clone the repository with the same path specified as the package.json file.

Install Dependencies

npm install

Some bundles have unique steps to follow after installation for them to work locally, so check if there is an installation guide for the installed bundle. (Ex : Cache)

Import the Feature in the Project

  • Import the feature into your project:
import { Button } from "@phpcreation/bundle";

Every time you make a change in the feature in the bundle, you need to rebuild the bundle for the change to take effect.

When the Feature is Tested and Ready

  • Build the project to ensure everything is functioning correctly:
npm run build
  • Push the branch to the repository and create a pull request:
git push origin branch-name
  • Create a pull request in the repository targeting the main branch.
  • If not done already publish the bundle on GitHub under the “Actions” tab of the bundle project.

In the App Where You Need the Feature, Update the Bundle to the Latest Version

  • Unlink the local bundle path in package.json (or remove the package from package.json):
npm unlink @phpcreation/bundle
  • Install the latest version of the bundle:
npm install @phpcreation/bundle
Last updated on