Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
release: 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
erffy authored Dec 8, 2024
2 parents 52467d8 + c210b93 commit e7678d3
Show file tree
Hide file tree
Showing 13 changed files with 1,276 additions and 565 deletions.
81 changes: 47 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,70 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@main
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Fetch all tags
run: git fetch --tags
- name: Get current version
id: version
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV

- name: Get current version from package.json
run: |
echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ github.token }}
- name: Get previous release tag
id: get_previous_tag
run: |
latest_tag=$(gh release list --limit 1 --json tagName | jq -r '.[0].tagName')
echo "PREV_RELEASE=$latest_tag" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ github.token }}
- name: Check if version has been released
id: check_if_released
- name: Check existing release
id: check_release
run: |
gh release view ${{ env.VERSION }} && echo "RELEASED=true" >> $GITHUB_ENV || echo "RELEASED=false" >> $GITHUB_ENV
if gh release view ${{ env.VERSION }} &>/dev/null; then
echo "EXISTS=true" >> $GITHUB_ENV
else
echo "EXISTS=false" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Generate ChangeLog
if: success() && env.RELEASED == 'false'
- name: Generate changelog
if: env.EXISTS == 'false'
id: changelog
run: |
changelog=$(git log ${{ env.PREV_RELEASE }}..HEAD --oneline)
echo "CHANGELOG=$changelog" >> $GITHUB_ENV
# Get the latest tag
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$latest_tag" ]; then
# If no tags exist, get all commits
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
git log --pretty=format:"- %s (%h)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
# Get commits since last tag
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
git log ${latest_tag}..HEAD --pretty=format:"- %s (%h)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
fi
- name: Create Git Tag and Push
if: success() && env.RELEASED == 'false'
- name: Create Git Tag
if: env.EXISTS == 'false'
run: |
git tag -a "${{ env.VERSION }}" -m "Version ${{ env.VERSION }}"
git push origin "${{ env.VERSION }}"
echo "TAG_CREATED=true" >> $GITHUB_ENV
git tag -a "v${{ env.VERSION }}" -m "Release v${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"
- name: Create Release
if: success() && env.TAG_CREATED == 'true'
uses: softprops/action-gh-release@master
- name: Create GitHub Release
if: env.EXISTS == 'false'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
prerelease: ${{ contains(env.VERSION, 'rc') }}
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
body: |
### ChangeLog
## Changes
${{ env.CHANGELOG }}
## Installation
```bash
npm install erfdb@${{ env.VERSION }}
```
prerelease: ${{ contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') || contains(env.VERSION, 'rc') }}
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
tests
pnpm-lock.yaml
src
.tap

# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore

Expand Down
110 changes: 70 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[![CodeQL](https://github.com/erffy/erfdb/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/erffy/erfdb/actions/workflows/github-code-scanning/codeql)
[![Release](https://github.com/erffy/erfdb/actions/workflows/release.yml/badge.svg)](https://github.com/erffy/erfdb/actions/workflows/release.yml)

## erfdb
- A Map-based Smartest and Fastest database module
A high-performance, type-safe database module built on Map

### Features
- 🍃 Performance: Written in TypeScript for optimal speed and performance.
- 🛠️ Ease of Use: Provides a basic functionality for managing the database.
- 🔒 Security: Implements best practices to secure data storage and access.
- 🖥️ Versatile Driver Support: Supports up to 4 drivers, providing flexibility for different storage and retrieval needs.
- ♻️ Modern: Fully compatible with both ESM (ECMAScript Modules) and CJS (CommonJS), ensuring seamless integration with modern JavaScript environments.
- 🚀 **High Performance** - Built with TypeScript and optimized for speed
- 🛡️ **Type Safety** - Full TypeScript support with comprehensive type definitions
- 🔌 **Multiple Drivers** - Support for JSON, YAML, BSON and in-memory storage
- 🔄 **Modern JavaScript** - Compatible with both ESM and CommonJS
- 🛠️ **Rich API** - Extensive set of utility methods for data manipulation
- 🔒 **Data Security** - Implements best practices for secure data handling

### Installation
Note: Before installation, you need to install 'typescript' globally with the package manager you use.
Expand Down Expand Up @@ -43,40 +46,67 @@ for (let i = 0; i < 200; i++) db.set(`key-${i}`, i);
for (let i = 0; i < 50; i++) db2.set(`key-${i}`, i);
*/

db.all(); // db.all(5);
db.toArray();
db.at('k:0'); // db.at('v:0');
db.clone();
db.concat(db2);
db.del('key-25');
db.each((e) => typeof e);
db.every((e) => e === 28);
db.filter((e) => typeof e === 'number');
db.find((e) => e === 2)?.key;
db.get('key-5');
db.has('key-1');
db.intersection(db2);
db.toJSON();
db.toSet();
db.indexOf('key-5'); // 6
db.last();
db.first();
db.typeOf('key-2'); // number
db.keyOf(24);
db.push('data', { id: 1 });
db.pull('data', { id: 1 });
db.map((e) => e === 24);
db.math('key-29', '-', 2);
db.merge(db2);
db.partition((c) => c === 24);
db.pick('key-5', 'key-6');
db.reduce((e) => e * 3, 2);
db.set('d', '0');
db.sizeOf('d'); // 1
db.size;
db.slice(5, 5);
db.some((e) => e === 24);
db.sweep((e) => e);
// Get all entries (optionally limit to first 5)
db.all(); // Returns all entries
db.all(5); // Returns first 5 entries

// Convert to different formats
db.toArray(); // Convert to array of {key, value} objects
db.toJSON(); // Convert to plain object
db.toSet(); // Convert to Set of {key, value} objects

// Access and check entries
db.at('key:test'); // Get entry by key path
db.at('value:123'); // Get entry by value
db.get('users.john'); // Get value by key
db.getMany(['users.john', 'users.jane']); // Get multiple values
db.has('key-1'); // Check if key exists
db.typeOf('users.age'); // Get type of value
db.sizeOf('users'); // Get size of value
db.size; // Get total number of entries

// Find entries
db.find(user => user.age > 18); // Find first matching entry
db.keyOf('john'); // Get key for value
db.indexOf('key-5'); // Get index of key

// Navigate entries
db.first(); // Get first entry
db.last(); // Get last entry
db.slice(5, 10); // Get entries from index 5 to 10

// Modify entries
db.set('users.john', {name: 'John'}); // Set value
db.setMany([['user1', data1], ['user2', data2]]); // Set multiple entries
db.del('users.jane'); // Delete entry
db.delMany(['user1', 'user2']); // Delete multiple entries
db.push('users.john.roles', 'admin'); // Add to array
db.pull('users.john.roles', 'admin'); // Remove from array
db.math('score', '+', 10); // Perform math operation

// Iterate and transform
db.each((value, key) => console.log(key, value)); // Iterate entries
db.map(value => value * 2); // Transform values
db.filter(user => user.age >= 18); // Filter entries
db.reduce((sum, value) => sum + value, 0); // Reduce to single value
db.partition(user => user.age >= 18); // Split into two arrays
db.sweep(value => value === null); // Remove entries matching condition

// Combine databases
db.clone(); // Create copy
db.concat(otherDb); // Combine databases
db.merge(otherDb); // Merge databases
db.intersection(otherDb); // Get common entries

// Check conditions
db.every(num => num > 0); // Test if all match
db.some(num => num > 100); // Test if any match

// Select entries
db.pick('user.name', 'user.email'); // Get specific entries

// Clear database
db.clear(); // Remove all entries
```

<br>
Expand Down
Binary file modified bun.lockb
Binary file not shown.
Loading

0 comments on commit e7678d3

Please sign in to comment.