Delay getting dependencies?

Hello sempai, can’t seem to get an answer to this from Google. :frowning: Is there a way to avoid the deps.get prompt during phx.new?

Welcome to the forum!

Have you tried:

mix help phx.new

Thank you for the reply. The info from mix help phx.new seems to be similar to what I read in hex doc. There are no arguments for not prompting for deps.get. I am exploring and learning Elixir/Phoenix and I’m experimenting with System.cmd() and doing System.cmd(“mix”, [“phx.new”, “hello_world”]) would not work as it would pause the execution when it hits the deps.get prompt…

Here are the arguments in the documentation:-
• --no-webpack - do not generate webpack files for static asset building.
When choosing this option, you will need to manually handle JavaScript
dependencies if building HTML apps
• --no-ecto - do not generate Ecto files.
• --no-html - do not generate HTML views.
• --binary-id - use binary_id as primary key type in Ecto schemas
• --verbose - use verbose output

I don’t know of a way to skip asset compilation from the phx.new command, but you could sort of get around it with a hacky invocation of sh and the yes unix command:

System.cmd("sh", ["-c", "yes | mix phx.new example_app"])

Thank you for your help. I tried your suggestion but I could not get it to work properly. I spent another two days researching your ideas and got it working using :os.cmd(“yes | mix phx.new hellow_world_app”) instead. Thank you for your help!

2 Likes