File tree Expand file tree Collapse file tree 3 files changed +20
-24
lines changed Expand file tree Collapse file tree 3 files changed +20
-24
lines changed Original file line number Diff line number Diff line change 1616 with :
1717 node-version : 20
1818 registry-url : https://registry.npmjs.org/
19- - run : npm ci
20- - run : npm test
21- - run : npm run build
22- - run : npm publish
19+ cache : " npm"
20+ - name : Install dependencies
21+ run : npm ci
22+ - name : Run tests
23+ run : npm test
24+ - name : Build package
25+ run : npm run build
26+ - name : Check package version matches release
27+ run : |
28+ PKG_VERSION=$(node -p "require('./package.json').version")
29+ GITHUB_REF_VERSION=${GITHUB_REF#refs/tags/v}
30+ if [ "$PKG_VERSION" != "$GITHUB_REF_VERSION" ]; then
31+ echo "::error::Package version ($PKG_VERSION) does not match release tag ($GITHUB_REF_VERSION)"
32+ exit 1
33+ fi
34+ - name : Publish to NPM
35+ run : npm publish --provenance --access public
2336 env :
2437 NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
Original file line number Diff line number Diff line change 1212 " algorithm"
1313 ],
1414 "scripts" : {
15- "test" : " vitest run" ,
15+ "test" : " vitest run | pino-pretty " ,
1616 "test:watch" : " vitest watch" ,
1717 "build" : " tsc && chmod u+x build/index.js" ,
1818 "start" : " node build/index.js" ,
Original file line number Diff line number Diff line change 11import { pino } from "pino" ;
22
3- const prodConfig = {
3+ const logger = pino ( {
44 level : "info" ,
55 formatters : {
66 level : ( label : string ) => ( { level : label . toUpperCase ( ) } )
77 } ,
88 timestamp : ( ) => `,"timestamp":"${ new Date ( ) . toISOString ( ) } "` ,
99 messageKey : "message" ,
1010 nestedKey : "payload"
11- } ;
12-
13- const devConfig = {
14- level : "debug" ,
15- transport : {
16- target : "pino-pretty" ,
17- options : {
18- colorize : true ,
19- translateTime : "SYS:yyyy-mm-dd HH:MM:ss.l" ,
20- ignore : "pid,hostname" ,
21- messageKey : "message"
22- }
23- }
24- } ;
25-
26- const logger = pino (
27- process . env . NODE_ENV === "production" ? prodConfig : devConfig
28- ) ;
11+ } ) ;
2912
3013export default logger ;
You can’t perform that action at this time.
0 commit comments