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
Remove fs-extra #147
base: main
Are you sure you want to change the base?
Remove fs-extra #147
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/fs-extra@9.0.0 |
You can use Available since 16.7.0, marked as Experimental, though. I use it in scripts without trouble, but I’m not sure if I’d dare doing it in package code. |
const util = require('util'); | ||
const fs = require('graceful-fs'); | ||
const {rimraf} = require('rimraf'); | ||
|
||
const copyFile = util.promisify(fs.copyFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, there’s a a promises API: https://nodejs.org/api/fs.html#promises-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, I looked for it in my code but didn't see any usages, so I thought they must have appeared after v10.
For now Maybe I should break this in a future version because for a soon-to-be feature I'll need a more recent version of |
You are correct, Node.js 10 and 12 are currently broken. Given that:
… I would say that it could be time to release that major version with some cleanups :) |
Fixes #120
Removes the dependency on
fs-extra
. As @lydell pointed out,fs.copyFileSync
already exists in corefs
.fs.copy
(which copies entire directories) however doesn't. I chose to fix this by hardcoding which files to copy (which is faster, though potentially error-prone 🤷)Now that
fs-extra
is absent from the dependencies,tsc
complains about the files that reference it in thenew-package/
folder. Those files are copied over and not included, but do usefs-extra
(mostly because of the "need" to copy entire directories, ideally in a sync manner). I don't know how to suppress this error, and if I ignore the file, then ESLint complains that it can't parse it.If anyone has an idea on how to fix this, I'm all ears!