module.exports = function(grunt) {
  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    ts: {
      default: {
        src: ['ts/**/*.ts'],
        outDir: 'tmp/',
        options: {
          module: 'none',
          sourceMap: false,
          target: 'es6',
          rootDir: 'ts/'
        }
      },
    },
    concat: {
      js: {
        src: ['tmp/**/*.js'],
        dest: 'tmp/bootstrap.out'
      },
      dist: {
        src: ['html/index.html'],
        dest: 'webroot/index.html',
      },
      options: {
        process: true
      }
    },
    watch: {
      jsbootstrapts: {
        files: ['ts/**/*.ts'],
        tasks: ['ts', 'concat']
      },
      html: {
        files: ['html/*'],
        tasks: ['concat']
      },
      lessdefault: {
        files: ['less/*.less'],
        tasks: ['less:default', 'concat']
      },
    },
    less: {
      default: {
        options: {
          "strictImports": true,
          "compress": true
        },
        files: {
          "tmp/default.css": "less/main.less",
        }
      },
    },
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks("grunt-ts");

  // Default task(s).
  grunt.registerTask('default', ['less', 'ts', 'concat', 'watch']);
  grunt.registerTask('release', ['less', 'ts', 'concat']);

};
