@noony-serverless/core 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -432,11 +432,210 @@ EXPOSE 8080
|
|
|
432
432
|
CMD ["npm", "start"]
|
|
433
433
|
```
|
|
434
434
|
|
|
435
|
+
## Publishing to npm
|
|
436
|
+
|
|
437
|
+
This package is published as `@noony-serverless/core` on npm. Follow these steps to publish a new version:
|
|
438
|
+
|
|
439
|
+
### Prerequisites
|
|
440
|
+
|
|
441
|
+
1. **npm Account**: You need an npm account. Create one at [npmjs.com/signup](https://www.npmjs.com/signup)
|
|
442
|
+
2. **Organization Access**: You must have access to the `@noony-serverless` organization on npm
|
|
443
|
+
- If you own the organization, you're all set
|
|
444
|
+
- If not, you need to [create the organization](https://www.npmjs.com/org/create) first
|
|
445
|
+
3. **Two-Factor Authentication**: Highly recommended for security
|
|
446
|
+
|
|
447
|
+
### Publishing Steps
|
|
448
|
+
|
|
449
|
+
#### 1. Login to npm
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
npm login
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
You'll be prompted for:
|
|
456
|
+
|
|
457
|
+
- Username
|
|
458
|
+
- Password
|
|
459
|
+
- Email
|
|
460
|
+
- One-time password (if 2FA is enabled)
|
|
461
|
+
|
|
462
|
+
Verify you're logged in:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
npm whoami
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
#### 2. Prepare the Package
|
|
469
|
+
|
|
470
|
+
Ensure all changes are committed and tests pass:
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
# Run tests
|
|
474
|
+
npm test
|
|
475
|
+
|
|
476
|
+
# Run linter
|
|
477
|
+
npm run lint
|
|
478
|
+
|
|
479
|
+
# Build the package
|
|
480
|
+
npm run build
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
#### 3. Update Version
|
|
484
|
+
|
|
485
|
+
Update the version in `package.json` following [Semantic Versioning](https://semver.org/):
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# For bug fixes (0.4.0 -> 0.4.1)
|
|
489
|
+
npm version patch
|
|
490
|
+
|
|
491
|
+
# For new features (0.4.0 -> 0.5.0)
|
|
492
|
+
npm version minor
|
|
493
|
+
|
|
494
|
+
# For breaking changes (0.4.0 -> 1.0.0)
|
|
495
|
+
npm version major
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
This will:
|
|
499
|
+
|
|
500
|
+
- Update `package.json` version
|
|
501
|
+
- Create a git commit
|
|
502
|
+
- Create a git tag
|
|
503
|
+
|
|
504
|
+
#### 4. Publish to npm
|
|
505
|
+
|
|
506
|
+
For scoped packages (like `@noony-serverless/core`), you must specify public access:
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
npm publish --access public
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**For the first publish only**, you need the `--access public` flag. Subsequent publishes can use:
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
npm publish
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
#### 5. Push to Git
|
|
519
|
+
|
|
520
|
+
Don't forget to push the version commit and tags:
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
git push && git push --tags
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### Publishing Checklist
|
|
527
|
+
|
|
528
|
+
Before publishing, verify:
|
|
529
|
+
|
|
530
|
+
- [ ] All tests pass (`npm test`)
|
|
531
|
+
- [ ] No linting errors (`npm run lint`)
|
|
532
|
+
- [ ] Build succeeds (`npm run build`)
|
|
533
|
+
- [ ] Version number updated in `package.json`
|
|
534
|
+
- [ ] CHANGELOG.md updated (if applicable)
|
|
535
|
+
- [ ] README.md is up to date
|
|
536
|
+
- [ ] All changes committed to git
|
|
537
|
+
- [ ] Logged into npm (`npm whoami`)
|
|
538
|
+
|
|
539
|
+
### Troubleshooting
|
|
540
|
+
|
|
541
|
+
#### Error: "Access token expired or revoked"
|
|
542
|
+
|
|
543
|
+
**Solution**: Run `npm login` to re-authenticate
|
|
544
|
+
|
|
545
|
+
#### Error: "404 Not Found - Not in this registry"
|
|
546
|
+
|
|
547
|
+
**Solution**: For first publish of a scoped package, use:
|
|
548
|
+
|
|
549
|
+
```bash
|
|
550
|
+
npm publish --access public
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
#### Error: "You do not have permission to publish"
|
|
554
|
+
|
|
555
|
+
**Solution**:
|
|
556
|
+
|
|
557
|
+
- Verify you're logged in as the correct user
|
|
558
|
+
- Check you have publish access to the `@noony-serverless` organization
|
|
559
|
+
- Create the organization if it doesn't exist
|
|
560
|
+
|
|
561
|
+
#### Error: "Cannot publish over existing version"
|
|
562
|
+
|
|
563
|
+
**Solution**: Update the version number in `package.json` or use:
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
npm version patch # or minor/major
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
#### Error: "403 Forbidden"
|
|
570
|
+
|
|
571
|
+
**Solutions**:
|
|
572
|
+
|
|
573
|
+
- Ensure you're logged in: `npm whoami`
|
|
574
|
+
- Verify you own the package or have collaborator access
|
|
575
|
+
- If this is a new scoped package, verify the organization exists
|
|
576
|
+
|
|
577
|
+
### Automated Publishing with GitHub Actions
|
|
578
|
+
|
|
579
|
+
For automated publishing, create `.github/workflows/publish.yml`:
|
|
580
|
+
|
|
581
|
+
```yaml
|
|
582
|
+
name: Publish to npm
|
|
583
|
+
|
|
584
|
+
on:
|
|
585
|
+
release:
|
|
586
|
+
types: [created]
|
|
587
|
+
|
|
588
|
+
jobs:
|
|
589
|
+
publish:
|
|
590
|
+
runs-on: ubuntu-latest
|
|
591
|
+
steps:
|
|
592
|
+
- uses: actions/checkout@v3
|
|
593
|
+
- uses: actions/setup-node@v3
|
|
594
|
+
with:
|
|
595
|
+
node-version: '20'
|
|
596
|
+
registry-url: 'https://registry.npmjs.org'
|
|
597
|
+
- run: npm ci
|
|
598
|
+
- run: npm test
|
|
599
|
+
- run: npm run build
|
|
600
|
+
- run: npm publish --access public
|
|
601
|
+
env:
|
|
602
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
To use this:
|
|
606
|
+
|
|
607
|
+
1. Create an npm access token at [npmjs.com/settings/tokens](https://www.npmjs.com/settings/tokens)
|
|
608
|
+
2. Add it as a GitHub secret named `NPM_TOKEN`
|
|
609
|
+
3. Create a GitHub release to trigger publishing
|
|
610
|
+
|
|
611
|
+
### Version Management
|
|
612
|
+
|
|
613
|
+
This package follows [Semantic Versioning](https://semver.org/):
|
|
614
|
+
|
|
615
|
+
- **MAJOR** version (1.0.0 → 2.0.0): Breaking changes
|
|
616
|
+
- **MINOR** version (1.0.0 → 1.1.0): New features, backwards compatible
|
|
617
|
+
- **PATCH** version (1.0.0 → 1.0.1): Bug fixes, backwards compatible
|
|
618
|
+
|
|
619
|
+
Current version: **0.4.0**
|
|
620
|
+
|
|
621
|
+
### Package Distribution
|
|
622
|
+
|
|
623
|
+
When published, the package includes only the `build/` directory contents:
|
|
624
|
+
|
|
625
|
+
- `build/core/**/*.js` and `*.d.ts`
|
|
626
|
+
- `build/middlewares/**/*.js` and `*.d.ts`
|
|
627
|
+
- `build/utils/**/*.js` and `*.d.ts`
|
|
628
|
+
- `build/index.js` and `index.d.ts`
|
|
629
|
+
- `README.md`
|
|
630
|
+
|
|
631
|
+
Source TypeScript files are not included in the npm package.
|
|
632
|
+
|
|
435
633
|
## Community & Support
|
|
436
634
|
|
|
437
635
|
- 📖 [Documentation](https://github.com/noony-org/noony-serverless)
|
|
438
636
|
- 🐛 [Issue Tracker](https://github.com/noony-org/noony-serverless/issues)
|
|
439
637
|
- 💬 [Discussions](https://github.com/noony-org/noony-serverless/discussions)
|
|
638
|
+
- 📦 [npm Package](https://www.npmjs.com/package/@noony-serverless/core)
|
|
440
639
|
|
|
441
640
|
## License
|
|
442
641
|
|
|
@@ -91,7 +91,7 @@ exports.BodyValidationMiddleware = BodyValidationMiddleware;
|
|
|
91
91
|
// Modified to fix type instantiation error
|
|
92
92
|
const bodyValidatorMiddleware = (schema) => ({
|
|
93
93
|
before: async (context) => {
|
|
94
|
-
context.req.parsedBody = await validateBody(schema, context.req.
|
|
94
|
+
context.req.parsedBody = await validateBody(schema, context.req.parsedBody);
|
|
95
95
|
},
|
|
96
96
|
});
|
|
97
97
|
exports.bodyValidatorMiddleware = bodyValidatorMiddleware;
|
package/package.json
CHANGED