Comments (7)
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.
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 thebank-app
top level dir and in this scenario we are runningdeps-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.
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.
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.
Does that help?
Yup. I think everything here looks good. Thanks, Sean!
from deps-new.
Cool. I'll leave this open until it is fully documented.
from deps-new.
I believe this is sufficiently documented now.
from deps-new.
Related Issues (20)
- scratch template does not use :name HOT 18
- Support loading template files through multiple deps HOT 3
- [Feature request] Add ability to use conditions in templates HOT 2
- how to build ci with aliases HOT 1
- add sr.ht and Codeberg as SCM domains HOT 6
- Consider not using .clj for extension of template source files HOT 3
- Consider supporting additional document formats like AsciiDoc? HOT 9
- Drop use of build-clj from templates HOT 1
- Update to non-alpha tools.deps HOT 1
- Consider moving pom.xml to template folder HOT 1
- Suggestion: Simpler DX when using this tool with custom templates. HOT 4
- [template] .tmpl files remain after creating a new project with template template HOT 3
- Consider publish to mvn also? HOT 5
- Add .portal/vs-code.edn to .gitignore
- When updating dependencies in deps.edn, the method for adjusting the dependency repository HOT 4
- Some of template seems too old to use HOT 3
- Running basic tests for a new app HOT 2
- Make deps-new more usable as a library HOT 1
- It should not be necessary to use -Sdeps to reference a third-party template HOT 3
- Release 0.7.1 has title 0.7.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deps-new.