Skip to content

Commit ba5e12d

Browse files
Merge pull request #22 from NexGenStudioDev/dev
Dev
2 parents d4fcb03 + 53bb71b commit ba5e12d

3 files changed

Lines changed: 52 additions & 14 deletions

File tree

.github/workflows/publish.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- master
77
tags:
8-
- 'v*' # optional: publish on version tags like v1.0.0
8+
- 'v*'
99

1010
jobs:
1111
publish:
@@ -16,7 +16,7 @@ jobs:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
1818

19-
- name: Setup Node.js 18
19+
- name: Setup Node.js
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: 18
@@ -33,13 +33,15 @@ jobs:
3333
- name: Build package
3434
run: pnpm build
3535

36-
# - name: Run tests (optional)
37-
# run: pnpm test
38-
3936
- name: Authenticate to npm
40-
run: npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN}
4137
env:
38+
# Required so setup-node writes correct .npmrc
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4240
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
run: |
42+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
4343
4444
- name: Publish to npm
45-
run: pnpm publish --access public --no-git-checks
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
run: pnpm publish --access public --no-git-checks

PACKAGE_MANAGERS.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,45 @@ npm run version:major
7979

8080
5. Publish package:
8181

82-
```bash
83-
npm run publish:npm
84-
```
82+
# 📦 Publishing and Installing npm Packages with Custom Tags
83+
84+
When you publish a package to npm, each version **must have a version number higher than all previously published versions**. This helps npm identify the newest version.
85+
86+
If you try to publish a version that is **lower or the same** as a previously published version using the default `latest` tag, npm will throw an error.
87+
88+
---
89+
90+
## Using Custom Tags to Avoid Errors
91+
92+
To avoid this error, you can publish your package using a **different tag** instead of `latest`. Tags let you label versions differently, such as `beta`, `next`, or `dev`.
93+
94+
---
95+
96+
## Example: Publishing a Beta Version
97+
98+
If you're working on a new feature or a major update and want users to test it **without affecting the stable release**, you can publish it under a `beta` tag.
99+
100+
### Steps:
101+
102+
1. **Update the Version**
103+
Increment your package’s version number to indicate it’s a beta release.
104+
For example, if your current version is `1.0.0`, you might update it to `1.1.0-beta.0`.
105+
106+
2. **Publish with a Custom Tag**
107+
Run the following command to publish your package under the `beta` tag:
108+
109+
```bash
110+
npm publish --tag beta
111+
```
112+
113+
Or if you use an npm script like publish:npm:
114+
115+
```bash
116+
npm run publish:npm -- --tag beta
117+
```
118+
119+
This way, your beta version is available for testing, but users installing your package normally will still get the stable latest version.
120+
85121

86122
### Using pnpm
87123
1. Make your changes
@@ -100,9 +136,9 @@ npm run publish:npm
100136
4. Bump version (choose one):
101137

102138
````bash
103-
npm run version:patch
104-
npm run version:minor
105-
npm run version:major
139+
npm run version:patch # Small bugfixes, no new features
140+
npm run version:minor # New features, no breaking changes
141+
npm run version:major # Breaking changes, major updates
106142
````
107143

108144
5. Publish:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nexgenstudiodev/fastkit",
33
"type": "commonjs",
4-
"version": "1.0.0",
4+
"version": "1.0.2",
55
"description": "A modular, class-based toolkit for fast API development with TypeScript and Express.",
66
"main": "dist/FastKit.js",
77
"types": "dist/FastKit.d.ts",

0 commit comments

Comments
 (0)