-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I was having some issues with OneDrive and discovered that it wanted me to rename files or folders called "~". It didn't really give me specifics on where these files were but after searching, I discovered the files in /node_modules\postcss-initial~. I talked to ChatGPT about it and it said it's bad practice to have a file like that in a published npm package. I have no idea if that's correct. But I'd like to report it if it's something that shouldn't be there. The following was suggested by ChatGPT regarding a request to solve the issue of the ~/ folder.
Hi there! 👋
I noticed that the published version of postcss-initial contains a folder structure starting with a literal ~ directory, specifically:
~/.config/configstore/update-notifier-npm.json
This likely came from a script or tool (possibly update-notifier) trying to write to the user's home directory using the path ~/.config/..., but in Node.js, ~ is not automatically expanded to the home directory unless handled explicitly (e.g., via os.homedir()).
As a result, the package ends up containing a physical ~ folder with config data, which causes:
Issues on Windows systems (especially with OneDrive sync)
Unintended files in production node_modules
Confusion or bloat in the package
Suggested Fixes:
Add the ~ directory to .npmignore
Ensure any scripts writing to config files resolve ~ properly before publishing
Thanks for your work maintaining the package!