OCaml project generator.
  • OCaml 84.2%
  • Makefile 6.3%
  • Text 4.1%
  • Dune 3.4%
  • Shell 1.4%
  • Other 0.6%
Find a file
Mathieu Barbin b2307a7be8
Preserve trailing newline characters at the end of template files when present (#123)
* Add new Spin_std.Sys test

This test verifies that newline char at end of file are preserved
during templating.

This test is currently broken and is fixed by the next commit.

* Fix Spin_std.Sys.read_file

Make it preserve newline characters at the end of the template files.

Files without trailing newline make dune @fmt and git produce
warnings.
2021-11-24 20:02:29 +01:00
.github/workflows Improve prompts 2021-06-29 13:53:01 +02:00
bin Move opam-spin to spin package 2021-06-04 16:35:02 +02:00
doc Update demo 2021-05-27 14:28:25 +02:00
lib Preserve trailing newline characters at the end of template files when present (#123) 2021-11-24 20:02:29 +01:00
script Add hello command (#114) 2021-06-04 13:43:16 +02:00
template Improve prompts 2021-06-29 13:53:01 +02:00
test Preserve trailing newline characters at the end of template files when present (#123) 2021-11-24 20:02:29 +01:00
test_bin Fix the inheritance overwrites for multi-level inheritance 2021-07-31 19:52:35 +02:00
test_template Make the test run for spin only 2021-06-04 17:01:58 +02:00
vendor Drop Reason and Esy support (#112) 2021-05-26 17:00:52 +02:00
.gitattributes Drop Reason and Esy support (#112) 2021-05-26 17:00:52 +02:00
.gitignore Drop Reason and Esy support (#112) 2021-05-26 17:00:52 +02:00
.ocamlformat Improve templates (#108) 2021-05-11 15:44:32 +02:00
CHANGES.md Preserve trailing newline characters at the end of template files when present (#123) 2021-11-24 20:02:29 +01:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2020-02-15 06:09:39 +00:00
CONTRIBUTING.md Improve contributing guide 2021-06-29 13:53:13 +02:00
dune-project Make the test run for spin only 2021-06-04 17:01:58 +02:00
LICENSE Drop Reason and Esy support (#112) 2021-05-26 17:00:52 +02:00
Makefile Run opam switch create with -y 2021-05-27 14:18:57 +02:00
opam-spin.opam Make the test run for spin only 2021-06-04 17:01:58 +02:00
opam-spin.opam.template Split the opam plugin in an 2021-06-04 16:27:16 +02:00
README.md Rename master to main 2021-05-26 17:05:04 +02:00
spin.opam Make the test run for spin only 2021-06-04 17:01:58 +02:00

Logo

OCaml project generator.

Build Status npm version

FeaturesInstallationTemplatesUsageRoadmapContributingLicenseAcknowledgements

Demo

Features

🚀 Quickly start new projects that are ready for the real world.

❤️ Have a great developer experience when developing with OCaml.

🏄 Be as productive as Ruby-on-Rails or Elixir's Mix users.

🔌 Establish a convention for projects organizations to make it easy to get into new projects.

Installation

Using Homebrew (macOS)

brew install tmattio/tap/spin

Using Opam

opam install spin

Using a script

curl -fsSL https://github.com/tmattio/spin/raw/main/script/install.sh | bash

Templates

You can generate a new project using a template with spin new. For instance:

spin new bin my_app

Will create a new binary application in the directory ./my_app/

Anyone can create new Spin templates, but we provide official templates for a lot of use cases.

Official templates

The official Spin templates templates are the following:

  • bin - Native project containing a binary.
  • cli - Command Line Interface releasable on Opam.
  • lib - Library releasable on Opam.
  • ppx - PPX library.
  • c-bindings - Bindings to a C library.
  • js - Js application with Js_of_ocaml.

If you'd like to add an official template, don't hesitate to open a PR!

Other OCaml templates

You can find community Spin templates for various projects here: https://github.com/ocaml-templates

Here are some non-official Spin templates that you can use:

Other non-OCaml templates

Although the focus of Spin is to offer a great project generator for the OCaml ecosystem, it can also be used to generate non-OCaml templates. Here are a few examples:

Usage

For a detailed documentation of Spin's CLI, run spin --help, or refer to the CLI documentation.

spin new TEMPLATE [PATH] [--default] [--ignore-config]

Create a new ReasonML/Ocaml project from a template.

PATH defaults to the current working directory.

When --default is passed, the user will not be prompted for configurations that have a default value.

When --ignore-config is passed, the configuration file will be ignored and the user will be prompted for all the configurations.

spin ls

List the official Spin templates.

spin config

Prompt the user for values that can be saved in the configuration file.

If a value is present in the configuration file, it will not be prompted when generating a new project.

Roadmap

See our development board for a list of selected features and issues.

Here are some of the improvements we'll be working on as well in for next releases:

  • Support windows
  • Support CLI options/args for configurations
  • Minimal hello template
  • Generators for lib/bin/test for all templates

Contributing

We'd love your help improving Spin!

Take a look at our Contributing Guide to get started.

License

Distributed under the ISC License. See LICENSE for more information.

Acknowledgements

Thanks to everyone who contributed to Spin!

Special thanks to @wesoudshoorn for creating Spin's logo.