Skip to content

Commit

Permalink
feat: add public documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MilosPaunovic committed Jun 15, 2024
1 parent be47b48 commit 66b44b5
Show file tree
Hide file tree
Showing 12 changed files with 861 additions and 43 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy VitePress site to Pages

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: pnpm install
- name: Build with VitePress
run: pnpm docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ lib-cov
logs
node_modules
temp
docs/.vitepress/dist
docs/.vitepress/cache
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Miloš Paunović <https://github.com/MilosPaunovic>
Copyright © 2024 Miloš Paunović <https://github.com/MilosPaunovic>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
# utils

[![NPM version](https://img.shields.io/npm/v/@paunovic/utils)](https://www.npmjs.com/package/@paunovic/utils)
[![npm downloads](https://badgen.net/npm/dm/@paunovic/utils)](https://www.npmjs.com/package/@paunovic/utils)
[![Continuous Integration](https://github.com/MilosPaunovic/utils/actions/workflows/ci.yml/badge.svg)](https://github.com/MilosPaunovic/utils/actions/workflows/ci.yml)

A versatile collection of utility functions for simplifying JavaScript development.

## 🚀 Features

- 📝 Strings - Versatile utilities for generating and manipulating strings.
- 🔢 Numbers - Utilities for generating, manipulating, and validating numbers.
- 🧩 Various - A collection of utilities for diverse purposes.

## 📦 Install

```bash
# Using npm to install as a development dependency
npm install --save-dev @paunovic/utils

# Using Yarn to add as a development dependency
yarn add --dev @paunovic/utils

# Using pnpm to add as a development dependency
pnpm add --save-dev @paunovic/utils
```

## 🪄 Usage

```ts
// Importing specific function using ESM syntax
import { uniqueIdentifier } from '@paunovic/utils'

// Importing specific function using CommonJS syntax
const { uniqueIdentifier } = require('@paunovic/utils')

// Seeing the imported function in action
const ID = uniqueIdentifier()
```

## License

[MIT](./LICENSE) License © 2024 - PRESENT [Miloš Paunović](https://github.com/MilosPaunovic)
[MIT](./LICENSE) Copyright © 2024 [Miloš Paunović](https://github.com/MilosPaunovic)
28 changes: 28 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { defineConfig } from 'vitepress'

export default defineConfig({
title: 'utils',

description: 'A versatile collection of utility functions for simplifying JavaScript development.',

themeConfig: {
nav: [
{ text: 'Guide', link: '/guide' },
{ text: 'Examples', items: [{ text: 'Strings', link: '/api/strings' }, { text: 'Numbers', link: '/api/numbers' }, { text: 'Various', link: '/api/various' }] },
],

sidebar: [
{ text: 'Guide', items: [{ text: 'Getting Started', link: '/guide' }] },
{ text: 'Examples', items: [{ text: 'Strings', link: '/api/strings' }, { text: 'Numbers', link: '/api/numbers' }, { text: 'Various', link: '/api/various' }] },
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/MilosPaunovic/utils' },
],

footer: {
message: 'Made with ❤️ in Belgrade, Serbia.',
copyright: 'Copyright © 2024 - present <a href="https://github.com/MilosPaunovic">Miloš Paunović</a>',
},
},
})
9 changes: 9 additions & 0 deletions docs/api/numbers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
outline: deep
prev: false
next: false
---

# 🔢 Numbers

Utilities for generating, manipulating, and validating numbers.
33 changes: 33 additions & 0 deletions docs/api/strings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
outline: deep
prev: false
next: false
---

# 📝 Strings

Versatile utilities for generating and manipulating strings.

## uniqueIdentifier

Generates a unique 21-character identifier string.

::: details
```ts
/**
* @description
* This function generates a unique identifier consisting of:
*
* - A single random lowercase letter at the beginning.
* - A random alphanumeric string of 12 characters.
* - The last 8 characters of the current timestamp in hexadecimal format.
*
* @returns {string} A unique 21-character identifier string.
*/
```
:::
```ts
import { uniqueIdentifier } from '@paunovic/utils'

const ID = uniqueIdentifier() // "k4a3e8b7f21bqwertyuio"
```
9 changes: 9 additions & 0 deletions docs/api/various.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
outline: deep
prev: false
next: false
---

# 🧩 Various

A collection of utilities for diverse purposes.
35 changes: 35 additions & 0 deletions docs/guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
outline: deep
prev: false
next: false
---

# Getting Started

A versatile collection of utility functions for simplifying JavaScript development.

## 📦 Install

```bash
# Using npm to install as a development dependency
npm install --save-dev @paunovic/utils

# Using Yarn to add as a development dependency
yarn add --dev @paunovic/utils

# Using pnpm to add as a development dependency
pnpm add --save-dev @paunovic/utils
```

## 🪄 Usage

```ts
// Importing specific function using ESM syntax
import { uniqueIdentifier } from '@paunovic/utils'

// Importing specific function using CommonJS syntax
const { uniqueIdentifier } = require('@paunovic/utils')

// Seeing the imported function in action
const ID = uniqueIdentifier()
```
32 changes: 32 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
layout: home

hero:
name: utils

tagline: "A versatile collection of utility functions for simplifying JavaScript development."

actions:
- theme: brand
text: Getting Started
link: /guide
- theme: alt
text: View on GitHub
link: https://github.com/MilosPaunovic/utils

features:
- icon: 📝
title: Strings
details: Versatile utilities for generating and manipulating strings.
link: /api/strings

- icon: 🔢
title: Numbers
details: Utilities for generating, manipulating, and validating numbers.
link: /api/numbers

- icon: 🧩
title: Various
details: A collection of utilities for diverse purposes.
link: /api/various
---
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"start": "esno src/index.ts",
"test": "vitest",
"typecheck": "tsc --noEmit",
"prepare": "simple-git-hooks"
"prepare": "simple-git-hooks",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
},
"devDependencies": {
"@antfu/eslint-config": "^2.21.1",
Expand All @@ -64,6 +67,7 @@
"typescript": "^5.4.5",
"unbuild": "^2.0.0",
"vite": "^5.3.1",
"vitepress": "^1.2.3",
"vitest": "^1.6.0"
},
"simple-git-hooks": {
Expand Down
Loading

0 comments on commit 66b44b5

Please sign in to comment.