Git Product home page Git Product logo

Comments (18)

seancorfield avatar seancorfield commented on August 29, 2024

True. What would you expect it to affect? It's creating a bare minimum "project" with just a scratch.clj file in it.

from deps-new.

borkdude avatar borkdude commented on August 29, 2024

I think it would be nice if the name option affected the namespace name, like with the other templates. But I could create my own "minimal" template for this if you think scratch should behave the way it does now. minimal could also have a test directory with one example test.

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

I'd be happy to take a PR to add a new minimal template that is somewhere between scratch and app -- with an additional README section describing it.

from deps-new.

borkdude avatar borkdude commented on August 29, 2024

Cool. What I think would be reasonable for a minimal template:

  • empty deps.edn
  • src/app_name/core.clj with one function (same as scratch probably)
  • test/app_name/core_test.clj with one test

Would you agree with this?
My use case for this minimal template would be to make it the default in neil's new command. The idea of neil is to take an existing project or start with a minimal setup and then incrementally add things to it: neil add test adds cognitect's test runner, neil add build adds a build.clj, etc. Starting with neil new minimal myproject would be the use case for the above template.

Another minor thing:
Currently neil runs with a fork of deps-new to make it compatible with babashka. To commit to make it babashka-compatible was this one:
borkdude@76259a2
I replaced the usage of Calendar with Date: babashka doesn't ship with the Calender class since it has adopted java.time.* as the preferred time library and adding Calender would mean adding more space to the binary while it's regarded as something that's replaced by java.time. But because Date is so ubiquitous, of course it has support for that.
I would understand if you wouldn't accept this change and would be happy to continue using my minor fork, but if you don't mind, I could include this change too with the above mentioned minimal template.

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

So an empty deps.edn but also a test file -- that couldn't be run without neil add test? That seems a bit confusing.

Other than that quibble, yes, everything else sounds good -- including dropping use of Calendar (that was pure paranoia on my part instead of just using the code in your commit).

from deps-new.

borkdude avatar borkdude commented on August 29, 2024

Yes, that's a good point. We could add the first test as part of neil add test I guess. So let's say we leave that out. Then the only change compared to scratch would be that the generated namespace respects --name. Wouldn't you agree that we could just make that change to scratch, or would you consider that a breaking change?

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

There is a way to make it possible to rename scratch.clj -- update the template.edn to contain :scratch/file "scratch" and add a mapping to copy src/scratch.clj to src/{{scratch/file}}.clj and then you could invoke it specifying :scratch/file as an option behind the scenes. Would that work for you?

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

Like this:

seanc@Sean-win-11-laptop:~/oss/deps-new$ clojure -X org.corfield.new/scratch :name play :scratch/file ground
Creating project from org.corfield.new/scratch in play
seanc@Sean-win-11-laptop:~/oss/deps-new$ tree play
play
├── deps.edn
└── src
    └── ground.clj

1 directory, 2 files

seanc@Sean-win-11-laptop:~/oss/deps-new$ tree resources/org/corfield/new/scratch
resources/org/corfield/new/scratch
├── root
│   └── deps.edn
├── src
│   └── scratch.clj
└── template.edn

2 directories, 3 files
seanc@Sean-win-11-laptop:~/oss/deps-new$ cat resources/org/corfield/new/scratch/template.edn
{:scratch/file "scratch"
 :transform
 [["src" "src"
   {"scratch.clj" "{{scratch/file}}.clj"}]]}

from deps-new.

borkdude avatar borkdude commented on August 29, 2024

Almost... If it does also support a two-level directory, like foo/bar.clj then it would be sufficient. Single segment namespace aren't a great start imo.

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

Specify a qualified :scratch/file:

seanc@Sean-win-11-laptop:~/oss/deps-new$ clojure -X org.corfield.new/scratch :name play :scratch/file play/ground
Creating project from org.corfield.new/scratch in play
seanc@Sean-win-11-laptop:~/oss/deps-new$ tree play
play
├── deps.edn
└── src
    └── play
        └── ground.clj

2 directories, 2 files

from deps-new.

borkdude avatar borkdude commented on August 29, 2024

Excellent, I'll use that :)

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

Ah, that doesn't update the ns ... just a second ...

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

OK, try the latest commit. It accepts :scratch which generates :scratch/file and :scratch/ns so qualified names work properly.

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

Feel free to send a PR to fix bb compatibility -- I noticed it already applied to @rads fork of deps-new and let me know if you need anything else changed. Once that's all in, I'll tag a new version.

from deps-new.

borkdude avatar borkdude commented on August 29, 2024

Here's the PR to make deps-new bb compatible: #33
Thanks!

from deps-new.

borkdude avatar borkdude commented on August 29, 2024

@rads Has tried the latest commits and everything looks good. After the release we can move back to the original deps-new repo.

from deps-new.

seancorfield avatar seancorfield commented on August 29, 2024

Merged. Is anything else needed at this point or shall I go ahead and tag a new release?

from deps-new.

borkdude avatar borkdude commented on August 29, 2024

All good!

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.