Giter Site home page Giter Site logo

broccoli-typescript-compiler's Introduction

broccoli-typescript-compiler

Build Status Build status

A Broccoli plugin which compiles TypeScript files.

How to install?

$ npm install broccoli-typescript-compiler --save-dev

How to use?

var typescript = require("broccoli-typescript-compiler").default;
var cjsTree = typescript(inputTree, {
  tsconfig: {
    compilerOptions: {
      module: "commonjs",
      target: "es5",
      moduleResolution: "node",
      newLine: "LF",
      rootDir: "src",
      outDir: "dist",
      sourceMap: true,
      declaration: true,
    },
    files: ["src/index.ts", "src/tests/**"],
  },
  throwOnError: false,
  annotation: "compile program",
});

Config Options:

tsconfig:

annotation:

An optional string, which when provide should be a descriptive annotation. Useful for debugging, to tell multiple instances of the same plugin apart.

throwOnError

An optional boolean, defaulting to false. If set to true, will cause the build to break on errors.

note: if process.env.NODE_ENV === 'production' is true, throwOnError will default to true.

Ways to use:

via the broccoli plugin subclass

This outputs only the emitted files from the compiled program.

const { TypescriptCompiler } = require("broccoli-typescript-compiler");
let compiled = new TypescriptCompiler(input, options);

via function

This outputs only the emitted files from the compiled program.

const { default: typescript } = require("broccoli-typescript-compiler");

let compiled = typescript(src, options);

filter function (passthrough non .ts files)

This selects only ts files from the input to compile and merges emitted files with the non ts files in the input.

const { filterTypescript } = require("broccoli-typescript-compiler");
let output = filterTypescript(input, options);

Developemnt

How to upgrade typescript

  1. Update typescript in package.json
  2. Run yarn run generate-tsconfig-interface
  3. Update vendor/typescript. cd vendor/typescript && git fetch --tags && git checkout v[new-version-of-typescript]
  4. Commit all of the above changes
  5. Run yarn test. There may be some changes needed to the tests to accomidate changes in TypeScript.

broccoli-typescript-compiler's People

Contributors

arthurvr avatar asakusuma avatar bekzod avatar chadhietala avatar chancancode avatar davewasmer avatar ef4 avatar givanse avatar hhff avatar jayphelps avatar joliss avatar jschiq2 avatar krisselden avatar lynchbomb avatar nightire avatar peterood avatar philipbjorge avatar rwjblue avatar sebmck avatar smfoote avatar stefanpenner avatar theseyi avatar thoov avatar tomdale avatar twokul avatar wycats avatar

Watchers

 avatar  avatar  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.