Registry / devops / golfy
library0.1.0jsnpmunverified

An aggressive JavaScript minifier specialized for code golf that prioritizes output length over stability, compatibility, and execution performance. Version 0.1.0 is a work-in-progress, experimental tool that performs transformations like replacing require() calls with inline expressions, stripping unnecessary variables, and other hacky optimizations. Compared to general-purpose minifiers (e.g., terser, uglify-js), golfy will break code in non-standard environments and is not suitable for production use. It is designed exclusively for competitive code golfing where byte count is the only metric that matters.

npm install golfy
INSTALL
IMPORT
SIG · GOLFY
G
golfy
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

golfy CLI
golfy code.js
node golfy code.js
golfy is primarily a CLI tool installed globally via npm. There is no programmatic API currently exposed.
stdin usage
cat code.js | golfy
golfy < code.js
Piping via cat or similar is the recommended way to process input from stdin.
Installation
npm install -g golfy
npm install golfy
Global installation is required for CLI usage; local install does not expose the binary.

Installs golfy globally and minifies a simple JavaScript expression, showing the shortened output.

npm install -g golfy echo 'const x = 1 + 2; console.log(x)' > input.js golfy input.js
Debug
Known issues
breakingOutput may produce code that only runs in specific JS engines (e.g., Node.js).
fix
Do not use golfy for production code. Only use for code golf where runtime is controlled.
affects: >=0.0.0
deprecatedThis project is highly experimental and may change without notice.
fix
Pin version if using in reproducible builds, but expect breaking changes.
affects: 0.1.0
gotchagolfy does not preserve side effects; it may remove code it deems unnecessary.
fix
Review output carefully. Test minified code to ensure intended behavior.
affects: >=0.0.0
gotchaStandard library functions may be inlined or replaced in ways that differ across Node versions.
fix
Use only well-known Node.js APIs and verify output on your target Node version.
affects: >=0.0.0
Errors
Common errors & fixes
golfy: command not found
global npm bin directory not in PATH
fix
Ensure npm global install location (e.g., /usr/local/bin) is in PATH, or use npx golfy.
SyntaxError: Unexpected token
Input contains unsupported modern JavaScript syntax
fix
Transpile code to ES5 or use a compatible version; golfy may not support all ES6+ features.
Error: Module not found
golfy tries to resolve require() calls but the module isn't available
fix
Ensure required modules are installed in the project or switch to Node.js built-ins.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
packagegolfy
golfy — npm install golfy · libregistry