๐ NestJS Package Starter: A streamlined, ready-to-use template for building robust, scalable NestJS packages.
This package provides a well-structured template thatโs ideal for kickstarting the development of NestJS modules. Itโs equipped with essential configurations and a flexible structure to elevate your NestJS ecosystem.
- Ready-to-use structure for NestJS modules.
- Essential configurations for TypeScript, Jest, ESLint, and Prettier.
- Integrated testing setup with Jest.
- Continuous Integration and Release Management with
release-it
.
Certainly! Below is the continuation of your README.md
with instructions on how to create a new package by cloning your starter template, modifying the code, and preparing it for release:
Follow these steps to use this starter template to create your own NestJS package:
First, clone the nestjs-package-starter
repository:
git clone https://github.com/iamtalwinder/nestjs-package-starter.git your-package-name
cd your-package-name
Replace your-package-name
with the name of your new package.
Install the necessary dependencies:
npm install
- Update Package Details: Edit the
package.json
file to reflect your package's name, description, repository, etc. - Develop Your Module: Add or modify the NestJS modules, services, etc., inside the
lib
directory. - Write Tests: Write unit and end-to-end tests for your modules inside the
test
directory. Place unit tests intest/unit
and end-to-end tests intest/e2e
.
Before publishing, you can build and test your package locally:
- Build Your Package: Run
npm run build
to compile your TypeScript code. - Run Unit Tests: Execute
npm run test:unit
to run unit tests. - Run E2E Tests: Execute
npm run test:e2e
to run end-to-end tests.
To prepare your package for release, follow these steps:
-
Set Up Git Repository: Initialize a new Git repository if you haven't already:
git init git add . git commit -m "Initial commit"
-
Configure
release-it
: If not already configured, set uprelease-it
in your project. You might want to modify.release-it.json
to suit your release workflow.
Absolutely, setting up the remote repository correctly is an important step in managing your package's source code and preparing for publication. Here are the steps including the ones you mentioned, to be added in your README.md
:
Before you release and publish your package, make sure your local repository is properly linked to a remote repository on GitHub (or another version control service). This step is crucial for version control and collaboration.
-
Create a Remote Repository: If you haven't already, create a new repository on GitHub (or your preferred service). Do not initialize it with a README, license, or .gitignore files โ your local repository will already have these.
-
Add Remote Repository: Link your local repository to the remote repository. Replace
<github_url>
with the URL of your new GitHub repository.git remote add upstream <github_url>
-
Push to Remote Repository: Push your code to the main branch of the remote repository. This step uploads your local repository content to GitHub.
git push --set-upstream origin main
Remember to replace <github_url>
with the actual URL of your GitHub repository. These instructions will guide users through setting up their own package, pushing it to a remote repository, and publishing it to npm.
Create a Release: When you're ready to publish your package, you can use release-it
to automate the versioning and publishing process:
```bash
npm run release
```
This command will handle version bumping, tagging, and publishing your package to npm. Ensure you have the correct access rights on npm and your Git remote is set up correctly.