Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLorantfy committed Oct 17, 2024
1 parent 7c02bf2 commit 35e2cd8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 11 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,35 @@ jobs:
node-version: 20
cache: 'pnpm'
- run: pnpm install
- run: pnpm test
- run: pnpm build
- name: Build z
run: cd packages/z && pnpm build
- name: Test z
run: cd packages/z && pnpm test
- name: Test nestjs-zod
run: cd packages/nestjs-zod && pnpm test
- name: Build nestjs-zod
run: cd packages/nestjs-zod && pnpm build
- name: Build example app
run: cd packages/example && pnpm run build
- name: Test example app
run: cd packages/example && pnpm run test:e2e

- name: Extract version
id: version
uses: olegtarasov/[email protected]
uses: olegtarasov/[email protected].3
with:
tagRegex: 'v(.*)'

- name: Set version from release
uses: reedyuk/npm-version@1.0.1
uses: reedyuk/npm-version@1.1.1
with:
version: ${{ steps.version.outputs.tag }}
package: 'packages/nestjs-zod'

- name: Create NPM config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
run: cd packages/nestjs-zod && npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to NPM
run: npm publish
run: cd packages/nestjs-zod && npm publish
4 changes: 2 additions & 2 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "nestjs-zod-example",
"version": "0.0.1",
"description": "",
"author": "",
"description": "Example app showing how to use nestjs-zod",
"author": "Ben Lorantfy <[email protected]>",
"private": true,
"license": "UNLICENSED",
"scripts": {
Expand Down
19 changes: 18 additions & 1 deletion packages/example/src/posts/posts.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Body, Controller, Post } from '@nestjs/common';
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { ApiOkResponse } from '@nestjs/swagger';
import { createZodDto } from 'nestjs-zod'
import { z } from 'zod'

Expand All @@ -14,4 +15,20 @@ export class PostsController {
createPost(@Body() body: PostDto) {
return body;
}

@Get()
@ApiOkResponse({ type: [PostDto], description: 'Get all posts' })
getAll() {
return [];
}

@Get(':id')
@ApiOkResponse({ type: PostDto, description: 'Get a post by ID' })
getById(@Param('id') id: string) {
return {
title: 'Hello',
content: 'World',
authorId: 1,
};
}
}
6 changes: 5 additions & 1 deletion packages/nestjs-zod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
],
"sideEffects": false,
"license": "MIT",
"repository": "[email protected]:BenLorantfy/nestjs-zod.git",
"repository": {
"type": "git",
"url": "[email protected]:BenLorantfy/nestjs-zod.git",
"directory": "packages/nestjs-zod"
},
"author": "Evgeny Zakharov <[email protected]>",
"publishConfig": {
"access": "public"
Expand Down
6 changes: 5 additions & 1 deletion packages/z/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
],
"sideEffects": false,
"license": "MIT",
"repository": "[email protected]:BenLorantfy/nestjs-zod.git",
"repository": {
"type": "git",
"url": "[email protected]:BenLorantfy/nestjs-zod.git",
"directory": "packages/z"
},
"author": "Evgeny Zakharov <[email protected]>",
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit 35e2cd8

Please sign in to comment.