A package of commonly used JavaScript utilities.
NPM
npm i --save common-utils-pkg
Yarn
yarn add common-utils-pkg
// Specific methods
import { randomPastelColor } from 'common-utils-pkg';
randomPastelColor();
// All methods
import * as UTILS from 'common-utils-pkg';
UTILS.randomPastelColor();
<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
Read more about the methods available here
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
yarn docusaurus:generate- generate new files. Will auto refresh pageyarn docusaurus:start- start up the docu page
Maintainers should validate a release locally before publishing:
pnpm run typecheck
pnpm test
pnpm run pack:checkConfigure 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.
Doc updates should be automatically be deployed once merged to main by github action.
