npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

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.