diff --git a/.gitignore b/.gitignore index d38ddad..5fdede1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,5 @@ static kfs plugins .rpt2_cache -*.js -*.d.ts \ No newline at end of file +./*.js +./*.d.ts \ No newline at end of file diff --git a/src/backend/webpack.prod.js b/src/backend/webpack.prod.js new file mode 100644 index 0000000..f1cd375 --- /dev/null +++ b/src/backend/webpack.prod.js @@ -0,0 +1,53 @@ +const TerserPlugin = require('terser-webpack-plugin'); + +const path = require('path'); + + + const FrontblockLib = { + mode: 'production', + entry: path.resolve(__dirname, '../../../lib/FrontblockLib.js'), + output: { + path: path.resolve(__dirname, '../../../static'), + filename: 'FrontblockLib.js', + }, + module: { + rules: [ + { test: /\FrontblockLib.ts/, use: 'ts-loader' } + ] + }, + optimization: { + minimizer: [new TerserPlugin({ + cache: true, + parallel: true, + terserOptions:{ + mangle: false, + keep_classnames: true + } + })], + splitChunks: { + cacheGroups: { + common: { + chunks: 'all', + minChunks: 2, + maxInitialRequests: 5, + minSize: 0, + name: 'common' + }, + vendor: { + test: /node_modules/, + chunks: 'all', + name: 'vendor', + priority: 10, + enforce: true, + minChunks: 2 + } + } + } + } + } + + +module.exports = [ + //Object.assign({}, angularPage), + Object.assign({}, FrontblockLib), +]; \ No newline at end of file diff --git a/src/frontend/dashboard/karma.conf.js b/src/frontend/dashboard/karma.conf.js new file mode 100644 index 0000000..af139fa --- /dev/null +++ b/src/frontend/dashboard/karma.conf.js @@ -0,0 +1,33 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular/cli'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular/cli/plugins/karma') + ], + client:{ + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + reports: [ 'html', 'lcovonly' ], + fixWebpackSourcePaths: true + }, + angularCli: { + environment: 'dev' + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false + }); +}; diff --git a/src/frontend/dashboard/protractor.conf.js b/src/frontend/dashboard/protractor.conf.js new file mode 100644 index 0000000..7ee3b5e --- /dev/null +++ b/src/frontend/dashboard/protractor.conf.js @@ -0,0 +1,28 @@ +// Protractor configuration file, see link for more information +// https://github.com/angular/protractor/blob/master/lib/config.ts + +const { SpecReporter } = require('jasmine-spec-reporter'); + +exports.config = { + allScriptsTimeout: 11000, + specs: [ + './e2e/**/*.e2e-spec.ts' + ], + capabilities: { + 'browserName': 'chrome' + }, + directConnect: true, + baseUrl: 'http://localhost:4200/', + framework: 'jasmine', + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000, + print: function() {} + }, + onPrepare() { + require('ts-node').register({ + project: 'e2e/tsconfig.e2e.json' + }); + jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); + } +}; diff --git a/src/frontend/dashboard/src/typings.d.ts b/src/frontend/dashboard/src/typings.d.ts new file mode 100644 index 0000000..ef5c7bd --- /dev/null +++ b/src/frontend/dashboard/src/typings.d.ts @@ -0,0 +1,5 @@ +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +} diff --git a/src/frontend/widget/rollup.config.js b/src/frontend/widget/rollup.config.js new file mode 100644 index 0000000..975646e --- /dev/null +++ b/src/frontend/widget/rollup.config.js @@ -0,0 +1,27 @@ +import resolve from 'rollup-plugin-node-resolve'; +import typescript from 'rollup-plugin-typescript2'; + +export default { + input: 'src/frontend/widget/main.ts', + output: { + file: 'FrontendPlugin.js', + format: 'system' + }, + plugins: [ + resolve({ + // pass custom options to the resolve plugin + customResolveOptions: { + moduleDirectory: 'node_modules' + } + }), + typescript({ + typescript: require('typescript'), + tsconfig: "tsconfig.frontend.json" + }) + ], + external: [ + 'plugins-core', + '@angular/core', + '@angular/common' + ] +} \ No newline at end of file