ryoppippi / unplugin-typia

unplugin for Typia with an extra Bun plugin 🫶
https://jsr.io/@ryoppippi/unplugin-typia
MIT License
27 stars 5 forks source link

Not generated when ran with esbuild and Github Action #163

Closed slainless closed 1 week ago

slainless commented 3 weeks ago

Checkout: https://github.com/slainless/prodeskel-ws/blob/master/.github/workflows/jsr.yml

Not generated in JSR build: https://jsr.io/@slainless/prodeskel-ws/0.1.3/dist/core/index.js#L20 Compared to: https://github.com/slainless/prodeskel-ws/blob/master/src/core/index.ts#L31

Summary:

ryoppippi commented 3 weeks ago

OK, it does not work on my local env too. Hmm let me check

ryoppippi commented 3 weeks ago

idk, but this project is too complex. Why you have so many tsconfig.json.

I also added tsconfig options to unplugin-typia instance, but not works. tsc and typia generate works fine.

idk

ryoppippi commented 3 weeks ago

idk why it is not works for esbuild, but when I tested with bun build script, it works.

If you really want to use esbuild, you can keep this issue.

Otherwise, use this script instead

import dts from 'bun-plugin-dts-auto'
import UnpluginTypia from '@ryoppippi/unplugin-typia/bun'
import { $ } from 'bun'

await $`rm -rf dist`

const pkgJSON = await Bun.file('./package.json').json()
const dependencies = [
  ...Object.keys(pkgJSON.dependencies || {}),
  ...Object.keys(pkgJSON.devDependencies || {})
]

await Bun.build({
  entrypoints: [
    "./src/core/index.ts",
    "./src/schema/index.ts",
    "./src/browser/index.ts"
  ],
  outdir: "./dist",
  splitting:true,
  target: "browser",
  external: dependencies,
  plugins: [
    UnpluginTypia({ cache: true, log: 'verbose' }), // you can choose whether you use cache or not
    dts()
  ]
});
ryoppippi commented 3 weeks ago

Also, it is better if you use Bun's official GitHub Actions https://bun.sh/guides/runtime/cicd

slainless commented 3 weeks ago

idk why it is not works for esbuild, but when I tested with bun build script, it works.

Actually, I have also tested doing the bundling via Bun and it's generated as expected. So my guess, it's either:

But it's still an early guess since I haven't tried using other bundler or reproducing this issue in simpler repository to prove esbuild + unplugin-typia combination to be not working as expected.

Anyway, thanks for the response. Will switch out from esbuild for the time being.

ryoppippi commented 2 weeks ago

@slainless Hi! I updated some dependencies, I released a new version of unplugin-typia and typia

Have you ever tested? Is build result same?

If you stop using esbuild, I'd like to close this issue and wait for someone to open this issue again!

ryoppippi commented 1 week ago

@slainless If you need any further support, please open this issue