3.3.0 • Published 5 months ago

cm-utilities v3.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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.

TypePackage
ESM modulesnpm version
CJS modulesnpm 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:

MethodDescription
bytesToHumanAllows bytes to be displayed in a human readable form
calculateNextVersionAllows you to calculate the next semantic version
calculateSHA1Allows you to calculate the SHA-1 value of a file
endAllows you to calculate the time spent receiving the start
generateTimestampAllows you to generate a timestamp from the current date
generateVersionCodeIt allows you to generate the version code (consecutive integer) for an Android application
generateVersionNameAllows you to generate the version name (version text) for an Android application
isoToUnixTimeAllows you to convert a date in ISO format to unix time
joinUnixAllows you to convert the folder separator according to the operating system
localHourAllows you to get the local time in [hh:mm:ss.sss] format if you are not in a Cloudflare Pages or Vercel pipeline
logAllows printing in console
parseUnixPathAllows you to convert path separators to Unix format
printFilesizePrints the size of a file in a human readable form
printJSONFormats a JSON text string in a more readable way
printJSONObjectFormats a JSON object in a more readable way
readAppChangesAllows you to read the application changes from the environment variables that correspond to each language
readBranchAllows you to read the current branch in which this method is being executed
readRevisionAllows you to read the SHA1 of the current commit in which this method is being executed
readVersionAllows reading the VERSION file in the root of the project
readVersionWithSuffixAllows you to read the VERSION file in the root of the project by adding the suffix according to the current branch
sendBackupAllows you to register a new backup in CM Control
sendDeploymentAllows you to register a new deployment in CM Control
sendPOSTAllows you to make a POST type HTTP request
unixTimeAllows you to obtain the current unix time
validateFileAllows you to validate if a file exists and is readable
writeVersionAllows 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 contact@cristiammercado.com, 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

3.3.0

5 months ago

3.2.0

6 months ago

3.1.0

6 months ago

3.0.0

7 months ago

2.1.0

8 months ago

2.0.0

9 months ago

1.8.0

9 months ago

1.7.0

10 months ago

1.6.1

11 months ago

1.6.0

11 months ago

1.5.2

12 months ago

1.5.1

12 months ago

1.5.0

12 months ago

1.2.0

1 year ago

1.2.8

1 year ago

1.1.9

1 year ago

1.2.7

1 year ago

1.1.8

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.4.1

12 months ago

1.2.3

1 year ago

1.4.0

12 months ago

1.3.1

12 months ago

1.2.2

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago