mastercontroller 1.3.10 → 1.3.13

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.
@@ -18,7 +18,10 @@
18
18
  "Bash(npm install:*)",
19
19
  "Bash(node test-raw-body-preservation.js:*)",
20
20
  "Bash(tree:*)",
21
- "Bash(wc:*)"
21
+ "Bash(wc:*)",
22
+ "Bash(npm test:*)",
23
+ "Bash(git add:*)",
24
+ "Bash(git commit:*)"
22
25
  ],
23
26
  "deny": [],
24
27
  "ask": []
package/.eslintrc.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "env": {
3
+ "node": true,
4
+ "es2021": true
5
+ },
6
+ "extends": "eslint:recommended",
7
+ "parserOptions": {
8
+ "ecmaVersion": 2021,
9
+ "sourceType": "module"
10
+ },
11
+ "rules": {
12
+ "no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
13
+ "no-console": "off",
14
+ "no-prototype-builtins": "off",
15
+ "no-empty": ["error", { "allowEmptyCatch": true }],
16
+ "semi": ["error", "always"],
17
+ "quotes": ["error", "single", { "avoidEscape": true }],
18
+ "indent": ["error", 4, { "SwitchCase": 1 }],
19
+ "comma-dangle": ["error", "never"],
20
+ "no-trailing-spaces": "error",
21
+ "eol-last": ["error", "always"],
22
+ "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1 }],
23
+ "object-curly-spacing": ["error", "always"],
24
+ "array-bracket-spacing": ["error", "never"],
25
+ "space-before-function-paren": ["error", {
26
+ "anonymous": "never",
27
+ "named": "never",
28
+ "asyncArrow": "always"
29
+ }],
30
+ "keyword-spacing": ["error", { "before": true, "after": true }],
31
+ "space-infix-ops": "error",
32
+ "no-var": "warn",
33
+ "prefer-const": "warn",
34
+ "no-throw-literal": "error",
35
+ "no-eval": "error",
36
+ "no-implied-eval": "error",
37
+ "no-new-func": "error",
38
+ "no-new-wrappers": "error",
39
+ "no-return-await": "error",
40
+ "require-await": "warn"
41
+ },
42
+ "ignorePatterns": [
43
+ "node_modules/",
44
+ "coverage/",
45
+ "dist/",
46
+ "build/",
47
+ "*.min.js",
48
+ "test-*.js"
49
+ ]
50
+ }
@@ -0,0 +1,317 @@
1
+ name: MasterController CI/CD
2
+
3
+ on:
4
+ push:
5
+ branches: [ master, main, develop ]
6
+ pull_request:
7
+ branches: [ master, main, develop ]
8
+ schedule:
9
+ # Run security audit weekly on Monday at 9am UTC
10
+ - cron: '0 9 * * 1'
11
+
12
+ jobs:
13
+ # Code Quality & Linting
14
+ lint:
15
+ name: Lint & Code Quality
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '20.x'
25
+ cache: 'npm'
26
+
27
+ - name: Install dependencies
28
+ run: npm ci
29
+
30
+ - name: Run ESLint
31
+ run: npm run lint --if-present
32
+ continue-on-error: true
33
+
34
+ - name: Check code formatting
35
+ run: npx prettier --check "**/*.js" --ignore-path .gitignore
36
+ continue-on-error: true
37
+
38
+ # Security Scanning
39
+ security:
40
+ name: Security Audit
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - name: Checkout code
44
+ uses: actions/checkout@v4
45
+
46
+ - name: Setup Node.js
47
+ uses: actions/setup-node@v4
48
+ with:
49
+ node-version: '20.x'
50
+ cache: 'npm'
51
+
52
+ - name: Install dependencies
53
+ run: npm ci
54
+
55
+ - name: Run npm audit
56
+ run: npm audit --audit-level=moderate
57
+ continue-on-error: true
58
+
59
+ - name: Run Snyk security scan
60
+ uses: snyk/actions/node@master
61
+ continue-on-error: true
62
+ env:
63
+ SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
64
+ with:
65
+ args: --severity-threshold=high
66
+
67
+ - name: OWASP Dependency Check
68
+ uses: dependency-check/Dependency-Check_Action@main
69
+ continue-on-error: true
70
+ with:
71
+ project: 'MasterController'
72
+ path: '.'
73
+ format: 'HTML'
74
+
75
+ - name: Upload Dependency Check results
76
+ uses: actions/upload-artifact@v3
77
+ if: always()
78
+ with:
79
+ name: dependency-check-report
80
+ path: reports/
81
+
82
+ # Unit Tests
83
+ test:
84
+ name: Test - Node ${{ matrix.node-version }} on ${{ matrix.os }}
85
+ runs-on: ${{ matrix.os }}
86
+ strategy:
87
+ matrix:
88
+ node-version: ['18.x', '20.x', '22.x']
89
+ os: [ubuntu-latest, macos-latest, windows-latest]
90
+ fail-fast: false
91
+ steps:
92
+ - name: Checkout code
93
+ uses: actions/checkout@v4
94
+
95
+ - name: Setup Node.js ${{ matrix.node-version }}
96
+ uses: actions/setup-node@v4
97
+ with:
98
+ node-version: ${{ matrix.node-version }}
99
+ cache: 'npm'
100
+
101
+ - name: Install dependencies
102
+ run: npm ci
103
+
104
+ - name: Run tests
105
+ run: npm test --if-present
106
+ env:
107
+ NODE_ENV: test
108
+
109
+ - name: Upload coverage to Codecov
110
+ uses: codecov/codecov-action@v3
111
+ if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
112
+ with:
113
+ token: ${{ secrets.CODECOV_TOKEN }}
114
+ files: ./coverage/coverage-final.json
115
+ flags: unittests
116
+ name: codecov-umbrella
117
+
118
+ # Integration Tests
119
+ integration:
120
+ name: Integration Tests
121
+ runs-on: ubuntu-latest
122
+ services:
123
+ redis:
124
+ image: redis:7-alpine
125
+ options: >-
126
+ --health-cmd "redis-cli ping"
127
+ --health-interval 10s
128
+ --health-timeout 5s
129
+ --health-retries 5
130
+ ports:
131
+ - 6379:6379
132
+ steps:
133
+ - name: Checkout code
134
+ uses: actions/checkout@v4
135
+
136
+ - name: Setup Node.js
137
+ uses: actions/setup-node@v4
138
+ with:
139
+ node-version: '20.x'
140
+ cache: 'npm'
141
+
142
+ - name: Install dependencies
143
+ run: npm ci
144
+
145
+ - name: Run integration tests
146
+ run: npm run test:integration --if-present
147
+ env:
148
+ NODE_ENV: test
149
+ REDIS_HOST: localhost
150
+ REDIS_PORT: 6379
151
+
152
+ # Performance & Load Tests
153
+ performance:
154
+ name: Performance Tests
155
+ runs-on: ubuntu-latest
156
+ if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
157
+ steps:
158
+ - name: Checkout code
159
+ uses: actions/checkout@v4
160
+
161
+ - name: Setup Node.js
162
+ uses: actions/setup-node@v4
163
+ with:
164
+ node-version: '20.x'
165
+ cache: 'npm'
166
+
167
+ - name: Install dependencies
168
+ run: npm ci
169
+
170
+ - name: Run performance tests
171
+ run: npm run test:performance --if-present
172
+ continue-on-error: true
173
+
174
+ - name: Upload performance results
175
+ uses: actions/upload-artifact@v3
176
+ if: always()
177
+ with:
178
+ name: performance-results
179
+ path: performance/
180
+
181
+ # Build & Package
182
+ build:
183
+ name: Build & Package
184
+ runs-on: ubuntu-latest
185
+ needs: [lint, security, test]
186
+ steps:
187
+ - name: Checkout code
188
+ uses: actions/checkout@v4
189
+
190
+ - name: Setup Node.js
191
+ uses: actions/setup-node@v4
192
+ with:
193
+ node-version: '20.x'
194
+ cache: 'npm'
195
+
196
+ - name: Install dependencies
197
+ run: npm ci --production
198
+
199
+ - name: Create package
200
+ run: npm pack
201
+
202
+ - name: Upload package artifact
203
+ uses: actions/upload-artifact@v3
204
+ with:
205
+ name: npm-package
206
+ path: '*.tgz'
207
+
208
+ # Docker Build (for containerized deployments)
209
+ docker:
210
+ name: Docker Build & Scan
211
+ runs-on: ubuntu-latest
212
+ if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
213
+ steps:
214
+ - name: Checkout code
215
+ uses: actions/checkout@v4
216
+
217
+ - name: Set up Docker Buildx
218
+ uses: docker/setup-buildx-action@v3
219
+
220
+ - name: Build Docker image
221
+ uses: docker/build-push-action@v5
222
+ with:
223
+ context: .
224
+ push: false
225
+ tags: mastercontroller:${{ github.sha }}
226
+ cache-from: type=gha
227
+ cache-to: type=gha,mode=max
228
+
229
+ - name: Scan Docker image with Trivy
230
+ uses: aquasecurity/trivy-action@master
231
+ with:
232
+ image-ref: mastercontroller:${{ github.sha }}
233
+ format: 'sarif'
234
+ output: 'trivy-results.sarif'
235
+
236
+ - name: Upload Trivy results to GitHub Security
237
+ uses: github/codeql-action/upload-sarif@v2
238
+ if: always()
239
+ with:
240
+ sarif_file: 'trivy-results.sarif'
241
+
242
+ # Publish to NPM (on release)
243
+ publish:
244
+ name: Publish to NPM
245
+ runs-on: ubuntu-latest
246
+ needs: [build]
247
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
248
+ steps:
249
+ - name: Checkout code
250
+ uses: actions/checkout@v4
251
+
252
+ - name: Setup Node.js
253
+ uses: actions/setup-node@v4
254
+ with:
255
+ node-version: '20.x'
256
+ registry-url: 'https://registry.npmjs.org'
257
+ cache: 'npm'
258
+
259
+ - name: Install dependencies
260
+ run: npm ci
261
+
262
+ - name: Publish to NPM
263
+ run: npm publish
264
+ env:
265
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
266
+
267
+ # Code Coverage Report
268
+ coverage:
269
+ name: Code Coverage Report
270
+ runs-on: ubuntu-latest
271
+ needs: [test]
272
+ steps:
273
+ - name: Checkout code
274
+ uses: actions/checkout@v4
275
+
276
+ - name: Setup Node.js
277
+ uses: actions/setup-node@v4
278
+ with:
279
+ node-version: '20.x'
280
+ cache: 'npm'
281
+
282
+ - name: Install dependencies
283
+ run: npm ci
284
+
285
+ - name: Generate coverage report
286
+ run: npm run coverage --if-present
287
+ continue-on-error: true
288
+
289
+ - name: Upload coverage report
290
+ uses: actions/upload-artifact@v3
291
+ if: always()
292
+ with:
293
+ name: coverage-report
294
+ path: coverage/
295
+
296
+ - name: Comment PR with coverage
297
+ uses: codecov/codecov-action@v3
298
+ if: github.event_name == 'pull_request'
299
+ with:
300
+ token: ${{ secrets.CODECOV_TOKEN }}
301
+
302
+ # Notify on failure
303
+ notify:
304
+ name: Notify on Failure
305
+ runs-on: ubuntu-latest
306
+ needs: [lint, security, test, build]
307
+ if: failure()
308
+ steps:
309
+ - name: Send Slack notification
310
+ uses: 8398a7/action-slack@v3
311
+ if: always()
312
+ with:
313
+ status: ${{ job.status }}
314
+ text: 'MasterController CI/CD pipeline failed'
315
+ webhook_url: ${{ secrets.SLACK_WEBHOOK }}
316
+ env:
317
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "none",
4
+ "singleQuote": true,
5
+ "printWidth": 100,
6
+ "tabWidth": 4,
7
+ "useTabs": false,
8
+ "arrowParens": "always",
9
+ "endOfLine": "lf"
10
+ }