ls-constants
v1.23.0
Published
Repository that hosts common constants that can be used across projects.
Downloads
3
Readme
ls-constants
Repository that hosts common constants that can be used across projects.
Contributing
This project should only contain constants and constant helper functions.
If you find the need for complex functions or platform/project-specific stuff, you can add them to ls-react-native-common
, ls-react-web-common
or ls-react-common
, depending on your requirements.
How to import this library on your projects?
Previously, when we weren't using the build + packing process we were directly importing them from the GitHub's repository with:
{
...
"ls-constants": "https://github.com/lawnstarter/ls-constants#{release_version}",
...
}
By doing so, we were facing some problems during the build time inside our projects that used this library, which had to pack the entire project while installing the dependencies. So, in order to avoid that, we improved the project in a way that it pre-builds, pack and release the project, avoiding unnecessary compilations and build processes within other projects.
With these improvements we can now access and import the library using the following line:
{
...
"@lawnstarter/ls-constants": "^{release_version}",
...
}
After adding the library to your project dependencies, you can start to use all of our pre-defined constants with:
import { constant } from '@lawnstarter/ls-constants';
console.log(constant); // Logs the constant
Tips
Formatting the code
For a better code format that will be aligned with our main projects, execute the following code:
Note that this action will fix some prettier issues with your code and will also sort your imports
yarn prettier:all
Linting
To perform syntax checking and automatically fix any detected issues, run:
yarn lint
Testing
Unit & Integration tests can be executed with:
yarn test
Building
The project can be built for production using the following command:
npm run build:lib
Publish process
Packaging with Vite and Release with Semantic-Release
Vite serves as a modern front-end build tool designed to simplify and accelerate your project
packaging process. With its esbuild-powered pre-bundling strategy and Hot Module Replacement (HMR) implementation, Vite
seamlessly bundles your project to create a final product ready for production. To package your project with Vite
, you
just need to set up the vite.config.js
file and execute the build command.
After your project has been packaged, Semantic-Release
automates the whole process of releasing your project. It helps to version your release, generate release notes and
changelogs, and publish the package. This is done with the help of plugins that share a defined release cycle to
automate parts of the release process. Semantic-Release
uses the commit messages to determine the type of changes in the
codebase. Following formalized conventions for commit messages, Semantic-Release
automatically determines the next
semantic version number, generates a changelog and publishes the release.
When combined, Vite
and Semantic-Release
offer a powerful, efficient, and automated process for packaging and deploying
your project.