diff --git a/package.json b/package.json index 1f39761ccb1..f8206facdcc 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "node": ">=5.8.0" }, "scripts": { - "build": "webpack --production --hide-modules", + "build": "webpack --production --hide-modules --stats=errors-only", "unit-test": "karma start test/unit/karma.conf.js --single-run=true", "unit-test-watch": "karma start test/unit/karma.conf.js", "pree2e-test": "webdriver-manager update", diff --git a/scripts/app.js b/scripts/app.js index f0959f42bdd..26968d1ae3e 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -24,10 +24,10 @@ window.SwaggerEditor = angular.module('SwaggerEditor', [ 'ngStorage' ]); -require('./config.js'); +require('scripts/config.js'); // Require all of components -require('./components'); +require('scripts/components'); // Bootstrap the app -require('./bootstrap'); +require('scripts/bootstrap'); diff --git a/scripts/components.js b/scripts/components.js index 7aee3dd85ab..2b9f03b55f8 100644 --- a/scripts/components.js +++ b/scripts/components.js @@ -6,72 +6,72 @@ */ // Configurations -require('./config/app.config.js'); +require('scripts/config/app.config.js'); // Router -require('./router'); +require('scripts/router'); // Services -require('./services/analytics.js'); -require('./services/ast-manager.js'); -require('./services/auth-manager.js'); -require('./services/autocomplete.js'); -require('./services/backend.js'); -require('./services/builder.js'); -require('./services/codegen.js'); -require('./services/editor.js'); -require('./services/external-hooks.js'); -require('./services/fileloader.js'); -require('./services/focused-path.js'); -require('./services/fold-state-manager.js'); -require('./services/keyword-map.js'); -require('./services/local-storage.js'); -require('./services/preferences.js'); -require('./services/storage.js'); -require('./services/sway-worker.js'); -require('./services/tag-manager.js'); -require('./services/yaml.js'); +require('scripts/services/analytics.js'); +require('scripts/services/ast-manager.js'); +require('scripts/services/auth-manager.js'); +require('scripts/services/autocomplete.js'); +require('scripts/services/backend.js'); +require('scripts/services/builder.js'); +require('scripts/services/codegen.js'); +require('scripts/services/editor.js'); +require('scripts/services/external-hooks.js'); +require('scripts/services/fileloader.js'); +require('scripts/services/focused-path.js'); +require('scripts/services/fold-state-manager.js'); +require('scripts/services/keyword-map.js'); +require('scripts/services/local-storage.js'); +require('scripts/services/preferences.js'); +require('scripts/services/storage.js'); +require('scripts/services/sway-worker.js'); +require('scripts/services/tag-manager.js'); +require('scripts/services/yaml.js'); // Controllers -require('./controllers/editor.js'); -require('./controllers/errorpresenter.js'); -require('./controllers/general-modal.js'); -require('./controllers/header.js'); -require('./controllers/import-file.js'); -require('./controllers/importurl.js'); -require('./controllers/main.js'); -require('./controllers/modal.js'); -require('./controllers/openexamples.js'); -require('./controllers/paste-json.js'); -require('./controllers/preferences.js'); -require('./controllers/preview.js'); -require('./controllers/security.js'); -require('./controllers/confirm-reset.js'); +require('scripts/controllers/editor.js'); +require('scripts/controllers/errorpresenter.js'); +require('scripts/controllers/general-modal.js'); +require('scripts/controllers/header.js'); +require('scripts/controllers/import-file.js'); +require('scripts/controllers/importurl.js'); +require('scripts/controllers/main.js'); +require('scripts/controllers/modal.js'); +require('scripts/controllers/openexamples.js'); +require('scripts/controllers/paste-json.js'); +require('scripts/controllers/preferences.js'); +require('scripts/controllers/preview.js'); +require('scripts/controllers/security.js'); +require('scripts/controllers/confirm-reset.js'); // Directives -require('./directives/auto-focus.js'); -require('./directives/collapsewhen.js'); -require('./directives/on-file-change.js'); -require('./directives/operation.js'); -require('./directives/schemamodel.js'); -require('./directives/scroll-into-view-when.js'); -require('./directives/stop-event.js'); -require('./directives/track-event.js'); -require('./directives/tryoperation.js'); +require('scripts/directives/auto-focus.js'); +require('scripts/directives/collapsewhen.js'); +require('scripts/directives/on-file-change.js'); +require('scripts/directives/operation.js'); +require('scripts/directives/schemamodel.js'); +require('scripts/directives/scroll-into-view-when.js'); +require('scripts/directives/stop-event.js'); +require('scripts/directives/track-event.js'); +require('scripts/directives/tryoperation.js'); // Enums -require('./enums/defaults.js'); -require('./enums/strings.js'); +require('scripts/enums/defaults.js'); +require('scripts/enums/strings.js'); // Filter -require('./filters/formdata.js'); +require('scripts/filters/formdata.js'); // Plugins -require('./plugins/jquery.scroll-into-view.js'); +require('scripts/plugins/jquery.scroll-into-view.js'); // Misc -require('./ace/snippets/swagger.snippet.js'); -require('./analytics/google.js'); +require('scripts/ace/snippets/swagger.snippet.js'); +require('scripts/analytics/google.js'); // Ace Editor window.ace = require('brace'); diff --git a/scripts/controllers/header.js b/scripts/controllers/header.js index 5a0002cc5dc..204f58afbc0 100644 --- a/scripts/controllers/header.js +++ b/scripts/controllers/header.js @@ -62,7 +62,7 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, */ function showCodegenError(resp) { $uibModal.open({ - template: require('../templates/code-gen-error-modal.html'), + template: require('templates/code-gen-error-modal.html'), controller: 'GeneralModal', size: 'large', resolve: { @@ -100,7 +100,7 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, $scope.openImportFile = function() { $uibModal.open({ - template: require('../templates/file-import.html'), + template: require('templates/file-import.html'), controller: 'FileImportCtrl', size: 'large' }); @@ -108,7 +108,7 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, $scope.openImportUrl = function() { $uibModal.open({ - template: require('../templates/url-import.html'), + template: require('templates/url-import.html'), controller: 'UrlImportCtrl', size: 'large' }); @@ -116,7 +116,7 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, $scope.openPasteJSON = function() { $uibModal.open({ - template: require('../templates/paste-json.html'), + template: require('templates/paste-json.html'), controller: 'PasteJSONCtrl', size: 'large' }); @@ -124,7 +124,7 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, $scope.openAbout = function() { $uibModal.open({ - template: require('../templates/about.html'), + template: require('templates/about.html'), size: 'large', controller: 'ModalCtrl' }); @@ -138,7 +138,7 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, $scope.openEditorPreferences = Editor.showSettings; $scope.resetSettings = function() { $uibModal.open({ - template: require('../templates/reset-editor.html'), + template: require('templates/reset-editor.html'), controller: 'ConfirmReset', size: 'large' }); @@ -147,7 +147,7 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, $scope.openExamples = function() { $uibModal.open({ - template: require('../templates/open-examples.html'), + template: require('templates/open-examples.html'), controller: 'OpenExamplesCtrl', size: 'large' }); @@ -155,7 +155,7 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, $scope.openPreferences = function() { $uibModal.open({ - template: require('../templates/preferences.html'), + template: require('templates/preferences.html'), controller: 'PreferencesCtrl', size: 'large' }); diff --git a/scripts/controllers/security.js b/scripts/controllers/security.js index 8d49e85bf60..c8fb4a9e833 100644 --- a/scripts/controllers/security.js +++ b/scripts/controllers/security.js @@ -17,7 +17,7 @@ SwaggerEditor.controller('SecurityCtrl', function SecurityCtrl($scope, $scope.authenticate = function(securityName, security) { if (security.type === 'basic') { $uibModal.open({ - template: require('../templates/auth/basic.html'), + template: require('templates/auth/basic.html'), controller: ['$scope', '$uibModalInstance', function BasicAuthAuthenticateCtrl($scope, $uibModalInstance) { @@ -34,7 +34,7 @@ SwaggerEditor.controller('SecurityCtrl', function SecurityCtrl($scope, }); } else if (security.type === 'oauth2') { $uibModal.open({ - template: require('../templates/auth/oauth2.html'), + template: require('templates/auth/oauth2.html'), controller: ['$scope', '$uibModalInstance', function OAuth2AuthenticateCtrl($scope, $uibModalInstance) { $scope.cancel = $uibModalInstance.close; @@ -52,7 +52,7 @@ SwaggerEditor.controller('SecurityCtrl', function SecurityCtrl($scope, }); } else if (security.type === 'apiKey') { $uibModal.open({ - template: require('../templates/auth/api-key.html'), + template: require('templates/auth/api-key.html'), controller: ['$scope', '$uibModalInstance', function APIKeyAuthenticateCtrl($scope, $uibModalInstance) { $scope.cancel = $uibModalInstance.close; diff --git a/scripts/directives/operation.js b/scripts/directives/operation.js index 7b69f30bf1d..ed094efb86e 100644 --- a/scripts/directives/operation.js +++ b/scripts/directives/operation.js @@ -6,7 +6,7 @@ SwaggerEditor.directive('swaggerOperation', function(defaults) { return { restrict: 'E', replace: true, - template: require('../templates/operation.html'), + template: require('templates/operation.html'), scope: false, link: function($scope) { $scope.isTryOpen = false; diff --git a/scripts/directives/schemamodel.js b/scripts/directives/schemamodel.js index 7fa777b582f..c24b811db9d 100644 --- a/scripts/directives/schemamodel.js +++ b/scripts/directives/schemamodel.js @@ -5,7 +5,7 @@ var JSONSchemaView = require('json-schema-view-js'); SwaggerEditor.directive('schemaModel', function() { return { - template: require('../templates/schema-model.html'), + template: require('templates/schema-model.html'), restrict: 'E', replace: true, scope: { diff --git a/server.js b/server.js index 54407814935..34ef84bd05f 100644 --- a/server.js +++ b/server.js @@ -20,7 +20,8 @@ function startServer(port, cb) { var server = new WebpackDevServer(compiler, { progress: true, - quiet: true, + stats: 'errors-only', + showModules: false, publicPath: config.output.publicPath, headers: { 'Set-Cookie': diff --git a/webpack.config.js b/webpack.config.js index dca2e505d3d..a88856c3572 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -21,7 +21,7 @@ var config = { resolve: { extensions: ['', '.js', '.json'], - root: path.resolve(__dirname), + root: __dirname, modulesDirectories: ['node_modules'] },