{"id":13739932,"url":"https://github.com/betaorbust/babel-plugin-groundskeeper-willie","last_synced_at":"2026-04-04T04:24:30.536Z","repository":{"id":9984514,"uuid":"63983480","full_name":"betaorbust/babel-plugin-groundskeeper-willie","owner":"betaorbust","description":"The spiritual successor to groundskeeper. Removes console calls, debuggers, and and pragma-wrapped code.","archived":false,"fork":false,"pushed_at":"2022-11-11T17:26:59.000Z","size":523,"stargazers_count":63,"open_issues_count":6,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T03:03:57.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/betaorbust.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-22T21:10:45.000Z","updated_at":"2025-04-04T03:31:28.000Z","dependencies_parsed_at":"2023-01-11T20:13:50.308Z","dependency_job_id":null,"html_url":"https://github.com/betaorbust/babel-plugin-groundskeeper-willie","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betaorbust%2Fbabel-plugin-groundskeeper-willie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betaorbust%2Fbabel-plugin-groundskeeper-willie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betaorbust%2Fbabel-plugin-groundskeeper-willie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betaorbust%2Fbabel-plugin-groundskeeper-willie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/betaorbust","download_url":"https://codeload.github.com/betaorbust/babel-plugin-groundskeeper-willie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253135585,"owners_count":21859669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T04:00:39.817Z","updated_at":"2026-04-04T04:24:30.475Z","avatar_url":"https://github.com/betaorbust.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Optimization"],"readme":"# Groundskeeper Willie Babel Plugin\n\n[![NPM Version](https://badge.fury.io/js/babel-plugin-groundskeeper-willie.svg)](https://badge.fury.io/js/babel-plugin-groundskeeper-willie)\n\nThis project is a Babel plugin encompassing and expanding the functionality of the very useful [Groundskeeper](https://github.com/Couto/groundskeeper) utility. Remaking Groundskeeper's\nfeatures as a Babel plugin gives ongoing support to ES2015+, while greatly reducing runtime\nfor those already using Babel in their build process.\n\nThis plugin will:\n\n- **Remove `console` statements, so your production code doesn't junk up the console,\n  but your development code can be as verbose as you wish.**\n\n  - To keep specific console statements, you can disable Groundskeeper Willie by adding\n    a line disable directive, which makes it significantly more flexible compared to [babel-plugin-transform-remove-console](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-console)\n\n  Source:\n\n  ```javascript\n  console.log(`I'll be removed.`);\n  console.log(`I'll be preserved!`); // groundskeeper-willie-disable-line\n  ```\n\n  Result:\n\n  ```javascript\n  console.log(`I'll be preserved!`); // groundskeeper-willie-disable-line\n  ```\n\n- **Remove `debugger` statements, so you don't accidentally ship halting code.**\n\n  - Same as above, you can disable this in specific cases with a line disable directive.\n\n  Source:\n\n  ```javascript\n  () =\u003e {\n    debugger;\n    do.something();\n    debugger; // groundskeeper-willie-disable-line\n  }\n  ```\n\n  Result:\n\n  ```javascript\n  () =\u003e {\n    do.something();\n    debugger; // groundskeeper-willie-disable-line\n  }\n  ```\n\n- **Remove code between comment `\u003cpragmas\u003e`, so you can use your debug code in development, but strip it out in production.**\n\n  Source:\n\n  ```javascript\n  module.exports = {\n  \tprodFunction() {\n  \t\t/* ... */\n  \t},\n  \t// \u003ctestCode\u003e\n  \ttestFunction() {\n  \t\t/* ... */\n  \t},\n  \t//\u003c/testCode\u003e\n  \totherProdCode() {\n  \t\t/* ... */\n  \t},\n  };\n  ```\n\n  Result:\n\n  ```javascript\n  module.exports = {\n  \tprodFunction() {\n  \t\t/* ... */\n  \t},\n  \totherProdCode() {\n  \t\t/* ... */\n  \t},\n  };\n  ```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg align=\"center\" width=\"300px\" src=\"https://cloud.githubusercontent.com/assets/921683/17076208/7eae721c-5061-11e6-8afd-3071b0de4f70.gif\" /\u003e\n\u003c/p\u003e\n\n## Complete Example:\n\n#### Input:\n\nHere we have a file that has some development code, a console, etc.\n\n```javascript\nmodule.exports = {\n    appCode(){\n        console.log(`We're running with scissors!`);\n        return [\n            'included',\n            /*\u003cotherPragma\u003e*/\n            'excluded',\n            /*\u003c/otherPragma\u003e*/\n            'also included'];\n    }\n};\n\n//\u003cdebug\u003e\nmodule.exports.debugCode = {\n    do.debugging.things.that.should.not.be.in.production();\n}\n//\u003c/debug\u003e\n```\n\n#### Output:\n\nWhen run with the Groundskeeper Willie plugin, we'll get back:\n\n```javascript\nmodule.exports = {\n\tappCode() {\n\t\treturn ['included', 'also included'];\n\t},\n};\n```\n\n## Why would you do that?\n\nRight now, we (at Netflix) use pragmas so that our developer logging, debug code, and\nother related exports can live alongside the production code, but, at distribution time,\nwe can ship down the smallest payload, without junking up the console, or sending extra\nunused code.\n\n## What's a pragma?\n\nFor the purposes of our little plugin, pragmas are comments that have an opening\ntag, and a closing tag, with a provided name. The pragma may appear in either a line\ncomment or a block comment, and look like HTML/XML-esq open and close tags.\n\n```javascript\n//\u003cthisIsAPragma\u003e\nconst removed = code.that.will.be.removed();\n//\u003c/thisIsAPragma\u003e\nreturn ['included', /* \u003cother\u003e */ 'excluded', /* \u003c/other\u003e */ 'also included'];\n```\n\n## Plugin Options\n\nThe following are the available options with their default values.\n\n```json\n{\n\t\"plugins\": [\n\t\t[\n\t\t\t\"groundskeeper-willie\",\n\t\t\t{\n\t\t\t\t\"removeConsole\": true,\n\t\t\t\t\"removeDebugger\": true,\n\t\t\t\t\"removePragma\": true\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\n#### `removeConsole`\n\nIf you wish to leave in all console statements, set this to false.\n\n#### `removeDebugger`\n\nIf you wish to leave in all debugger statements, set this to false.\n\n#### `removePragma`\n\nIf you wish to leave in all pragmas-wrapped code, stet this to false.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetaorbust%2Fbabel-plugin-groundskeeper-willie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetaorbust%2Fbabel-plugin-groundskeeper-willie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetaorbust%2Fbabel-plugin-groundskeeper-willie/lists"}