lein-typescript

A Leiningen plugin for running TypeScript compiler

EPL-1.0 License

Downloads
424
Stars
7
Committers
2

lein-typescript

TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language. - Wikipedia

lein-typescript is a Leiningen plugin that allows to use TypeScript compiler.

Pre-requirements

Install NodeJS and NPM (package manager for Node) to install TypeScript:

  • On Ubuntu: sudo apt-get install nodejs
  • On Mac OS X: brew install node

Installation

Install TypeScript to use lein-typescript plugin. It could be done in few ways:

  • Use NPM to install TypeScript globally: npm install typescript -g
  • You can also install TypeScript in the current directory: npm install typescript
  • Use lein-npm plugin: lein npm install
  • Use just Leiningen: lein deps

To enable lein-typescript for your project, put the following in the :plugins vector of your project.clj file:

; Use latest version instead of "X.X.X"
:plugins [[lein-typescript "X.X.X"]]

Configuration

To configure lein-typescript, put the :typescript parameter in the file project.clj. It could be a single configuration (simple map) or a collection of configurations (for multiple configuration).

:typescript {
  :sources ["*.ts" "resources/*.ts"]
  :excludes ["bad.ts"]
  :out "app.js"
  :declaration true
  :remove-comments true
  :target :es5
}

Configuration parameters

Hooks

To enable this plugin in the compile stage, use the following hook:

:hooks [lein-typescript.plugin]

Usage

To compile TypeScript files using configuration from project.clj, you should use: lein typescript. It is also possible to use short alias for typescript task: lein ts.

To show help: lein help typescript

Example project

Just clone the current repository and try to play with example project for better understanding how to use lein-typescript.

Thanks to

Microsoft Corporation, Anders Hejlsberg and TypeScript community for the great programming language.

Might also like

  • lein-coffeescript - a Leiningen plugin for running CoffeeScript compiler.
  • lein-jslint - a Leiningen plugin for running javascript code through JSLint.
  • lein-jshint - a Leiningen plugin for running javascript code through JSHint.
  • lein-plantuml - a Leiningen plugin for generating UML diagrams using PlantUML.
  • lein-asciidoctor - A Leiningen plugin for generating documentation using Asciidoctor.
  • jabberjay - a simple framework for creating Jabber bots.
  • coderwall-clj - a tiny CoderWall client for Clojure.

License

Copyright © 2015 Vladislav Bauer

Distributed under the Eclipse Public License, the same as Clojure.