ctix icon indicating copy to clipboard operation
ctix copied to clipboard

skipEmptyDir doesn't work?

Open Samuel-Morgan-Tyghe opened this issue 1 year ago • 3 comments

If i have a parentfolder of childfolders then it should create an index.ts file on that level?

If this isn't the intended purpose of skipEmptyDir can we add one to make it backwards compatible with create-ts-index.

It's a migration blocker

Samuel-Morgan-Tyghe avatar Oct 30 '24 08:10 Samuel-Morgan-Tyghe

@Samuel-Morgan-Tyghe Hi,

Can you provide reproducable repo?

imjuni avatar Nov 08 '24 04:11 imjuni

@imjuni https://codesandbox.io/p/devbox/j3mn67?migrateFrom=y9x7nm

Samuel-Morgan-Tyghe avatar Nov 11 '24 15:11 Samuel-Morgan-Tyghe

In the sandbox i have added "skipEmptyDir":false, which i assume makes an index.ts file for every directory including empty ones.

previous cti would create an index file in both /src/ and /src/components despite not exporting anything from these folders

usecase should be

i should be able to breakdown by folders IE @Src/components = src/components/index.ts that imports/exports src/components/firstcomponent/index.ts +src/components/secondcomponent/index.ts

Samuel-Morgan-Tyghe avatar Nov 11 '24 15:11 Samuel-Morgan-Tyghe

@Samuel-Morgan-Tyghe Finally, I had time to look into this issue. Thank you for your patience.

I reviewed the reproducible repo you provided, and I found a bug in the create mode behavior.

The skipEmptyDir option itself is working correctly, but there is another problem.

Since ctix detects the directory hierarchy using the glob result, it sometimes misses some directories, so index.ts files are not created in those cases.

In your reproducible repo, I think it will work properly if you add the option "startFrom": "./src". I hope this helps with your issue.

I will continue to investigate the root cause of the problem and apply a fix.

Thank you for your contribution!

imjuni avatar Apr 12 '25 00:04 imjuni

@Samuel-Morgan-Tyghe Hi,

I have released a new version of ctix (v2.7.1) that includes a fix for this issue.

I have tested it here: https://codesandbox.io/p/devbox/skipemptydir-doesnt-work-167-forked-thqc5x

and confirmed that it works as intended.

If the issue still persists, please let me know.

Thank you for your contribution!

imjuni avatar Apr 13 '25 16:04 imjuni