{"id":18850196,"url":"https://github.com/clj-commons/zprint-clj","last_synced_at":"2025-04-14T09:21:54.031Z","repository":{"id":49723331,"uuid":"117496733","full_name":"clj-commons/zprint-clj","owner":"clj-commons","description":"Node.js wrapper for ZPrint Clojure source code formatter","archived":false,"fork":false,"pushed_at":"2021-06-10T12:24:40.000Z","size":1677,"stargazers_count":13,"open_issues_count":4,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T02:59:29.332Z","etag":null,"topics":["clojure","fmt","pretty-printer"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clj-commons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2018-01-15T04:21:25.000Z","updated_at":"2021-02-23T07:38:24.000Z","dependencies_parsed_at":"2022-09-09T13:40:39.479Z","dependency_job_id":null,"html_url":"https://github.com/clj-commons/zprint-clj","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clj-commons%2Fzprint-clj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clj-commons%2Fzprint-clj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clj-commons%2Fzprint-clj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clj-commons%2Fzprint-clj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clj-commons","download_url":"https://codeload.github.com/clj-commons/zprint-clj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852189,"owners_count":21171843,"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":["clojure","fmt","pretty-printer"],"created_at":"2024-11-08T03:28:22.246Z","updated_at":"2025-04-14T09:21:54.002Z","avatar_url":"https://github.com/clj-commons.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"logo.png\" width=128 /\u003e\n\n[![CircleCI](https://circleci.com/gh/clj-commons/zprint-clj.svg?style=svg)](https://circleci.com/gh/clj-commons/zprint-clj)\n\n_Node.js wrapper for [ZPrint](https://github.com/kkinnear/zprint) Clojure source code formatter_\n\n## Usage\n\n### CLI\n\n#### Install\n```\nnpm i -g zprint-clj\n```\n\n#### Format and write back\n```\nzprint-clj -i \"./src/**/*.{clj,cljs,cljc,edn}\" -o ./\n```\n\n#### Check formatting without writing (useful for CI)\n```\nzprint-clj --check \"./src/**/*.{clj,cljs,cljc,edn}\"\n```\n\n### API\n\n```\nnpm i zprint-clj\n```\n\n```js\nconst printFile = require('zprint-clj');\nconst outputText = format(inputText, inputFilePath, opts);\n```\n\n### Options\n\n* `isHangEnabled` `true|false` — enable hang mode (disabled by default), slows down formatting, but results in better formatted output\n\n*Difference between output when Hang mode is on and off*\n\n```diff\ndiff --git a/hang.clj b/nohang.clj\nindex 907120f..965fdfa 100644\n--- a/hang.clj\n+++ b/nohang.clj\n@@ -1,6 +1,7 @@\n (ns zprint-clj.core\n-  (:require [zprint.core :as zprint]\n-            [goog.object :as gobj]))\n+  (:require\n+    [zprint.core :as zprint]\n+    [goog.object :as gobj]))\n@@ -15,8 +16,9 @@\n\n (defn- make-cfg\n   [opts]\n-  (cond (false? (gobj/get opts \"isHangEnabled\")) no-hang\n-        :else {}))\n+  (cond\n+    (false? (gobj/get opts \"isHangEnabled\")) no-hang\n+    :else {}))\n```\n\n### Advanced Configuration\n\nYou can configure `zprint-clj` with a `.zprintrc` file. The `.zprintrc` is written in EDN format.\n\nYour `.zprintrc` file will be resolved if it is found in one of two locations:\n\n1.  The current directory where the zprint-clj process was initialized\n2.  The global `HOME` directory\n\nIf none found, we fall back on `zprint-clj` [default settings](https://github.com/kkinnear/zprint#quick-start).\n\n## Building\n\n**production**\n\n```\nclojure scripts/build.clj\n```\n\n**debug**\n\n```\nclojure scripts/build_debug.clj\n```\n\n## Local Development\n\nThe following guide outlines how to locally develop `zprint-clj`. Please make sure you have the [clj cli tool installed](https://clojure.org/guides/deps_and_cli).\n\n- Install `zprint-clj` dependencies\n\n  ```bash\n  npm install\n  ```\n\n- Make your your code changes in the `src` directory\n\n- Compile your changes\n\n  ```bash\n  clojure scripts/build_debug.clj\n  ```\n\n- Update `js-src/index` to look like this\n\n  ```bash\n  const zp = require(\"../out/main-debug\").zprint_clj.core;\n  ```\n\n  \u003e This tells zprint-clj to use the debug version\n\n- Create a test Clojure file with some test code you want to see formatted\n\n- Open the test file in your editor of choice\n\n- Run zprint-clj against your test file\n\n  ```clojure\n  js-src/cli.js -i \u003cyour-filename-here\u003e -o \u003cyour-filename-here\u003e\n  ```\n\n  \u003e If you are running in a different directory you will have to update above path to `js-src/cli.js`. The reason we run this instead of `main-debug` is because `cli`, or `index`, act as the entry points for JS for this library.\n\n## Editor plugins\n\n- [Atom](https://github.com/roman01la/zprint-atom)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclj-commons%2Fzprint-clj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclj-commons%2Fzprint-clj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclj-commons%2Fzprint-clj/lists"}