The S-Hive Models project is a centralized repository of reusable models designed to streamline the integration and development of multiple applications. By standardizing these models, you can ensure consistency, reduce redundancy, and improve the overall maintainability of your projects.
This package supports TypeScript, is built with TypeORM for database interactions, and uses PostgreSQL as its primary database dependency.
- Centralized reusable models for database management.
- TypeScript support for type safety and code reliability.
- Built using TypeORM, with support for migrations and advanced ORM capabilities.
- Easily extensible to suit the needs of different applications.
Install the package via npm:
npm install s-hive-models
Import the models into your project:
import { User } from 's-hive-models';
You can use the models in conjunction with your TypeORM setup for seamless database interactions.
Compile the TypeScript files into JavaScript:
npm run build
Remove the dist folder to ensure a fresh build:
npm run clean
Automatically build the project before publishing:
npm run prepare
Increment the package version using semantic versioning:
npm run bump-version
This defaults to a patch update. Modify it manually for major or minor updates.
The release process for this project is streamlined using the npm run release
script. This ensures that every release is consistent, validated, and ready for distribution. Here's how the release process works and what each step entails:
npm run release
-
Clean the Build Directory: Removes the
dist
folder to ensure no outdated or residual files are included in the build.
npm run clean
- Git Commit:: Stages and commits any uncommitted changes with a standard message.
npm run git-commit
-
Bump the Version: Automatically increments the package version according to semantic versioning (e.g.,
1.0.14
→1.0.15
).
npm version patch
-
Build the Project: Compiles all TypeScript files into JavaScript and outputs them into the
dist
directory.
npm run build
- Push Changes and Tags: Pushes the changes (including the version bump and tag) to the remote repository.
git push origin release-alpha
-
Pre-Publish Validation: Runs the
check-version
script to ensure the version and metadata are valid. This step prevents publishing if something is off.
npm run prepublishOnly
- Publish to npm: Publishes the updated package to the npm registry.
npm run publish-package
When you run npm run release
, you'll see logs indicating each step of the process:
> npm run clean
> Cleaning the dist directory...
> npm version patch
> Version bumped from 1.0.14 to 1.0.15...
> npm run build
> Compiling TypeScript files...
> npm run prepublishOnly
> Running pre-publish checks...
> npm run publish-package
> Publishing package to npm registry...
> Package published successfully!
- Ensure you are logged into npm and have the proper permissions to publish the package.
- The
release
script is a single command that automates the entire process, but you can also run each step manually if needed.
The following files are included in the npm package distribution:
-
src/**/*
: The source TypeScript files for reference. -
dist/**/*
: The compiled JavaScript files for production use. -
package.json
: The package metadata. -
README.md
: The documentation for the package. -
LICENSE
: The license agreement.
This project is licensed under the MIT License. See the LICENSE
file for details.
We welcome contributions to improve this package! Feel free to fork the repository, create a branch, and open a pull request with your changes.