Skip to content

Commit 74de536

Browse files
Merge pull request #26 from NexGenStudioDev/dev
Dev
2 parents 4ae6f1a + f1e7aa0 commit 74de536

File tree

12 files changed

+168
-13
lines changed

12 files changed

+168
-13
lines changed

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
registry=https://registry.npmjs.org/
22
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
3-
save-prefix=^
3+
save-prefix=^

PACKAGE_MANAGERS.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ The following scripts are available via `npm run <script>` or `pnpm run <script>
3333

3434
The following scripts are available via `npm run <script>` or `pnpm run <script>`:
3535

36+
37+
38+
39+
### 📦 SETUP.md – NPM Token Authentication with .env and CLI
40+
41+
3642
| Script | Description |
3743
|--------------------|------------------------------------------------------------------|
3844
| **build** | Compile TypeScript using `tsc` and fix paths using `tsc-alias` |
@@ -54,17 +60,10 @@ The following scripts are available via `npm run <script>` or `pnpm run <script>
5460
| **add** | *(Your custom script — specify its function if needed)* |
5561

5662

57-
### 🎯 Filter Usage (Workspace Targeting)
5863

59-
````bash
60-
pnpm build --filter @nexgenstudiodev/fastkit-config
61-
pnpm add -D @types/express --filter @nexgenstudiodev/fastkit-config
62-
63-
````
6464

6565
### 🚀 Publishing Workflow
6666

67-
6867
#### Using npm
6968

7069
1. Make your changes
@@ -125,7 +124,7 @@ If you're working on a new feature or a major update and want users to test it *
125124
```bash
126125
npm run publish:npm -- --tag beta
127126
```
128-
127+
129128
This way, your beta version is available for testing, but users installing your package normally will still get the stable latest version.
130129

131130

@@ -169,6 +168,26 @@ pnpm run publish:pnpm
169168

170169
---
171170

171+
172+
173+
# Version & Tag Management for `@nexgenstudiodev/fastkit`
174+
175+
| Topic | Command / Info | Description |
176+
|-----------------------------|------------------------------------------------------------|-----------------------------------------------|
177+
| **View all tags** | `npm dist-tag ls @nexgenstudiodev/fastkit` | List all tags and their versions |
178+
| **Set latest tag version** | `npm dist-tag add @nexgenstudiodev/fastkit@1.1.3 latest` | Point `latest` tag to version `1.1.3` |
179+
| **Tag a version as beta** | `npm dist-tag add @nexgenstudiodev/fastkit@2.0.0 beta` | Mark version `2.0.0` as `beta` |
180+
| **Install latest version** | `npm install @nexgenstudiodev/fastkit` | Install version tagged `latest` |
181+
| **Install specific version** | `npm install @nexgenstudiodev/fastkit@1.1.3` | Install exact version `1.1.3` |
182+
| **Install tagged version** | `npm install @nexgenstudiodev/fastkit@beta` | Install version tagged `beta` |
183+
| **Publish with tag** | `npm publish --tag latest` or `npm publish --tag beta` | Publish package with specified tag |
184+
| **Clear npm cache** | `npm cache clean --force` | Fix cache issues when updates don’t appear |
185+
186+
---
187+
188+
189+
190+
172191
## ✅ Best Practices
173192

174193
- Use a single package manager throughout your project

package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
22
"name": "@nexgenstudiodev/fastkit",
3-
"version": "2.4.0",
4-
"description": "A comprehensive FastKit library with auth, database config, and utilities",
3+
4+
"type": "commonjs",
5+
"version": "1.2.0",
6+
"description": "A modular, class-based toolkit for fast API development with TypeScript and Express.",
57
"main": "dist/FastKit.js",
68
"types": "dist/FastKit.d.ts",
79
"files": [
810
"dist"
911
],
12+
13+
"scripts": {
14+
"format": "prettier --write 'src/**/*.{ts,tsx,js,json,md}'",
15+
"lint": "eslint src/**/*.{ts,tsx}",
16+
"lint:fix": "eslint src/**/*.{ts,tsx} --fix",
17+
"link": "npm link @nexgenstudiodev/fastkit",
18+
"build": "tsc && pnpm exec tsc-alias",
19+
"link:manage": "ts-node src/script/manage-link.ts",
20+
"manage": "ts-node src/script/index.ts"
21+
},
22+
1023
"keywords": [
1124
"fastkit",
1225
"auth",
@@ -82,8 +95,10 @@
8295
"jest": "^30.0.3",
8396
"lint-staged": "^16.1.2",
8497
"prettier": "^3.6.2",
98+
"prompts": "^2.4.2",
8599
"rimraf": "^6.0.1",
86100
"ts-jest": "^29.4.0",
101+
"ts-node": "^10.9.2",
87102
"ts-node-dev": "^2.0.0",
88103
"tsc-alias": "^1.8.16",
89104
"tsconfig-paths": "^4.2.0",

pnpm-lock.yaml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config/FastKit-Config/__test__/config.test.dist.js

Whitespace-only changes.

src/config/FastKit-Config/config.validation.ts

Whitespace-only changes.

src/script/build.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { execSync } from 'child_process';
2+
3+
4+
export function build() {
5+
console.log('Running clean...');
6+
execSync('rimraf dist', { stdio: 'inherit' });
7+
8+
console.log('Compiling TypeScript...');
9+
execSync('tsc', { stdio: 'inherit' });
10+
11+
console.log('Fixing path aliases...');
12+
execSync('pnpm exec tsc-alias', { stdio: 'inherit' });
13+
14+
console.log('Build complete!');
15+
}

src/script/index.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import prompts from 'prompts';
2+
import { build } from './build';
3+
import { startProd } from './production';
4+
import { publish } from './publish';
5+
6+
async function main() {
7+
const response = await prompts({
8+
type: 'select',
9+
name: 'command',
10+
message: 'Which script do you want to run?',
11+
choices: [
12+
{ title: 'Build', value: 'build' },
13+
{ title: 'Start Production', value: 'prod' },
14+
{ title: 'Publish', value: 'publish' },
15+
{ title: 'Exit', value: 'exit' },
16+
],
17+
});
18+
19+
switch (response.command) {
20+
case 'build':
21+
build();
22+
break;
23+
case 'prod':
24+
startProd();
25+
break;
26+
case 'publish':
27+
publish();
28+
break;
29+
default:
30+
console.log('Exiting...');
31+
process.exit(0);
32+
}
33+
}
34+
35+
main();

src/script/production.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { execSync } from 'child_process';
2+
3+
export function startProd() {
4+
console.log('Running pre-production tasks: format, lint, build');
5+
execSync('pnpm run format && pnpm run lint --fix && pnpm run build', { stdio: 'inherit' });
6+
7+
console.log('Starting production server...');
8+
execSync('node dist/index.js', { stdio: 'inherit' });
9+
}

src/script/publish.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { execSync } from 'child_process';
2+
3+
/**
4+
* Bump version, run format/lint/build, then publish
5+
* @param bumpType one of 'patch' | 'minor' | 'major' (default: patch)
6+
* @param tag optional npm tag (e.g., 'beta')
7+
*/
8+
function publishWithVersionBump(bumpType = 'patch', tag?: string) {
9+
console.log(`Bumping version (${bumpType})...`);
10+
execSync(`npm version ${bumpType}`, { stdio: 'inherit' });
11+
12+
console.log('Running prepublish tasks: format, lint, build');
13+
execSync('pnpm run format && pnpm run lint && pnpm run build', { stdio: 'inherit' });
14+
15+
const publishCmd = tag
16+
? `npm publish --access public --tag ${tag}`
17+
: 'npm publish --access public';
18+
19+
console.log(`Publishing${tag ? ` with tag "${tag}"` : ''} to npm...`);
20+
execSync(publishCmd, { stdio: 'inherit' });
21+
}
22+
23+
export function publish() {
24+
publishWithVersionBump('patch');
25+
}
26+
27+
export function publishBeta() {
28+
publishWithVersionBump('patch', 'beta');
29+
}

0 commit comments

Comments
 (0)