This guide covers how to set up, manage, and use the nano-db package, a lightweight database abstraction for the nanoweb ecosystem.
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
- 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-format
package is a peer dependency and must be installed.
-
Install the package:
pnpm add nano-db
-
Install peer dependencies:
pnpm add nano-format
-
Build the package:
pnpm build
-
Start the development server:
pnpm dev
-
Run tests:
pnpm test
-
Build the package:
pnpm build
-
Lint the code:
pnpm lint
Before committing, ensure all workspace dependencies are resolved:
pnpm ws:latest
To use workspace versions during development:
pnpm ws:workspace
pnpm ws:check
- 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
- 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.
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:*
|
-
Dependency Issues: Run
pnpm install
andpnpm ws:latest
. -
Build Errors: Ensure
nano-format
is installed and runpnpm build
. -
Test Failures: Check test files and run
pnpm test
. -
Pre-commit Hook Failures: Verify
.husky/pre-commit
and runpnpm ws:check
.
With these steps, you can efficiently use and maintain nano-db! ๐