implementation of command new#79
Conversation
|
First off, thanks for the PR! Overall looks good, one comment so far and just want to address some of the considerations you made in the description:
I don't particularly have an explicit structure in mind. I do like having some sort of top level The manifest is hard, I think we should have something. The I prefer keeping test files and the source files aligned, however I don't think it should be impossible to separate them. Having a default |
|
each ecosystem have its structure and various manifests, for instance elixir: $ mix new myproject
myproject
├── lib
│ └── myproject.ex
├── mix.exs
├── README.md
└── test
├── myproject_test.exs
└── test_helper.exshaskell: $ stack new myproject
myproject
├── app
│ └── Main.hs
├── CHANGELOG.md
├── LICENSE
├── myproject.cabal
├── package.yaml
├── README.md
├── Setup.hs
├── src
│ └── Lib.hs
├── stack.yaml
└── test
└── Spec.hsjava have a cultural tendency of structuring project so (but can depend from tool used... eclipse, netbeans, intellij, maven vs gradle...) $ tree myproject
myproject
├── pom.xml
└── src
├── main
│ ├── java
│ │ └── org
│ │ └── example
│ │ └── Main.java
│ └── resources
└── test
└── javaless structured are javascript, golang and python. I don't know them well and I see lot of different approach... $ mkdir myproject && cd myproject
$ npm init
$ tree myproject
myproject
└── package.json$ mkdir myproject && cd myproject
$ go mod init myproject
$ tree myproject
myproject
└── go.modin golang are born some defaults, for example here: https://github.com/golang-standards/project-layout |
|
If we consider Rust toolchain inspirational for Steel rust is pretty light in the scaffolding. |
|
For the testing side, I'm super fun of the testing approach used by Golang that enforce test files in the same folder of source file: instead languages like Rust and Zig tends to put unit tests and sources in the same file... My final proposal is this one: myproject
├── cog.scm
└── src
├── main.scm
├── mysum.scm
└── mysum-test.scmTest running is interesting, and I plan to create a new issue for implementing but do you want keep the file extension |
|
Couple points - the way the current library installer works is that it verbatim copies the directory to the (define package-name 'steel/logging)
(define version "0.1.0")
;; Core library, requires no dependencies
(define dependencies '())with the structure: Would then be installed to We could change the behavior to ignore Personally I don't feel the need to enforce a Also - I think tests in libraries and not separate is fine - I like the ability to test private methods as well as public ones. Public ones can be tested externally. |
|
Of course, let me know your decision, and I'm here to help with any fixes if needed. |
|
I think I quite like the flat structure - this is how racket projects are built with So lets go without the src directory for now and a flat structure. I think we can revisit this later if necessary, but for now I think just giving the option of adding the directory yourself is fine if you want to. |
|
Sure! Do you think the current commit is okay, or should we consider either putting |
|
I think the current structure is fine |
|
rust project structure is good, I vouch for such project layout! |
|
Hi @mattwparas, does it make sense to refresh this PR, or if it's too early to make a decision, I can close it for now? |
|
@AngeloChecked If you'd like to refresh the PR that would be fine! |
3a47283 to
0bb07fc
Compare
|
hi @mattwparas, I added the following to the test: (define dummy-provide 1)
(provide dummy-provide)This is just to allow the Let me know if you have any new insights or ideas about the starting scaffolding "experience" |
|
Hi @AngeloChecked - I think I'd like it better if this command were a part of the package manager, akin to I'm scaffolding that up now, and will follow up once its ready |
pkg manager will be a part of steel binary? that would be nice. just like |
The
steel newcommand shares its purpose with tools likecargo newandstack new- it creates the initial boilerplate to kickstart programming.There are various considerations to ponder:
package.jsonorcargo.toml)?main.scmfixed as the root, or can it be configured in the manifest?In this implementation, I've made certain choices: a flat file structure, an example test file,
main.scmas the root, andcogs.scmas the manifest.I don't have strong preferences and usually go with defaults I like. But I'm open to making changes and improvements, also in the code.
Please feel free to suggest any improvements.