{"id":41590,"library":"nginx-format","title":"nano-formatter","description":"A pure JavaScript formatter for NGINX configuration files, version 0.1.8. It indents, splits long directives, and normalizes whitespace. Ships with TypeScript definitions. No runtime dependencies. Unlike nginxbeautifier (Python) or nginx-config-formatter (Java), this is a lightweight Node.js library suitable for CLI or build tool integration. Development appears slow; last update was in 2022. Works in Node.js only (not browser). Supports customizable indentation and maximum line length.","status":"maintenance","version":"0.1.8","language":"javascript","source_language":"en","source_url":"https://github.com/saper150/nginx-format","tags":["javascript","typescript"],"install":[{"cmd":"npm install nginx-format","lang":"bash","label":"npm"},{"cmd":"yarn add nginx-format","lang":"bash","label":"yarn"},{"cmd":"pnpm add nginx-format","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM named import; CommonJS requires destructuring","wrong":"const nginxFormat = require('nginx-format').nginxFormat","symbol":"nginxFormat","correct":"import { nginxFormat } from 'nginx-format'"},{"note":"Library has a default export that is the named function; both work but prefer named import","wrong":"const nginxFormat = require('nginx-format')","symbol":"default","correct":"import nginxFormat from 'nginx-format'"},{"note":"TypeScript-only; not exported as value","wrong":"","symbol":"NginxFormatOptions","correct":"import type { NginxFormatOptions } from 'nginx-format'"}],"quickstart":{"code":"import { nginxFormat } from 'nginx-format';\nimport { readFileSync, writeFileSync } from 'fs';\n\nconst config = readFileSync('/etc/nginx/nginx.conf', 'utf8');\nconst formatted = nginxFormat(config, {\n  indent: '  ',\n  newLineSeparator: '\\n',\n  maxStatementLength: 80\n});\nwriteFileSync('nginx-formatted.conf', formatted);\nconsole.log('Formatted successfully');","lang":"typescript","description":"Reads an NGINX config file, formats it with 2-space indentation, and writes the result."},"warnings":[{"fix":"Ensure comments are placed on separate lines before formatting.","message":"The formatter may strip comments that are not on their own line (e.g., inline comments after directives).","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Validate config with nginx -t before formatting.","message":"Does not validate syntax; malformed input may produce silently incorrect output.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Evaluate if maintenance status meets your needs.","message":"The package has not been updated since 2022; consider forking or using alternatives like nginxbeautifier.","severity":"gotcha","affected_versions":"<=0.1.8"}],"env_vars":null,"search_vec":"'0.1.8':13 '2022':58 'appear':52 'browser':64 'build':48 'cli':46 'config':35 'configur':10 'customiz':66 'definit':25 'depend':28 'develop':51 'direct':18 'file':11 'formatt':3,7,36 'indent':15,67 'integr':50 'java':37 'javascript':6,72 'last':54 'length':71 'librari':43 'lightweight':41 'line':70 'long':17 'maximum':69 'nano':2 'nano-formatt':1 'nginx':9,34 'nginx-config-formatt':33 'nginxbeautifi':30 'node.js':42,61 'normal':20 'pure':5 'python':31 'runtim':27 'ship':22 'slow':53 'split':16 'suitabl':44 'support':65 'tool':49 'typescript':24,73 'unlik':29 'updat':55 'version':12 'whitespac':21 'work':59","created_at":"2026-06-04T18:53:09.115333+00:00","updated_at":"2026-06-04T18:53:09.115333+00:00","problems":[{"fix":"Use `import { nginxFormat } from 'nginx-format'`","cause":"Using default import when library expects named import or vice versa.","error":"TypeError: nginxFormat is not a function"},{"fix":"Run `npm install nginx-format` and ensure import path is exactly 'nginx-format'.","cause":"Package not installed or import path incorrect.","error":"Cannot find module 'nginx-format'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/saper150/nginx-format#readme","github":"https://github.com/saper150/nginx-format","docs":null,"changelog":null,"pypi":null,"npm":"nginx-format","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}