Skip to content

Instantly share code, notes, and snippets.

@esnya
Created January 23, 2016 15:29
Show Gist options
  • Select an option

  • Save esnya/7fb2a60b98619614bae1 to your computer and use it in GitHub Desktop.

Select an option

Save esnya/7fb2a60b98619614bae1 to your computer and use it in GitHub Desktop.
node_modulesをお掃除するスクリプト
import std.algorithm;
import std.file;
import std.path;
import std.parallelism;
import std.process;
import std.range;
import std.stdio;
void main() {
foreach(name; dirEntries("node_modules", SpanMode.shallow)
.map!(a => a.name.baseName)
.filter!`!a.startsWith(".")`
.array
.parallel
) {
writeln("npm rm ", name);
spawnProcess(["npm.cmd", "rm", "--progress=false", name]).wait();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment