Browse Source

Reworked client-side build environment.

* Replaced package management via maven webjars with npm packages.
* Consolidated webpack configuration into a single file.
* Moved other files out of the root folder.
* Tried to simplify configuration wherever possible.
jalbr74 7 years ago
parent
commit
78948e6b4d
36 changed files with 357 additions and 509 deletions
  1. 140 168
      client/package-lock.json
  2. 14 11
      client/package.json
  3. 1 1
      client/src/components/changepassword/autogen-change-password.controller.ts
  4. 1 1
      client/src/components/changepassword/type-change-password.controller.ts
  5. 2 7
      client/src/index-dev.html
  6. 4 0
      client/src/modules/configeditor/configeditor.module.ts
  7. 6 6
      client/src/modules/helpdesk/helpdesk-detail.component.ts
  8. 2 2
      client/src/modules/helpdesk/helpdesk-search-cards.component.ts
  9. 2 2
      client/src/modules/helpdesk/helpdesk-search-table.component.ts
  10. 1 0
      client/src/modules/helpdesk/helpdesk.module.ts
  11. 5 1
      client/src/modules/helpdesk/main.dev.ts
  12. 5 1
      client/src/modules/helpdesk/main.ts
  13. 4 1
      client/src/modules/peoplesearch/main.dev.ts
  14. 4 1
      client/src/modules/peoplesearch/main.ts
  15. 2 2
      client/src/modules/peoplesearch/orgchart-search.component.ts
  16. 2 2
      client/src/modules/peoplesearch/orgchart.component.ts
  17. 2 2
      client/src/modules/peoplesearch/peoplesearch-cards.component.ts
  18. 2 2
      client/src/modules/peoplesearch/peoplesearch-table.component.ts
  19. 1 0
      client/src/modules/peoplesearch/peoplesearch.module.ts
  20. 1 1
      client/src/modules/peoplesearch/person-card.component.ts
  21. 2 2
      client/src/modules/peoplesearch/person-details-dialog.component.ts
  22. 1 1
      client/src/services/helpdesk.service.dev.ts
  23. 1 1
      client/src/services/people.service.dev.ts
  24. 3 3
      client/test/karma.conf.js
  25. 0 53
      client/webpack.build.js
  26. 0 110
      client/webpack.common.js
  27. 141 0
      client/webpack.config.js
  28. 0 49
      client/webpack.dev.js
  29. 0 27
      client/webpack.test.js
  30. 0 25
      server/pom.xml
  31. 1 4
      server/src/main/webapp/WEB-INF/jsp/changepassword.jsp
  32. 2 13
      server/src/main/webapp/WEB-INF/jsp/configeditor.jsp
  33. 0 8
      server/src/main/webapp/WEB-INF/jsp/fragment/footer.jsp
  34. 3 2
      server/src/main/webapp/WEB-INF/jsp/fragment/header.jsp
  35. 1 0
      server/src/main/webapp/WEB-INF/jsp/helpdesk.jsp
  36. 1 0
      server/src/main/webapp/WEB-INF/jsp/peoplesearch.jsp

File diff suppressed because it is too large
+ 140 - 168
client/package-lock.json


+ 14 - 11
client/package.json

@@ -8,31 +8,33 @@
         "npm": ">=3.9"
     },
     "scripts": {
-        "build": "webpack --config=webpack.build.js --mode=production",
+        "build": "webpack --mode=production",
         "clean": "rimraf dist/",
-        "test": "karma start --mode=development",
-        "test-single-run": "karma start --mode=development --singleRun --no-auto-watch",
-        "start": "webpack-dev-server --config=webpack.dev.js --mode=development --colors",
-        "sync": "webpack --config=webpack.build.js --mode=production --output-path=../server/target/pwm-1.8.0-SNAPSHOT/public/resources/webjars/pwm-client --watch --progress --colors"
+        "test": "karma start test/karma.conf.js --mode=development",
+        "test-single-run": "karma start test/karma.conf.js --mode=development --singleRun --no-auto-watch",
+        "start": "webpack-dev-server --mode=development --port 4000 --history-api-fallback --colors",
+        "sync": "webpack --mode=production --output-path=../server/target/pwm-1.8.0-SNAPSHOT/public/resources/webjars/pwm-client --watch --progress --colors"
     },
     "author": "",
     "license": "ISC",
-    "dependencies": {},
-    "devDependencies": {
+    "dependencies": {
         "@microfocus/ias-icons": "1.0.0-alpha",
         "@microfocus/ng-ias": "1.0.0-alpha.2",
         "@microfocus/ux-ias": "1.0.0-alpha.1",
+        "@uirouter/angularjs": "1.0.15",
+        "angular": "1.6.9",
+        "angular-aria": "1.6.9",
+        "angular-translate": "2.17.0",
+        "textangular": "1.5.16"
+    },
+    "devDependencies": {
         "@types/angular": "1.6.43",
         "@types/angular-mocks": "1.5.11",
         "@types/angular-translate": "2.15.2",
         "@types/angular-ui-router": "1.1.40",
         "@types/jasmine": "2.8.6",
         "@types/node": "9.4.7",
-        "@uirouter/angularjs": "1.0.15",
-        "angular": "1.6.9",
-        "angular-aria": "1.6.9",
         "angular-mocks": "1.6.9",
-        "angular-translate": "2.17.0",
         "autoprefixer": "8.1.0",
         "copy-webpack-plugin": "4.5.1",
         "css-loader": "0.28.10",
@@ -40,6 +42,7 @@
         "html-loader": "0.5.5",
         "html-webpack-plugin": "3.0.6",
         "ignore-loader": "0.1.2",
+        "imports-loader": "0.8.0",
         "jasmine": "3.1.0",
         "jasmine-core": "3.1.0",
         "jshint": "2.9.5",

+ 1 - 1
client/src/components/changepassword/autogen-change-password.controller.ts

@@ -27,7 +27,7 @@ import {IChangePasswordSuccess} from './success-change-password.controller';
 
 const RANDOM_MAPPING_SIZE = 20;
 
-require('components/changepassword/autogen-change-password.component.scss');
+require('./autogen-change-password.component.scss');
 
 export default class AutogenChangePasswordController {
     fetchingRandoms: boolean;

+ 1 - 1
client/src/components/changepassword/type-change-password.controller.ts

@@ -28,7 +28,7 @@ import {IChangePasswordSuccess} from './success-change-password.controller';
 import {IPasswordService, IValidatePasswordData} from '../../services/password.service';
 import IPwmService from '../../services/pwm.service';
 
-require('components/changepassword/type-change-password.component.scss');
+require('./type-change-password.component.scss');
 
 const EMPTY_MATCH_STATUS = 'EMPTY';
 const IN_PROGRESS_MESSAGE_WAIT_MS = 5;

+ 2 - 7
client/index.html → client/src/index-dev.html

@@ -27,8 +27,8 @@
     <meta name="viewport" content="initial-scale=1, maximum-scale=1">
     <title>PWM Development</title>
 
-    <link rel="stylesheet" href="vendor/ias-icons.css">
-    <link rel="stylesheet" href="vendor/ux-ias.css">
+    <link rel="stylesheet" href="vendor/ux-ias/ias-icons.css">
+    <link rel="stylesheet" href="vendor/ux-ias/ux-ias.css">
     <style>
         html, body {
             margin: 0;
@@ -40,10 +40,5 @@
 <body ng-cloak>
 <ui-view>Loading...</ui-view>
 
-<script src="vendor/angular.js"></script>
-<script src="vendor/angular-aria.js"></script>
-<script src="vendor/angular-translate.js"></script>
-<script src="vendor/angular-ui-router.js"></script>
-<script src="vendor/ng-ias.js"></script>
 </body>
 </html>

+ 4 - 0
client/src/modules/configeditor/configeditor.module.ts

@@ -20,7 +20,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+import 'textangular';
+import 'textangular/dist/textAngular-sanitize';
+
 import { module } from 'angular';
+
 import ConfigEditorController from './configeditor.controller';
 
 module('configeditor.module', ['textAngular'])

+ 6 - 6
client/src/modules/helpdesk/helpdesk-detail.component.ts

@@ -29,11 +29,11 @@ import {IActionButton, IHelpDeskConfigService, PASSWORD_UI_MODES} from '../../se
 import {IPerson} from '../../models/person.model';
 import {IChangePasswordSuccess} from '../../components/changepassword/success-change-password.controller';
 
-let autogenChangePasswordTemplateUrl = require('components/changepassword/autogen-change-password.component.html');
+let autogenChangePasswordTemplateUrl = require('../../components/changepassword/autogen-change-password.component.html');
 let helpdeskDetailDialogTemplateUrl = require('./helpdesk-detail-dialog.template.html');
-let randomChangePasswordTemplateUrl = require('components/changepassword/random-change-password.component.html');
-let successChangePasswordTemplateUrl = require('components/changepassword/success-change-password.component.html');
-let typeChangePasswordTemplateUrl = require('components/changepassword/type-change-password.component.html');
+let randomChangePasswordTemplateUrl = require('../../components/changepassword/random-change-password.component.html');
+let successChangePasswordTemplateUrl = require('../../components/changepassword/success-change-password.component.html');
+let typeChangePasswordTemplateUrl = require('../../components/changepassword/type-change-password.component.html');
 let verificationsDialogTemplateUrl = require('./verifications-dialog.template.html');
 
 const STATUS_WAIT = 'wait';
@@ -42,8 +42,8 @@ const STATUS_SUCCESS = 'success';
 const PROFILE_TAB_NAME = 'profileTab';
 
 @Component({
-    stylesheetUrl: require('modules/helpdesk/helpdesk-detail.component.scss'),
-    templateUrl: require('modules/helpdesk/helpdesk-detail.component.html')
+    stylesheetUrl: require('./helpdesk-detail.component.scss'),
+    templateUrl: require('./helpdesk-detail.component.html')
 })
 export default class HelpDeskDetailComponent {
     customButtons: {[key: string]: IActionButton};

+ 2 - 2
client/src/modules/helpdesk/helpdesk-search-cards.component.ts

@@ -33,8 +33,8 @@ import {IHelpDeskService} from '../../services/helpdesk.service';
 import IPwmService from '../../services/pwm.service';
 
 @Component({
-    stylesheetUrl: require('modules/helpdesk/helpdesk-search.component.scss'),
-    templateUrl: require('modules/helpdesk/helpdesk-search-cards.component.html')
+    stylesheetUrl: require('./helpdesk-search.component.scss'),
+    templateUrl: require('./helpdesk-search-cards.component.html')
 })
 export default class HelpDeskSearchCardsComponent extends HelpDeskSearchBaseComponent {
     static $inject = [

+ 2 - 2
client/src/modules/helpdesk/helpdesk-search-table.component.ts

@@ -32,8 +32,8 @@ import {IHelpDeskService} from '../../services/helpdesk.service';
 import IPwmService from '../../services/pwm.service';
 
 @Component({
-    stylesheetUrl: require('modules/helpdesk/helpdesk-search.component.scss'),
-    templateUrl: require('modules/helpdesk/helpdesk-search-table.component.html')
+    stylesheetUrl: require('./helpdesk-search.component.scss'),
+    templateUrl: require('./helpdesk-search-table.component.html')
 })
 export default class HelpDeskSearchTableComponent extends HelpDeskSearchBaseComponent {
     columnConfiguration: any;

+ 1 - 0
client/src/modules/helpdesk/helpdesk.module.ts

@@ -20,6 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+import 'angular-aria';
 
 import {IComponentOptions, module} from 'angular';
 import DateFilter from './date.filters';

+ 5 - 1
client/src/modules/helpdesk/main.dev.ts

@@ -20,6 +20,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+import 'angular';
+import 'angular-translate';
+import '@microfocus/ng-ias/dist/ng-ias';
+
 import { bootstrap, module } from 'angular';
 import helpDeskModule from './helpdesk.module';
 import routes from './routes';
@@ -38,7 +42,7 @@ module('app', [
     'ng-ias'
 ])
     .config(['$translateProvider', ($translateProvider: angular.translate.ITranslateProvider) => {
-        $translateProvider.translations('en', require('i18n/translations_en.json'));
+        $translateProvider.translations('en', require('../../i18n/translations_en.json'));
         $translateProvider.useSanitizeValueStrategy('escapeParameters');
         $translateProvider.preferredLanguage('en');
     }])

+ 5 - 1
client/src/modules/helpdesk/main.ts

@@ -20,6 +20,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+import 'angular';
+import 'angular-translate';
+import '@microfocus/ng-ias/dist/ng-ias';
+
 import { bootstrap, module } from 'angular';
 import helpDeskModule from './helpdesk.module';
 import PeopleService from '../../services/people.service';
@@ -43,7 +47,7 @@ module('app', [
         '$translateProvider',
         ($translateProvider: angular.translate.ITranslateProvider) => {
             $translateProvider
-                .translations('fallback', require('i18n/translations_en.json'))
+                .translations('fallback', require('../../i18n/translations_en.json'))
                 .useLoader('translationsLoader')
                 .useSanitizeValueStrategy('escapeParameters')
                 .preferredLanguage('en')

+ 4 - 1
client/src/modules/peoplesearch/main.dev.ts

@@ -20,6 +20,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+import 'angular';
+import 'angular-translate';
+import '@microfocus/ng-ias/dist/ng-ias';
 
 import { bootstrap, module } from 'angular';
 import ConfigService from '../../services/peoplesearch-config.service.dev';
@@ -40,7 +43,7 @@ module('app', [
 
     .config(routes)
     .config(['$translateProvider', ($translateProvider: angular.translate.ITranslateProvider) => {
-        $translateProvider.translations('en', require('i18n/translations_en.json'));
+        $translateProvider.translations('en', require('../../i18n/translations_en.json'));
         $translateProvider.useSanitizeValueStrategy('escapeParameters');
         $translateProvider.preferredLanguage('en');
     }])

+ 4 - 1
client/src/modules/peoplesearch/main.ts

@@ -20,6 +20,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+import 'angular';
+import 'angular-translate';
+import '@microfocus/ng-ias/dist/ng-ias';
 
 import { bootstrap, module } from 'angular';
 import ConfigService from '../../services/peoplesearch-config.service';
@@ -43,7 +46,7 @@ module('app', [
         '$translateProvider',
         ($translateProvider: angular.translate.ITranslateProvider) => {
             $translateProvider
-                .translations('fallback', require('i18n/translations_en.json'))
+                .translations('fallback', require('../../i18n/translations_en.json'))
                 .useLoader('translationsLoader')
                 .useSanitizeValueStrategy('escapeParameters')
                 .preferredLanguage('en')

+ 2 - 2
client/src/modules/peoplesearch/orgchart-search.component.ts

@@ -31,8 +31,8 @@ import IOrgChartData from '../../models/orgchart-data.model';
 import { IPerson } from '../../models/person.model';
 
 @Component({
-    stylesheetUrl: require('modules/peoplesearch/orgchart-search.component.scss'),
-    templateUrl: require('modules/peoplesearch/orgchart-search.component.html')
+    stylesheetUrl: require('./orgchart-search.component.scss'),
+    templateUrl: require('./orgchart-search.component.html')
 })
 export default class OrgChartSearchComponent {
     directReports: IPerson[];

+ 2 - 2
client/src/modules/peoplesearch/orgchart.component.ts

@@ -41,8 +41,8 @@ export enum OrgChartSize {
         person: '<',
         showImages: '<'
     },
-    stylesheetUrl: require('modules/peoplesearch/orgchart.component.scss'),
-    templateUrl: require('modules/peoplesearch/orgchart.component.html')
+    stylesheetUrl: require('./orgchart.component.scss'),
+    templateUrl: require('./orgchart.component.html')
 })
 export default class OrgChartComponent {
     directReports: IPerson[];

+ 2 - 2
client/src/modules/peoplesearch/peoplesearch-cards.component.ts

@@ -40,8 +40,8 @@ export enum PeopleSearchCardsSize {
 }
 
 @Component({
-    stylesheetUrl: require('modules/peoplesearch/peoplesearch-cards.component.scss'),
-    templateUrl: require('modules/peoplesearch/peoplesearch-cards.component.html')
+    stylesheetUrl: require('./peoplesearch-cards.component.scss'),
+    templateUrl: require('./peoplesearch-cards.component.html')
 })
 export default class PeopleSearchCardsComponent extends PeopleSearchBaseComponent {
     photosEnabled: boolean;

+ 2 - 2
client/src/modules/peoplesearch/peoplesearch-table.component.ts

@@ -32,8 +32,8 @@ import PromiseService from '../../services/promise.service';
 import SearchResult from '../../models/search-result.model';
 
 @Component({
-    stylesheetUrl: require('modules/peoplesearch/peoplesearch-table.component.scss'),
-    templateUrl: require('modules/peoplesearch/peoplesearch-table.component.html')
+    stylesheetUrl: require('./peoplesearch-table.component.scss'),
+    templateUrl: require('./peoplesearch-table.component.html')
 })
 export default class PeopleSearchTableComponent extends PeopleSearchBaseComponent {
     columnConfiguration: any;

+ 1 - 0
client/src/modules/peoplesearch/peoplesearch.module.ts

@@ -20,6 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+import 'angular-aria';
 
 import {IComponentOptions, module} from 'angular';
 import { HighlightFilter } from './string.filters';

+ 1 - 1
client/src/modules/peoplesearch/person-card.component.ts

@@ -25,7 +25,7 @@ import {IAugmentedJQuery} from 'angular';
 import { IPerson } from '../../models/person.model';
 import { IPeopleService } from '../../services/people.service';
 
-const templateUrl = require('modules/peoplesearch/person-card.component.html');
+const templateUrl = require('./person-card.component.html');
 
 class PersonCardController {
     private details: any[]; // For large style cards

+ 2 - 2
client/src/modules/peoplesearch/person-details-dialog.component.ts

@@ -28,8 +28,8 @@ import { IAugmentedJQuery, ITimeoutService } from 'angular';
 import { IPerson } from '../../models/person.model';
 
 @Component({
-    stylesheetUrl: require('modules/peoplesearch/person-details-dialog.component.scss'),
-    templateUrl: require('modules/peoplesearch/person-details-dialog.component.html')
+    stylesheetUrl: require('./person-details-dialog.component.scss'),
+    templateUrl: require('./person-details-dialog.component.html')
 })
 export default class PersonDetailsDialogComponent {
     person: IPerson;

+ 1 - 1
client/src/services/helpdesk.service.dev.ts

@@ -28,7 +28,7 @@ import {IPromise, IQService, ITimeoutService, IWindowService} from 'angular';
 import {IPerson} from '../models/person.model';
 import SearchResult from '../models/search-result.model';
 
-const peopleData = require('./people.data');
+const peopleData = require('./people.data.json');
 
 const MAX_RESULTS = 10;
 const SIMULATED_RESPONSE_TIME = 300;

+ 1 - 1
client/src/services/people.service.dev.ts

@@ -27,7 +27,7 @@ import { IPeopleService } from './people.service';
 import IOrgChartData from '../models/orgchart-data.model';
 import SearchResult from '../models/search-result.model';
 
-const peopleData = require('./people.data');
+const peopleData = require('./people.data.json');
 
 const MAX_RESULTS = 10;
 const SIMULATED_RESPONSE_TIME = 0;

+ 3 - 3
client/karma.conf.js → client/test/karma.conf.js

@@ -21,14 +21,14 @@
  */
 
 var webpack = require('webpack');
-var webpackConfig = require('./webpack.test.js');
+var webpackConfig = require('../webpack.test.js');
 var path = require("path");
 var os = require('os');
 
 module.exports = function (config) {
     config.set({
         // base path that will be used to resolve all patterns (eg. files, exclude)
-        basePath: '',
+        basePath: '..',
 
         // frameworks to use
         // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
@@ -36,7 +36,7 @@ module.exports = function (config) {
 
         // list of files / patterns to load in the browser
         files: [
-            'test/karma-test-suite.ts'
+            'karma-test-suite.ts'
         ],
 
         exclude: [],

+ 0 - 53
client/webpack.build.js

@@ -1,53 +0,0 @@
-/*
- * Password Management Servlets (PWM)
- * http://www.pwm-project.org
- *
- * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2018 The PWM Project
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-var commonConfig = require('./webpack.common.js');
-var CopyWebpackPlugin = require('copy-webpack-plugin');
-var UglifyJsPlugin = require('uglifyjs-webpack-plugin');
-var webpack = require('webpack');
-var webpackMerge = require('webpack-merge');
-
-module.exports = webpackMerge(commonConfig, {
-    devtool: 'source-map',
-    entry: {
-        'peoplesearch.ng': './src/modules/peoplesearch/main',
-        'changepassword.ng': './src/modules/changepassword/changepassword.module',
-        'configeditor.ng': './src/modules/configeditor/configeditor.module',
-        'helpdesk.ng': './src/modules/helpdesk/main'
-    },
-    plugins: [
-        new CopyWebpackPlugin([
-            { from: 'node_modules/@microfocus/ux-ias/dist/ux-ias.css', to: 'vendor/' },
-            { from: 'node_modules/@microfocus/ng-ias/dist/ng-ias.js', to: 'vendor/' },
-            { from: 'node_modules/@microfocus/ias-icons/dist/ias-icons.css', to: 'vendor/' },
-            { from: 'node_modules/@microfocus/ias-icons/dist/fonts', to: 'vendor/fonts' }
-        ]),
-        new UglifyJsPlugin({
-            sourceMap: true,
-            uglifyOptions: {
-                compress: {warnings: false},
-                comments: false
-            }
-        })
-    ]
-});

+ 0 - 110
client/webpack.common.js

@@ -1,110 +0,0 @@
-/*
- * Password Management Servlets (PWM)
- * http://www.pwm-project.org
- *
- * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2018 The PWM Project
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-var HtmlWebpackPlugin = require('html-webpack-plugin');
-var autoPrefixer = require('autoprefixer');
-var path = require('path');
-var webpack = require('webpack');
-
-var outDir = path.resolve(__dirname, 'dist');
-
-module.exports = {
-    devServer: {
-        contentBase: outDir,
-        // outputPath: outDir,
-        port: 4000,
-        historyApiFallback: true
-    },
-    // Externals copied to /dist via CopyWebpackPlugin
-    externals:
-    {
-        'angular': true,
-        // Wrapped in window because of hyphens
-        'angular-ui-router': 'window["angular-ui-router"]',
-        'angular-translate': 'window["angular-translate"]'
-    },
-    module: {
-        rules: [
-            {
-                test: /\.ts$/,
-                enforce: 'pre',
-                loader: 'tslint-loader'
-            },
-            {
-                test: /\.ts$/,
-                loader: 'ts-loader',
-                exclude: /node_modules/
-            },
-            {
-                test: /index\.html$/,
-                loader: 'html-loader',
-                exclude: /node_modules/
-            },
-            {
-                test: /\.html$/,
-                loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, './src')) + '/!html-loader',
-                exclude: /index\.html$/
-            },
-            {
-                test: /\.scss$/,
-                loaders: [ 'style-loader', 'css-loader', 'sass-loader', {
-                    loader: 'postcss-loader',
-                    options: {
-                        plugins: function () {
-                            return [autoPrefixer('last 2 versions')]
-                        }
-                    }
-                }]
-            },
-            {
-                test: /\.(png|jpg|jpeg|gif|svg)$/,
-                loaders: [ 'url-loader?limit=25000' ]
-            }
-        ]
-    },
-    // [name] is replaced by entry point name
-    output: {
-        filename: '[name].js',
-        path: outDir
-    },
-    plugins: [
-        new HtmlWebpackPlugin({
-            chunks: ['peoplesearch.ng'],
-            filename: 'peoplesearch.html',
-            template: 'index.html',
-            // title: 'PeopleSearch Development',
-            inject: 'body'
-        }),
-        new HtmlWebpackPlugin({
-            chunks: ['helpdesk.ng'],
-            filename: 'helpdesk.html',
-            template: 'index.html',
-            // title: 'PeopleSearch Development',
-            inject: 'body'
-        })
-    ],
-    resolve: {
-        extensions: [ '.ts', '.js', '.json' ],
-        modules: ['./src', './vendor', 'node_modules']
-    }
-};

+ 141 - 0
client/webpack.config.js

@@ -0,0 +1,141 @@
+const path = require('path');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const CopyWebpackPlugin = require('copy-webpack-plugin');
+const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
+const webpackMerge = require('webpack-merge');
+const webpack = require('webpack');
+const autoPrefixer = require('autoprefixer');
+
+const outDir = path.resolve(__dirname, 'dist');
+const srcDir = path.resolve(__dirname, 'src');
+
+module.exports = function (env, argv) {
+    const isProductionMode = (argv["mode"] === "production");
+
+    const commonConfig = {
+        devtool: 'source-map',
+        entry: {
+            'changepassword.ng': './src/modules/changepassword/changepassword.module',
+            'configeditor.ng': './src/modules/configeditor/configeditor.module'
+
+            // (see production and development specific sections below for more entries)
+        },
+        output: {
+            filename: "[name].js",
+            path: outDir
+        },
+        resolve: {
+            extensions: [".ts", ".js"]
+        },
+        module: {
+            rules: [
+                {
+                    test: /.ts$/,
+                    loader: "ts-loader"
+                },
+                {
+                    test: /\.ts$/,
+                    enforce: 'pre',
+                    loader: 'tslint-loader'
+                },
+                {
+                    test: /index-dev\.html$/,
+                    loader: 'html-loader',
+                    exclude: /node_modules/
+                },
+                {
+                    test: /\.html$/,
+                    loader: 'ngtemplate-loader!html-loader',
+                    exclude: /index-dev\.html$/
+                },
+                {
+                    test: /\.(scss)$/,
+                    loaders: [ 'style-loader', 'css-loader', 'sass-loader', {
+                        loader: 'postcss-loader',
+                        options: {
+                            plugins: function () {
+                                return [autoPrefixer('last 2 versions')]
+                            }
+                        }
+                    }]
+                },
+                {
+                    test: /\.(png|jpg|jpeg|gif|svg)$/,
+                    loaders: [ 'url-loader?limit=25000' ]
+                },
+                {
+                    test: [
+                        require.resolve("textangular"),
+                        require.resolve("textangular/dist/textAngular-sanitize")
+                    ],
+                    use: "imports-loader?angular"
+                }
+            ]
+        },
+        plugins: [
+            new CopyWebpackPlugin([
+                { from: 'node_modules/@microfocus/ux-ias/dist/ux-ias.css', to: 'vendor/ux-ias/' },
+                { from: 'node_modules/@microfocus/ias-icons/dist/ias-icons.css', to: 'vendor/ux-ias/' },
+                { from: 'node_modules/@microfocus/ias-icons/dist/fonts', to: 'vendor/ux-ias/fonts' },
+                { from: 'node_modules/textangular/dist/textAngular.css', to: 'vendor/textangular' }
+            ])
+        ],
+        optimization: {
+            splitChunks: {
+                cacheGroups: {
+                    vendor: {
+                        test: /[\\/]node_modules[\\/]/,
+                        name: "vendor",
+                        chunks: "all"
+                    }
+                }
+            }
+        }
+    };
+
+    if (isProductionMode) {
+        // Production-specific configuration
+        return webpackMerge(commonConfig, {
+            entry: {
+                'peoplesearch.ng': './src/modules/peoplesearch/main',
+                'helpdesk.ng': './src/modules/helpdesk/main'
+            },
+            plugins: [
+                new UglifyJsPlugin({
+                    sourceMap: true,
+                    uglifyOptions: {
+                        compress: {warnings: false},
+                        comments: false
+                    }
+                })
+            ]
+        });
+    }
+    else {
+        // Development-specific configuration
+        return webpackMerge(commonConfig, {
+            entry: {
+                'peoplesearch.ng': './src/modules/peoplesearch/main.dev',
+                'helpdesk.ng': './src/modules/helpdesk/main.dev'
+            },
+            plugins: [
+                new HtmlWebpackPlugin({
+                    chunks: ['peoplesearch.ng', 'vendor'],
+                    chunksSortMode: 'dependency',
+                    filename: 'peoplesearch.html',
+                    template: 'src/index-dev.html',
+                    inject: 'body',
+                    livereload: true
+                }),
+                new HtmlWebpackPlugin({
+                    chunks: ['helpdesk.ng', 'vendor'],
+                    chunksSortMode: 'dependency',
+                    filename: 'helpdesk.html',
+                    template: 'src/index-dev.html',
+                    inject: 'body',
+                    livereload: true
+                })
+            ],
+        });
+    }
+};

+ 0 - 49
client/webpack.dev.js

@@ -1,49 +0,0 @@
-/*
- * Password Management Servlets (PWM)
- * http://www.pwm-project.org
- *
- * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2018 The PWM Project
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-var commonConfig = require('./webpack.common.js');
-var CopyWebpackPlugin = require('copy-webpack-plugin');
-var webpackMerge = require('webpack-merge');
-
-module.exports = webpackMerge(commonConfig, {
-    devtool: 'cheap-module-source-map',
-    entry: {
-        'peoplesearch.ng': './src/modules/peoplesearch/main.dev',
-        'changepassword.ng': './src/modules/changepassword/changepassword.module',
-        'configeditor.ng': './src/modules/configeditor/configeditor.module',
-        'helpdesk.ng': './src/modules/helpdesk/main.dev'
-    },
-    plugins: [
-        // Don't forget to add this to karma.conf.js
-        new CopyWebpackPlugin([
-            { from: 'node_modules/@uirouter/angularjs/release/angular-ui-router.js', to: 'vendor/' },
-            { from: 'node_modules/angular/angular.js', to: 'vendor/' },
-            { from: 'node_modules/angular-aria/angular-aria.js', to: 'vendor/' },
-            { from: 'node_modules/angular-translate/dist/angular-translate.js', to: 'vendor/' },
-            { from: 'node_modules/@microfocus/ux-ias/dist/ux-ias.css', to: 'vendor/' },
-            { from: 'node_modules/@microfocus/ng-ias/dist/ng-ias.js', to: 'vendor/' },
-            { from: 'node_modules/@microfocus/ias-icons/dist/ias-icons.css', to: 'vendor/' },
-            { from: 'node_modules/@microfocus/ias-icons/dist/fonts', to: 'vendor/fonts' }
-        ])
-    ]
-});

+ 0 - 27
client/webpack.test.js

@@ -1,27 +0,0 @@
-/*
- * Password Management Servlets (PWM)
- * http://www.pwm-project.org
- *
- * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2018 The PWM Project
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-var commonConfig = require('./webpack.common.js');
-var webpackMerge = require('webpack-merge');
-
-module.exports = webpackMerge(commonConfig, {});

+ 0 - 25
server/pom.xml

@@ -822,31 +822,6 @@
             <artifactId>famfamfam-flags</artifactId>
             <version>1.0.0</version>
         </dependency>
-        <dependency>
-            <groupId>org.webjars.bower</groupId>
-            <artifactId>angular</artifactId>
-            <version>1.6.9</version>
-        </dependency>
-        <dependency>
-            <groupId>org.webjars.bower</groupId>
-            <artifactId>angular-aria</artifactId>
-            <version>1.6.9</version>
-        </dependency>
-        <dependency>
-            <groupId>org.webjars.bower</groupId>
-            <artifactId>angular-ui-router</artifactId>
-            <version>1.0.14</version>
-        </dependency>
-        <dependency>
-            <groupId>org.webjars.bower</groupId>
-            <artifactId>angular-translate</artifactId>
-            <version>2.17.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.webjars.bower</groupId>
-            <artifactId>textAngular</artifactId>
-            <version>1.5.16</version>
-        </dependency>
     </dependencies>
 
     <repositories>

+ 1 - 4
server/src/main/webapp/WEB-INF/jsp/changepassword.jsp

@@ -135,11 +135,8 @@
     </script>
 </pwm:script>
 
-<pwm:script-ref url="/public/resources/webjars/angular/angular.min.js" />
-<pwm:script-ref url="/public/resources/webjars/angular-ui-router/release/angular-ui-router.min.js" />
-<pwm:script-ref url="/public/resources/webjars/angular-translate/angular-translate.min.js" />
-
 <pwm:script-ref url="/public/resources/js/changepassword.js"/>
+<pwm:script-ref url="/public/resources/webjars/pwm-client/vendor.js" />
 <pwm:script-ref url="/public/resources/webjars/pwm-client/changepassword.ng.js" />
 
 <%@ include file="fragment/footer.jsp" %>

+ 2 - 13
server/src/main/webapp/WEB-INF/jsp/configeditor.jsp

@@ -163,21 +163,10 @@
 <pwm:script-ref url="/public/resources/js/configeditor.js"/>
 <pwm:script-ref url="/public/resources/js/admin.js"/>
 
-<%--Add support for angular--%>
-<pwm:script-ref url="/public/resources/webjars/angular/angular.min.js" />
-<pwm:script-ref url="/public/resources/webjars/angular-ui-router/release/angular-ui-router.min.js" />
-<pwm:script-ref url="/public/resources/webjars/angular-translate/angular-translate.min.js" />
-<%--/ Add support for angular--%>
-
-<%--Add support for the "textAngular" library (a control for editing HTML)--%>
-<link rel="stylesheet" type="text/css" href="<pwm:url url='/public/resources/webjars/textAngular/dist/textAngular.css' addContext="true"/>"/>
-<pwm:script-ref url="/public/resources/webjars/textAngular/dist/textAngular-rangy.min.js" />
-<pwm:script-ref url="/public/resources/webjars/textAngular/dist/textAngular-sanitize.min.js" />
-<pwm:script-ref url="/public/resources/webjars/textAngular/dist/textAngular.min.js" />
-<%--/ Add support for the "textAngular" library (a control for editing HTML)--%>
-
 <%--Provide the angular code we made specifically for this page:--%>
+<link rel="stylesheet" type="text/css" href="<pwm:url url='/public/resources/webjars/pwm-client/vendor/textangular/textAngular.css' addContext="true"/>"/>
 <link rel="stylesheet" type="text/css" href="<pwm:url url='/public/resources/html-editor.css' addContext="true"/>"/>
+<pwm:script-ref url="/public/resources/webjars/pwm-client/vendor.js" />
 <pwm:script-ref url="/public/resources/webjars/pwm-client/configeditor.ng.js" />
 <%--/ Provide the angular code we made specifically for this page:--%>
 

+ 0 - 8
server/src/main/webapp/WEB-INF/jsp/fragment/footer.jsp

@@ -26,14 +26,6 @@
 <%@ page import="password.pwm.http.PwmRequestFlag" %>
 <%@ taglib uri="pwm" prefix="pwm" %>
 
-<pwm:if test="<%=PwmIfTest.requestFlag%>" requestFlag="<%=PwmRequestFlag.INCLUDE_IAS_ANGULAR%>">
-    <pwm:script-ref url="/public/resources/webjars/angular/angular.min.js" />
-    <pwm:script-ref url="/public/resources/webjars/angular-aria/angular-aria.min.js" />
-    <pwm:script-ref url="/public/resources/webjars/angular-ui-router/release/angular-ui-router.min.js" />
-    <pwm:script-ref url="/public/resources/webjars/angular-translate/angular-translate.min.js" />
-    <pwm:script-ref url="/public/resources/webjars/pwm-client/vendor/ng-ias.js" />
-</pwm:if>
-
 <%-- begin pwm footer --%>
 <pwm:if test="<%=PwmIfTest.requestFlag%>" requestFlag="<%=PwmRequestFlag.HIDE_FOOTER_TEXT%>" negate="true">
     <div id="footer">

+ 3 - 2
server/src/main/webapp/WEB-INF/jsp/fragment/header.jsp

@@ -65,8 +65,9 @@
             var PWM_GLOBAL = PWM_GLOBAL || {}; PWM_GLOBAL['startupFunctions'] = [];
         </script>
     </pwm:script>
+
     <% if (JspUtility.getPwmRequest(pageContext).isFlag(PwmRequestFlag.INCLUDE_IAS_ANGULAR) || JspUtility.getPwmRequest(pageContext).isFlag(PwmRequestFlag.INCLUDE_IAS_CSS)) { %>
-        <link rel="stylesheet" type="text/css" href="<pwm:url url='/public/resources/webjars/pwm-client/vendor/ias-icons.css' addContext="true"/>"/>
-        <link rel="stylesheet" type="text/css" href="<pwm:url url='/public/resources/webjars/pwm-client/vendor/ux-ias.css' addContext="true"/>"/>
+        <link rel="stylesheet" type="text/css" href="<pwm:url url='/public/resources/webjars/pwm-client/vendor/ux-ias/ias-icons.css' addContext="true"/>"/>
+        <link rel="stylesheet" type="text/css" href="<pwm:url url='/public/resources/webjars/pwm-client/vendor/ux-ias/ux-ias.css' addContext="true"/>"/>
     <% } %>
 </head>

+ 1 - 0
server/src/main/webapp/WEB-INF/jsp/helpdesk.jsp

@@ -47,6 +47,7 @@
 
 <jsp:include page="/WEB-INF/jsp/fragment/footer.jsp"/>
 
+<pwm:script-ref url="/public/resources/webjars/pwm-client/vendor.js" />
 <pwm:script-ref url="/public/resources/webjars/pwm-client/helpdesk.ng.js" />
 
 </body>

+ 1 - 0
server/src/main/webapp/WEB-INF/jsp/peoplesearch.jsp

@@ -41,6 +41,7 @@
 
 <%@ include file="fragment/footer.jsp" %>
 
+<pwm:script-ref url="/public/resources/webjars/pwm-client/vendor.js" />
 <pwm:script-ref url="/public/resources/webjars/pwm-client/peoplesearch.ng.js" />
 
 </body>

Some files were not shown because too many files changed in this diff