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

cm-utilities-cjs

v2.0.0

Published

Internal utilities for CM projects created with npm

Downloads

176

Readme

CM Utilities

Internal utilities for CM projects created with npm using ESM and CJS modules.

You can check the npm page for ESM modules library and the npm page for CJS modules library.

| Type | Package | |-------------|------------------------------------------------------------------------------------------------------------| | ESM modules | npm version | | CJS modules | npm version |

Installation

npm install --save-dev cm-utilities or npm install --save-dev cm-utilities-cjs

Usage

First, import the functions from ESM modules you will need:

import {end, readBranch, readCommitSHA1, readVersion} from 'cm-utilities';

Or, import the functions from CJS modules you will need:

const {end, readBranch, readCommitSHA1, readVersion} = require('cm-utilities');

Then, use them in your different scripts according to the needs of your project.

Functions

These are the different functions that you can use from this library:

| Method | Description | |-----------------------|---------------------------------------------------------------------------------------------------------------------| | bytesToHuman | Allows bytes to be displayed in a human readable form | | calculateNextVersion | Allows you to calculate the next semantic version | | calculateSHA1 | Allows you to calculate the SHA-1 value of a file | | end | Allows you to calculate the time spent receiving the start | | generateTimestamp | Allows you to generate a timestamp from the current date | | generateVersionCode | It allows you to generate the version code (consecutive integer) for an Android application | | generateVersionName | Allows you to generate the version name (version text) for an Android application | | isoToUnixTime | Allows you to convert a date in ISO format to unix time | | joinUnix | Allows you to convert the folder separator according to the operating system | | localHour | Allows you to get the local time in [hh:mm:ss.sss] format if you are not in a Cloudflare Pages or Vercel pipeline | | log | Allows printing in console | | parseUnixPath | Allows you to convert path separators to Unix format | | printFilesize | Prints the size of a file in a human readable form | | printJSON | Formats a JSON text string in a more readable way | | printJSONObject | Formats a JSON object in a more readable way | | readAppChanges | Allows you to read the application changes from the environment variables that correspond to each language | | readBranch | Allows you to read the current branch in which this method is being executed | | readRevision | Allows you to read the SHA1 of the current commit in which this method is being executed | | readVersion | Allows reading the VERSION file in the root of the project | | readVersionWithSuffix | Allows you to read the VERSION file in the root of the project by adding the suffix according to the current branch | | sendBackup | Allows you to register a new backup in CM Control | | sendDeployment | Allows you to register a new deployment in CM Control | | sendPOST | Allows you to make a POST type HTTP request | | unixTime | Allows you to obtain the current unix time | | validateFile | Allows you to validate if a file exists and is readable | | writeVersion | Allows writing to the VERSION file in the root of the project |

Release history & changelog

See the Releases page for a list of all releases, including changes.

Help / Support

If you run into any issues, please email me at [email protected], or you can use the contact form in my page.

For bug reports, please open an issue on GitHub.

Contributing

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Added some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create a new pull request to develop branch.

License

MIT