From b4e492e582812520e5e5c0df70feeba442da55d0 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 15 Nov 2024 13:51:08 -0600 Subject: [PATCH 1/9] Go crap --- go.sum | 4 ---- 1 file changed, 4 deletions(-) diff --git a/go.sum b/go.sum index 41131327..569f9b1f 100644 --- a/go.sum +++ b/go.sum @@ -179,12 +179,8 @@ github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 h1:vkHw5I/plNdTr435 github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231/go.mod h1:murToZ2N9hNJzewjHBgfFdXhZKjY3z5cYC1VXk+lbFE= github.com/pulumi/esc v0.10.0 h1:jzBKzkLVW0mePeanDRfqSQoCJ5yrkux0jIwAkUxpRKE= github.com/pulumi/esc v0.10.0/go.mod h1:2Bfa+FWj/xl8CKqRTWbWgDX0SOD4opdQgvYSURTGK2c= -github.com/pulumi/pulumi/pkg/v3 v3.138.0 h1:a+MMvCrvsju4YFVYEwPBtcW7XqsEIV3B+FMblisxEkM= -github.com/pulumi/pulumi/pkg/v3 v3.138.0/go.mod h1:xpaeNeKmM2KLafWwm8TlvJGbWtwEwlrK88U6FvXucpY= github.com/pulumi/pulumi/pkg/v3 v3.139.0 h1:vWwAvEL0US8Z6emggo+OI/ZducMq9m9LKCJbEDbERvU= github.com/pulumi/pulumi/pkg/v3 v3.139.0/go.mod h1:LtEg3PKYzbFnAKWFOENGRwGRNBpv16xKtbK+7esiSHU= -github.com/pulumi/pulumi/sdk/v3 v3.138.0 h1:1feN0YU1dHnbNw+cHaenmx3AgU0DEiKQbvjxaGQuShk= -github.com/pulumi/pulumi/sdk/v3 v3.138.0/go.mod h1:PvKsX88co8XuwuPdzolMvew5lZV+4JmZfkeSjj7A6dI= github.com/pulumi/pulumi/sdk/v3 v3.139.0 h1:oBGP58b2Yw1HbPA3LHO/jHmOaVqFSEjw5BXd36ZbPLw= github.com/pulumi/pulumi/sdk/v3 v3.139.0/go.mod h1:PvKsX88co8XuwuPdzolMvew5lZV+4JmZfkeSjj7A6dI= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= From 739474a4fb0fde36b8947386deda9085d5ad9de1 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 15 Nov 2024 13:51:33 -0600 Subject: [PATCH 2/9] Init zod project # Conflicts: # bun.lockb --- packages/zod2uml/index.ts | 1 + packages/zod2uml/package.json | 11 +++++++++++ packages/zod2uml/tsconfig.json | 27 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 packages/zod2uml/index.ts create mode 100644 packages/zod2uml/package.json create mode 100644 packages/zod2uml/tsconfig.json diff --git a/packages/zod2uml/index.ts b/packages/zod2uml/index.ts new file mode 100644 index 00000000..f67b2c64 --- /dev/null +++ b/packages/zod2uml/index.ts @@ -0,0 +1 @@ +console.log("Hello via Bun!"); \ No newline at end of file diff --git a/packages/zod2uml/package.json b/packages/zod2uml/package.json new file mode 100644 index 00000000..5d8c8f04 --- /dev/null +++ b/packages/zod2uml/package.json @@ -0,0 +1,11 @@ +{ + "name": "zod2uml", + "module": "index.ts", + "type": "module", + "devDependencies": { + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } +} \ No newline at end of file diff --git a/packages/zod2uml/tsconfig.json b/packages/zod2uml/tsconfig.json new file mode 100644 index 00000000..238655f2 --- /dev/null +++ b/packages/zod2uml/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } +} From 056e42151f30039fc2143979de49ac0dda8b6d3f Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 15 Nov 2024 14:54:48 -0600 Subject: [PATCH 3/9] Add zod --- packages/zod2uml/index.ts | 6 +++++- packages/zod2uml/package.json | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/zod2uml/index.ts b/packages/zod2uml/index.ts index f67b2c64..96b2ddd4 100644 --- a/packages/zod2uml/index.ts +++ b/packages/zod2uml/index.ts @@ -1 +1,5 @@ -console.log("Hello via Bun!"); \ No newline at end of file +import { z } from 'zod'; + +const tmp = z.object({ + thing: z.string(), +}); diff --git a/packages/zod2uml/package.json b/packages/zod2uml/package.json index 5d8c8f04..cd15fb3d 100644 --- a/packages/zod2uml/package.json +++ b/packages/zod2uml/package.json @@ -1,11 +1,15 @@ { "name": "zod2uml", + "license": "GPL-3.0-only", "module": "index.ts", "type": "module", + "dependencies": { + "zod": "^3.23.8" + }, "devDependencies": { "@types/bun": "latest" }, "peerDependencies": { "typescript": "^5.0.0" } -} \ No newline at end of file +} From 878a000372cb77e4e47e77b33b8a24be91e0387b Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 15 Nov 2024 20:08:45 -0600 Subject: [PATCH 4/9] Update lockfile --- bun.lockb | Bin 65012 -> 66476 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bun.lockb b/bun.lockb index d26b45ef393fc2704a3d545f31192627bb21d836..9783e2e2eff03d244f0b06416c74900c713c28ea 100755 GIT binary patch delta 9641 zcmeHNX;f85wmx+M<$z31aJY=lkuYBIq9|8P93p}kW015H$W>8sU{aDGV1hAAeGc2a zmKb6%u^n(i9HWQ|8gWQk+e9%j32`N++i3J@+Nf=O-#&w~?6i4ry|>%=KO%?O*IqW3{nX{Dnez}zY4i4Xy&BpGqUZH^o`C>%$%MPnm1G01tl)8 z1f^Wjwx|*u3(i21E$@R~xS^@`f_xsqcJN$2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aOmys%VZCu6Za zU%genZ0w(A{GnQ!L)kkpGdpV%MR|r$573+yjfv=Zk{#;R7x z$ye{*df9bT)3vkpASyhC47KXt@qEW6JayiG+i|qxK<4&MRE_@LuU~I{a`39Pq-T4y z8>#WY?5X4F_C`$f(_1??jq{XKqm4g0;jZJO`2L}4x-H26Odqk92AomER(j@)V)1_7 zYui74%lWXZ4f-*Wgy@Z?-<)~$d>YaJAJ1nPg`Q2*$4c^k!^^C;6l`pc$99Rc+4&-p z9zDJyDk$wdpZ`s;HJD=0ah!9`rHL!F>zso1ISa`|x_i!U@qR~~aJ=W&N=4UnL=JJ~ zG49(4_r;=pLUUoVnbw?FEZ&cVi8nGPS(ooQ>kG#c9o#95E}mDCydM>RefiMRx;fv? zy5H{o>=+U_@VY6gVbJ{+Cq-UR1g_YNikL^47ZiHxVxnF%Es3E`7ZWT$&(4k_$<~XL z7cXCbK)0o|;ewLn{qVRfcKp&Vd-^5gG)usg5^TM_pCaX=z9+uTeC;4wl57dRaL}!! z<_n7DAGd1`nO4Tq`1(-~aRbSy`C+EIdZlIbIe3Ipb&kHMA4uIU#fdM-c}cZ=5vhOj zT+ln|oR}Sar`}MEzAaJBrJR~B@1@7A>LSEppX{<}ugnnERd Date: Sat, 16 Nov 2024 23:53:31 -0600 Subject: [PATCH 5/9] It kinda works --- Makefile | 3 ++ bun.lockb | Bin 66476 -> 67020 bytes packages/zod/index.ts | 19 ++++++++++++ packages/zod/package.json | 15 ++++++++++ packages/zod/testdata/zod.ts | 7 +++++ packages/zod/tsconfig.json | 27 +++++++++++++++++ packages/zod2uml/index.ts | 54 +++++++++++++++++++++++++++++++--- packages/zod2uml/package.json | 9 +++--- 8 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 packages/zod/index.ts create mode 100644 packages/zod/package.json create mode 100644 packages/zod/testdata/zod.ts create mode 100644 packages/zod/tsconfig.json diff --git a/Makefile b/Makefile index bb6cd175..6fd80476 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,9 @@ bin/ux: $(shell $(DEVOPS) list --go --exclude-tests) bin/uml2ts: $(shell $(DEVOPS) list --ts --exclude-tests) bun build --cwd packages/uml2ts index.ts --compile --outfile ${WORKING_DIR}/$@ +bin/zod2uml: $(shell $(DEVOPS) list --ts --exclude-tests) + bun build --cwd packages/zod2uml index.ts --compile --outfile ${WORKING_DIR}/$@ + bin/devops: $(shell $(DEVOPS) list --go --exclude-tests) go -C cmd/devops build -o ${WORKING_DIR}/$@ diff --git a/bun.lockb b/bun.lockb index 9783e2e2eff03d244f0b06416c74900c713c28ea..537901f0eeb2acc5891814c7a8a0b5345dc388cc 100755 GIT binary patch delta 9545 zcmeHNd3aPsw!hU$humx=1d`k|S(?otS-TTDkdO-ujtB%o5V0A=>5wKwvp^O|h%sRi zP}%hOsh|SE1!WZjh^)c{kR=2h^%+J~{8W6h$$M_N@qXtnfQ~xfH}9|aKI`Mxr_QNU zr%s(ZRrlr=>*xC(d)Rkra&K?&H)Fj$zumqm`p`=|XZbX>q|AEUG9dj)&zR}E%kN*8 znQavkmyM5%i))y^UaK2FL6X$C5cM$7C}_olUInj!dMitc%c>-))K`)Mz)v#hC4;&R zy4Wg7p=dAhPA_A#bHTIzG=tWG%HRvV-l<6q#g)=(4Ac>VJQ(1H`#b3TN1)vCEzl6q zA!ug@<3M|YhJmuYxH74zq`W|S5}jG!5Ar~k7nPM)cqQq3ADy3ETvnJ=JymLh61TU2 zQkCf3&;pJH=b*@*kHsi#=w5H_be_Rc@Z3JR#8Xw}EtKAa9y{!gZpe8eD_{ij=*E{I=nO%jx1hQR3Z<1i ztR$@F(gI$gf(11ou}Cy4ls=XWe+!layWR=JP6-rtUo7MxG{#AXy(}F7-l#( zS|q6l^v|MS9O&cVF;wH@;CY2z;}Bt^v0exF_qZRpH?)Wqv^*aOOZ zL4{|M7b}oq*X4DfoM)||+-~MmVR40)c=NjH@)p?RmGFZwS@^^LEdtN| z4gVS%c_DbGnGXDN;M168ceI;&C&BXsH}}FEKwkjm0jnn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M@!y`!IOsCT~_fucQf!l4*_TNCD)%)Pz)KKFB{a=7>%-8ih$(cNvl zt!93Zsj4 z>(q8t#pfDEnSf#rcp_!jW#FgsO?3|OGIe-I6>rhaI#q0@u!ECDEtMTq#VPvzL5H|V zjRzfavj?TUn`E~h0z+OncX8y=gKN>C19nG)t!UUG2YyK3_pU0OwBnFu!gM-`_+a`P z-zTa6UR8WZPvJY7f~r+|X>U7wj?H+H*zbR-V$inS7JVv`;!^OJGS%*N*sWL2*?Yco z+WI_RiF}MSt{495=QhMM)B|55?xOM4YKrxYIcoTsjIsaO@R{DC?j6=cXTyv0{KMoA zX3GM}afvWn8EvR`;B5U2ZSABR)fsl{tulUH+Ws#W<;+JbD9SeOM-$)65L;=>d#d=H z7VHb5^Y3*KWX{P`<$ygPo>)5oPQ%${61av7L_Z%Mgnxa=&V~9uza<53E)X z*M^{nWTS^6G2%suNLw)h5nfu3ULQ-|00$}Z(Sdn|J01d6nWlJyntqKE3$h=1q0%TR4-CVgF}p`3VhenrwyvzdVhWB>i#W<15>6zOQ*3e zawzDq3a9OH*dg+1JmU9gOjU>5f%7US(0HXV74jj-8slD%Rnx_a|q@Q`LzioX+P@sQ;|vq<`75p}hQP0)?M?q?6Ud{cEA47?%>)iw~V@ zDm$fmcRPuRLwNfneS0e1lcSVyIw9~{q;b7in3{4_%=W*Gq8 diff --git a/packages/zod/index.ts b/packages/zod/index.ts new file mode 100644 index 00000000..1f0e8d72 --- /dev/null +++ b/packages/zod/index.ts @@ -0,0 +1,19 @@ +import type { Field, Spec, Type } from '@unmango/tdl/v1alpha1/tdl'; +import { create } from '@unmango/tdl/spec'; +import { ZodObject, ZodType, type ZodSchema } from 'zod'; + +type Schema = Record; + +export function parse(schema: Schema): Spec { + if (schema instanceof ZodObject) { + return create({ + name: schema._def.description, + }); + } + + return create(); +} + +export function parseObject(name: string, schema: ZodType): Spec { + return create({ name }); +} diff --git a/packages/zod/package.json b/packages/zod/package.json new file mode 100644 index 00000000..eb6c2bd3 --- /dev/null +++ b/packages/zod/package.json @@ -0,0 +1,15 @@ +{ + "name": "@unmango/2zod", + "module": "index.ts", + "type": "module", + "dependencies": { + "@unmango/tdl": "workspace:*", + "zod": "^3.23.8" + }, + "devDependencies": { + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } +} diff --git a/packages/zod/testdata/zod.ts b/packages/zod/testdata/zod.ts new file mode 100644 index 00000000..f02e110b --- /dev/null +++ b/packages/zod/testdata/zod.ts @@ -0,0 +1,7 @@ +import { z } from 'zod'; + +const schema = z.object({ + thing: z.string(), +}).describe('test'); + +export default schema; diff --git a/packages/zod/tsconfig.json b/packages/zod/tsconfig.json new file mode 100644 index 00000000..238655f2 --- /dev/null +++ b/packages/zod/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } +} diff --git a/packages/zod2uml/index.ts b/packages/zod2uml/index.ts index 96b2ddd4..99727a77 100644 --- a/packages/zod2uml/index.ts +++ b/packages/zod2uml/index.ts @@ -1,5 +1,51 @@ -import { z } from 'zod'; +import { parse, parseObject } from '@unmango/2zod'; +import * as fs from 'fs/promises'; +import * as path from 'path'; +import { z, type ZodTypeAny } from 'zod'; -const tmp = z.object({ - thing: z.string(), -}); +if (process.argv.length !== 3) { + console.log('path to zod schema definition script is required'); + process.exit(1); +} + +const schemaPath = process.argv[2]; +if (!await fs.exists(schemaPath)) { + console.log('not found: %s', schemaPath); + process.exit(1); +} + +const module = z.record(z.string(), z.unknown()); +const exports = module.parse(await import(schemaPath)); + +if (exports.default) { + if (!isZod(exports.default)) { + console.log('default export was not a supported zod type'); + process.exit(1); + } + + const ext = path.extname(schemaPath); + const name = path.basename(schemaPath, ext); + const spec = parseObject(name, exports.default); + console.log(JSON.stringify(spec)); +} else { + const schemas: Record = {}; + for (const [k, v] of Object.entries(exports)) { + if (!isZod(v)) { + console.log('exported member %s was not a supported zod type'); + process.exit(1); + } + + schemas[k] = v; + } + + const spec = parse(schemas); + console.log(JSON.stringify(spec)); +} + +function isZod(x: unknown): x is ZodTypeAny { + if (!x?.constructor.name) { + return false; + } + + return ['ZodObject'].includes(x.constructor.name); +} diff --git a/packages/zod2uml/package.json b/packages/zod2uml/package.json index cd15fb3d..e8d6db3f 100644 --- a/packages/zod2uml/package.json +++ b/packages/zod2uml/package.json @@ -1,15 +1,16 @@ { "name": "zod2uml", - "license": "GPL-3.0-only", + "license": "GPL-3.0-only", "module": "index.ts", "type": "module", "dependencies": { + "@unmango/2zod": "workspace:*", "zod": "^3.23.8" }, "devDependencies": { "@types/bun": "latest" }, - "peerDependencies": { - "typescript": "^5.0.0" - } + "peerDependencies": { + "typescript": "^5.0.0" + } } From 7b2f9dd0d47073ebe1d9976264f93d0a80f90299 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Sat, 16 Nov 2024 23:57:34 -0600 Subject: [PATCH 6/9] Make targets --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6fd80476..e0c9e211 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,11 @@ else TEST_FLAGS := --github-output --race --trace endif -build: generate bin/ux bin/devops .make/buf_build packages/tdl/dist packages/ts/dist +build: generate .make/buf_build build_go build_ts + +build_go: bin/ux bin/devops +build_ts: bin/uml2ts bin/zod2uml packages/tdl/dist packages/ts/dist + test: .make/go_test .make/ts_test generate: ${GO_PB_SRC} docker: .make/docker_ux .make/docker_uml2ts From 24eb99f309b3cfbf8397f1e94559ac37cb352aa4 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Sat, 16 Nov 2024 23:58:13 -0600 Subject: [PATCH 7/9] Release the bin --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34fdc645..c96dd839 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,6 +34,7 @@ jobs: matrix: tool: - uml2ts + - zod2uml target: - bun-linux-x64 - bun-linux-arm64 From 57d824d44b737892932113243f96d61a38a90c82 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Sun, 17 Nov 2024 00:05:52 -0600 Subject: [PATCH 8/9] New docker image and docker fixes --- .github/workflows/ci.yml | 1 + Makefile | 6 +++++- docker/uml2ts/Dockerfile | 2 ++ docker/zod2uml/.dockerignore | 22 ++++++++++++++++++++ docker/zod2uml/Dockerfile | 39 ++++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 docker/zod2uml/.dockerignore create mode 100644 docker/zod2uml/Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 989eedd7..d60317c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: tool: - ux - uml2ts + - zod2uml steps: - uses: actions/checkout@v4 - uses: ./.github/actions/build-docker diff --git a/Makefile b/Makefile index e0c9e211..39c4a311 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ build_ts: bin/uml2ts bin/zod2uml packages/tdl/dist packages/ts/dist test: .make/go_test .make/ts_test generate: ${GO_PB_SRC} -docker: .make/docker_ux .make/docker_uml2ts +docker: .make/docker_ux .make/docker_uml2ts .make/docker_zod2uml format: .make/dprint .make/go_fmt .make/buf_format lint: .make/buf_lint .make/go_lint tidy: go.sum @@ -110,6 +110,10 @@ go.sum: go.mod ${GO_SRC} docker build -f docker/uml2ts/Dockerfile -t uml2ts ${WORKING_DIR} @touch $@ +.make/docker_zod2uml: ${TS_SRC} $(wildcard docker/zod2uml/*) + docker build -f docker/zod2uml/Dockerfile -t zod2uml ${WORKING_DIR} + @touch $@ + .make/go_test: ${GO_SRC} | bin/ginkgo bin/ux bin/uml2ts $(GINKGO) run ${TEST_FLAGS} $(sort $(dir $?)) @touch $@ diff --git a/docker/uml2ts/Dockerfile b/docker/uml2ts/Dockerfile index 0b110ce9..2e96368b 100644 --- a/docker/uml2ts/Dockerfile +++ b/docker/uml2ts/Dockerfile @@ -12,6 +12,8 @@ COPY package.json . COPY packages/tdl/package.json packages/tdl/ COPY packages/ts/package.json packages/ts/ COPY packages/uml2ts/package.json packages/uml2ts/ +COPY packages/zod/package.json packages/zod/ +COPY packages/zod2uml/package.json packages/zod2uml/ COPY bun.lockb . RUN bun install --frozen-lockfile --production diff --git a/docker/zod2uml/.dockerignore b/docker/zod2uml/.dockerignore new file mode 100644 index 00000000..34d728dd --- /dev/null +++ b/docker/zod2uml/.dockerignore @@ -0,0 +1,22 @@ +node_modules +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE +.vscode +Makefile +.env +.editorconfig +.idea +coverage* +.config +.github +.make +cli +docker +pkg +proto +src diff --git a/docker/zod2uml/Dockerfile b/docker/zod2uml/Dockerfile new file mode 100644 index 00000000..328f8c72 --- /dev/null +++ b/docker/zod2uml/Dockerfile @@ -0,0 +1,39 @@ +# syntax=docker/dockerfile:1 +FROM --platform=$BUILDPLATFORM oven/bun:1.1.34 AS base +ARG BUILDPLATFORM +WORKDIR /build + +FROM --platform=$BUILDPLATFORM base AS install + +RUN mkdir -p gen/proto/{es,ts} packages/{ts,uml,uml2ts} + +# Need everything because the lockfile references everything +COPY package.json . +COPY packages/tdl/package.json packages/tdl/ +COPY packages/ts/package.json packages/ts/ +COPY packages/uml2ts/package.json packages/uml2ts/ +COPY packages/zod/package.json packages/zod/ +COPY packages/zod2uml/package.json packages/zod2uml/ +COPY bun.lockb . + +RUN bun install --frozen-lockfile --production + +FROM --platform=$BUILDPLATFORM install AS build +COPY --from=install /build/node_modules . + +COPY packages/tdl/ packages/tdl/ +COPY packages/zod/ packages/zod/ +COPY packages/zod2uml/ . + +RUN bun build \ + --compile \ + --minify \ + --sourcemap ./index.ts \ + --outfile ./dist/zod2uml + +FROM --platform=$BUILDPLATFORM ubuntu:noble-20241015 AS test +COPY --from=build /build/dist/zod2uml . + +FROM --platform=$BUILDPLATFORM oven/bun:1.1.34-distroless +COPY --from=build /build/dist/zod2uml /bin/ +ENTRYPOINT ["/bin/zod2uml"] From b574f82baec5b0e50339a48eb0a7b3db637d3183 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Sun, 17 Nov 2024 00:06:19 -0600 Subject: [PATCH 9/9] And this one too --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c96dd839..3d91bda9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,7 @@ jobs: tool: - ux - uml2ts + - zod2uml steps: - uses: actions/checkout@v4 - uses: ./.github/actions/build-docker