@yaro.page/nano-db v1.0.24
š 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! š
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago