@yaro.page/nano-db
v1.2.1
Published
This guide covers how to set up, manage, and use the **nano-db** package, a lightweight database abstraction for the nanoweb ecosystem.
Downloads
36
Readme
📖 Nano-DB Usage Guide
This guide covers how to set up, manage, and use the nano-db package, a lightweight database abstraction for the nanoweb ecosystem.
📌 Project Structure
The nano-db package follows a modular structure:
nano-db/
├── lib/ # Source code
│ ├── Manifest.js
│ ├── ManifestChange.js
│ ├── ManifestNode.js
│ ├── ManifestNodes.js
│ ├── NANODb.js
│ ├── NANODbOptions.js
│ ├── SearchEntries.js
│ ├── SearchEntry.js
│ ├── SearchIndex.js
│ ├── index.js
├── test/ # Test files
| ├── 00-README.md.test.js # Document generator and tester
│ ├── Manifest.test.js
│ ├── NANODb.test.js
├── package.json # Package metadata and scripts
├── vitest.config.js # Vitest configuration
└── README.md # This documentation🔗 Requirements
- Node.js runtime environment You must have Node v22+ installed.
- pnpm package manager You must have the pnpm package manager installed.
- nano-format
The
nano-formatpackage is a peer dependency and must be installed.
🔧 Setting Up the Package
Install the package:
pnpm add nano-dbInstall peer dependencies:
pnpm add nano-formatBuild the package:
pnpm build
🚗 Running the Development Environment
Start the development server:
pnpm devRun tests:
pnpm testBuild the package:
pnpm buildLint the code:
pnpm lint
🔄 Managing Dependencies & Versions
Updating Dependencies
Before committing, ensure all workspace dependencies are resolved:
pnpm ws:latestTo use workspace versions during development:
pnpm ws:workspaceChecking for Issues Before Commit
pnpm ws:check🏗 Releasing the Package
- Ensure all changes are committed and pushed.
- Run the release script:
This will:pnpm release- Run tests and linting
- Build the package
- Tag the new version in Git
- Publish to npm
- Push commits and tags
🛸 Contributing
- Create a new branch:
git checkout -b feature/my-update - Make changes and commit:
git commit -m "Add new feature" - Push your branch and open a pull request.
⚙️ Useful Utility Scripts
| Command | Description |
|-----------------|-------------|
| pnpm build | Build the package (generates documentation) |
| pnpm test | Run tests |
| pnpm lint | Lint the code |
| pnpm dev | Start development server |
| pnpm release | Release the package |
| pnpm ws:check | Validate package.json & pre-commit hooks |
| pnpm ws:latest| Replace workspace:* with actual versions |
| pnpm ws:workspace | Convert all versions to workspace:* |
🛠️ Troubleshooting
- Dependency Issues: Run
pnpm installandpnpm ws:latest. - Build Errors: Ensure
nano-formatis installed and runpnpm build. - Test Failures: Check test files and run
pnpm test. - Pre-commit Hook Failures: Verify
.husky/pre-commitand runpnpm ws:check.
With these steps, you can efficiently use and maintain nano-db! 🚀
