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 16
16
with :
17
17
node-version : 20
18
18
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
23
36
env :
24
37
NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
Original file line number Diff line number Diff line change 12
12
" algorithm"
13
13
],
14
14
"scripts" : {
15
- "test" : " vitest run" ,
15
+ "test" : " vitest run | pino-pretty " ,
16
16
"test:watch" : " vitest watch" ,
17
17
"build" : " tsc && chmod u+x build/index.js" ,
18
18
"start" : " node build/index.js" ,
Original file line number Diff line number Diff line change 1
1
import { pino } from "pino" ;
2
2
3
- const prodConfig = {
3
+ const logger = pino ( {
4
4
level : "info" ,
5
5
formatters : {
6
6
level : ( label : string ) => ( { level : label . toUpperCase ( ) } )
7
7
} ,
8
8
timestamp : ( ) => `,"timestamp":"${ new Date ( ) . toISOString ( ) } "` ,
9
9
messageKey : "message" ,
10
10
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
+ } ) ;
29
12
30
13
export default logger ;
You can’t perform that action at this time.
0 commit comments