Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neil new puts :neil :project :name ,,, indented behind :aliases :build :nsdefault #169

Open
teodorlu opened this issue Feb 21, 2023 · 6 comments

Comments

@teodorlu
Copy link
Contributor

teodorlu commented Feb 21, 2023

Hi!

When I run neil new mylib, I get this deps.edn:

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.11.1"}}
 :aliases
 {:test
  {:extra-paths ["test"]
   :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
                io.github.cognitect-labs/test-runner
                {:git/tag "v0.5.1" :git/sha "dfb30dd"}}}
  :build {:deps {io.github.clojure/tools.build
                 {:git/tag "v0.9.2" :git/sha "fe6b140"}
                 slipset/deps-deploy {:mvn/version "0.2.0"}}
          :ns-default build} :neil {:project {:name mylib/mylib}}}}

I'd prefer if :neil {:project {:name mylib/mylib}} was on its own line, like this:

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.11.1"}}
 :aliases
 {:test
  {:extra-paths ["test"]
   :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
                io.github.cognitect-labs/test-runner
                {:git/tag "v0.5.1" :git/sha "dfb30dd"}}}
  :build {:deps {io.github.clojure/tools.build
                 {:git/tag "v0.9.2" :git/sha "fe6b140"}
                 slipset/deps-deploy {:mvn/version "0.2.0"}}
          :ns-default build}
  :neil {:project {:name mylib/mylib}}}}

Thoughts?

$ neil --version
neil 0.1.56

Log

I'm taking some notes as I go along. I don't want to create notifications for each edit, so I batch these together in the original post rather than create comments for each step.

2023-02-21

The call that puts :neil {:project {:name ,,,}} on the end of another line rather than on its own line appears to be:

(r/assoc-in nodes [:aliases :neil :project k] v)

(defn assoc-project-meta!
"Updates deps-file's :neil :project `k` with `v`"
[{:keys [dir deps-file k v]
:as opts}]
(ensure-neil-project opts)
(let [deps-file (resolve-deps-file dir deps-file)
deps-edn (slurp deps-file)
nodes (r/parse-string deps-edn)
nodes (r/assoc-in nodes [:aliases :neil :project k] v)]
(spit deps-file (str nodes))))

@borkdude
Copy link
Contributor

I'd prefer that too. Not sure why it happens, but might be something in borkdude/rewrite-edn as well. Feel free to have a peek!

@agorgl
Copy link

agorgl commented Mar 28, 2023

Just noticed this too!

@borkdude
Copy link
Contributor

borkdude commented Mar 28, 2023

Feel free to post an issue + minimal repro at borkdude/rewrite-edn

@teodorlu
Copy link
Contributor Author

teodorlu commented Mar 29, 2023

I started to explore this with a Clerk notebook, but I didn't really get anywhere (no repro).

I believe the relevant neil function for this behavior is babashka.neil.project/assoc-project-meta!.

Happy to discuss in Slack if someone wants to give it a shot.

@borkdude
Copy link
Contributor

I mean a repro using rewrite-edn.

@teodorlu
Copy link
Contributor Author

teodorlu commented Sep 24, 2023

Made an issue now. I didn't understand what you meant at first --- that this is actually something rewrite-edn is meant to handle!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants