Git Product home page Git Product logo

Comments (7)

seancorfield avatar seancorfield commented on July 25, 2024

My response on Slack:

You can override substitution keys easily via the command-line, and this new version has the idea of a "top" namespace and a "main" namespace so you can do something like this:

clojure -Tdeps-new create :template app :name company/project :top ws :main cool.api

So the project name is used for group/artifact and for the scm stuff in pom.xml but not for the file structure:

from deps-new.

athomasoriginal avatar athomasoriginal commented on July 25, 2024

I like the enhanced substitution keys and I believe they actually solve my issues.

To make this a useful issue, perhaps I can just outline how I create projects and my confusion around clj-new API which may help with:

  • documentation
  • collecting usage information

As background, all projects I create either live as a standalone app/library or inside of an organization/monorepo. I also never use core for the :main file. Here is what those project folder structures would look like:

  • Creating a standalone app or library
      ├── readme-links                       # :name
      │   │   ├── src        
      │   │   │   ├── athomasoriginal        # :ws
      │   │   │   │     └── readme-links.clj # :main || :name

    clojure -Tdeps-new create :template app :name athomasoriginal/readmelinks

  • Creating an app in a monorepo/existing github organization
    ├── bank-app          (mono-repo name/existing organization name)        
    │   ├── web-server
    │   │   ├── src        
    │   │   │   ├── bank-app       
    │   │   │   │     └── web-server.clj 

    clojure -Tdeps-new create :template app :name bank-app/web-server
    I would assume in this scenario that the user already created the bank-app top level dir and in this scenario we are running deps-new inside of the monorepo/organization repo.

So where the confusion came for me is :name can be qualified (org-name/project-name ) which doesn't map, in my mind, to the project structure which will be written.

With this, my only suggestion might be to remove the idea of a qualified name and just do:

`clojure -Tdeps-new create :template app :name readme-links :org athomasoriginal`

And the rest of the behaviour is the same. I realize this is a bit of departure. Hope this helps and thank you for your efforts!!

from deps-new.

seancorfield avatar seancorfield commented on July 25, 2024

deps-new doesn't (currently) require a qualified name, but if you say :name readme-links it will turn that into readme-links/readme-links behind the scenes and then :top would be readme-links (the leading portion) and :main would be readme-links (the trailing portion) -- both of which you could override on the command-line anyway -- and :target-dir would be readme-links (the trailing portion) -- which could also be overridden on the command-line.

But the :name can provide much more than just the :top and :main (and :target-dir) portions: it could be io.gitlab.someorg/someproject and that also sets the group/artifact ID and the SCM setup etc.

I think what was missing from clj-new for your scenario was that it was impossible to override all of the internal parts of the data -- and the data itself didn't drive where/how the project was actually created anyway.

Does that help?

from deps-new.

seancorfield avatar seancorfield commented on July 25, 2024

Also, in case this helps too, you could run deps-new from above the monorepo:

(! 976)-> clojure -Tdeps-new app :name bank-app/web-server :target-dir bank-app/web-server
Creating project from org.corfield.new/app in bank-app/web-server
(! 977)-> tree bank-app
bank-app
|____web-server
| |____.gitignore
| |____CHANGELOG.md
| |____deps.edn
| |____doc
| | |____intro.md
| |____LICENSE
| |____pom.xml
| |____README.md
| |____resources
| | |____.keep
| |____src
| | |____bank_app
| | | |____web_server.clj
| |____test
| | |____bank_app
| | | |____web_server_test.clj

:target-dir allows you to specify a path, so you can write into an existing workspace. If you ran it again with a different name, you can get another subproject alongside it:

(! 978)-> clojure -Tdeps-new app :name bank-app/front-end :target-dir bank-app/front-end
Creating project from org.corfield.new/app in bank-app/front-end
(! 979)-> ls bank-app/
front-end	web-server

from deps-new.

athomasoriginal avatar athomasoriginal commented on July 25, 2024

Does that help?

Yup. I think everything here looks good. Thanks, Sean!

from deps-new.

seancorfield avatar seancorfield commented on July 25, 2024

Cool. I'll leave this open until it is fully documented.

from deps-new.

seancorfield avatar seancorfield commented on July 25, 2024

I believe this is sufficiently documented now.

from deps-new.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.