Skip to content

Commit 1a8c6be

Browse files
Add documentation, policies, and file module restructure
Introduced CODE_OF_CONDUCT.md, CONTRIBUTING.md, and SECURITY.md for project governance. Updated README with installation, usage, and contribution details. Refactored file-related utilities and tests into a dedicated 'file' module, updated CLI import, and improved documentation structure and assets. Enhanced workflow to only release if src/bin changes, and added scripts/gen-indexes.js for index generation.
1 parent 5731c56 commit 1a8c6be

29 files changed

Lines changed: 708 additions & 82 deletions

.github/workflows/weekly-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Check for commits in last 7 days
1818
id: check
1919
run: |
20-
if git log --since="7 days ago" --oneline | grep .; then
20+
if git log --since="7 days ago" --oneline -- src/ bin/ | grep .; then
2121
echo "has_commits=true" >> $GITHUB_OUTPUT
2222
else
2323
echo "has_commits=false" >> $GITHUB_OUTPUT

CODE_OF_CONDUCT.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We, as contributors, maintainers, and members of the community, pledge to foster an open, welcoming, diverse, inclusive, and harassment-free environment for everyone.
6+
We are committed to ensuring a positive experience for all participants, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, race, religion, or sexual identity and orientation.
7+
8+
## Our Standards
9+
10+
Examples of behavior that contribute to a positive and respectful environment include:
11+
12+
- Using inclusive and welcoming language
13+
- Showing respect for differing viewpoints and experiences
14+
- Offering and receiving constructive feedback with courtesy
15+
- Taking responsibility for mistakes and learning from them
16+
- Showing empathy toward others in the community
17+
18+
Examples of unacceptable behavior include:
19+
20+
- The use of sexualized language or imagery
21+
- Trolling, insults, or derogatory comments
22+
- Personal or political attacks
23+
- Public or private harassment
24+
- Publishing others’ private information without explicit permission
25+
- Other conduct which could reasonably be considered inappropriate in a professional setting
26+
27+
## Our Responsibilities
28+
29+
Project maintainers are responsible for:
30+
31+
- Clarifying the standards of acceptable behavior
32+
- Monitoring community spaces and interactions
33+
- Taking appropriate and fair corrective action in response to any behavior deemed inappropriate, threatening, offensive, or harmful
34+
35+
They have the right and responsibility to remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned with this Code of Conduct, and to ban temporarily or permanently any contributor for behavior they deem inappropriate.
36+
37+
## Scope
38+
39+
This Code of Conduct applies within all project spaces such as GitHub repositories, issue trackers, pull requests, and communication channels as well as in public spaces when an individual is representing the project or its community.
40+
41+
## Enforcement
42+
43+
Instances of abusive, harassing, or otherwise unacceptable behavior can be reported to the project team at:
44+
45+
**Email:** [tenegamesbusiness@gmail.com](mailto:tenegamesbusiness@gmail.com)
46+
47+
All reports will be reviewed and investigated promptly and fairly. The project team is obligated to maintain confidentiality with regard to the reporter of an incident.

CONTRIBUTING.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Contributing to JS Utils Kit
2+
3+
Thank you for your interest in contributing to **JS Utils Kit**. Whether you're fixing bugs, proposing new utilities, refining documentation, or improving tests, your contributions are valuable and appreciated.
4+
5+
## Requirements
6+
7+
Before getting started, ensure you have the following installed:
8+
9+
- Node.js
10+
- Yarn
11+
- Git
12+
- TypeScript (used during development)
13+
14+
## Quick Start
15+
16+
1. **Fork the repository** on GitHub.
17+
18+
2. **Clone your fork:**
19+
20+
```sh
21+
git clone https://github.com/your-username/js-utils-kit.git
22+
cd js-utils-kit
23+
```
24+
25+
3. **Install dependencies:**
26+
27+
```sh
28+
yarn install
29+
```
30+
31+
4. **Run tests:**
32+
33+
```sh
34+
yarn test
35+
```
36+
37+
## Project Structure
38+
39+
| Directory | Purpose |
40+
| ---------- | -------------------------------------- |
41+
| `src/` | Source code organized by category |
42+
| `bin/` | CLI entry points |
43+
| `tests/` | Unit tests using Jest |
44+
| `scripts/` | Development tools (e.g. index builder) |
45+
| `docs/` | Generated TypeDoc documentation |
46+
47+
## Scripts
48+
49+
| Command | Description |
50+
| ------------------ | ------------------------------------------------- |
51+
| `yarn test` | Run all Jest tests |
52+
| `yarn gen:indexes` | Generate export indexes for all categories |
53+
| `yarn build` | Compile project to CJS, ESM, and type files |
54+
| `yarn docs` | Generate TypeScript documentation via TypeDoc |
55+
| `prebuild` | Automatically runs `gen:indexes` before build |
56+
| `postbuild` | Automatically generates documentation after build |
57+
58+
## Development Workflow
59+
60+
1. **Create a new branch:**
61+
62+
```sh
63+
git checkout -b feat/your-feature-name
64+
```
65+
66+
2. **Make changes and commit with a clear message:**
67+
68+
```sh
69+
git commit -m "feat: add clamp utility"
70+
```
71+
72+
3. **Test and build before opening a PR:**
73+
74+
```sh
75+
yarn test
76+
yarn build
77+
```
78+
79+
4. **Push and open a Pull Request on GitHub.**
80+
81+
## Commit Guidelines
82+
83+
Follow [Conventional Commits](https://www.conventionalcommits.org/) for commit messages:
84+
85+
- `feat:` for new features
86+
- `fix:` for bug fixes
87+
- `docs:` for documentation changes
88+
- `refactor:` for code refactoring (no feature or fix)
89+
- `test:` for adding or updating tests
90+
- `chore:` for tooling, CI, or build changes
91+
92+
## Testing
93+
94+
All tests are located in the `tests/` directory and use [Jest](https://jestjs.io).
95+
96+
To run the test suite:
97+
98+
```sh
99+
yarn test
100+
```
101+
102+
Ensure new utilities are covered with appropriate test cases.
103+
104+
## CLI Usage
105+
106+
The CLI entry point is in `bin/index.ts`, powered by [Commander](https://github.com/tj/commander.js).
107+
108+
To test it locally:
109+
110+
```sh
111+
node dist/cli/index.js --help
112+
```
113+
114+
## Pull Request Checklist
115+
116+
Before opening a pull request, make sure:
117+
118+
- [ ] The change has a clear purpose
119+
- [ ] Related tests are added or updated
120+
- [ ] The utility is compatible with both ESM and CJS
121+
- [ ] The utility is properly exported in `index.ts`
122+
- [ ] There are no unintended breaking changes
123+
124+
If you have questions or need clarification, feel free to open an issue or start a discussion. Thank you for helping improve JS Utils Kit.

README.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
11
# JS Utils Kit
22

3-
A compact library of essential JavaScript utility functions—such as array operations, object helpers, Promise utilities, and type checks. Designed to be lightweight, dependable, and effortlessly integrated into JS or TS projects, it has minimal bundle impact and works seamlessly with modern bundlers.
3+
[![npm version](https://img.shields.io/npm/v/js-utils-kit.svg)](https://www.npmjs.com/package/js-utils-kit)
4+
[![License](https://img.shields.io/github/license/TenEplaysOfficial/js-utils-kit.svg)](LICENSE)
5+
6+
**JS Utils Kit** is a compact and reliable library of essential JavaScript utility functions. It includes helpers for arrays, objects, numbers, promises, type checking, and more. Designed for performance and modularity, it integrates easily into JavaScript and TypeScript projects with minimal impact on bundle size.
7+
8+
> Lightweight. Dependable. Modular.
9+
10+
## Installation
11+
12+
```sh
13+
yarn add js-utils-kit
14+
# or
15+
npm install js-utils-kit
16+
```
17+
18+
## Usage
19+
20+
```ts
21+
import * as kit from 'js-utils-kit';
22+
23+
// Number utilities
24+
kit.number.clamp(10, 0, 100);
25+
26+
// Root-level utilities
27+
kit.isNode();
28+
```
29+
30+
## Features
31+
32+
- Organized by category (e.g., `number`, `string`, `file`, etc.)
33+
- Fully typed with TypeScript
34+
- Thoroughly tested with Jest
35+
- Tree-shakable and supports both ESM and CJS
36+
- CLI-ready tools for file and system operations
37+
38+
## Documentation
39+
40+
Full documentation available at [GitHub Pages](https://teneplaysofficial.github.io/js-utils-kit/)
41+
42+
## Requirements
43+
44+
- Node.js
45+
- Yarn
46+
- TypeScript (for development)
47+
48+
## Contributing
49+
50+
Contributions are welcome. Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
51+
52+
## License
53+
54+
[MIT](LICENSE)

SECURITY.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Only the latest **major** release of `js-utils-kit` is actively maintained and supported. Previous versions may not receive security patches unless otherwise stated.
6+
7+
| Version | Supported |
8+
| ------- | --------- |
9+
| 1.x | Yes |
10+
| <1.0.0 | No |
11+
12+
## Reporting a Vulnerability
13+
14+
If you discover a potential security vulnerability in this project:
15+
16+
1. **Do not open a public GitHub issue.**
17+
18+
2. Contact the maintainers directly via email:
19+
20+
**Email:** [tenegamesbusiness@gmail.com](mailto:tenegamesbusiness@gmail.com)
21+
22+
3. Include the following details in your report:
23+
- Affected version(s)
24+
- Steps to reproduce or a proof-of-concept
25+
- Description of the potential impact
26+
- Suggested remediation or workaround (if known)
27+
28+
## Disclosure Policy
29+
30+
We aim to respond to all vulnerability reports within **72 hours**. If the issue is confirmed, appropriate actions may include:
31+
32+
- Releasing a patch or hotfix
33+
- Providing recommended mitigations or workarounds
34+
- Publishing a security advisory through GitHub
35+
36+
You may be credited for responsible disclosure, unless you request to remain anonymous.
37+
38+
## Responsible Disclosure
39+
40+
We follow responsible disclosure practices. Please refrain from sharing security vulnerabilities publicly until they have been investigated, validated, and addressed through an official fix or advisory.
41+
42+
Thank you for helping make `js-utils-kit` more secure.

bin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs';
22
import ora from 'ora';
33
import { Command } from 'commander';
4-
import { createArchive } from '../src';
4+
import { createArchive } from '../src/file';
55

66
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
77

docs/assets/highlight.css

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
:root {
2-
--light-hl-0: #000000;
3-
--dark-hl-0: #D4D4D4;
4-
--light-hl-1: #001080;
5-
--dark-hl-1: #9CDCFE;
2+
--light-hl-0: #795E26;
3+
--dark-hl-0: #DCDCAA;
4+
--light-hl-1: #000000;
5+
--dark-hl-1: #D4D4D4;
66
--light-hl-2: #A31515;
77
--dark-hl-2: #CE9178;
8-
--light-hl-3: #000000;
9-
--dark-hl-3: #C8C8C8;
8+
--light-hl-3: #008000;
9+
--dark-hl-3: #6A9955;
1010
--light-hl-4: #AF00DB;
1111
--dark-hl-4: #C586C0;
12-
--light-hl-5: #795E26;
13-
--dark-hl-5: #DCDCAA;
14-
--light-hl-6: #0000FF;
15-
--dark-hl-6: #569CD6;
12+
--light-hl-5: #0000FF;
13+
--dark-hl-5: #569CD6;
14+
--light-hl-6: #001080;
15+
--dark-hl-6: #9CDCFE;
16+
--light-hl-7: #098658;
17+
--dark-hl-7: #B5CEA8;
18+
--light-hl-8: #000000;
19+
--dark-hl-8: #C8C8C8;
1620
--light-code-background: #FFFFFF;
1721
--dark-code-background: #1E1E1E;
1822
}
@@ -25,6 +29,8 @@
2529
--hl-4: var(--light-hl-4);
2630
--hl-5: var(--light-hl-5);
2731
--hl-6: var(--light-hl-6);
32+
--hl-7: var(--light-hl-7);
33+
--hl-8: var(--light-hl-8);
2834
--code-background: var(--light-code-background);
2935
} }
3036

@@ -36,6 +42,8 @@
3642
--hl-4: var(--dark-hl-4);
3743
--hl-5: var(--dark-hl-5);
3844
--hl-6: var(--dark-hl-6);
45+
--hl-7: var(--dark-hl-7);
46+
--hl-8: var(--dark-hl-8);
3947
--code-background: var(--dark-code-background);
4048
} }
4149

@@ -47,6 +55,8 @@
4755
--hl-4: var(--light-hl-4);
4856
--hl-5: var(--light-hl-5);
4957
--hl-6: var(--light-hl-6);
58+
--hl-7: var(--light-hl-7);
59+
--hl-8: var(--light-hl-8);
5060
--code-background: var(--light-code-background);
5161
}
5262

@@ -58,6 +68,8 @@
5868
--hl-4: var(--dark-hl-4);
5969
--hl-5: var(--dark-hl-5);
6070
--hl-6: var(--dark-hl-6);
71+
--hl-7: var(--dark-hl-7);
72+
--hl-8: var(--dark-hl-8);
6173
--code-background: var(--dark-code-background);
6274
}
6375

@@ -68,4 +80,6 @@
6880
.hl-4 { color: var(--hl-4); }
6981
.hl-5 { color: var(--hl-5); }
7082
.hl-6 { color: var(--hl-6); }
83+
.hl-7 { color: var(--hl-7); }
84+
.hl-8 { color: var(--hl-8); }
7185
pre, code { background: var(--code-background); }

docs/assets/navigation.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)