Giter Club home page Giter Club logo

lein-typescript's Introduction

lein-typescript

Build Status Dependencies Status

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

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
  :preserve-const-enums true
  :suppress-implicit-any-index-errors true
  :target :es5
}

Configuration parameters

:sources
List of input CoffeeScript sources. It is possible to use a single source or a vector of sources. To configure this parameter, you could also use a Glob Patterns.
:excludes
List of glob patterns to prevent processing of some files. It is also possible to use both variants: single pattern and collection of patterns.
:out-dir
Redirect output structure to the specified directory (it is undefined by default). ":out" parameter will be used in priority.
:out
Concatenate and emit output to single file which you can specify using this parameter (it is undefined by default).
:remove-comments
Do not emit comments to output (default value is "false").
:preserve-const-enums
Do not erase const enum declarations in generated code (default value is "false").
:suppress-implicit-any-index-errors
Suppress noImplicitAny errors for indexing objects lacking index signatures (default value is "false").
:declaration
Generates corresponding ".d.ts" file (default value is "false").
:source-map
Generates corresponding '.map' file (default is "false").
:module
Specify module code generation: :commonjs or :amd (it is undefined by default).
:target
Specify ECMAScript target version: :es3 (default), :es5, or :es6 (experimental).
:watch
Watch input files. It could be helpful to use this parameter with lein-pdo and/or with separate profile (default is "false").

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.

lein-typescript's People

Contributors

vbauer avatar

Watchers

James Cloos avatar Roma Chi avatar

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.