Skip to content

iamdevlinph/common-utils-pkg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

527 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Common Utilities Package

A package of commonly used JavaScript utilities.

Package Details

npm version node version coverage downloads

Repo Details

open issues open prs code size contributors

Installation

NPM

npm i --save common-utils-pkg

Yarn

yarn add common-utils-pkg

Usage

ES6

// Specific methods

import { randomPastelColor } from 'common-utils-pkg';
randomPastelColor();
// All methods

import * as UTILS from 'common-utils-pkg';
UTILS.randomPastelColor();

Browser

<script src="https://unpkg.com/common-utils-pkg"></script>
<script>
  // Specific methods

  const randomPastelColor = window['common-utils-pkg].randomPastelColor;
  randomPastelColor();
</script>
<script>
  // All methods

  const UTILS = window['common-utils-pkg'];
  UTILS.randomPastelColor();
</script>

Read more about the usage here

Available Methods

Read more about the methods available here

Contributing

1.Create a folder under src/ and name the folder with the same name as the method.

2.Create methodName.ts and methodName.test.ts

The full directory should look like this:

src/
  method-name/
    - method-name.ts
    - method-name.test.ts

Scripts

  • yarn docusaurus:generate - generate new files. Will auto refresh page
  • yarn docusaurus:start - start up the docu page

Publishing

Maintainers should validate a release locally before publishing:

pnpm run typecheck
pnpm test
pnpm run pack:check

Configure Settings → Trusted Publisher for this package on npmjs.com:

Setting Value
Provider GitHub Actions
Organization / user iamdevlinph
Repository common-utils-pkg
Workflow filename publish-package.yml
Environment (blank)
Allowed action npm publish

Enter only the workflow filename, not its full path. Trusted Publishing uses OIDC; do not add NPM_TOKEN, NODE_AUTH_TOKEN, or a package PAT. It requires a GitHub-hosted runner, Node 22.14 or newer, and npm 11.5.1 or newer. The workflow uses Node 24 (from .nvmrc), verifies npm 11.5.1 or newer, and uses pnpm 11.2.2.

To release, update the version in package.json, create and push the matching tag v<version>, then publish a GitHub Release for that tag. The workflow requires the release tag to equal v plus the package version.

If publishing fails only because of external configuration, rerun the failed job. If code or workflow changes are required, publish a new version unless the failed tag was never released and is intentionally recreated. After the first successful OIDC publish, delete the obsolete GitHub NPM_TOKEN secret and set npm publishing access to require two-factor authentication and disallow tokens.

Publish doc updates

Doc updates should be automatically be deployed once merged to main by github action.

About

A package of commonly used JavaScript utilities.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages