fix: Update build config and add missing dependencies

- Fixed tsconfig.prod.json moduleResolution for npm build
- Added @socket.io/redis-adapter, @prisma/client, fs-extra to dependencies
- Moved fs-extra from devDependencies to dependencies
- Created GIT_SETUP_INSTRUCTIONS.md for deployment guide
This commit is contained in:
2025-12-06 20:26:50 +05:30
parent 95a1017d91
commit 021bda5315
3 changed files with 241 additions and 2 deletions

235
GIT_SETUP_INSTRUCTIONS.md Normal file
View File

@@ -0,0 +1,235 @@
# Git Repository Setup Instructions
## Status: ✅ Local Setup Complete, Awaiting Remote Creation
---
## What Was Done Locally
### 1. ✅ File Reorganization
- **Old v1 codebase** moved to `v1_legacy/` folder
- **New v2 codebase** remains in `v2/` folder
- **Build system** updated for v2 structure
### 2. ✅ Build Configuration
- **build.ts** rewritten for v2 structure
- **tsconfig.prod.json** excludes v1_legacy and tests
- **Builds only v2 code** for npm publishing
### 3. ✅ CI/CD Pipeline
- **Jenkinsfile** created with kaniko pipeline
- Configured for npm library publishing
- Points to `npmjs-token` credential
### 4. ✅ Git Configuration
- **Repository initialized**
- **Remote added:** `https://gitea.armco.dev/Restruct-Corporate-Advantage/node-starter-kit.git`
- **Branch:** `main`
- **All files committed** (109 files, 20,681 insertions)
---
## What Needs to Be Done on Gitea
### Create Repository on Gitea
The repository needs to be created on Gitea before pushing. You have two options:
#### Option 1: Via Gitea Web UI
1. Navigate to: https://gitea.armco.dev/Restruct-Corporate-Advantage
2. Click "New Repository"
3. Repository name: `node-starter-kit`
4. Description: "Modern plugin-based starter kit for Node.js applications with TypeScript, security, and observability"
5. Visibility: Private or Public (as per org policy)
6. **Do NOT initialize with README** (we already have it)
7. Click "Create Repository"
#### Option 2: Via Gitea CLI (tea)
```bash
# Install tea if not already installed
# brew install tea
# Login to Gitea
tea login add --name armco --url https://gitea.armco.dev
# Create repository
tea repo create \
--name node-starter-kit \
--description "Modern plugin-based starter kit for Node.js applications" \
--owner Restruct-Corporate-Advantage \
--private
```
---
## After Repository Creation
### Push to Remote
Once the repository exists on Gitea, run:
```bash
cd /Users/mohit/__Projects__/node-starter-kit
git push -u origin main
```
### Verify Setup
```bash
# Check remote
git remote -v
# Check branch
git branch -a
# Check status
git status
```
---
## Jenkins Pipeline
### Automatic Trigger
Once code is pushed to `main` branch:
1. Jenkins will detect the `Jenkinsfile`
2. Pipeline will execute `kanikoPipeline` with `isNpmLib: true`
3. Steps:
- Install dependencies: `npm ci`
- Build package: `npm run build` (calls build.ts)
- Publish to npm: `npm publish` (in dist folder)
### Required Jenkins Credentials
Ensure the following credential exists in Jenkins:
- **Credential ID:** `npmjs-token`
- **Type:** Secret text
- **Value:** Your npm authentication token
### Manual Trigger
If needed, you can manually trigger the pipeline from Jenkins UI.
---
## Build Process Flow
```
npm run publish:sh
publish.sh
npm run build
build.ts executes:
1. Remove dist/ folder
2. Compile TypeScript (v2 only, excludes v1_legacy & tests)
3. Adjust package.json for publishing
4. Copy README, LICENSE, .npmignore to dist/
5. dist/ ready for npm publish
cd dist && npm publish
```
---
## Current Git State
```
Branch: main
Remote: origin → https://gitea.armco.dev/Restruct-Corporate-Advantage/node-starter-kit.git
Commits: 1 (95a1017)
Files staged: 109 files
Untracked: None
Changes: None (all committed)
```
---
## Commit Summary
**Commit:** 95a1017
**Message:** "feat: Complete NSK v2 implementation with testing infrastructure"
**Includes:**
- v2 complete implementation (all P0, P1, P2 features)
- v1_legacy folder (backward compatibility)
- Testing infrastructure (82 tests, Vitest)
- OpenTelemetry plugin
- withServices() API
- Updated build system
- Jenkinsfile for CI/CD
- Complete documentation
---
## Verification Checklist
Before pushing, verify:
- [x] All v1 files moved to v1_legacy/
- [x] v2/ folder structure correct
- [x] build.ts updated for v2
- [x] tsconfig.prod.json excludes tests and v1_legacy
- [x] Jenkinsfile created
- [x] .gitignore properly configured
- [x] Git remote set to Gitea
- [x] All files committed
- [x] Branch renamed to main
- [ ] **Repository created on Gitea** ⬅️ NEXT STEP
- [ ] Code pushed to remote
---
## Post-Push Tasks
After successful push:
1. **Verify on Gitea:**
- Check files are visible
- Verify branch structure
- Check Jenkinsfile is present
2. **Monitor Jenkins:**
- Pipeline should auto-trigger
- Watch build logs
- Verify npm publish
3. **Test npm Package:**
```bash
npm install @armco/node-starter-kit@latest
```
4. **Verify v2 Exports:**
```typescript
import { Application } from '@armco/node-starter-kit/v2'
```
---
## Troubleshooting
### If push fails with 403
- Repository doesn't exist on Gitea yet
- Create it using instructions above
### If Jenkins pipeline fails
- Check `npmjs-token` credential exists
- Verify package.json name matches npm registry
- Check npm publish permissions
### If build fails
- Run locally: `npm run build`
- Check build.ts for errors
- Verify tsconfig.prod.json
---
## Summary
**Status:** ✅ Ready to push once repository created
**Next Action:** Create repository on Gitea, then push
**Command:** `git push -u origin main`
Everything is prepared and committed locally. Just need the remote repository to exist!

View File

@@ -98,7 +98,10 @@
"@opentelemetry/exporter-metrics-otlp-http": "^0.45.1",
"@opentelemetry/exporter-jaeger": "^1.18.1",
"@opentelemetry/exporter-zipkin": "^1.18.1",
"node-cron": "^3.0.3"
"node-cron": "^3.0.3",
"@socket.io/redis-adapter": "^8.2.1",
"@prisma/client": "^5.7.0",
"fs-extra": "^11.1.1"
},
"devDependencies": {
"@types/axios": "^0.14.0",
@@ -119,7 +122,6 @@
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.0.4",
"@vitest/ui": "^1.0.4",
"fs-extra": "^11.1.1",
"get-port": "^7.0.0",
"mongodb-memory-server": "^9.1.3",
"nodemon": "^3.0.1",

View File

@@ -1,6 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"removeComments": true
},