File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 2828
2929 - name : Build
3030 run : npm run build
31+
32+ - name : Smoke test
33+ run : node smoke.js
Original file line number Diff line number Diff line change 4343 - name : Unit Tests
4444 run : pnpm test
4545
46+ - name : Smoke test
47+ run : node smoke.js
48+
4649 - name : Semantic Release
4750 run : npx semantic-release
4851 env :
Original file line number Diff line number Diff line change 1+ const fs = require ( "fs" ) ;
2+ const path = require ( "path" ) ;
3+
4+ const root = __dirname ;
5+ const files = {
6+ json : path . join ( root , "dist" , "openapi.json" ) ,
7+ yaml : path . join ( root , "dist" , "openapi.yaml" ) ,
8+ ts : path . join ( root , "openapi.ts" ) ,
9+ } ;
10+
11+ let failed = false ;
12+
13+ // JSON parse check
14+ try {
15+ JSON . parse ( fs . readFileSync ( files . json , "utf8" ) ) ;
16+ console . log ( "OK: openapi.json is valid JSON" ) ;
17+ } catch ( e ) {
18+ console . error ( "FAIL: openapi.json is not valid JSON:" , e . message ) ;
19+ failed = true ;
20+ }
21+
22+ // YAML basic structure check
23+ try {
24+ const yaml = fs . readFileSync ( files . yaml , "utf8" ) ;
25+ if ( ! yaml . includes ( "openapi:" ) ) throw new Error ( "Missing openapi: key" ) ;
26+ console . log ( "OK: openapi.yaml has valid structure" ) ;
27+ } catch ( e ) {
28+ console . error ( "FAIL: openapi.yaml:" , e . message ) ;
29+ failed = true ;
30+ }
31+
32+ // TypeScript file exists and is non-empty
33+ try {
34+ const ts = fs . readFileSync ( files . ts , "utf8" ) ;
35+ if ( ts . length === 0 ) throw new Error ( "File is empty" ) ;
36+ console . log ( "OK: openapi.ts is non-empty" ) ;
37+ } catch ( e ) {
38+ console . error ( "FAIL: openapi.ts:" , e . message ) ;
39+ failed = true ;
40+ }
41+
42+ if ( failed ) process . exit ( 1 ) ;
You can’t perform that action at this time.
0 commit comments