"use strict";

// Load TypeScript from our dependencies
try {
	var typescript = require("typescript");
} catch(e) {
	console.error("Couldn't load some dependencies; try running 'npm install'");
	process.exit(1);
}

// TypeScript compiler options on the server
const server = {
	typings: true,
	typescript: {
		module: "commonjs",
		target: "ES5",
		moduleResolution: "node",
		typescript: typescript,
		noEmitOnError: true
	}
};

// TypeScript compiler options on the client
const browser = {
	typescript: {
		module: "commonjs",
		sortOutput: true,
		target: "ES5",
		moduleResolution: "node",
		typescript: typescript,
		noEmitOnError: true
	},

	browserify: {
	}
};

// Style options
// sass is passed straight to node-sass
const styles = {
	sass: {
	},
	sassyImport: {
	},
	autoprefixer: ["last 2 versions", "Firefox ESR", "not IE < 11", "not ExplorerMobile < 11"],
	stylelint: {
		rules: {
			"declaration-no-important": true,
			"declaration-block-no-duplicate-properties": true,
			"block-no-single-line": true,
			"function-calc-no-unspaced-operator": true,
			"property-no-vendor-prefix": true,
			"number-leading-zero": "always"
			"indentation": "tab",
		}
	}
};

const config = {
	browserSync: {
		proxy: {
			target: "localhost:8000",
			ws: true
		}
	},

	preset: "debug",
	presets: {
		debug: {
			watch: true,
			sourcemaps: true,
			minify: false,
			out: "debug"
		},
		production: {
			watch: false,
			sourcemaps: false,
			minify: true,
			out: "production",
			transforms: [
				{
					name: "Metadata",
					type: "static",
					source: ["package.json", "Dockerfile"],
					dest: ""
				}
			]
		}
	},

	transforms: [
		{
			name: "Server (Runtime)",
			config: server,
			type: "server",
			extraEntries: ["typings/main.d.ts"],
			source: "node_modules/@server/**/*.ts",
			dest: "node_modules/@server"
		},
		{
			name: "Server (Common)",
			config: server,
			type: "server",
			source: "node_modules/@common/**/*.ts",
			dest: "node_modules/@common"
		},
		{
			config: {
				rename: "main.js"
			},
			name: "Server (Bootstrap)",
			type: "static",
			source: "node_modules/@server/bootstrap.js",
			dest: ""
		},
		{
			config: browser,
			type: "browser",
			extraEntries: ["typings/browser.d.ts"],
			source: "node_modules/@client/main.ts",
			dest: "static/bundle.js"
		},
		{
			config: styles,
			type: "styles",
			source: "node_modules/@client/main.scss",
			dest: "static/bundle.css"
		},
		{
			type: "static",
			source: "node_modules/@static/**/*.*",
			dest: "static"
		},
		{
			name: "Nodemon config",
			type: "static",
			source: "nodemon.json",
			dest: ""
		}
	]
};

module.exports = config;
@@ -1183,16 +1183,17 @@
 %22always%22
+,
 %0D%0A%09%09%09%22in
@@ -1209,17 +1209,16 @@
 %22: %22tab%22
-,
 %0D%0A%09%09%7D%0D%0A%09

Fix stupid typos