Skip to content

stack new for creating new projects with templates #137

@radix

Description

@radix

I'll let others determine whether this is in of scope, but I think it would be a good idea to build in a project-creating command that sets up a basic directory/file structure.

This would be kinda like cabal init, but wider in scope -- more like lein new.

Here are some of the features I imagine it should have, perhaps to be split into separate tickets:

  • stack new myproj would create a myproj directory with src, README, LICENSE, stack.yaml
  • create a Main.hs (if the user specifies a command-line argument?)
  • create sample unit test file
  • create a directory layout within src based on module names provided by the user (as a command-line argument?)
  • support plugins for different code templates.
  • support specifying the template-plugin on the stack new command line without installing that plugin ahead of time, e.g. stack new myproj --template=yesod-scaffold-stack[==x.x.x] would automatically install the yesod-scaffold-stack plugin and use it to generate the new project.

(see plugin discussion at #136)

It would be nice to also have commands for manipulating a project after it's been created. New users coming to the tooling may want to just play around, and having to decide up-front what "kind" of project they should make (library and/or executable? what should the targets be?) can be a bit paralyzing -- if they make one choice, and write some code, how will they change it later? The project-creation command should make this very clear and as easy as possible to change afterward.

Khan Thompson created http://hackage.haskell.org/package/hein recently, which is basically exactly what I'm suggesting here. On the reddit discussion at http://www.reddit.com/r/haskell/comments/37wsxc/hein_an_alpha_build_tool_modelled_after_lein/crqilmw he indicated he'd be happy to deprecate his in favor of this one (implicitly, anyway).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions