-
Notifications
You must be signed in to change notification settings - Fork 11
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
what is the equivalent of nodir
?
#51
Comments
|
it is an option as can be seen in this
I did try to remove it completely as mentioned above, but it still fails and it also fails with oh I also noticed another issue which is even worst, I have some code to cleanup temp folders via an npm script and is also an option Lerna-Lite itself and that also is failing, in fact it goes into an infinite loop 😨 But that was working fine with import { removeSync } from 'fs-extra/esm';
import { join as pathJoin } from 'node:path';
import normalizePath from 'normalize-path';
import tempDir from 'temp-dir';
import { glob } from 'tinyglobby';
glob(normalizePath(pathJoin(tempDir, '/lerna-*')), { onlyDirectories: true })
.then((deleteFolders) => {
// silently delete all files/folders that startsWith "lerna-"
console.log(`Found ${deleteFolders.length} temp folders to cleanup.`);
(deleteFolders || []).forEach((folder) => removeSync(folder));
})
.catch((error) => {
console.error('Error occurred while cleaning up temp folders:', error);
}); it's supposed to delete folders like below but the script doesn't find anything, neither stops which is bad I wonder if in both cases the pattern has to be changed or is invalid compare to previous |
can you give me the exact pattern that fails?
try using |
nope that doesn't seem to help and this is rather quick with globby (1-2sec) but infinite loop with tinyglobby. here's the console log of the normalize path which is provided as the glob pattern
|
can reproduce, seems like the root inferrer sets the root at |
is the pattern you're using in the first comment (the one from lerna-lite) an absolute path? if so it might be caused by the same issue |
okay i see the issue in the temp directory thing. since the cwd isn't explicitly set, it defaults to import { removeSync } from 'fs-extra/esm';
import { join as pathJoin } from 'node:path';
import normalizePath from 'normalize-path';
import tempDir from 'temp-dir';
import { glob } from 'tinyglobby';
glob(normalizePath(pathJoin(tempDir, '/lerna-*')), { absolute: true, cwd: tempDir, onlyDirectories: true })
.then((deleteFolders) => {
// silently delete all files/folders that startsWith "lerna-"
console.log(`Found ${deleteFolders.length} temp folders to cleanup.`);
(deleteFolders || []).forEach((folder) => removeSync(folder));
})
.catch((error) => {
console.error('Error occurred while cleaning up temp folders:', error);
}); |
the code from the 1st question was created by another user, not the original author, and it was documented in this comment and I'm just trying to replace globby with tinyglobby, the original code had this
yes you're right for the 2nd one, that works :) |
ahhh I found my issue for the 1st question, I had a mock on globby but didn't rename it well for tinyglobby, then if I rename it properly it now works.. So it looks like I'm all good to proceed with the switch :) const { globMock } = vi.hoisted(() => ({ globMock: vi.fn() }));
- vi.mock('glob', async () => ({
+ vi.mock('tinyglobby', async () => ({
...(await vi.importActual<any>('tinyglobby')),
globSync: globMock,
})); Thanks a lot for the help and making the globbing world much faster and smaller 🚀 |
Hello, I'm trying to migrate from
globby
totinyglobby
in Lerna-Lite, I was waiting for the missing optionfollowSymbolicLinks
before switching which you just reloeased today (great) but I'm getting 1 unit test failure that used thenodir
withglobby
, it doesn't look liketinyglobby
supports that option and I tried to useonlyDirectories: false
instead but that doesn't help (I also triednodir
nonetheless and failed, and I also even tried to remove the option completely but again it also failed). Here's my Lerna-Lite PR to do the switch, and my unit test file.Here's my previous code (in my Lerna-Lite
make-diff-predicate.ts
file)and here's what I tried
You can see my unit test failure in this CI PR workflow
It looks like it's the only failure that I have before being to switch to tinyglobby, any help would be super appreciate. Thanks :)
The text was updated successfully, but these errors were encountered: