Menci / vite-plugin-top-level-await

Transform code to support top-level await in normal browsers for Vite.
MIT License
272 stars 15 forks source link

Avoid publishing test files #54

Closed bluwy closed 3 months ago

bluwy commented 4 months ago

A small issue I noticed is that the *.spec.js and *.spec.d.ts files are published to npm. It would be nice to remove them to keep the package lean. I tried configuring files or .npmignore to remove them, but they don't seem to work in yarn v1. Perhaps we can move to plain npm or pnpm or upgrade yarn?

Feel free to close this if you don't think this is a big issue though.

Menci commented 3 months ago

I having used yarn v2 or pnpm in my own projects before. PRs welcomed!

Menci commented 3 months ago

BTW, I'm sure that files and .npmignore are support in yarn v1. How they work differently in yarn v2 or pnpm?

bluwy commented 3 months ago

files doesn't work in that if I add files: [..., "!dist/*.spec.js"], it simply includes all files that passes that glob pattern instead of filtering out from the existing captured files, or even if I specified the full path.

.npmignore have no effect and seems like reported at https://github.com/yarnpkg/yarn/issues/685

It looks like CI is testing against node 14, so switch the package manager to latest npm/yarn/pnpm, could be tricky. Maybe swapping out the publish step to use npm is enough though, so we keep the existing setup in place.

bluwy commented 3 months ago

Actually, the npm-publish action used always uses npm to publish. For some reason I thought it would use yarn or the existing preferred one. Anyways I could simply update the files then and it should work

bluwy commented 3 months ago

Thanks for publishing it, but for some reason now the readme at https://www.npmjs.com/package/vite-plugin-top-level-await/v/1.4.4 is blank 🥲 But the code tab, still shows that README.md exists. I'm not sure what's going on, maybe the README.md needs to explicitly be in the files now, but it doesn't quite make sense. (Or maybe we should leave it a couple hours in case something's up with npm's cache)

Menci commented 3 months ago

Seems the README is good now