@thewave-studio/code-library
v1.2.0
Published
A library that contains reusable parts of code
Downloads
10
Maintainers
Readme
The Wave - Code library
This library contains reusable pieces of code created by The Wave Studio, that can be used across multiple projects
HOW TO USE IT
- Create a
.npmrc
file at the root of your project with this snippet of code
//registry.npmjs.org/:_authToken=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
- Install the library as usual using
npm i @thewave-studio/code-library
oryarn add @thewave-studio/code-library
- Use the library as usual, for example
import {useMousePosition} from "@thewave-studio/code-library"
HOW TO CONTRIBUTE TO THE LIBRARY
- Install the modules by running
npm i
oryarn
and then runnpm prepare
oryarn run prepare
to install Husky hooks - The
main
branch is used to ship production ready code - DO NOT RUN
git commit
to do the commit. Runyarn run commit
ornpm run commit
instead. Conventional Commits MUST BE USED to ensure thatsemantic release
can identify the type of commit and increase the package version accordingly. Read more about it here.
REACT HOOKS
REGEX
- VALID_URL_REGEX This regex validates an URL and it can also be used to determine whether an URL is external which can be useful when using routing in SPA
- ITALIAN_PHONE_NUMBER_REGEX This regex validates an italian phone number (with prefix +39)
UTILITY
yarn new-hook nameOfTheHook
ornpm run new-hook nameOfTheHook
(wherenameOfTheHook
is the hook name): this utility will help you create a folder structure and the necessary files to create a new hook (test, hook, markdown and demo). Keep in mind that this will create just some boilerplate files but with a consistent structure.