Skip to content

TypeScript 2.0 Pre boilerplate for node and the browser. Tests in Mocha & Chai. TSLint for better code quality

License

Notifications You must be signed in to change notification settings

aristocrats/sikky

Repository files navigation

TypeScript 2.0 Pre boilerplate for node and the browser

Build Status CircleCI Build status Coverage Status npm version npm downloads npm

A fast, and small sized TypeScript 2.0 boilerplate. All source files get transpiled down to ES2015 by default. Rollup and Bublé are used to make a clean ES2015 bundle.Bublé is used for compability with older browsers. Easy to get rid of or replaced with Babel.

Debugging and server testing can be done within VSCode.

A complete bundle time is assumed to be around 2 ms, and 4 ms for the browser tests. Depends on your computer and the size of your source files.

Features

  • Statically typed build system for working with Typescript 2.0 Pre
  • VSCode integration. Debug and run tests in the editor.
  • Consistent code style with TSLint.
  • Bublé as the ES2015 compiler
  • Rollup for bundling
  • Intelligent code editing with VSCode
  • Experimental support for ES7 decorators.
  • async/await and generators support for ES5/ES3
  • Karma as the test runner
  • Test Driven Development (TDD)
  • Mocha & Chai de facto standard
  • Sinon for test doubles
  • Environment variabels
  • Code Coverage with Istanbul
  • Production and development build with Rollup.
  • ECMAScript 2015 modules in Node.
  • Allow dead code elimination for ES6 modules
  • SourceMap
  • TSX / JSX
  • Easy debugging

Quick start

The only development dependency of this project is Node.js. So just make sure you have it installed. Then type few commands known to every Node developer...

git clone --depth 1 https://github.com/kflash/sikky.git
cd sikky
# install the project's dependencies
npm install

# dev build
npm run build:dev
# prod build
npm run build:prod

... and boom! You have it all setup for you!

Workflow

  • npm run build - transpile down to ES5 and builds a bundle both for development and production
  • npm run build:dev - transpile down to ES5 and builds a bundle for development
  • npm run build:prod - transpile down to ES5 and builds a bundle for production
  • npm run build:vcode - build task for the VSCode editor
  • npm run build:watch - watch your TypeScript files and trigger recompilation on changes.
  • npm run lint:src - validates all source files
  • npm run lint:tests - validates all test files
  • npm run clean - removed the dist, coverage and build folders
  • npm run clean:build - remove the build folder
  • npm run clean:dist - removed the dist folder
  • npm run test - run tests both for browser and node
  • npm run test:browser - run all unit tests in the browser
  • npm run test:node - run all unit tests in the node.js environment
  • npm run tdd:browser - run all unit tests and watch files for changes in the browser.
  • npm run tdd:node - run all unit tests and watch files for changes in the node.js environment.
  • npm run debug - debug task used by VSCode.
  • npm run dependencies:check - shows a list over dependencies with a higher version number then the current one - if any
  • npm run dependencies:upgrade - automatically upgrade all devDependencies & dependencies, and update package.json

Node development

Start the VSCode editor, and press Ctrl+Shift+B to build the project. You will see compiler output in the output window (Ctrl+Shift+U) indicating that TypeScript transpile your source code to ES2015.

To stop the compilation, press Ctrl+P → > Tasks: Terminate Running Task.

Press F5 to start debugging.

To run the Mocha tests on node.js - press F1 and then type task to see all tasks available. Click on test to run the tests.

Watch

With the npm run build:watch, the TypeScript 2.0 compiler will start in watch mode, and watch input files and trigger recompilation on changes. Dead code elimination for ES6 modules are activated by default, so later on you can use either Webpack 2.0 (early beta stage) or Rollup to perform tree shaking.

The watch task inform you if something is wrong with your code, and can come up with suggestions on how to solve current issue.

7:28:24 PM - File change detected. Starting incremental compilation...
src/universal/foo.ts(7,10): error TS2348: Value of type 'typeof TeaSpoon' is not callable.
Did you mean to include 'new'?

Continuous integration (CI)

Travis, Circle and Appveyor are the only supported CI. Travis is setup to work with Linux and OSX. Appveyor only runs in a Windows environment, but are configured to run on both the x86 and x64 platform.

Test-driven development (TDD)

It's integrated a tdd task both for the browser tests, and server tests.

Code coverage

Istanbul are used to generate the coverage report.

Server testing

Server testing is done with Mocha + Chai, and is also integrated with the VSCode.

Android and iOS

This boilerplate is tested against Travis CI configured to run Android with SDK version android-19 - 23. It's not tested with iOS. But the conlusion is that this works just fine.

About

TypeScript 2.0 Pre boilerplate for node and the browser. Tests in Mocha & Chai. TSLint for better code quality

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published