Last updated
Generated README for a Utility Library
The generator produces a complete README.md from your package.json and source code:
# string-utils
[](https://www.npmjs.com/package/string-utils)
[](https://github.com/example/string-utils/actions)
[](https://codecov.io/gh/example/string-utils)
A lightweight utility library for common string operations.
## Installation
```bash
npm install string-utils
```
## Quick Start
```javascript
import { truncate, slugify, capitalize } from 'string-utils';
truncate('Hello, World!', 8); // 'Hello...'
slugify('Hello World'); // 'hello-world'
capitalize('hello world'); // 'Hello World'
```
Generated API Reference from JSDoc
The generator extracts JSDoc comments and produces a formatted API reference:
## API Reference
### truncate(str, maxLength, suffix?)
Truncates a string to the specified maximum length.
**Parameters:**
| Name | Type | Default | Description |
|------|------|---------|-------------|
| str | string | — | The string to truncate |
| maxLength | number | — | Maximum length of the result |
| suffix | string | '...' | String appended when truncated |
**Returns:** `string` — The truncated string
**Example:**
```javascript
truncate('Hello, World!', 8); // 'Hello...'
truncate('Hello, World!', 8, '…'); // 'Hello, …'
truncate('Hi', 10); // 'Hi' (not truncated)
```
**Since:** 1.0.0
Generated TypeScript API Documentation
For TypeScript packages, type information is extracted automatically:
### slugify(input, options?)
Converts a string to a URL-friendly slug.
**Signature:**
```typescript
function slugify(input: string, options?: SlugifyOptions): string
```
**Parameters:**
- `input: string` — The string to convert
- `options?: SlugifyOptions` — Optional configuration
**SlugifyOptions:**
```typescript
interface SlugifyOptions {
separator?: string; // Default: '-'
lowercase?: boolean; // Default: true
strict?: boolean; // Default: false — remove non-word chars
locale?: string; // Default: 'en' — affects transliteration
}
```
**Returns:** `string`
**Examples:**
```typescript
slugify('Hello World') // 'hello-world'
slugify('Hello World', { separator: '_' }) // 'hello_world'
slugify('Héllo Wörld') // 'hello-world'
```
Generated Installation Section
The generator creates installation instructions for multiple package managers:
## Installation
**npm:**
```bash
npm install string-utils
```
**yarn:**
```bash
yarn add string-utils
```
**pnpm:**
```bash
pnpm add string-utils
```
**Requirements:**
- Node.js 16.0.0 or higher
- npm 7.0.0 or higher
## Usage
**ES Modules (recommended):**
```javascript
import { truncate, slugify } from 'string-utils';
```
**CommonJS:**
```javascript
const { truncate, slugify } = require('string-utils');
```
**Browser (CDN):**
```html
<script src="https://cdn.jsdelivr.net/npm/string-utils/dist/index.umd.js"></script>
```
Generated Changelog Section
The generator creates a structured changelog from git history and version tags:
## Changelog
### [2.1.0] — 2024-03-15
**Added:**
- `capitalize()` function for title-casing strings
- `locale` option for `slugify()` to handle international characters
**Fixed:**
- `truncate()` now correctly handles multi-byte Unicode characters
- `slugify()` no longer strips valid URL characters
### [2.0.0] — 2024-01-10
**Breaking Changes:**
- `truncate()` now returns the original string (not truncated) when it's shorter than maxLength
- Removed deprecated `shorten()` function — use `truncate()` instead
**Added:**
- TypeScript type definitions included in package
### [1.2.0] — 2023-11-05
**Added:**
- `wordCount()` function
- `stripHtml()` function
Generated Contributing Guidelines
The generator creates a CONTRIBUTING.md with project-specific instructions:
## Contributing
### Development Setup
```bash
git clone https://github.com/example/string-utils.git
cd string-utils
npm install
npm run dev
```
### Running Tests
```bash
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # With coverage report
```
### Code Style
This project uses ESLint and Prettier. Run `npm run lint:fix` before committing.
### Pull Request Process
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/my-feature`
3. Make your changes and add tests
4. Ensure all tests pass: `npm test`
5. Submit a pull request with a clear description
### Commit Message Format
Follow [Conventional Commits](https://conventionalcommits.org/):
- `feat: add new feature`
- `fix: resolve bug`
- `docs: update documentation`
- `test: add tests`
Generated HTML Documentation Site
The HTML export creates a documentation website structure:
<!-- Generated documentation page structure -->
<nav>
<ul>
<li><a href="#installation">Installation</a></li>
<li><a href="#quick-start">Quick Start</a></li>
<li><a href="#api">API Reference</a>
<ul>
<li><a href="#truncate">truncate()</a></li>
<li><a href="#slugify">slugify()</a></li>
<li><a href="#capitalize">capitalize()</a></li>
</ul>
</li>
<li><a href="#changelog">Changelog</a></li>
</ul>
</nav>
Package.json Fields Used for Documentation
The generator reads these fields from package.json to populate the documentation:
{
"name": "string-utils",
"version": "2.1.0",
"description": "A lightweight utility library for common string operations",
"keywords": ["string", "utility", "truncate", "slugify"],
"author": "Jane Doe <jane@example.com>",
"license": "MIT",
"homepage": "https://string-utils.example.com",
"repository": {
"type": "git",
"url": "https://github.com/example/string-utils"
},
"bugs": {
"url": "https://github.com/example/string-utils/issues"
},
"engines": {
"node": ">=16.0.0"
}
}