kt3k / packup

📦 Zero-config web application packager for Deno
https://packup.deno.dev/
MIT License
328 stars 18 forks source link

fix(build): ensure the dist files' directories exist before writing them #54

Closed symful closed 1 year ago

symful commented 1 year ago

If files from static folder are in subdirectories, the CLI will error'd. This ensure that the directories of dist files (including from static folder), exist before writing the files.

kt3k commented 1 year ago

(CI issue is irrelevant of this change. I'll fix them and merge this soon)

symful commented 1 year ago

Fixed the code to meet the tests. Also I added flag config (c), it is the path for tsconfig.json. I added this to enable to customize the options of jsx, jsxFragment, jsxFactory, etc. The getter function (located in bundle_util.ts) will first look for deno.json, denoc.json, or tsconfig.json if the flag is not set. I made it so it manually read the config file and manually put the jsx options from the config file to the build function, since it doesn't work if I just put the tsconfig path. I don't know why :/.

I also changed the serve_test.ts to read the output of the command first instead of using new Promise + setTimeout to wait for the cli to serve, to speed up the test.