perfect-payload 1.5.0-beta.0 → 1.5.0-beta.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/package.json CHANGED
@@ -1,12 +1,22 @@
1
1
  {
2
2
  "name": "perfect-payload",
3
- "version": "1.5.0-beta.0",
3
+ "version": "1.5.0-beta.1",
4
4
  "type": "module",
5
5
  "description": "Lightweight JSON payload validation library with structured errors, nested validation, field paths, and customizable validation rules.",
6
6
  "main": "index.js",
7
7
  "scripts": {
8
8
  "test": "jest"
9
9
  },
10
+ "files": [
11
+ "index.js"
12
+ ],
13
+ "jest": {
14
+ "testPathIgnorePatterns": [
15
+ "/node_modules/",
16
+ "/test.js",
17
+ "/testingV1.js"
18
+ ]
19
+ },
10
20
  "repository": {
11
21
  "type": "git",
12
22
  "url": "git+https://github.com/kiranpoojary/perfect-payload.git"
package/.babelrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "presets": ["@babel/preset-env"]
3
- }
4
-
@@ -1,332 +0,0 @@
1
- name: Stage npm package
2
-
3
- on:
4
- push:
5
- # Beta:
6
- # Run for pushes to every branch except main.
7
- branches:
8
- - "**"
9
- - "!main"
10
-
11
- # Production:
12
- # Run only when a version tag is pushed.
13
- # Examples: v1.3.0, v1.3.1, v2.0.0
14
- tags:
15
- - "v*.*.*"
16
-
17
- permissions:
18
- contents: read
19
- id-token: write
20
-
21
- jobs:
22
- # ==========================================================
23
- # 1. PACKAGE INFO
24
- # ==========================================================
25
- package-info:
26
- name: Package Info
27
- runs-on: ubuntu-latest
28
-
29
- outputs:
30
- name: ${{ steps.package.outputs.name }}
31
- version: ${{ steps.package.outputs.version }}
32
- release_type: ${{ steps.package.outputs.release_type }}
33
-
34
- steps:
35
- - name: Checkout repository
36
- uses: actions/checkout@v7
37
-
38
- - name: Read package information
39
- id: package
40
- shell: bash
41
- run: |
42
- NAME=$(node -p "require('./package.json').name")
43
- VERSION=$(node -p "require('./package.json').version")
44
-
45
- echo "name=$NAME" >> "$GITHUB_OUTPUT"
46
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
47
-
48
- if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
49
- RELEASE_TYPE="production"
50
- else
51
- RELEASE_TYPE="beta"
52
- fi
53
-
54
- echo "release_type=$RELEASE_TYPE" >> "$GITHUB_OUTPUT"
55
-
56
- echo "======================================"
57
- echo "PACKAGE INFORMATION"
58
- echo "======================================"
59
- echo "Package: $NAME"
60
- echo "Version: $VERSION"
61
- echo "Release type: $RELEASE_TYPE"
62
- echo "Git ref: $GITHUB_REF_NAME"
63
- echo "Git ref type: $GITHUB_REF_TYPE"
64
- echo "======================================"
65
-
66
- # ==========================================================
67
- # 2. VALIDATE RELEASE
68
- # ==========================================================
69
- validate-release:
70
- name: Validate Release
71
- needs: package-info
72
- runs-on: ubuntu-latest
73
-
74
- steps:
75
- - name: Validate branch / tag and version
76
- shell: bash
77
- run: |
78
- VERSION="${{ needs.package-info.outputs.version }}"
79
-
80
- echo "Version: $VERSION"
81
- echo "Ref: $GITHUB_REF_NAME"
82
- echo "Ref type: $GITHUB_REF_TYPE"
83
-
84
- # --------------------------------------------------
85
- # PRODUCTION
86
- # Must come from a Git tag.
87
- #
88
- # Tag: v1.3.0
89
- # package version: 1.3.0
90
- # --------------------------------------------------
91
- if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
92
-
93
- TAG="$GITHUB_REF_NAME"
94
-
95
- if [[ "$VERSION" == *"-beta"* ]]; then
96
- echo "::error::Production releases cannot contain -beta."
97
- echo "::error::Current package version: $VERSION"
98
- exit 1
99
- fi
100
-
101
- EXPECTED_TAG="v$VERSION"
102
-
103
- if [[ "$TAG" != "$EXPECTED_TAG" ]]; then
104
- echo "::error::Git tag does not match package.json version."
105
- echo "::error::Tag: $TAG"
106
- echo "::error::Expected tag: $EXPECTED_TAG"
107
- exit 1
108
- fi
109
-
110
- echo "Valid production release."
111
- echo "Tag $TAG matches package version $VERSION."
112
-
113
- # --------------------------------------------------
114
- # BETA
115
- # Any non-main branch.
116
- #
117
- # Example:
118
- # feature/custom-validator
119
- # package version: 1.3.0-beta.0
120
- # --------------------------------------------------
121
- else
122
-
123
- if [[ "$GITHUB_REF_NAME" == "main" ]]; then
124
- echo "::error::Production releases from main pushes are disabled."
125
- echo "::error::Create a Git tag to release production."
126
- exit 1
127
- fi
128
-
129
- if [[ "$VERSION" != *"-beta"* ]]; then
130
- echo "::error::Non-main branches must contain a beta version."
131
- echo "::error::Current version: $VERSION"
132
- echo "::error::Expected something like 1.3.0-beta.0"
133
- exit 1
134
- fi
135
-
136
- echo "Valid beta release."
137
- echo "Branch: $GITHUB_REF_NAME"
138
- echo "Version: $VERSION"
139
-
140
- fi
141
-
142
- # ==========================================================
143
- # 3. INSTALL DEPENDENCIES
144
- # ==========================================================
145
- install:
146
- name: Install Dependencies
147
- needs:
148
- - package-info
149
- - validate-release
150
-
151
- runs-on: ubuntu-latest
152
-
153
- steps:
154
- - name: Checkout repository
155
- uses: actions/checkout@v7
156
-
157
- - name: Setup Node.js
158
- uses: actions/setup-node@v7
159
- with:
160
- node-version: 24
161
- registry-url: https://registry.npmjs.org
162
- package-manager-cache: false
163
-
164
- - name: Setup npm
165
- run: npm install --global npm@11.19.1
166
-
167
- - name: Verify Node and npm versions
168
- run: |
169
- node -v
170
- npm -v
171
-
172
- - name: Install dependencies
173
- run: npm ci
174
-
175
- # ==========================================================
176
- # 4. RUN TESTS
177
- # ==========================================================
178
- test:
179
- name: Run Tests
180
- needs: install
181
- runs-on: ubuntu-latest
182
-
183
- steps:
184
- - name: Checkout repository
185
- uses: actions/checkout@v7
186
-
187
- - name: Setup Node.js
188
- uses: actions/setup-node@v7
189
- with:
190
- node-version: 24
191
- package-manager-cache: false
192
-
193
- - name: Install dependencies
194
- run: npm ci
195
-
196
- - name: Run tests
197
- run: npm test -- --passWithNoTests
198
-
199
- # ==========================================================
200
- # 5. CHECK NPM VERSION
201
- # ==========================================================
202
- check-npm:
203
- name: Check npm Version
204
- needs:
205
- - package-info
206
- - validate-release
207
- - test
208
-
209
- runs-on: ubuntu-latest
210
-
211
- steps:
212
- - name: Setup Node.js
213
- uses: actions/setup-node@v7
214
- with:
215
- node-version: 24
216
- registry-url: https://registry.npmjs.org
217
- package-manager-cache: false
218
-
219
- - name: Check whether version already exists
220
- shell: bash
221
- run: |
222
- NAME="${{ needs.package-info.outputs.name }}"
223
- VERSION="${{ needs.package-info.outputs.version }}"
224
-
225
- echo "Checking npm for $NAME@$VERSION..."
226
-
227
- if npm view "$NAME@$VERSION" version >/dev/null 2>&1; then
228
- echo "::error::$NAME@$VERSION is already published."
229
- echo "::error::Use a new package version."
230
- exit 1
231
- fi
232
-
233
- echo "$NAME@$VERSION is not published."
234
- echo "Release is ready to stage."
235
-
236
- # ==========================================================
237
- # 6. STAGE NPM PACKAGE
238
- #
239
- # This environment can optionally have a GitHub
240
- # Required Reviewer configured.
241
- #
242
- # npm itself still requires approval + 2FA after staging.
243
- # ==========================================================
244
- stage-npm:
245
- name: Stage npm Package
246
- needs:
247
- - package-info
248
- - check-npm
249
-
250
- runs-on: ubuntu-latest
251
-
252
- environment:
253
- name: npm-stage
254
-
255
- steps:
256
- - name: Checkout repository
257
- uses: actions/checkout@v7
258
-
259
- - name: Setup Node.js
260
- uses: actions/setup-node@v7
261
- with:
262
- node-version: 24
263
- registry-url: https://registry.npmjs.org
264
- package-manager-cache: false
265
-
266
- - name: Setup npm
267
- run: npm install --global npm@11.19.1
268
-
269
- - name: Show release information
270
- shell: bash
271
- run: |
272
- echo "======================================"
273
- echo "READY TO STAGE"
274
- echo "======================================"
275
- echo "Package: ${{ needs.package-info.outputs.name }}"
276
- echo "Version: ${{ needs.package-info.outputs.version }}"
277
- echo "Type: ${{ needs.package-info.outputs.release_type }}"
278
- echo "Ref: $GITHUB_REF_NAME"
279
- echo "======================================"
280
-
281
- # ------------------------------------------------------
282
- # BETA
283
- # Triggered only from non-main branch pushes.
284
- # ------------------------------------------------------
285
- - name: Stage Beta Package
286
- if: >
287
- github.ref_type == 'branch' &&
288
- needs.package-info.outputs.release_type == 'beta'
289
- run: |
290
- echo "Staging beta package..."
291
- echo "${{ needs.package-info.outputs.name }}@${{ needs.package-info.outputs.version }}"
292
-
293
- npm stage publish --tag beta
294
-
295
- # ------------------------------------------------------
296
- # PRODUCTION
297
- # Triggered ONLY from Git tags.
298
- # ------------------------------------------------------
299
- - name: Stage Production Package
300
- if: >
301
- github.ref_type == 'tag' &&
302
- needs.package-info.outputs.release_type == 'production'
303
- run: |
304
- echo "Staging production package..."
305
- echo "${{ needs.package-info.outputs.name }}@${{ needs.package-info.outputs.version }}"
306
-
307
- npm stage publish
308
-
309
- # ==========================================================
310
- # 7. COMPLETION
311
- # ==========================================================
312
- complete:
313
- name: npm Package Staged
314
- needs:
315
- - package-info
316
- - stage-npm
317
-
318
- runs-on: ubuntu-latest
319
-
320
- steps:
321
- - name: Staging completed
322
- run: |
323
- echo "======================================"
324
- echo "NPM STAGING COMPLETED"
325
- echo "======================================"
326
- echo "Package: ${{ needs.package-info.outputs.name }}"
327
- echo "Version: ${{ needs.package-info.outputs.version }}"
328
- echo "Type: ${{ needs.package-info.outputs.release_type }}"
329
- echo ""
330
- echo "The package has been staged on npm."
331
- echo "Review and approve it on npm with 2FA."
332
- echo "======================================"