deps-new

Gregory Bleiker 2024-11-25T10:33:05.867179Z

I'm currently trying to get some #clojuredart templates together for deps-new (https://github.com/gregorybleiker/cljd-templates). I'm facing the problem that I'd like a .gitignore file to be copied to the output directory. However, this is getting overwritten by another initialization process if I just place it in the root directory, so I need to read and append data somewhere. What is the recommended method to do this? Use regular closure/java functions in post-process-fn?

Gregory Bleiker 2024-11-26T09:18:37.998569Z

Yes, something in post-process-fn does overwrite .gitignore and that can't be helped, but I still have to modify/overwrite the file after that. So is the best way of going about this to use directly in that method or does deps-new have another mechanism to achieve this?

seancorfield 2024-11-26T19:43:39.384379Z

Well, you control the post-process code so if you want to preserve the .gitignore file that deps-new creates from your template, it seems you have a couple of choices: • start by copying .gitignore somewhere, run the other post-process code, copy .gitignore back (overwriting whatever version the post-process code created) • rename .gitignore in the template and let deps-new copy that to the target dir, then in post-process as the last step, copy that file over the .gitignore created by those earlier steps deps-new gives you the post-process hook so that you can do whatever you want after deps-new has created the project from the template: you have complete control over what that hook does.

Gregory Bleiker 2024-11-26T20:07:07.950659Z

Thank you @seancorfield for clearing that up. I just wanted to make sure I'm not working against the system by doing this kind of modifications in the post-process function.

seancorfield 2024-11-26T20:29:11.152319Z

That post-process hook is very much "caveat programmer" -- but by that point, deps-new is "done" with its work.

seancorfield 2024-11-25T17:25:53.904619Z

Can you explain how you are using the template to create a new project so I can try to repro this? i.e., the actual clojure -Tnew ... command you are using...

Gregory Bleiker 2024-11-25T18:05:11.718399Z

there's a run.sh in the repo... however, the setup is a bit involved because you need flutter/dart as a prerequisite

seancorfield 2024-11-25T18:49:07.503829Z

I only need to run the clojure -Tnew ... command to generate a project. I don't need anything setup.

seancorfield 2024-11-25T18:49:59.848819Z

(I'm asking because the issue you're describing has not cropped up in deps-new template I've heard of so far, so I want to test just the project creation part)

seancorfield 2024-11-25T18:52:59.932409Z

I suspect something else you are doing is overwriting the .gitignore file..

seancorfield 2024-11-25T19:01:52.988189Z

If I comment out the three -fn items in template.edn and run this command in the dart-cli folder, it creates a project correctly with the expected .gitignore file:

clojure -Sdeps '{:paths ["resources"]}' -Tnew create :template clojuredart/cli :name user/user
So I think something in your post-process-fn is overwriting your .gitignore file.