[{"data":1,"prerenderedAt":404},["ShallowReactive",2],{"project-15731936":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":36,"aspects":37,"strip":45,"post_text":48,"what":49,"said":98,"maker_in_thread":213,"shape":221,"grid":225,"attempts":365,"same_week":366,"maker_shows":46,"maker_hidden":396,"reader_version":397,"card":398},"15731936","node-prune","Node.js node_modules file pruning","title","Show HN: Node.js node_modules file pruning","https:\u002F\u002Fgithub.com\u002Ftj\u002Fnode-prune","github.com","tjholowaychuk",1511058922,2017,111,61,405,2242,19,"notable","dev_tools","dependency pruning cli","cli",[24,25,26,27,28],"node_modules","npm","pruning","lambda deployment","docker image size","mixed",-0.128,{"positive":32,"neutral":33,"mixed":34,"critical":35},6,14,2,9,31,{"docs":38,"idea":40,"performance":42,"execution":43,"design":44},{"positive":39,"critical":39},0,{"positive":41,"critical":32},1,{"positive":41,"critical":39},{"positive":39,"critical":34},{"positive":34,"critical":39},[46,46,47,46,39,46,41,46,39,46,46,46,41,41,41,41,39,46,39,39,39,41,39,47,47,39,47,46,39,47,39,39,41,39,41,39,46,39,39,39],3,5,null,{"problem":50,"audience":66,"pricing":48,"motivation":77,"time_to_build":48,"stack":83,"openness":95,"stage":96,"team_size":97},{"value":51,"source":52,"evidence":53},"node_modules contains unneeded files that bloat deployments","commenter",[54,58,62],{"id":55,"by":56,"text":57},"15732406","lxe","Awesome idea. Especially if you’re packaging your projects via something like Docker this can shave hundreds of megabytes. (Even if you’re using the Docker layer cache, any…",{"id":59,"by":60,"text":61},"15732383","hiphipjorge","This is completely useless because npm still downloads those files and the hdd space is pretty negligeble. It should def go under the category of troll driven development. This…",{"id":63,"by":64,"text":65},"15732766","namuol","Is this serious? I mean, kudos for helping push node module developers to make better use of `.npmignore` et al, but this project strikes me as overly snarky or even trolling...…",{"value":67,"source":68,"evidence":69},"Node.js developers deploying to AWS Lambda or Docker","inferred",[70,73,76],{"id":71,"by":11,"text":72},"15732776","It's not a troll, this is for AWS Lambda, where size impacts deployments and cost starts. See my comment below about the automation, I think it could\u002Fshould be done too!",{"id":74,"by":11,"text":75},"15732385","It's for Lambda",{"id":55,"by":56,"text":57},{"value":78,"source":79,"evidence":80},"Reduce Node.js deployment size for AWS Lambda","maker",[81,82],{"id":71,"by":11,"text":72},{"id":74,"by":11,"text":75},[84],{"value":85,"source":68,"evidence":86},"Go",[87,91],{"id":88,"by":89,"text":90},"15732165","orf","Rather than two giant 440px high images consisting of tiny text in the readme I'd quite love to read exactly what it does and why. Does it prune files in modules that are not…",{"id":92,"by":93,"text":94},"15732845","andreineculau","Usually I don't care about what language an executable is written in. After all, as a user I'm just interested in whether it executes or not. But these small-software situations…","open_source","launched","unknown",{"praise":99,"objections":112,"requests":149,"questions":165,"alternatives":178},[100],{"value":101,"source":52,"evidence":102},"Useful for shrinking Lambda and Docker deployments",[103,107,108],{"id":104,"by":105,"text":106},"15733146","finstell","It's especially good for deployments to AWS Lambda.",{"id":55,"by":56,"text":57},{"id":109,"by":110,"text":111},"15732458","gcommer","Love it. Saved 600MB... and test cases still passed :) I ported it to bash really quick, as thats probably easier for people to drop into their dotfiles if they don't have a…",[113,125,138],{"value":114,"source":52,"evidence":115},"Deleting files may break packages that need them at runtime",[116,120,121],{"id":117,"by":118,"text":119},"15732222","goldenkey","It looks like it removes the files necessary for \"npm install\" assuming that the module will do npm install immediately when you install it. This is not true for all cases…",{"id":55,"by":56,"text":57},{"id":122,"by":123,"text":124},"15732928","finchisko","No it should NOT be handled by npm. Imagine some npm project really needs those files. Like module that is rendering markdown files to html. If npm would be that \"smart\" to strip…",{"value":126,"source":52,"evidence":127},"Authors should fix packaging with .npmignore or files array instead",[128,132,135],{"id":129,"by":130,"text":131},"15732279","sergiotapia","Shouldn't this be handled entirely by npm? If these files are unnecessary why do they get downloaded in the first place?",{"id":133,"by":11,"text":134},"15732288","Ideally people use the \"files\" array. It might be nice if someone writes a bot to go around and fix large packages by adding that.",{"id":136,"by":60,"text":137},"15732387","I guess there is the \"files\" and \".npmignore\" which handle these, but they don't seem to be widely used in the community.",{"value":139,"source":52,"evidence":140},"Removing .d.ts files breaks ts-node",[141,145],{"id":142,"by":143,"text":144},"15732389","TheCoreh","https:\u002F\u002Fgithub.com\u002Ftj\u002Fnode-prune\u002Fblob\u002Fmaster\u002Fprune.go#L57 Doesn't this also result in .d.ts files being removed? These are type declaration files (Kinda like C's .h files) that…",{"id":146,"by":147,"text":148},"15732866","latchkey","ts-node no longer works.",[150,158],{"value":151,"source":52,"evidence":152},"Automate pull requests adding npmignore rules to large packages",[153,154],{"id":63,"by":64,"text":65},{"id":155,"by":156,"text":157},"15734138","tomchentw","Even better: submit a PR auto fix these issues on the corresponding GitHub repo when pruning",{"value":159,"source":52,"evidence":160},"Better documentation of what gets pruned and why",[161,162],{"id":88,"by":89,"text":90},{"id":163,"by":60,"text":164},"15732399","Maybe documentation should include uses cases? Newer users to npm + node might think this does something different. Just a suggestions.",[166,173],{"value":167,"source":52,"evidence":168},"Why write it in Go instead of shell or Node",[169,172],{"id":170,"by":123,"text":171},"15732857","No disrespect to TJ (he did many awesome projects I use almost daily), but wouldn't simple: 'find node_modules -not -regex \".*.[js,json]\" -delete' do the same job? Why project in…",{"id":92,"by":93,"text":94},{"value":174,"source":52,"evidence":175},"Should npm handle excluding unneeded files itself",[176,177],{"id":129,"by":130,"text":131},{"id":59,"by":60,"text":61},[179,190,194,202],{"value":180,"source":52,"evidence":181},"yarn autoclean",[182,186],{"id":183,"by":184,"text":185},"15732528","mambodog","The Yarn autoclean command also does something like this: https:\u002F\u002Fyarnpkg.com\u002Flang\u002Fen\u002Fdocs\u002Fcli\u002Fautoclean\u002F",{"id":187,"by":188,"text":189},"15732990","tuananh","you're looking for `yarn autoclean`. they have `.yarncleanrc` IIRC",{"value":191,"source":52,"evidence":192},"Shell find command to delete non-js files",[193],{"id":170,"by":123,"text":171},{"value":195,"source":52,"evidence":196},"npmignore whitelist or files array",[197,198],{"id":133,"by":11,"text":134},{"id":199,"by":200,"text":201},"15734018","vkjv","We've started publishing modules with a whitelist in the npmignore to help combat this. ``` * !dist\u002F**\u002F* ```",{"value":203,"source":52,"evidence":204},"Bundling with rollup or tree shaking",[205,209],{"id":206,"by":207,"text":208},"15732843","franciscop","I've been thinking about this in a different way: what about bundling things with rollup.js? Then each package in require() would be just a package.json and an index.js. I think…",{"id":210,"by":211,"text":212},"15732852","purrcat259","Wouldnt it make more sense to bundle, minify and treeshake your package than to delete unused files in node_modules? Tree shaking will remove unsused code even from files you are…",{"comments":214,"answered":32,"key":215},8,[216,217,220],{"id":71,"text":72},{"id":218,"text":219},"15732860","You can't always do that (native modules, other non-js assets..)",{"id":133,"text":134},{"commenters":222,"max_depth":214,"maker_replies":214,"first_comment_mins":223,"lifespan_hours":224},35,79,66,[226,228,230,232,234,237,240,244,246,250,252,255,257,259,262,264,265,268,271,272,273,274,275,276,277,278,281,284,287,290,293,294,297,299,301,303,307,308,312,315,318,321,323,326,328,331,334,336,339,342,344,346,348,350,351,352,356,358,360,362,364],[88,39,46,227,89,39],"project\u002Fneutral\u002Fdocs",[117,39,41,229,118,39],"project\u002Fcritical\u002Fidea",[104,39,47,231,105,39],"project\u002Fpositive\u002Fidea",[109,41,47,233,110,39],"project\u002Fpositive\u002Fperformance",[235,41,39,236,93,39],"15732854","commenter\u002Fneutral\u002Fnone",[238,41,46,239,188,39],"15732895","project\u002Fneutral\u002Fnone",[241,41,39,242,243,39],"15732947","other\u002Fneutral\u002Fnone","arve0",[142,34,46,245,143,39],"project\u002Fneutral\u002Fexecution",[247,34,46,248,249,39],"15732827","project\u002Fneutral\u002Fidea","zachrip",[146,34,41,251,147,39],"project\u002Fcritical\u002Fexecution",[253,34,46,245,254,39],"15733308","always_good",[256,34,46,245,147,39],"15733486",[258,34,39,236,254,39],"15733498",[260,34,46,239,261,39],"15734225","smt88",[263,34,46,239,147,39],"15737289",[183,46,46,248,184,39],[266,46,46,248,267,39],"15732847","chrismorgan",[55,269,46,270,56,39],4,"project\u002Fmixed\u002Fexecution",[187,269,41,229,188,39],[63,47,41,229,64,39],[71,47,39,248,11,41],[210,47,41,229,211,39],[218,47,39,236,11,41],[129,32,41,229,130,39],[133,32,39,227,11,41],[279,32,39,242,280,39],"15732515","exogen",[282,32,46,248,283,39],"15732804","yorwba",[285,32,39,236,286,39],"15733963","krisdol",[288,32,39,236,289,39],"15732330","SilasX",[291,32,39,236,292,39],"15732492","wildpeaks",[122,32,39,236,123,39],[295,32,39,236,296,39],"15734410","twhb",[170,298,41,251,123,39],7,[300,298,39,236,11,41],"15732885",[302,298,39,236,123,39],"15732936",[304,214,47,305,306,39],"15732558","maker\u002Fpositive\u002Fnone","billmalarky",[155,35,46,248,156,39],[309,310,47,311,306,39],"15732735",10,"project\u002Fpositive\u002Fdesign",[313,310,39,314,11,41],"15732742","maker\u002Fneutral\u002Fdesign",[316,310,47,317,306,39],"15732749","maker\u002Fpositive\u002Fdesign",[319,310,46,320,267,39],"15732842","project\u002Fmixed\u002Fdesign",[206,322,46,248,207,39],11,[324,325,39,242,296,39],"15734376",12,[199,327,39,242,200,39],13,[329,33,47,305,330,39],"15732240","dstroot",[332,33,39,236,333,39],"15732314","igotsideas",[335,33,39,236,306,39],"15732561",[337,33,39,236,338,39],"15732572","swyx",[92,340,41,341,93,39],15,"project\u002Fcritical\u002Fnone",[343,340,39,236,11,41],"15732886",[345,340,39,236,93,39],"15733055",[347,340,39,236,254,39],"15733327",[59,349,41,229,60,39],16,[74,349,39,248,11,41],[163,349,46,227,60,39],[353,349,39,354,355,39],"15732715","other\u002Fneutral\u002Fdocs","BigJono",[357,349,39,236,254,39],"15734950",[359,349,39,236,355,39],"15738786",[361,349,39,236,11,41],"15743262",[363,349,39,236,355,39],"15751294",[136,349,39,236,60,39],[],[367,372,377,382,387,392],{"id":368,"name":369,"points":370,"category":371},"15739744","Harvest Signal",572,"consumer_social",{"id":373,"name":374,"points":375,"category":376},"15757844","LogoFox",431,"creative",{"id":378,"name":379,"points":380,"category":381},"15761537","Gophercises",328,"learning_science",{"id":383,"name":384,"points":385,"category":386},"15736090","Boltzmann Machines",201,"ai",{"id":388,"name":389,"points":390,"category":391},"15759014","OhMyCo.in",167,"finance_crypto",{"id":393,"name":394,"points":395,"category":376},"15720448","Chord Progressions",161,false,"v2",{"id":399,"name":5,"line":6,"ai":396,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":400,"top":18,"kw":401,"maker":11,"domain":10,"tier":19,"attempts":39,"strip":402,"url":9,"mix":403,"praise":101,"objection":114,"sub":21},15731936,-0.13,[24,25,26,27,28],"3353031303331111030001055053050010103000",[32,33,34,35],1793990966752]