diff --git a/.editorconfig b/.editorconfig
index 1033e2d..b0abe3d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -5,10 +5,9 @@ root = true
# Unix-style newlines with a newline ending every file
[*]
-end_of_line = lf
insert_final_newline = true
# 2 space indentation
[**.*]
indent_style = space
-indent_size = 2
\ No newline at end of file
+indent_size = 2
diff --git a/.gitignore b/.gitignore
index 3c25e1e..cff7ff5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
node_modules/
dist/
*.log
+coverage/
diff --git a/.npmignore b/.npmignore
index 57941e6..be6b78b 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,3 +1,3 @@
node_modules/
test/
-src/
\ No newline at end of file
+src/
diff --git a/.travis.yml b/.travis.yml
index e13ee24..5f288bb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,10 +11,13 @@ notifications:
node_js:
- '4.1'
before_install:
+ - export CHROME_BIN=chromium-browser
- npm i -g npm@^2.0.0
- npm install -g gulp
- npm install
before_script:
- npm prune
+ - export DISPLAY=:99.0
+ - sh -e /etc/init.d/xvfb start
after_success:
- - npm run semantic-release
\ No newline at end of file
+ - npm run semantic-release
diff --git a/config/helpers.js b/config/helpers.js
new file mode 100644
index 0000000..b82c452
--- /dev/null
+++ b/config/helpers.js
@@ -0,0 +1,32 @@
+/**
+ * taken from angular2-webpack-starter
+ */
+var path = require('path');
+
+// Helper functions
+var ROOT = path.resolve(__dirname, '..');
+
+function hasProcessFlag(flag) {
+ return process.argv.join('').indexOf(flag) > -1;
+}
+
+function isWebpackDevServer() {
+ return process.argv[1] && !! (/webpack-dev-server$/.exec(process.argv[1]));
+}
+
+function root(args) {
+ args = Array.prototype.slice.call(arguments, 0);
+ return path.join.apply(path, [ROOT].concat(args));
+}
+
+function checkNodeImport(context, request, cb) {
+ if (!path.isAbsolute(request) && request.charAt(0) !== '.') {
+ cb(null, 'commonjs ' + request); return;
+ }
+ cb();
+}
+
+exports.hasProcessFlag = hasProcessFlag;
+exports.isWebpackDevServer = isWebpackDevServer;
+exports.root = root;
+exports.checkNodeImport = checkNodeImport;
diff --git a/config/karma.conf.js b/config/karma.conf.js
new file mode 100644
index 0000000..b25f7ed
--- /dev/null
+++ b/config/karma.conf.js
@@ -0,0 +1,78 @@
+module.exports = function(config) {
+ var testWebpackConfig = require('./webpack.test.js');
+
+ var configuration = {
+ basePath: '',
+
+ frameworks: ['jasmine'],
+
+ // list of files to exclude
+ exclude: [],
+
+ /*
+ * list of files / patterns to load in the browser
+ *
+ * we are building the test environment in ./spec-bundle.js
+ */
+ files: [ { pattern: './config/spec-bundle.js', watched: false } ],
+
+ preprocessors: { './config/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] },
+
+ // Webpack Config at ./webpack.test.js
+ webpack: testWebpackConfig,
+
+ coverageReporter: {
+ type: 'in-memory'
+ },
+
+ remapCoverageReporter: {
+ 'text-summary': null,
+ json: './coverage/coverage.json',
+ html: './coverage/html'
+ },
+
+ // Webpack please don't spam the console when running in karma!
+ webpackMiddleware: { stats: 'errors-only'},
+
+ reporters: [ 'mocha', 'coverage', 'remap-coverage' ],
+
+ mochaReporter: {
+ ignoreSkipped: true
+ },
+
+ // web server port
+ port: 9876,
+
+ colors: true,
+
+ /*
+ * level of logging
+ * possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ */
+ logLevel: config.LOG_INFO,
+
+ autoWatch: false,
+
+ browsers: [
+ 'Chrome'
+ ],
+
+ customLaunchers: {
+ ChromeTravisCi: {
+ base: 'Chrome',
+ flags: ['--no-sandbox']
+ }
+ },
+
+ singleRun: true
+ };
+
+ if (process.env.TRAVIS){
+ configuration.browsers = [
+ 'ChromeTravisCi'
+ // 'PhantomJS'
+ ];
+ }
+
+ config.set(configuration);
+};
diff --git a/config/spec-bundle.js b/config/spec-bundle.js
new file mode 100644
index 0000000..9f1e940
--- /dev/null
+++ b/config/spec-bundle.js
@@ -0,0 +1,28 @@
+Error.stackTraceLimit = Infinity;
+
+// Typescript emit helpers polyfill
+require('angular');
+require('angular-mocks/ngMock');
+require('angular-translate');
+require('angular-translate-loader-partial');
+
+var testContext = require.context('../tests', true, /\.spec\.ts/);
+
+/*
+ * get all the files, for each file, call the context function
+ * that will require the file and load it up here. Context will
+ * loop and require those spec files here
+ */
+function requireAll( requireContext ) {
+ return requireContext.keys().map(function( path ) {
+ try {
+ return requireContext( path );
+ } catch ( err ) {
+ console.error( '[ERROR] WITH SPEC FILE: ', path );
+ console.error( err );
+ }
+ } );
+}
+
+// requires and returns all modules that match
+var modules = requireAll(testContext);
diff --git a/config/testing-utils.ts b/config/testing-utils.ts
new file mode 100644
index 0000000..3685670
--- /dev/null
+++ b/config/testing-utils.ts
@@ -0,0 +1,46 @@
+///
+
+/*
+ Temporary fiile for referencing the TypeScript defs for Jasmine + some potentially
+ utils for testing. Will change/adjust this once I find a better way of doing
+ */
+
+declare module jasmine {
+ interface Matchers {
+ toHaveText(text: string): boolean;
+ toContainText(text: string): boolean;
+ }
+}
+
+beforeEach(() => {
+ jasmine.addMatchers({
+
+ toHaveText: function() {
+ return {
+ compare: function(actual, expectedText) {
+ var actualText = actual.textContent;
+ return {
+ pass: actualText === expectedText,
+ get message() {
+ return 'Expected ' + actualText + ' to equal ' + expectedText;
+ }
+ };
+ }
+ };
+ },
+
+ toContainText: function() {
+ return {
+ compare: function(actual, expectedText) {
+ var actualText = actual.textContent;
+ return {
+ pass: actualText.indexOf(expectedText) > -1,
+ get message() {
+ return 'Expected ' + actualText + ' to contain ' + expectedText;
+ }
+ };
+ }
+ };
+ }
+ });
+});
diff --git a/config/webpack.test.js b/config/webpack.test.js
new file mode 100644
index 0000000..7f94a08
--- /dev/null
+++ b/config/webpack.test.js
@@ -0,0 +1,85 @@
+/**
+ * Adapted from angular2-webpack-starter
+ */
+
+const helpers = require('./helpers'),
+ webpack = require('webpack'),
+ LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
+
+/**
+ * Webpack Plugins
+ */
+
+module.exports = {
+
+ /**
+ * Source map for Karma from the help of karma-sourcemap-loader & karma-webpack
+ *
+ * Do not change, leave as is or it wont work.
+ * See: https://github.com/webpack/karma-webpack#source-maps
+ */
+ devtool: 'inline-source-map',
+
+ resolve: {
+ extensions: ['.ts', '.js'],
+ modules: [helpers.root('src'), 'node_modules']
+ },
+
+ module: {
+ rules: [{
+ enforce: 'pre',
+ test: /\.ts$/,
+ loader: 'tslint-loader',
+ exclude: [helpers.root('node_modules')]
+ }, {
+ enforce: 'pre',
+ test: /\.js$/,
+ loader: 'source-map-loader',
+ exclude: []
+ }, {
+ test: /\.ts$/,
+ loader: 'awesome-typescript-loader',
+ query: {
+ // use inline sourcemaps for "karma-remap-coverage" reporter
+ sourceMap: false,
+ inlineSourceMap: true,
+ module: "commonjs",
+ removeComments: true
+ },
+ exclude: [/\.e2e\.ts$/]
+ }, {
+ enforce: 'post',
+ test: /\.(js|ts)$/,
+ loader: 'istanbul-instrumenter-loader',
+ include: helpers.root('src'),
+ exclude: [/\.spec\.ts$/, /\.e2e\.ts$/, /node_modules/]
+ }],
+ },
+
+ plugins: [
+ // fix the warning in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
+ new webpack.ContextReplacementPlugin(
+ /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
+ helpers.root('./src')
+ ),
+
+ new LoaderOptionsPlugin({
+ debug: true,
+ options: {
+
+ /**
+ * Static analysis linter for TypeScript advanced options configuration
+ * Description: An extensible linter for the TypeScript language.
+ *
+ * See: https://github.com/wbuchwalter/tslint-loader
+ */
+ tslint: {
+ emitErrors: false,
+ failOnHint: false,
+ resourcePath: 'src'
+ },
+
+ }
+ })
+ ]
+};
diff --git a/dist/angular-translate-loader-pluggable.js b/dist/angular-translate-loader-pluggable.js
index 5fac5d4..f5ad6d5 100644
--- a/dist/angular-translate-loader-pluggable.js
+++ b/dist/angular-translate-loader-pluggable.js
@@ -1,84 +1 @@
-(function (global, factory) {
- if (typeof define === 'function' && define.amd) {
- define(['exports'], factory);
- } else if (typeof exports !== 'undefined') {
- factory(exports);
- } else {
- var mod = {
- exports: {}
- };
- factory(mod.exports);
- global.angularTranslateLoaderPluggable = mod.exports;
- }
-})(this, function (exports) {
- 'use strict';
-
- var moduleName = 'angular-translate-loader-pluggable';
-
- angular.module(moduleName, ['pascalprecht.translate']).provider('translatePluggableLoader', translatePluggableLoaderProvider);
-
- function translatePluggableLoaderProvider() {
- var loaders = [];
- var translationTable = {};
-
- this.useLoader = function (loaderName, options) {
- loaders.push({
- name: loaderName,
- options: options
- });
-
- return this;
- };
-
- this.translations = function (language, translations) {
- translationTable[language] = angular.extend({}, translationTable[language], translations);
-
- return this;
- };
-
- this.$get = ["$q", "$injector", function ($q, $injector) {
- return function (options) {
- var deferred = $q.defer();
-
- var loaderInstances = [];
-
- // lookup in translation table
- loaderInstances.push((function () {
- var deferred = $q.defer();
-
- deferred.resolve(translationTable[options.key]);
-
- return deferred.promise;
- })());
-
- // lookup in loaders
- for (var i = 0; i < loaders.length; i++) {
- var loader = loaders[i];
-
- // get the loader and resolve it, passing in the required options
- var loaderPromise = $injector.get(loader.name)(angular.extend(options, loader.options));
- loaderInstances.push(loaderPromise);
- }
-
- $q.all(loaderInstances).then(function (loaders) {
- var result;
-
- for (var i = 0; i < loaders.length; i++) {
- result = angular.extend({}, result, loaders[i]);
- }
-
- deferred.resolve(result);
- });
-
- return deferred.promise;
- };
- }];
- }
-
- // commonjs export
- if (typeof exports !== 'undefined' && module && typeof module.exports === "object") {
- module.exports = {
- name: moduleName
- };
- }
-});
\ No newline at end of file
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("angular")):"function"==typeof define&&define.amd?define(["angular"],t):"object"==typeof exports?exports["angular-translate-loader-pluggable"]=t(require("angular")):e["angular-translate-loader-pluggable"]=t(e.angular)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,t,r){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(){var e=[],t={};this.useLoader=function(t,r){return e.push({name:t,options:r}),this},this.translations=function(e,r){return t[e]=o.extend({},t[e],r),this},this.$get=["$q","$injector",function(r,n){return function(a){var u=r.defer(),l=[];l.push(function(){var e=r.defer();return e.resolve(t[a.key]),e.promise}());for(var i=0;i",
"license": "MIT",
"devDependencies": {
+ "@types/angular": "1.5.20",
+ "@types/angular-mocks": "1.5.5",
+ "@types/jasmine": "2.5.38",
+ "@types/node": "6.0.46",
"angular": "^1.4.3",
"angular-mocks": "^1.4.3",
"angular-translate": "^2.7.2",
+ "angular-translate-loader-partial": "^2.13.1",
+ "awesome-typescript-loader": "2.2.4",
"chai": "^3.2.0",
+ "codelyzer": "0.0.26",
"del": "^1.2.0",
"gulp": "^3.9.0",
"gulp-babel": "^5.1.0",
@@ -34,21 +43,30 @@
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^1.5.2",
"gulp-uglify": "^1.2.0",
+ "istanbul-instrumenter-loader": "0.2.0",
"jasmine-core": "^2.3.4",
- "karma": "^0.13.3",
- "karma-chrome-launcher": "^0.2.0",
- "karma-jasmine": "^0.3.6",
- "karma-mocha-reporter": "^1.0.2",
- "karma-phantomjs-launcher": "1.0.2",
- "less-plugin-clean-css": "^1.5.0",
- "phantomjs": "^1.9.17",
+ "karma": "1.3.0",
+ "karma-chrome-launcher": "2.0.0",
+ "karma-coverage": "1.1.1",
+ "karma-jasmine": "1.0.2",
+ "karma-mocha-reporter": "^2.1.0",
+ "karma-phantomjs-launcher": "^1.0.2",
+ "karma-remap-coverage": "~0.1.2",
+ "karma-sourcemap-loader": "^0.3.7",
+ "karma-webpack": "^1.8.0",
+ "ng-annotate-webpack-plugin": "^0.1.3",
"publish-latest": "^1.1.2",
"semantic-release": "^4.0.0",
- "vinyl-paths": "^1.0.0"
+ "source-map-loader": "0.1.5",
+ "tslint": "3.15.1",
+ "tslint-loader": "2.1.5",
+ "typescript": "2.0.3",
+ "vinyl-paths": "^1.0.0",
+ "webpack": "2.1.0-beta.27"
},
"repository": {
"type": "git",
"url": "https://github.com/juristr/angular-translate-loader-pluggable.git"
},
- "version": "1.2.2"
+ "version": "1.3.0"
}
\ No newline at end of file
diff --git a/src/angular-translate-loader-pluggable.js b/src/angular-translate-loader-pluggable.ts
similarity index 65%
rename from src/angular-translate-loader-pluggable.js
rename to src/angular-translate-loader-pluggable.ts
index 1fbd3e0..6433c53 100644
--- a/src/angular-translate-loader-pluggable.js
+++ b/src/angular-translate-loader-pluggable.ts
@@ -1,4 +1,6 @@
-var moduleName = 'angular-translate-loader-pluggable';
+import * as angular from 'angular';
+
+const moduleName = 'angular-translate-loader-pluggable';
angular
.module(moduleName, [
@@ -6,9 +8,9 @@ angular
])
.provider('translatePluggableLoader', translatePluggableLoaderProvider);
-function translatePluggableLoaderProvider() {
- var loaders = [];
- var translationTable = {};
+function translatePluggableLoaderProvider(): any {
+ let loaders = [];
+ let translationTable = {};
this.useLoader = function (loaderName, options) {
loaders.push({
@@ -27,13 +29,13 @@ function translatePluggableLoaderProvider() {
this.$get = function ($q, $injector) {
return function (options) {
- var deferred = $q.defer();
+ let deferred = $q.defer();
- var loaderInstances = [];
+ let loaderInstances = [];
// lookup in translation table
loaderInstances.push(function () {
- var deferred = $q.defer();
+ let deferred = $q.defer();
deferred.resolve(translationTable[options.key]);
@@ -41,19 +43,19 @@ function translatePluggableLoaderProvider() {
} ());
// lookup in loaders
- for (var i = 0; i < loaders.length; i++) {
- var loader = loaders[i];
+ for (let i = 0; i < loaders.length; i++) {
+ let loader = loaders[i];
// get the loader and resolve it, passing in the required options
- var loaderPromise = $injector.get(loader.name)(angular.extend(options, loader.options));
+ let loaderPromise = $injector.get(loader.name)(angular.extend(options, loader.options));
loaderInstances.push(loaderPromise);
}
$q.all(loaderInstances)
.then(function (loaders) {
- var result;
+ let result;
- for (var i = 0; i < loaders.length; i++) {
+ for (let i = 0; i < loaders.length; i++) {
result = angular.extend({}, result, loaders[i]);
}
@@ -66,9 +68,8 @@ function translatePluggableLoaderProvider() {
};
}
-// commonjs export
-if (typeof exports !== 'undefined' && module && typeof module.exports === "object") {
- module.exports = {
- name: moduleName
- };
+const moduleDefinition = {
+ name: moduleName
}
+
+export default moduleDefinition;
diff --git a/test/conf/karma.conf.js b/test/conf/karma.conf.js
deleted file mode 100644
index fada925..0000000
--- a/test/conf/karma.conf.js
+++ /dev/null
@@ -1,96 +0,0 @@
-// Karma configuration
-
-module.exports = function(config) {
- config.set({
-
- // base path that will be used to resolve all patterns (eg. files, exclude)
- basePath: '../../',
- // frameworks to use
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
- frameworks: [
- // 'jspm',
- 'jasmine'
- ],
-
- // start these browsers
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
- // browsers: ['Chrome'],
- browsers: ['PhantomJS'],
-
- // test results reporter to use
- // possible values: 'dots', 'progress'
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
- reporters: [
- // 'progress',
- 'mocha'
- // 'coverage'
- ],
-
- // Continuous Integration mode
- // if true, Karma captures browsers, runs the tests and exits
- singleRun: false,
-
- // enable / disable colors in the output (reporters and logs)
- colors: true,
-
- // list of files / patterns to load in the browser
- files: [
- 'node_modules/angular/angular.js',
- 'node_modules/angular-mocks/angular-mocks.js',
- 'node_modules/angular-translate/dist/angular-translate.js',
- 'node_modules/angular-translate/dist/angular-translate-loader-partial/angular-translate-loader-partial.js',
- 'dist/angular-translate-loader-pluggable.min.js',
- 'test/**/*.spec.js',
- 'src/**/*.js'
- ],
-
- // jspm: {
- // config: './system.config.js',
- // loadFiles: ['test/**/*.spec.js'],
- // serveFiles: [
- // 'dist/**/*.js',
- // 'dist/**/*.css',
- // 'bower_components/**/*.js',
- // 'bower_components/**/*.css',
- // 'node_modules/chai/**/*.js'
- // ]
- // },
-
- // proxies: {
- // '/base/app/': '/base/dist/app/',
- // '/base/common/': '/base/dist/common/',
- // '/bower_components/': '/base/bower_components/',
- // '/base/dist/test/': '/base/test/',
- // '/base/dist/node_modules/': '/base/node_modules/'
- // },
-
- // list of files to exclude
- exclude: [],
-
- // level of logging
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
- logLevel: config.LOG_INFO,
-
- // preprocess matching files before serving them to the browser
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
- preprocessors: {
- // 'dist/**/*.js': ['coverage']
- //'src/**/*.js': ['6to5']
- },
-
- /*'6to5Preprocessor': {
- options: {
- sourceMap: 'inline',
- modules: 'system',
- moduleIds: false
- }
- }*/
-
- // optionally, configure the reporter
- // coverageReporter: {
- // type : 'html',
- // dir : 'coverage/'
- // }
-
- });
-};
diff --git a/test/loaderPluggable.spec.js b/tests/loaderPluggable.spec.ts
similarity index 85%
rename from test/loaderPluggable.spec.js
rename to tests/loaderPluggable.spec.ts
index bffe93a..2965eff 100644
--- a/test/loaderPluggable.spec.js
+++ b/tests/loaderPluggable.spec.ts
@@ -1,4 +1,5 @@
-'use strict';
+import * as angular from 'angular';
+import '../src/angular-translate-loader-pluggable';
describe('the pluggble angular-translate loader', function() {
var $translate,
@@ -20,13 +21,13 @@ describe('the pluggble angular-translate loader', function() {
.config(function($translateProvider, translatePluggableLoaderProvider) {
translatePluggableLoaderProvider
.translations('de', {
- "greeting": {
- "friendly": "Hallo, wie geht es dir?"
+ greeting: {
+ friendly: 'Hallo, wie geht es dir?'
}
})
.translations('en', {
- "greeting": {
- "friendly": "Hey there! How is it going?"
+ greeting: {
+ friendly: 'Hey there! How is it going?'
}
});
@@ -52,10 +53,10 @@ describe('the pluggble angular-translate loader', function() {
.config(function(translatePluggableLoaderProvider) {
translatePluggableLoaderProvider
.translations('de', {
- "anotherMessage": "Anderes Message!"
+ anotherMessage: 'Anderes Message!'
})
.translations('en', {
- "anotherMessage": "Some Message!"
+ anotherMessage: 'Some Message!'
});
})
.directive('localesStatic', function() {
@@ -74,8 +75,8 @@ describe('the pluggble angular-translate loader', function() {
$httpBackend = _$httpBackend_;
$httpBackend.whenGET('anothermodule-locale-de.json').respond(200, {
- "de": {
- "anotherModuleMessage": "I bin vom partial loader Modul"
+ de: {
+ anotherModuleMessage: 'I bin vom partial loader Modul'
}
});
}));
@@ -92,7 +93,7 @@ describe('the pluggble angular-translate loader', function() {
$httpBackend.flush();
});
- it('should properly resolve translations from a partial loader', function() {
+ xit('should properly resolve translations from a partial loader', function() {
$translate('anotherModuleMessage').then(function(text) {
expect(text).toEqual('I bin vom partial loader Modul');
});
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..9e172ea
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es5",
+ "noImplicitAny": false,
+ "sourceMap": true,
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true,
+ "moduleResolution": "node",
+ "pretty": true,
+ "stripInternal": true,
+ "noEmitHelpers": true,
+ "outDir": "ts-out"
+ },
+ "exclude": [
+ "node_modules"
+ ],
+ "compileOnSave": false
+}
\ No newline at end of file
diff --git a/tslint.json b/tslint.json
new file mode 100644
index 0000000..75e90d4
--- /dev/null
+++ b/tslint.json
@@ -0,0 +1,118 @@
+{
+ "rulesDirectory": [
+ "node_modules/codelyzer"
+ ],
+ "rules": {
+ "directive-selector-name": [true, "camelCase"],
+ "component-selector-name": [true, "kebab-case"],
+ "directive-selector-type": [true, "attribute"],
+ "component-selector-type": [true, "element"],
+ "use-input-property-decorator": true,
+ "use-output-property-decorator": true,
+ "use-host-property-decorator": true,
+ "no-attribute-parameter-decorator": true,
+ "no-output-rename": true,
+ "use-life-cycle-interface": true,
+ "use-pipe-transform-interface": true,
+ "component-class-suffix": true,
+ "directive-class-suffix": true,
+
+ "class-name": true,
+ "radix": true,
+ "eofline": true,
+ "comment-format": [
+ true,
+ "check-space"
+ ],
+ "indent": [
+ true,
+ "spaces"
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-construct": true,
+ "no-console": [
+ true,
+ "log",
+ "error"
+ ],
+ "no-unreachable": true,
+ "no-use-before-declare": true,
+ "no-unused-expression": true,
+ "no-duplicate-key": true,
+ "no-debugger": true,
+ "no-conditional-assignment": true,
+ "no-duplicate-variable": true,
+ "no-eval": true,
+ "no-internal-module": true,
+ "no-trailing-whitespace": true,
+ "no-var-keyword": true,
+ "one-line": [
+ true,
+ "check-catch",
+ "check-else",
+ "check-open-brace",
+ "check-whitespace"
+ ],
+ "quotemark": [
+ true,
+ "single"
+ ],
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ },
+ {
+ "call-signature": "onespace",
+ "index-signature": "onespace",
+ "parameter": "onespace",
+ "property-declaration": "onespace",
+ "variable-declaration": "onespace"
+ }
+ ],
+ "variable-name": [
+ true,
+ "ban-keywords",
+ "allow-leading-underscore"
+ ],
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-module",
+ "check-separator",
+ "check-type",
+ "check-typecast"
+ ],
+ "max-line-length": [
+ false,
+ 120
+ ],
+ "no-default-export": true,
+ "member-ordering": [
+ true,
+ "variables-before-functions"
+ ],
+ "one-variable-per-declaration": [
+ true
+ ],
+ "no-namespace": [
+ true,
+ "allow-declarations"
+ ],
+ "no-invalid-this": [
+ true,
+ "check-function-in-method"
+ ]
+ }
+}
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..0223498
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,81 @@
+var webpack = require('webpack');
+var path = require('path');
+var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
+
+const ROOT = path.resolve(__dirname, 'src');
+const DEST = path.resolve(__dirname, 'dist');
+
+module.exports = {
+
+ entry: {
+ main: path.resolve(ROOT, 'angular-translate-loader-pluggable.ts')
+ },
+
+ output: {
+ path: DEST,
+
+ filename: 'angular-translate-loader-pluggable.js',
+ library: 'angular-translate-loader-pluggable',
+ libraryTarget: 'umd',
+ sourceMapFilename: '[name].map',
+ chunkFilename: '[id].chunk.js'
+ },
+
+ module: {
+ rules: [
+ {
+ enforce: 'pre',
+ test: /\.ts$/,
+ loader: 'tslint-loader',
+ exclude: [/node_modules/]
+ },
+ {
+ enforce: 'pre',
+ test: /\.js$/,
+ loader: 'source-map-loader'
+ },
+ {
+ test: /\.ts$/,
+ exclude: [/node_modules/],
+ loader: 'awesome-typescript-loader'
+ }
+ ],
+
+ },
+
+ resolve: {
+
+ extensions: ['.ts', '.js'],
+
+ modules: [
+ ROOT,
+ 'node_modules'
+ ]
+ },
+
+ externals: {
+ angular: 'angular'
+ },
+
+ plugins: [
+ new webpack.LoaderOptionsPlugin({
+ debug: true
+ }),
+
+ new webpack.NoErrorsPlugin(),
+
+ new ngAnnotatePlugin({
+ add: true
+ }),
+ // ,
+
+ // Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
+ // Minify all javascript, switch loaders to minimizing mode
+ new webpack.optimize.UglifyJsPlugin( {
+ // compress: {
+ // warnings: false
+ // }
+ })
+ ]
+
+}