Open
Description
Currently it has 107 direct dependencies, and many more non-direct. It's worth cleaning them up.
Modules that can be replaced with other modules:
chalk
->picocolors
(mainly a size win)- chokidar v3 -> v4 upgrade, -11 deps (if I remember correctly)
find-up
-> empathic, -7 depsdot-prop
-> dlv + dset, might be that only one is neededexeca
-> tinyexec
Modules that can be removed in favor of 1-3 lines of code:
is-stream
p-filter
:
const filteredItems = await Promise.all(
items.map(async (item) => {
const shouldKeep = await someAsyncCondition(item); // Replace with your async condition
return shouldKeep ? item : null;
})
).then((results) => results.filter((item) => item !== null));
p-map
, probably could be replaced withPromise.all
p-wait-for
:
const waitFor = async (condition, interval = 100) => {
while (!(await condition())) {
await new Promise((resolve) => setTimeout(resolve, interval));
}
};
through2-filter
:
const { Transform } = require('node:stream');
const filterStream = new Transform({
decodeStrings: false,
transform(chunk, encoding, callback) {
if (chunk.includes('foo')) { // Example filter condition
this.push(chunk);
}
callback();
},
});
process.stdin
.pipe(filterStream)
.pipe(process.stdout);
from2-array
:
const { Readable } = require('node:stream');
const arrayToStream = (array) => {
return new Readable({
objectMode: true,
read() {
array.forEach((item) => this.push(item));
this.push(null);
},
});
};
tempy
->os.tmpdir()
+fs.createFile
/fs.mkdir
hasha
->crypto.createHash('sha512').digest()
PRs:
- remove
hasha
: chore(deps): remove hasha netlify/cli#7017