Skip to content

Commit

Permalink
added build on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
xiduzo committed May 6, 2024
1 parent 8c5052e commit a7e6a41
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/test-build-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Test, Build and Publish

on:
pull_request:
branches:
- 'master'
push:
branches:
- 'master'
Expand All @@ -14,10 +17,27 @@ jobs:
with:
node-version: 16
- run: npm ci

- run: npm test

build-publish-npm:
build:
needs: test
if: github.event.name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci

- run: npm run build:cjs
- run: npm run build:es2015
- run: npm run build:types

publish-npm:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions src/Decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ export function Handler(options: TransformValidateOptions = defaultHandlerOption
}

function transformValidateOrReject<T extends object, V extends object>(cls: ClassConstructor<T>, plain: V, options?: TransformValidateOptions): T {
if ('parse' in cls && typeof cls['parse'] === 'function') {
return transformUsingZod(cls as any, plain)
if ('parse' in cls && typeof (cls as unknown as ZodSchema<T>)['parse'] === 'function') {
return transformUsingZod(cls as unknown as ZodSchema<T>, plain)
}

return transformUsingClassTransformer(cls, plain, options)
Expand Down

0 comments on commit a7e6a41

Please sign in to comment.