@vactorynext/core
v1.0.21
Published
The `@vactorynext/core` package centralizes various components and functionalities used across Vactory and other VOID projects. This package includes a wide range of elements such as Contexts, Hooks, Lib, Block, and Paragraph components, ensuring consiste
Downloads
342
Readme
@vactorynext/core
The @vactorynext/core
package centralizes various components and functionalities used across Vactory and other VOID projects. This package includes a wide range of elements such as Contexts, Hooks, Lib, Block, and Paragraph components, ensuring consistency and ease of maintenance across different implementations.
The introduction of @vactorynext/core
addresses the challenge of manual updates in multiple projects for any changes, refactorings, or fixes. It serves as a central workspace, allowing for easy synchronization across projects through package updates.
Features
The @vactorynext/core
package offers a comprehensive set of methods and components:
- Blocks: JSX components for block elements.
- Paragraphs: JSX components for paragraph elements.
- Drupal: Functionalities specific to Drupal integration.
- Hooks: A collection of custom React hooks.
- Context: React custom context functionalities.
- Lib: Library functions for various features.
- Utils: Utility functions including date formatting, UI elements functionalities, and more.
- Webform: Hooks and functions for webform management.
- Server: Server-only functions, optimized for SSR processes.
- Fetch Intercept: Intercepts fetch errors
Installation
To install the package, use the following command with yarn:
yarn add @vactorynext/core -W
Usage
To use @vactorynext/core
, simply import the desired functionality or component into your project. Below are examples for each type of import provided by the package. Make sure to specify the correct path related to each feature:
Importing Blocks
import { BlocksController } from "@vactorynext/core/blocks"
Importing Paragraphs
import { ParagraphsController } from "@vactorynext/core/paragraphs"
Drupal Integration
import { drupal } from "@vactorynext/core/drupal"
Custom Hooks
import { useI18n } from "@vactorynext/core/hooks"
Context Usage
import { MenuProvider } from "@vactorynext/core/context"
Library Functions
import { removeQueryParamValue } from "@vactorynext/core/lib"
Utility Functions
import { vclsx } from "@vactorynext/core/utils"
import { ErrorBoundary } from "@vactorynext/core/utils"
Webform Hooks and Functions
import { useErrorMessage } from "@vactorynext/core/webform"
Server-only Functions
import { redis } from "@vactorynext/core/server"
Fetch Interceptor
const FetchInterceptor = dynamic(
() => import("@vactorynext/core/fetch-intercept").then((mod) => mod.FetchInterceptor),
{ ssr: false }
)
Contributing
We warmly welcome contributions to the @vactorynext/core
package. If you're looking to contribute, please follow these steps to ensure a smooth process:
Clone: The change can only be made in Vactory Next project
Make Changes Locally:
- Navigate to the
packages/core/src
folder in your local repository. - Implement your changes or enhancements here.
- For new path alias folders, ensure to add these in the
files
array inpackage.json
to include them in the package.
- Navigate to the
Run Tests:
- Before committing your changes, run any existing tests to make sure everything still works as expected (dev, build, storybook:dev, storybook:build, lint & docker for production environment).
Update Documentation:
- If your changes involve adding new features or modifying existing ones, update the relevant documentation and examples in the
README.md
or other documentation files.
- If your changes involve adding new features or modifying existing ones, update the relevant documentation and examples in the
Commit Your Changes:
- Commit your changes with a clear and descriptive commit message. This helps others understand the purpose and context of your changes.
Create a Pull Request (PR):
- Push your changes to your branch and create a pull request against the feature/v3 repository.
- In the PR description, provide detailed information about your changes. Highlight any important aspects or considerations related to your contribution.
- Make sure your PR title and description are clear and concise, giving maintainers a good understanding of your contribution.
PR Review:
- Once submitted, your PR will be reviewed by the maintainers or the package's responsible person.
- Engage in discussions or make further changes if requested by the reviewers.
Merging and Publishing:
- After your PR is approved and merged, the package's maintainer will handle publishing a new version with your changes.
Notes for Contributors:
- Please adhere to the coding style and standards used in the project.
License
@vactorynext/core
is licensed under MIT License.