这是indexloc提供的服务,不要输入任何密码
Skip to content

fix: change fast-glob to globby #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2020

Conversation

PabloSzx
Copy link
Contributor

@PabloSzx PabloSzx commented Oct 23, 2020

Right now the globs in the entry points need to be almost hard-coded since fast-glob doesn't expand the directories, but globby does, which actually uses fast-glob inside, and uses the same API, so this is a win-win. You can test this making some folders with depth, like src/a/b/index.ts while also having a src/index.ts, fast-glob won't find them.

And also the dts building using rollup was not preserving the modules structures and they were not actually matching with the normal js building files, just adding preserveModules fixed it.

I also made a published fork with these changes, so you can test them easily.

tsup-globby

@PabloSzx
Copy link
Contributor Author

PabloSzx commented Oct 23, 2020

I found these problems primarily while making a GitHub Action in Linux, while my personal computer is Windows, and I encountered this weird bug that in Windows at least fast-glob respects the ** and recursively gets all the folders, but in Linux that behaviour doesn't happen, and basically doesn't find anything.

I made another branch on the same repo showing the differences, and you can see that fast-glob is working very inconsistently between operative systems.

tsup-globby linux
tsup linux

tsup-globby windows
tsup windows

And I think it's important to point up that the declarations files are not working properly at all, even with preserveModules: true 👎, maybe because some filename collisions

@egoist
Copy link
Owner

egoist commented Oct 25, 2020

So maybe remove preserveModule: true if that doesn't solve the problem?

@PabloSzx
Copy link
Contributor Author

PabloSzx commented Oct 25, 2020

So maybe remove preserveModule: true if that doesn't solve the problem?

@egoist

I agree, but preserveModule tries to solve a different problem which is that without it the intermediate modules are not typed, but anyways, I will remove the preserveModule from this PR, and in my projects I had to stop using --dts and just doing tsc --emitDeclarationOnly

@PabloSzx PabloSzx force-pushed the globby_preserve_modules branch from 413414b to a1e19cf Compare October 25, 2020 14:28
@PabloSzx PabloSzx changed the title change fast-glob to globby & preserveModule dts change fast-glob to globby Oct 25, 2020
@egoist egoist changed the title change fast-glob to globby fix: change fast-glob to globby Oct 25, 2020
@egoist egoist merged commit 1fb78eb into egoist:master Oct 25, 2020
@github-actions
Copy link
Contributor

🎉 This PR is included in version 3.7.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@PabloSzx PabloSzx deleted the globby_preserve_modules branch October 25, 2020 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants