From 3cc7d841508102dc3425f2b416377f4d82a5028e Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 09:31:34 -0200 Subject: Removes all unecessary node modules references from package.json --- web-ui/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web-ui/package.json b/web-ui/package.json index 2a0056e4..7075862e 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -24,22 +24,22 @@ "watch": "0.19.1" }, "scripts": { - "test": "npm run jshint --silent && npm run build --silent && node_modules/karma/bin/karma start --single-run $GRUNT_OPTS", - "debug": "npm run build && node_modules/karma/bin/karma start --browsers Chrome $GRUNT_OPTS", + "test": "npm run jshint --silent && npm run build --silent && karma start --single-run $GRUNT_OPTS", + "debug": "npm run build && karma start --browsers Chrome $GRUNT_OPTS", "watch": "npm run compass-watch & npm run handlebars-watch", - "watch-test": "node_modules/karma/bin/karma start", - "handlebars": "mkdir -p app/js/generated/hbs/ && node_modules/handlebars/bin/handlebars app/templates/**/*.hbs > app/js/generated/hbs/templates.js --namespace=window.Pixelated --root .", - "handlebars-watch": "node_modules/.bin/watch 'npm run handlebars' app/templates", + "watch-test": "karma start", + "handlebars": "mkdir -p app/js/generated/hbs/ && handlebars app/templates/**/*.hbs > app/js/generated/hbs/templates.js --namespace=window.Pixelated --root .", + "handlebars-watch": "watch 'npm run handlebars' app/templates", "compass": "compass compile", "compass-watch": "compass watch", "build": "npm run clean && npm run handlebars && npm run add_git_version && npm run compass", - "jshint": "node_modules/jshint/bin/jshint --config=.jshintrc app test", + "jshint": "jshint --config=.jshintrc app test", "clean": "rm -rf .tmp/ 'dist/*' app/js/generated/hbs/* app/css/*", "buildmain": "node_modules/requirejs/bin/r.js -o config/buildoptions.js", "package": "/bin/bash config/package.sh", "imagemin": "node config/imagemin.js", - "minify_html": "node_modules/.bin/html-minifier app/index.html --collapse-whitespace | sed 's|.*||' > dist/index.html", - "minify_sandbox": "node_modules/.bin/html-minifier app/sandbox.html --collapse-whitespace | sed 's|.*||' > dist/sandbox.html", + "minify_html": "html-minifier app/index.html --collapse-whitespace | sed 's|.*||' > dist/index.html", + "minify_sandbox": "html-minifier app/sandbox.html --collapse-whitespace | sed 's|.*||' > dist/sandbox.html", "add_git_version": "/bin/bash config/add_git_version.sh" } } -- cgit v1.2.3 From be5cfc6a473ef2039bde71917a24831030c8a64d Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 09:53:48 -0200 Subject: Create webpack config file and add aliases --- web-ui/webpack.config.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 web-ui/webpack.config.js diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js new file mode 100644 index 00000000..2000f0ec --- /dev/null +++ b/web-ui/webpack.config.js @@ -0,0 +1,35 @@ +var path = require('path') + +module.exports = { + resolve: { + alias: { + 'mail_list': path.join(__dirname, '/app/js/mail_list'), + 'page': path.join(__dirname, '/app/js/page'), + 'feedback': path.join(__dirname, '/app/js/feedback'), + 'flight': path.join(__dirname, '/app/bower_components/flight'), + 'DOMPurify': path.join(__dirname, '/app/bower_components/DOMPurify/dist/purify.min'), + 'he': path.join(__dirname, '/app/bower_components/he/he'), + 'hbs': path.join(__dirname, '/app/js/generated/hbs'), + 'helpers': path.join(__dirname, '/app/js/helpers'), + 'lib': path.join(__dirname, '/app/js/lib'), + 'views': path.join(__dirname, '/app/js/views'), + 'tags': path.join(__dirname, '/app/js/tags'), + 'mail_list_actions': path.join(__dirname, '/app/js/mail_list_actions'), + 'user_alerts': path.join(__dirname, '/app/js/user_alerts'), + 'mail_view': path.join(__dirname, '/app/js/mail_view'), + 'dispatchers': path.join(__dirname, '/app/js/dispatchers'), + 'services': path.join(__dirname, '/app/js/services'), + 'mixins': path.join(__dirname, '/app/js/mixins'), + 'search': path.join(__dirname, '/app/js/search'), + 'foundation': path.join(__dirname, '/app/js/foundation'), + 'features': path.join(__dirname, '/app/js/features/features'), + 'i18next': path.join(__dirname, '/app/bower_components/i18next/i18next'), + 'i18nextXHRBackend': path.join(__dirname, '/app/bower_components/i18next-xhr-backend/i18nextXHRBackend'), + 'i18nextBrowserLanguageDetector': path.join(__dirname, '/app/bower_components/i18next-browser-languagedetector/i18nextBrowserLanguageDetector'), + 'quoted-printable': path.join(__dirname, '/app/bower_components/quoted-printable'), + 'utf8': path.join(__dirname, '/app/bower_components/utf8'), + 'user_settings': path.join(__dirname, '/app/js/user_settings') + }, + moduleDirectories: ['app/js'] + } +} -- cgit v1.2.3 From c1a3714ad0b4bd8105c5f4fca49017e956543eac Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 10:09:30 -0200 Subject: Move all bower dependencies to npm --- web-ui/package.json | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/web-ui/package.json b/web-ui/package.json index 7075862e..528fd095 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -5,22 +5,42 @@ "repository": "https://github.com/pixelated-project/pixelated-user-agent", "private": true, "devDependencies": { + "almond": "^0.3.3", "bower": "1.7.9", - "handlebars": "4.0.5", + "dompurify": "^0.8.4", + "flight": "0.0.2", + "font-awesome": "^4.7.0", + "foundation": "^4.2.1-1", + "handlebars": "^4.0.5", + "he": "^1.1.0", "html-minifier": "2.1.6", + "i18next": "^4.1.4", + "i18next-browser-languagedetector": "^1.0.1", + "i18next-xhr-backend": "^1.2.1", + "iframe-resizer": "^3.5.7", "imagemin": "5.2.1", + "jasmine-flight": "^4.0.0", + "jasmine-jquery": "^2.1.1", + "jquery": "^3.1.1", + "jquery-file-upload": "^4.0.5", + "jquery-ui": "^1.12.1", "jshint": "2.9.2", "karma": "0.13.19", "karma-chrome-launcher": "0.2.2", + "karma-coverage": "0.2.7", "karma-firefox-launcher": "0.1.7", "karma-jasmine": "0.2.2", "karma-jasmine-ajax": "0.1.13", "karma-junit-reporter": "0.2.2", "karma-phantomjs-launcher": "1.0.1", "karma-requirejs": "1.0.0", - "karma-coverage": "0.2.7", + "lodash": "^4.17.3", "minify": "2.0.9", + "modernizr": "^3.3.1", + "quoted-printable": "^1.0.1", "requirejs": "2.2.0", + "typeahead.js": "^0.11.1", + "utf8": "^2.1.2", "watch": "0.19.1" }, "scripts": { -- cgit v1.2.3 From 3710467f2542d6e3c1278f0172a8f9e12fe2491f Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 10:12:05 -0200 Subject: Remove uneccessarily aliases in webpack --- web-ui/webpack.config.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 2000f0ec..1a97c78d 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -6,9 +6,7 @@ module.exports = { 'mail_list': path.join(__dirname, '/app/js/mail_list'), 'page': path.join(__dirname, '/app/js/page'), 'feedback': path.join(__dirname, '/app/js/feedback'), - 'flight': path.join(__dirname, '/app/bower_components/flight'), 'DOMPurify': path.join(__dirname, '/app/bower_components/DOMPurify/dist/purify.min'), - 'he': path.join(__dirname, '/app/bower_components/he/he'), 'hbs': path.join(__dirname, '/app/js/generated/hbs'), 'helpers': path.join(__dirname, '/app/js/helpers'), 'lib': path.join(__dirname, '/app/js/lib'), @@ -23,11 +21,6 @@ module.exports = { 'search': path.join(__dirname, '/app/js/search'), 'foundation': path.join(__dirname, '/app/js/foundation'), 'features': path.join(__dirname, '/app/js/features/features'), - 'i18next': path.join(__dirname, '/app/bower_components/i18next/i18next'), - 'i18nextXHRBackend': path.join(__dirname, '/app/bower_components/i18next-xhr-backend/i18nextXHRBackend'), - 'i18nextBrowserLanguageDetector': path.join(__dirname, '/app/bower_components/i18next-browser-languagedetector/i18nextBrowserLanguageDetector'), - 'quoted-printable': path.join(__dirname, '/app/bower_components/quoted-printable'), - 'utf8': path.join(__dirname, '/app/bower_components/utf8'), 'user_settings': path.join(__dirname, '/app/js/user_settings') }, moduleDirectories: ['app/js'] -- cgit v1.2.3 From 3a1dc6f2bfc70a99a6dcf761b7d62bf0d2b45345 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 10:39:08 -0200 Subject: Removes almond from package.json as it will not be needed with webpack --- web-ui/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/web-ui/package.json b/web-ui/package.json index 528fd095..5739dc29 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -5,7 +5,6 @@ "repository": "https://github.com/pixelated-project/pixelated-user-agent", "private": true, "devDependencies": { - "almond": "^0.3.3", "bower": "1.7.9", "dompurify": "^0.8.4", "flight": "0.0.2", -- cgit v1.2.3 From 411e1f8cfa06fbd049fb055a4f453b56acdb7153 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 11:21:12 -0200 Subject: Adds index file for loading app with webpack --- web-ui/app/js/index.js | 18 ++++++++++++++++++ web-ui/webpack.config.js | 1 + 2 files changed, 19 insertions(+) create mode 100644 web-ui/app/js/index.js diff --git a/web-ui/app/js/index.js b/web-ui/app/js/index.js new file mode 100644 index 00000000..081fe51c --- /dev/null +++ b/web-ui/app/js/index.js @@ -0,0 +1,18 @@ +import compose from 'flight/lib/compose' +import registry from 'flight/lib/registry' +import advice from 'flight/lib/advice' +import withLogging from 'flight/lib/logger' +import debug from 'flight/lib/debug' +import events from 'page/events' +import initializeDefault from 'page/default' +import 'js/monkey_patching/all' + +window.Pixelated = window.Pixelated || {} +window.Pixelated.events = events + +compose.mixin(registry, [advice.withAdvice, withLogging]) + +debug.enable(true) +debug.events.logAll() + +initializeDefault('') diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 1a97c78d..230b50ea 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -23,6 +23,7 @@ module.exports = { 'features': path.join(__dirname, '/app/js/features/features'), 'user_settings': path.join(__dirname, '/app/js/user_settings') }, + extensions: ['', '.js'], moduleDirectories: ['app/js'] } } -- cgit v1.2.3 From cb4522fa47d5e46312d53a62654f58c4a53c8cc2 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 15:15:39 -0200 Subject: Add webpack compilation to build, fix aliases, and add babel --- .gitignore | 1 + web-ui/package.json | 11 ++++++++--- web-ui/webpack.config.js | 25 ++++++++++++++++++++++--- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 0c347bf8..5bd72b2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea .bundle +*bundle.js *.log *.DS_Store *.egg-info diff --git a/web-ui/package.json b/web-ui/package.json index 5739dc29..8453d7e1 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -5,9 +5,13 @@ "repository": "https://github.com/pixelated-project/pixelated-user-agent", "private": true, "devDependencies": { + "babel": "^6.5.2", + "babel-core": "^6.21.0", + "babel-loader": "^6.2.10", + "babel-preset-es2015": "^6.18.0", "bower": "1.7.9", "dompurify": "^0.8.4", - "flight": "0.0.2", + "flightjs": "^1.5.1", "font-awesome": "^4.7.0", "foundation": "^4.2.1-1", "handlebars": "^4.0.5", @@ -40,7 +44,8 @@ "requirejs": "2.2.0", "typeahead.js": "^0.11.1", "utf8": "^2.1.2", - "watch": "0.19.1" + "watch": "0.19.1", + "webpack": "^1.14.0" }, "scripts": { "test": "npm run jshint --silent && npm run build --silent && karma start --single-run $GRUNT_OPTS", @@ -51,7 +56,7 @@ "handlebars-watch": "watch 'npm run handlebars' app/templates", "compass": "compass compile", "compass-watch": "compass watch", - "build": "npm run clean && npm run handlebars && npm run add_git_version && npm run compass", + "build": "npm run clean && npm run handlebars && webpack --colors --progress && npm run add_git_version && npm run compass", "jshint": "jshint --config=.jshintrc app test", "clean": "rm -rf .tmp/ 'dist/*' app/js/generated/hbs/* app/css/*", "buildmain": "node_modules/requirejs/bin/r.js -o config/buildoptions.js", diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 230b50ea..39bdd511 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -1,12 +1,22 @@ var path = require('path') module.exports = { + entry: './app/js/index.js', + output: { + path: path.join(__dirname, '/app/js/'), + filename: 'bundle.js', + publicPath: '/assets/js/' + }, resolve: { alias: { + 'js': path.join(__dirname, '/app/js'), + 'flight': path.join(__dirname, '/app/bower_components/flight'), 'mail_list': path.join(__dirname, '/app/js/mail_list'), 'page': path.join(__dirname, '/app/js/page'), 'feedback': path.join(__dirname, '/app/js/feedback'), - 'DOMPurify': path.join(__dirname, '/app/bower_components/DOMPurify/dist/purify.min'), + 'DOMPurify': 'dompurify', + 'i18nextXHRBackend': 'i18next-xhr-backend', + 'i18nextBrowserLanguageDetector': 'i18next-browser-languagedetector', 'hbs': path.join(__dirname, '/app/js/generated/hbs'), 'helpers': path.join(__dirname, '/app/js/helpers'), 'lib': path.join(__dirname, '/app/js/lib'), @@ -23,7 +33,16 @@ module.exports = { 'features': path.join(__dirname, '/app/js/features/features'), 'user_settings': path.join(__dirname, '/app/js/user_settings') }, - extensions: ['', '.js'], - moduleDirectories: ['app/js'] + extensions: ['', '.js'] + }, + module: { + loaders: [ + { + test: /\.js$/, + exclude: /(node_modules|bower_components)/, + loader: 'babel', + query: { presets: ['es2015']} + } + ] } } -- cgit v1.2.3 From df7c34ec46cf4f11699a4a673d6bffe50a5b216e Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 15:33:22 -0200 Subject: Fixes jshint by adding semicolon in index.js --- web-ui/app/js/index.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/web-ui/app/js/index.js b/web-ui/app/js/index.js index 081fe51c..690c086b 100644 --- a/web-ui/app/js/index.js +++ b/web-ui/app/js/index.js @@ -1,18 +1,18 @@ -import compose from 'flight/lib/compose' -import registry from 'flight/lib/registry' -import advice from 'flight/lib/advice' -import withLogging from 'flight/lib/logger' -import debug from 'flight/lib/debug' -import events from 'page/events' -import initializeDefault from 'page/default' -import 'js/monkey_patching/all' +import compose from 'flight/lib/compose'; +import registry from 'flight/lib/registry'; +import advice from 'flight/lib/advice'; +import withLogging from 'flight/lib/logger'; +import debug from 'flight/lib/debug'; +import events from 'page/events'; +import initializeDefault from 'page/default'; +import 'js/monkey_patching/all'; -window.Pixelated = window.Pixelated || {} -window.Pixelated.events = events +window.Pixelated = window.Pixelated || {}; +window.Pixelated.events = events; -compose.mixin(registry, [advice.withAdvice, withLogging]) +compose.mixin(registry, [advice.withAdvice, withLogging]); -debug.enable(true) -debug.events.logAll() +debug.enable(true); +debug.events.logAll(); -initializeDefault('') +initializeDefault(''); -- cgit v1.2.3 From 0a64456b53b2b7d3ea67005892332416f6b2c5ba Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Tue, 27 Dec 2016 15:38:37 -0200 Subject: Clarifies how js files are compiled by creating separate npm task --- web-ui/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web-ui/package.json b/web-ui/package.json index 8453d7e1..24c4e91f 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -56,7 +56,8 @@ "handlebars-watch": "watch 'npm run handlebars' app/templates", "compass": "compass compile", "compass-watch": "compass watch", - "build": "npm run clean && npm run handlebars && webpack --colors --progress && npm run add_git_version && npm run compass", + "build": "npm run clean && npm run handlebars && npm run build-js && npm run add_git_version && npm run compass", + "build-js": "webpack --colors --progress", "jshint": "jshint --config=.jshintrc app test", "clean": "rm -rf .tmp/ 'dist/*' app/js/generated/hbs/* app/css/*", "buildmain": "node_modules/requirejs/bin/r.js -o config/buildoptions.js", -- cgit v1.2.3 From 42306527afd087373df57306c090698d99e0db4b Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 10:43:25 -0200 Subject: Output javascript bundle in dist folder and use it locally --- web-ui/app/index.html | 2 +- web-ui/config/compass.rb | 2 +- web-ui/webpack.config.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web-ui/app/index.html b/web-ui/app/index.html index 4b6a81a0..941d3a21 100644 --- a/web-ui/app/index.html +++ b/web-ui/app/index.html @@ -106,7 +106,7 @@ - + diff --git a/web-ui/config/compass.rb b/web-ui/config/compass.rb index 9c52a04e..4adf2ee2 100644 --- a/web-ui/config/compass.rb +++ b/web-ui/config/compass.rb @@ -24,7 +24,7 @@ http_path = "/" css_dir = "#{target_dir}/css" sass_dir = "app/scss" images_dir = "app/images" -javascripts_dir = "app/js" +javascripts_dir = "dist/js" # You can select your preferred output style here (can be overridden via the command line): # output_style = :expanded or :nested or :compact or :compressed diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 39bdd511..fb85bd16 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -3,7 +3,7 @@ var path = require('path') module.exports = { entry: './app/js/index.js', output: { - path: path.join(__dirname, '/app/js/'), + path: path.join(__dirname, '/dist/js/'), filename: 'bundle.js', publicPath: '/assets/js/' }, -- cgit v1.2.3 From 98de4c106a59b4c635ea9984d5f729c04413c71a Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 11:08:00 -0200 Subject: Copy all necessary assest to dist folder to package, via webpack --- web-ui/webpack.config.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index fb85bd16..e03f453a 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -1,4 +1,5 @@ -var path = require('path') +var path = require('path'); +var CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = { entry: './app/js/index.js', @@ -44,5 +45,23 @@ module.exports = { query: { presets: ['es2015']} } ] - } + }, + plugins: [ + new CopyWebpackPlugin([ + { context: 'app/', from: '404.html', to: '../' }, + { context: 'app/', from: 'fonts/*', to: '../' }, + { context: 'app/', from: 'locales/**/*', to: '../' }, + { context: 'app/', from: 'bower_components/font-awesome/fonts/*', to: '../' }, + { + context: 'app/', + from: 'bower_components/font-awesome/css/font-awesome.min.css', + to: '../bower_components/font-awesome/css' + }, + { + context: 'app/', + from: 'bower_components/jquery-file-upload/css/jquery.fileupload.css', + to: '../bower_components/jquery-file-upload/css' + } + ]) + ] } -- cgit v1.2.3 From 4120bb6063d277179a86a1b9cea6caae3aa676ba Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 15:10:46 -0200 Subject: Bundles local files that were previously in script tags with webpack for optimization --- web-ui/app/index.html | 2 -- web-ui/app/js/index.js | 5 ++++- web-ui/config/package.sh | 2 -- web-ui/webpack.config.js | 4 +++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/web-ui/app/index.html b/web-ui/app/index.html index 941d3a21..b1b77b3a 100644 --- a/web-ui/app/index.html +++ b/web-ui/app/index.html @@ -98,13 +98,11 @@ - - diff --git a/web-ui/app/js/index.js b/web-ui/app/js/index.js index 690c086b..8ec2eeab 100644 --- a/web-ui/app/js/index.js +++ b/web-ui/app/js/index.js @@ -1,3 +1,7 @@ +import 'js/foundation/initialize_foundation'; +import 'js/lib/highlightRegex'; +import 'js/monkey_patching/all'; + import compose from 'flight/lib/compose'; import registry from 'flight/lib/registry'; import advice from 'flight/lib/advice'; @@ -5,7 +9,6 @@ import withLogging from 'flight/lib/logger'; import debug from 'flight/lib/debug'; import events from 'page/events'; import initializeDefault from 'page/default'; -import 'js/monkey_patching/all'; window.Pixelated = window.Pixelated || {}; window.Pixelated.events = events; diff --git a/web-ui/config/package.sh b/web-ui/config/package.sh index 165eeff3..ad4a3895 100644 --- a/web-ui/config/package.sh +++ b/web-ui/config/package.sh @@ -52,13 +52,11 @@ app/bower_components/lodash/dist/lodash.js \ app/bower_components/jquery/dist/jquery.js \ app/bower_components/jquery-ui/jquery-ui.js \ app/bower_components/jquery-file-upload/js/jquery.fileupload.js \ -app/js/lib/highlightRegex.js \ app/bower_components/handlebars/handlebars.js \ app/bower_components/typeahead.js/dist/typeahead.bundle.js \ app/bower_components/foundation/js/foundation.js \ app/bower_components/foundation/js/foundation/foundation.reveal.js \ app/bower_components/foundation/js/foundation/foundation.offcanvas.js \ -app/js/foundation/initialize_foundation.js \ app/bower_components/iframe-resizer/js/iframeResizer.js \ .tmp/app.concatenated.js > dist/app.js node_modules/.bin/minify dist/app.js > dist/app.min.js diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index e03f453a..7bacee4a 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -1,10 +1,12 @@ var path = require('path'); +var webpack = require('webpack'); var CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = { entry: './app/js/index.js', + node: { fs: 'empty' }, output: { - path: path.join(__dirname, '/dist/js/'), + path: path.join(__dirname, '/app/js/'), filename: 'bundle.js', publicPath: '/assets/js/' }, -- cgit v1.2.3 From d83a6d27b7f92752a91a8d733353a38714e44951 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 15:55:53 -0200 Subject: Update package script to use webpack files --- web-ui/config/compass.rb | 2 +- web-ui/config/package.sh | 21 +++------------------ web-ui/package.json | 5 +---- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/web-ui/config/compass.rb b/web-ui/config/compass.rb index 4adf2ee2..9c52a04e 100644 --- a/web-ui/config/compass.rb +++ b/web-ui/config/compass.rb @@ -24,7 +24,7 @@ http_path = "/" css_dir = "#{target_dir}/css" sass_dir = "app/scss" images_dir = "app/images" -javascripts_dir = "dist/js" +javascripts_dir = "app/js" # You can select your preferred output style here (can be overridden via the command line): # output_style = :expanded or :nested or :compact or :compressed diff --git a/web-ui/config/package.sh b/web-ui/config/package.sh index ad4a3895..946b7f62 100644 --- a/web-ui/config/package.sh +++ b/web-ui/config/package.sh @@ -23,28 +23,12 @@ export PIXELATED_BUILD='package' mkdir -p dist # initial npm tasks -./go clean -./go compass -./go handlebars +./go build ./go imagemin ./go minify_html ./go minify_sandbox -./go add_git_version -./go buildmain -# copy files -cd app -cp --parents \ -404.html \ -fonts/* \ -locales/**/* \ -bower_components/font-awesome/css/font-awesome.min.css \ -bower_components/jquery-file-upload/css/jquery.fileupload.css \ -bower_components/font-awesome/fonts/* \ -../dist -cd - - # concat js files and minify for app.min.js cat \ app/bower_components/modernizr/modernizr.js \ @@ -58,7 +42,8 @@ app/bower_components/foundation/js/foundation.js \ app/bower_components/foundation/js/foundation/foundation.reveal.js \ app/bower_components/foundation/js/foundation/foundation.offcanvas.js \ app/bower_components/iframe-resizer/js/iframeResizer.js \ -.tmp/app.concatenated.js > dist/app.js +app/js/1.bundle.js \ +app/js/bundle.js > dist/app.js node_modules/.bin/minify dist/app.js > dist/app.min.js rm dist/app.js diff --git a/web-ui/package.json b/web-ui/package.json index 24c4e91f..3dab5f80 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -13,7 +13,6 @@ "dompurify": "^0.8.4", "flightjs": "^1.5.1", "font-awesome": "^4.7.0", - "foundation": "^4.2.1-1", "handlebars": "^4.0.5", "he": "^1.1.0", "html-minifier": "2.1.6", @@ -37,8 +36,6 @@ "karma-junit-reporter": "0.2.2", "karma-phantomjs-launcher": "1.0.1", "karma-requirejs": "1.0.0", - "lodash": "^4.17.3", - "minify": "2.0.9", "modernizr": "^3.3.1", "quoted-printable": "^1.0.1", "requirejs": "2.2.0", @@ -59,7 +56,7 @@ "build": "npm run clean && npm run handlebars && npm run build-js && npm run add_git_version && npm run compass", "build-js": "webpack --colors --progress", "jshint": "jshint --config=.jshintrc app test", - "clean": "rm -rf .tmp/ 'dist/*' app/js/generated/hbs/* app/css/*", + "clean": "rm -rf 'dist/*' app/js/generated/hbs/* app/css/*", "buildmain": "node_modules/requirejs/bin/r.js -o config/buildoptions.js", "package": "/bin/bash config/package.sh", "imagemin": "node config/imagemin.js", -- cgit v1.2.3 From b0eef380feab59153fbaa9b11084bd4def91ec5b Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 16:16:56 -0200 Subject: Move foundation from bower to npm and package them with webpack --- web-ui/app/index.html | 3 --- web-ui/app/js/index.js | 3 +++ web-ui/bower.json | 1 - web-ui/config/package.sh | 3 --- web-ui/package.json | 1 + 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/web-ui/app/index.html b/web-ui/app/index.html index b1b77b3a..65951a54 100644 --- a/web-ui/app/index.html +++ b/web-ui/app/index.html @@ -100,9 +100,6 @@ - - - diff --git a/web-ui/app/js/index.js b/web-ui/app/js/index.js index 8ec2eeab..724643c5 100644 --- a/web-ui/app/js/index.js +++ b/web-ui/app/js/index.js @@ -1,3 +1,6 @@ +import 'foundation-sites'; +import 'foundation-sites/js/foundation.reveal.js'; +import 'foundation-sites/js/foundation.offcanvas.js'; import 'js/foundation/initialize_foundation'; import 'js/lib/highlightRegex'; import 'js/monkey_patching/all'; diff --git a/web-ui/bower.json b/web-ui/bower.json index 4b7bdfb9..2a2b57e0 100644 --- a/web-ui/bower.json +++ b/web-ui/bower.json @@ -6,7 +6,6 @@ "flight": "1.3.0", "requirejs": "~2.1.15", "lodash": "2.4.1", - "foundation": "~5.4.7", "i18next": "~3.3.1", "i18next-xhr-backend": "~0.6.0", "i18next-browser-languagedetector": "~0.3.0", diff --git a/web-ui/config/package.sh b/web-ui/config/package.sh index 946b7f62..4eb11929 100644 --- a/web-ui/config/package.sh +++ b/web-ui/config/package.sh @@ -38,9 +38,6 @@ app/bower_components/jquery-ui/jquery-ui.js \ app/bower_components/jquery-file-upload/js/jquery.fileupload.js \ app/bower_components/handlebars/handlebars.js \ app/bower_components/typeahead.js/dist/typeahead.bundle.js \ -app/bower_components/foundation/js/foundation.js \ -app/bower_components/foundation/js/foundation/foundation.reveal.js \ -app/bower_components/foundation/js/foundation/foundation.offcanvas.js \ app/bower_components/iframe-resizer/js/iframeResizer.js \ app/js/1.bundle.js \ app/js/bundle.js > dist/app.js diff --git a/web-ui/package.json b/web-ui/package.json index 3dab5f80..267841f2 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -13,6 +13,7 @@ "dompurify": "^0.8.4", "flightjs": "^1.5.1", "font-awesome": "^4.7.0", + "foundation-sites": "^6.3.0", "handlebars": "^4.0.5", "he": "^1.1.0", "html-minifier": "2.1.6", -- cgit v1.2.3 From 93cec7cbc6c03b2bd95b1e031e894327bdaa65b4 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 17:18:45 -0200 Subject: Use minified files for dependencies and copy them to dist folder with webpack --- web-ui/app/index.html | 6 +++--- web-ui/package.json | 2 +- web-ui/webpack.config.js | 56 +++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/web-ui/app/index.html b/web-ui/app/index.html index 65951a54..9449dfb3 100644 --- a/web-ui/app/index.html +++ b/web-ui/app/index.html @@ -94,14 +94,14 @@ - - + + - + diff --git a/web-ui/package.json b/web-ui/package.json index 267841f2..728699e6 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -11,7 +11,7 @@ "babel-preset-es2015": "^6.18.0", "bower": "1.7.9", "dompurify": "^0.8.4", - "flightjs": "^1.5.1", + "flightjs": "1.3.0", "font-awesome": "^4.7.0", "foundation-sites": "^6.3.0", "handlebars": "^4.0.5", diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 7bacee4a..1ab036c6 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -6,8 +6,8 @@ module.exports = { entry: './app/js/index.js', node: { fs: 'empty' }, output: { - path: path.join(__dirname, '/app/js/'), - filename: 'bundle.js', + path: path.join(__dirname, '/app/'), + filename: 'app.min.js', publicPath: '/assets/js/' }, resolve: { @@ -50,19 +50,59 @@ module.exports = { }, plugins: [ new CopyWebpackPlugin([ - { context: 'app/', from: '404.html', to: '../' }, - { context: 'app/', from: 'fonts/*', to: '../' }, - { context: 'app/', from: 'locales/**/*', to: '../' }, - { context: 'app/', from: 'bower_components/font-awesome/fonts/*', to: '../' }, + { context: 'app/', from: '404.html' }, + { context: 'app/', from: 'fonts/*' }, + { context: 'app/', from: 'locales/**/*' }, + { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, { context: 'app/', from: 'bower_components/font-awesome/css/font-awesome.min.css', - to: '../bower_components/font-awesome/css' + to: 'bower_components/font-awesome/css' }, { context: 'app/', from: 'bower_components/jquery-file-upload/css/jquery.fileupload.css', - to: '../bower_components/jquery-file-upload/css' + to: 'bower_components/jquery-file-upload/css' + }, + { + context: 'app/', + from: 'bower_components/modernizr/modernizr.js', + to: 'bower_components/modernizr' + }, + { + context: 'app/', + from: 'bower_components/lodash/dist/lodash.min.js', + to: 'bower_components/lodash/dist' + }, + { + context: 'app/', + from: 'bower_components/jquery/dist/jquery.min.js', + to: 'bower_components/jquery/dist' + }, + { + context: 'app/', + from: 'bower_components/jquery-ui/jquery-ui.min.js', + to: 'bower_components/jquery-ui' + }, + { + context: 'app/', + from: 'bower_components/jquery-file-upload/js/jquery.fileupload.js', + to: 'bower_components/jquery-file-upload/js' + }, + { + context: 'app/', + from: 'bower_components/handlebars/handlebars.min.js', + to: 'bower_components/handlebars' + }, + { + context: 'app/', + from: 'bower_components/typeahead.js/dist/typeahead.bundle.min.js', + to: 'bower_components/typeahead.js/dist' + }, + { + context: 'app/', + from: 'bower_components/iframe-resizer/js/iframeResizer.min.js', + to: 'bower_components/iframe-resizer/js' } ]) ] -- cgit v1.2.3 From ee97dee72ec1673ad18fe86855b1e1aceabba674 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 17:51:54 -0200 Subject: Use webpack files for packaging --- web-ui/config/package.sh | 24 +------- web-ui/package.json | 6 +- web-ui/webpack.config.js | 1 + web-ui/webpack.production.config.js | 111 ++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 25 deletions(-) create mode 100644 web-ui/webpack.production.config.js diff --git a/web-ui/config/package.sh b/web-ui/config/package.sh index 4eb11929..cfb66879 100644 --- a/web-ui/config/package.sh +++ b/web-ui/config/package.sh @@ -23,33 +23,11 @@ export PIXELATED_BUILD='package' mkdir -p dist # initial npm tasks -./go build +./go build-prod ./go imagemin -./go minify_html ./go minify_sandbox -# concat js files and minify for app.min.js -cat \ -app/bower_components/modernizr/modernizr.js \ -app/bower_components/lodash/dist/lodash.js \ -app/bower_components/jquery/dist/jquery.js \ -app/bower_components/jquery-ui/jquery-ui.js \ -app/bower_components/jquery-file-upload/js/jquery.fileupload.js \ -app/bower_components/handlebars/handlebars.js \ -app/bower_components/typeahead.js/dist/typeahead.bundle.js \ -app/bower_components/iframe-resizer/js/iframeResizer.js \ -app/js/1.bundle.js \ -app/js/bundle.js > dist/app.js -node_modules/.bin/minify dist/app.js > dist/app.min.js -rm dist/app.js - -if [ ! -s dist/app.min.js ] -then -echo "Minification failed!" -exit 1; -fi - # concat js files and minify for sandbox.min.js cat \ app/js/sandbox.js \ diff --git a/web-ui/package.json b/web-ui/package.json index 728699e6..6405102b 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -37,6 +37,7 @@ "karma-junit-reporter": "0.2.2", "karma-phantomjs-launcher": "1.0.1", "karma-requirejs": "1.0.0", + "minify": "^2.0.13", "modernizr": "^3.3.1", "quoted-printable": "^1.0.1", "requirejs": "2.2.0", @@ -54,14 +55,15 @@ "handlebars-watch": "watch 'npm run handlebars' app/templates", "compass": "compass compile", "compass-watch": "compass watch", - "build": "npm run clean && npm run handlebars && npm run build-js && npm run add_git_version && npm run compass", + "build": "npm run build-statics && npm run build-js", + "build-statics": "npm run clean && npm run handlebars && npm run add_git_version && npm run compass", + "build-prod": "npm run build-statics && webpack -p --config ./webpack.production.config.js", "build-js": "webpack --colors --progress", "jshint": "jshint --config=.jshintrc app test", "clean": "rm -rf 'dist/*' app/js/generated/hbs/* app/css/*", "buildmain": "node_modules/requirejs/bin/r.js -o config/buildoptions.js", "package": "/bin/bash config/package.sh", "imagemin": "node config/imagemin.js", - "minify_html": "html-minifier app/index.html --collapse-whitespace | sed 's|.*||' > dist/index.html", "minify_sandbox": "html-minifier app/sandbox.html --collapse-whitespace | sed 's|.*||' > dist/sandbox.html", "add_git_version": "/bin/bash config/add_git_version.sh" } diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 1ab036c6..c4a54b4a 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -51,6 +51,7 @@ module.exports = { plugins: [ new CopyWebpackPlugin([ { context: 'app/', from: '404.html' }, + { context: 'app/', from: 'index.html' }, { context: 'app/', from: 'fonts/*' }, { context: 'app/', from: 'locales/**/*' }, { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, diff --git a/web-ui/webpack.production.config.js b/web-ui/webpack.production.config.js new file mode 100644 index 00000000..36eb9396 --- /dev/null +++ b/web-ui/webpack.production.config.js @@ -0,0 +1,111 @@ +var path = require('path'); +var webpack = require('webpack'); +var CopyWebpackPlugin = require('copy-webpack-plugin'); + +module.exports = { + entry: './app/js/index.js', + node: { fs: 'empty' }, + output: { + path: path.join(__dirname, '/dist/'), + filename: 'app.min.js', + publicPath: '/assets/js/' + }, + resolve: { + alias: { + 'js': path.join(__dirname, '/app/js'), + 'flight': path.join(__dirname, '/app/bower_components/flight'), + 'mail_list': path.join(__dirname, '/app/js/mail_list'), + 'page': path.join(__dirname, '/app/js/page'), + 'feedback': path.join(__dirname, '/app/js/feedback'), + 'DOMPurify': 'dompurify', + 'i18nextXHRBackend': 'i18next-xhr-backend', + 'i18nextBrowserLanguageDetector': 'i18next-browser-languagedetector', + 'hbs': path.join(__dirname, '/app/js/generated/hbs'), + 'helpers': path.join(__dirname, '/app/js/helpers'), + 'lib': path.join(__dirname, '/app/js/lib'), + 'views': path.join(__dirname, '/app/js/views'), + 'tags': path.join(__dirname, '/app/js/tags'), + 'mail_list_actions': path.join(__dirname, '/app/js/mail_list_actions'), + 'user_alerts': path.join(__dirname, '/app/js/user_alerts'), + 'mail_view': path.join(__dirname, '/app/js/mail_view'), + 'dispatchers': path.join(__dirname, '/app/js/dispatchers'), + 'services': path.join(__dirname, '/app/js/services'), + 'mixins': path.join(__dirname, '/app/js/mixins'), + 'search': path.join(__dirname, '/app/js/search'), + 'foundation': path.join(__dirname, '/app/js/foundation'), + 'features': path.join(__dirname, '/app/js/features/features'), + 'user_settings': path.join(__dirname, '/app/js/user_settings') + }, + extensions: ['', '.js'] + }, + module: { + loaders: [ + { + test: /\.js$/, + loader: 'babel', + query: { presets: ['es2015']} + } + ] + }, + plugins: [ + new webpack.optimize.UglifyJsPlugin(), + new webpack.optimize.DedupePlugin(), + new CopyWebpackPlugin([ + { context: 'app/', from: '404.html' }, + { context: 'app/', from: 'index.html' }, + { context: 'app/', from: 'fonts/*' }, + { context: 'app/', from: 'locales/**/*' }, + { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, + { + context: 'app/', + from: 'bower_components/font-awesome/css/font-awesome.min.css', + to: 'bower_components/font-awesome/css' + }, + { + context: 'app/', + from: 'bower_components/jquery-file-upload/css/jquery.fileupload.css', + to: 'bower_components/jquery-file-upload/css' + }, + { + context: 'app/', + from: 'bower_components/modernizr/modernizr.js', + to: 'bower_components/modernizr' + }, + { + context: 'app/', + from: 'bower_components/lodash/dist/lodash.min.js', + to: 'bower_components/lodash/dist' + }, + { + context: 'app/', + from: 'bower_components/jquery/dist/jquery.min.js', + to: 'bower_components/jquery/dist' + }, + { + context: 'app/', + from: 'bower_components/jquery-ui/jquery-ui.min.js', + to: 'bower_components/jquery-ui' + }, + { + context: 'app/', + from: 'bower_components/jquery-file-upload/js/jquery.fileupload.js', + to: 'bower_components/jquery-file-upload/js' + }, + { + context: 'app/', + from: 'bower_components/handlebars/handlebars.min.js', + to: 'bower_components/handlebars' + }, + { + context: 'app/', + from: 'bower_components/typeahead.js/dist/typeahead.bundle.min.js', + to: 'bower_components/typeahead.js/dist' + }, + { + context: 'app/', + from: 'bower_components/iframe-resizer/js/iframeResizer.min.js', + to: 'bower_components/iframe-resizer/js' + } + ]) + ] +} -- cgit v1.2.3 From bba4d81629d0a7519a02f719f14d10a7996c9063 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 17:53:34 -0200 Subject: Remove requirejs compilation taks and options --- web-ui/config/buildoptions.js | 27 --------------------------- web-ui/package.json | 1 - 2 files changed, 28 deletions(-) delete mode 100644 web-ui/config/buildoptions.js diff --git a/web-ui/config/buildoptions.js b/web-ui/config/buildoptions.js deleted file mode 100644 index 63c91653..00000000 --- a/web-ui/config/buildoptions.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014 ThoughtWorks, Inc. - * - * Pixelated is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Pixelated 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Pixelated. If not, see . - */ - -({ - baseUrl: '../app', - wrap: true, - almond: true, - optimize: 'none', - mainConfigFile: '../app/js/main.js', - out: '../.tmp/app.concatenated.js', - include: ['js/main'], - name: 'bower_components/almond/almond' -}) diff --git a/web-ui/package.json b/web-ui/package.json index 6405102b..de6759fb 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -61,7 +61,6 @@ "build-js": "webpack --colors --progress", "jshint": "jshint --config=.jshintrc app test", "clean": "rm -rf 'dist/*' app/js/generated/hbs/* app/css/*", - "buildmain": "node_modules/requirejs/bin/r.js -o config/buildoptions.js", "package": "/bin/bash config/package.sh", "imagemin": "node config/imagemin.js", "minify_sandbox": "html-minifier app/sandbox.html --collapse-whitespace | sed 's|.*||' > dist/sandbox.html", -- cgit v1.2.3 From d4204cfec82e847deba47a8fd95df64c7b342578 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 17:54:21 -0200 Subject: Add compiled files to gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5bd72b2b..820e352c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .idea .bundle -*bundle.js +*app.min.js *.log *.DS_Store *.egg-info -- cgit v1.2.3 From 86e464682533e6d21f7f5c69dc091532df4c6dbc Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 28 Dec 2016 19:02:50 -0200 Subject: Fixes offcanvas menu by moving foundation back to index.html --- web-ui/app/index.html | 4 +++ web-ui/app/js/index.js | 4 --- web-ui/package.json | 3 +- web-ui/webpack.config.js | 72 ++++--------------------------------- web-ui/webpack.production.config.js | 22 +++++++++++- 5 files changed, 33 insertions(+), 72 deletions(-) diff --git a/web-ui/app/index.html b/web-ui/app/index.html index 9449dfb3..4cdcb248 100644 --- a/web-ui/app/index.html +++ b/web-ui/app/index.html @@ -101,6 +101,10 @@ + + + + diff --git a/web-ui/app/js/index.js b/web-ui/app/js/index.js index 724643c5..2f06e2b8 100644 --- a/web-ui/app/js/index.js +++ b/web-ui/app/js/index.js @@ -1,7 +1,3 @@ -import 'foundation-sites'; -import 'foundation-sites/js/foundation.reveal.js'; -import 'foundation-sites/js/foundation.offcanvas.js'; -import 'js/foundation/initialize_foundation'; import 'js/lib/highlightRegex'; import 'js/monkey_patching/all'; diff --git a/web-ui/package.json b/web-ui/package.json index de6759fb..de80bded 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -10,10 +10,9 @@ "babel-loader": "^6.2.10", "babel-preset-es2015": "^6.18.0", "bower": "1.7.9", + "copy-webpack-plugin": "^4.0.1", "dompurify": "^0.8.4", - "flightjs": "1.3.0", "font-awesome": "^4.7.0", - "foundation-sites": "^6.3.0", "handlebars": "^4.0.5", "he": "^1.1.0", "html-minifier": "2.1.6", diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index c4a54b4a..eb64aab8 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -8,18 +8,19 @@ module.exports = { output: { path: path.join(__dirname, '/app/'), filename: 'app.min.js', - publicPath: '/assets/js/' + publicPath: '/assets/' }, resolve: { alias: { - 'js': path.join(__dirname, '/app/js'), + 'DOMPurify': 'dompurify', + 'i18nextXHRBackend': 'i18next-xhr-backend', + 'i18nextBrowserLanguageDetector': 'i18next-browser-languagedetector', 'flight': path.join(__dirname, '/app/bower_components/flight'), + 'found': path.join(__dirname, '/app/bower_components/foundation'), + 'js': path.join(__dirname, '/app/js'), 'mail_list': path.join(__dirname, '/app/js/mail_list'), 'page': path.join(__dirname, '/app/js/page'), 'feedback': path.join(__dirname, '/app/js/feedback'), - 'DOMPurify': 'dompurify', - 'i18nextXHRBackend': 'i18next-xhr-backend', - 'i18nextBrowserLanguageDetector': 'i18next-browser-languagedetector', 'hbs': path.join(__dirname, '/app/js/generated/hbs'), 'helpers': path.join(__dirname, '/app/js/helpers'), 'lib': path.join(__dirname, '/app/js/lib'), @@ -47,64 +48,5 @@ module.exports = { query: { presets: ['es2015']} } ] - }, - plugins: [ - new CopyWebpackPlugin([ - { context: 'app/', from: '404.html' }, - { context: 'app/', from: 'index.html' }, - { context: 'app/', from: 'fonts/*' }, - { context: 'app/', from: 'locales/**/*' }, - { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, - { - context: 'app/', - from: 'bower_components/font-awesome/css/font-awesome.min.css', - to: 'bower_components/font-awesome/css' - }, - { - context: 'app/', - from: 'bower_components/jquery-file-upload/css/jquery.fileupload.css', - to: 'bower_components/jquery-file-upload/css' - }, - { - context: 'app/', - from: 'bower_components/modernizr/modernizr.js', - to: 'bower_components/modernizr' - }, - { - context: 'app/', - from: 'bower_components/lodash/dist/lodash.min.js', - to: 'bower_components/lodash/dist' - }, - { - context: 'app/', - from: 'bower_components/jquery/dist/jquery.min.js', - to: 'bower_components/jquery/dist' - }, - { - context: 'app/', - from: 'bower_components/jquery-ui/jquery-ui.min.js', - to: 'bower_components/jquery-ui' - }, - { - context: 'app/', - from: 'bower_components/jquery-file-upload/js/jquery.fileupload.js', - to: 'bower_components/jquery-file-upload/js' - }, - { - context: 'app/', - from: 'bower_components/handlebars/handlebars.min.js', - to: 'bower_components/handlebars' - }, - { - context: 'app/', - from: 'bower_components/typeahead.js/dist/typeahead.bundle.min.js', - to: 'bower_components/typeahead.js/dist' - }, - { - context: 'app/', - from: 'bower_components/iframe-resizer/js/iframeResizer.min.js', - to: 'bower_components/iframe-resizer/js' - } - ]) - ] + } } diff --git a/web-ui/webpack.production.config.js b/web-ui/webpack.production.config.js index 36eb9396..b8531080 100644 --- a/web-ui/webpack.production.config.js +++ b/web-ui/webpack.production.config.js @@ -8,7 +8,7 @@ module.exports = { output: { path: path.join(__dirname, '/dist/'), filename: 'app.min.js', - publicPath: '/assets/js/' + publicPath: '/assets/' }, resolve: { alias: { @@ -105,6 +105,26 @@ module.exports = { context: 'app/', from: 'bower_components/iframe-resizer/js/iframeResizer.min.js', to: 'bower_components/iframe-resizer/js' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation.js', + to: 'bower_components/foundation/js' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation/foundation.reveal.js', + to: 'bower_components/foundation/js' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation/foundation.offcanvas.js', + to: 'bower_components/foundation/js' + }, + { + context: 'app/', + from: 'js/foundation/initialize_foundation.js', + to: 'js/foundation' } ]) ] -- cgit v1.2.3 From d67a32e951c6116adc3ad14d31f26a6459333648 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 29 Dec 2016 09:44:31 -0200 Subject: Use only dist folder for serving application --- service/pixelated/resources/login_resource.py | 4 ++-- service/pixelated/resources/root_resource.py | 4 ++-- web-ui/webpack.config.js | 2 +- web-ui/webpack.production.config.js | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/service/pixelated/resources/login_resource.py b/service/pixelated/resources/login_resource.py index ed0cb54e..2a11b73e 100644 --- a/service/pixelated/resources/login_resource.py +++ b/service/pixelated/resources/login_resource.py @@ -40,11 +40,11 @@ def _get_startup_folder(): def _get_static_folder(): - static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "app")) + static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "dist")) # this is a workaround for packaging if not os.path.exists(static_folder): static_folder = os.path.abspath( - os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "app")) + os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "dist")) if not os.path.exists(static_folder): static_folder = os.path.join('/', 'usr', 'share', 'pixelated-user-agent') return static_folder diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py index 8df76c70..101ff6b8 100644 --- a/service/pixelated/resources/root_resource.py +++ b/service/pixelated/resources/root_resource.py @@ -111,11 +111,11 @@ class RootResource(BaseResource): return os.path.join(path, '..', 'assets') def _get_static_folder(self): - static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "app")) + static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "dist")) # this is a workaround for packaging if not os.path.exists(static_folder): static_folder = os.path.abspath( - os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "app")) + os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "dist")) if not os.path.exists(static_folder): static_folder = os.path.join('/', 'usr', 'share', 'pixelated-user-agent') return static_folder diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index eb64aab8..a79d98be 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -6,7 +6,7 @@ module.exports = { entry: './app/js/index.js', node: { fs: 'empty' }, output: { - path: path.join(__dirname, '/app/'), + path: path.join(__dirname, 'dist'), filename: 'app.min.js', publicPath: '/assets/' }, diff --git a/web-ui/webpack.production.config.js b/web-ui/webpack.production.config.js index b8531080..79884ad7 100644 --- a/web-ui/webpack.production.config.js +++ b/web-ui/webpack.production.config.js @@ -53,6 +53,7 @@ module.exports = { new CopyWebpackPlugin([ { context: 'app/', from: '404.html' }, { context: 'app/', from: 'index.html' }, + { context: 'app/', from: 'css/*' }, { context: 'app/', from: 'fonts/*' }, { context: 'app/', from: 'locales/**/*' }, { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, -- cgit v1.2.3 From 7c847f5abd4a516236a74862eb7ec222087900be Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 29 Dec 2016 10:26:06 -0200 Subject: Makes sure builds include all necessary files --- web-ui/webpack.config.js | 82 ++++++++++++++++++++++++++++++++++++- web-ui/webpack.production.config.js | 4 +- 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index a79d98be..ca795ea5 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -48,5 +48,85 @@ module.exports = { query: { presets: ['es2015']} } ] - } + }, + plugins: [ + new CopyWebpackPlugin([ + { context: 'app/', from: '404.html' }, + { context: 'app/', from: 'index.html' }, + { context: 'app/', from: 'css/*' }, + { context: 'app/', from: 'fonts/*' }, + { context: 'app/', from: 'locales/**/*' }, + { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, + { + context: 'app/', + from: 'bower_components/font-awesome/css/font-awesome.min.css', + to: 'bower_components/font-awesome/css' + }, + { + context: 'app/', + from: 'bower_components/jquery-file-upload/css/jquery.fileupload.css', + to: 'bower_components/jquery-file-upload/css' + }, + { + context: 'app/', + from: 'bower_components/modernizr/modernizr.js', + to: 'bower_components/modernizr' + }, + { + context: 'app/', + from: 'bower_components/lodash/dist/lodash.min.js', + to: 'bower_components/lodash/dist' + }, + { + context: 'app/', + from: 'bower_components/jquery/dist/jquery.min.js', + to: 'bower_components/jquery/dist' + }, + { + context: 'app/', + from: 'bower_components/jquery-ui/jquery-ui.min.js', + to: 'bower_components/jquery-ui' + }, + { + context: 'app/', + from: 'bower_components/jquery-file-upload/js/jquery.fileupload.js', + to: 'bower_components/jquery-file-upload/js' + }, + { + context: 'app/', + from: 'bower_components/handlebars/handlebars.min.js', + to: 'bower_components/handlebars' + }, + { + context: 'app/', + from: 'bower_components/typeahead.js/dist/typeahead.bundle.min.js', + to: 'bower_components/typeahead.js/dist' + }, + { + context: 'app/', + from: 'bower_components/iframe-resizer/js/iframeResizer.min.js', + to: 'bower_components/iframe-resizer/js' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation.js', + to: 'bower_components/foundation/js' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation/foundation.reveal.js', + to: 'bower_components/foundation/js/foundation' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation/foundation.offcanvas.js', + to: 'bower_components/foundation/js/foundation' + }, + { + context: 'app/', + from: 'js/foundation/initialize_foundation.js', + to: 'js/foundation' + } + ]) + ] } diff --git a/web-ui/webpack.production.config.js b/web-ui/webpack.production.config.js index 79884ad7..77ff1fb9 100644 --- a/web-ui/webpack.production.config.js +++ b/web-ui/webpack.production.config.js @@ -115,12 +115,12 @@ module.exports = { { context: 'app/', from: 'bower_components/foundation/js/foundation/foundation.reveal.js', - to: 'bower_components/foundation/js' + to: 'bower_components/foundation/js/foundation' }, { context: 'app/', from: 'bower_components/foundation/js/foundation/foundation.offcanvas.js', - to: 'bower_components/foundation/js' + to: 'bower_components/foundation/js/foundation' }, { context: 'app/', -- cgit v1.2.3 From 639430167b646de6fdbb0f275386dae2856b7e72 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 29 Dec 2016 10:54:12 -0200 Subject: Compile sandbox files through webpack as well --- web-ui/app/index.html | 4 +- web-ui/app/sandbox.html | 4 +- web-ui/config/copy-webpack.js | 86 +++++++++++++++++++++++++++++++++++++ web-ui/config/package.sh | 9 ---- web-ui/package.json | 3 +- web-ui/webpack.config.js | 81 +--------------------------------- web-ui/webpack.production.config.js | 79 +--------------------------------- 7 files changed, 91 insertions(+), 175 deletions(-) create mode 100644 web-ui/config/copy-webpack.js diff --git a/web-ui/app/index.html b/web-ui/app/index.html index 4cdcb248..b40aecdf 100644 --- a/web-ui/app/index.html +++ b/web-ui/app/index.html @@ -92,7 +92,6 @@ - @@ -105,8 +104,7 @@ - - + diff --git a/web-ui/app/sandbox.html b/web-ui/app/sandbox.html index 8325b0da..3e110977 100644 --- a/web-ui/app/sandbox.html +++ b/web-ui/app/sandbox.html @@ -5,10 +5,8 @@ - - + - diff --git a/web-ui/config/copy-webpack.js b/web-ui/config/copy-webpack.js new file mode 100644 index 00000000..79a5de83 --- /dev/null +++ b/web-ui/config/copy-webpack.js @@ -0,0 +1,86 @@ +var CopyWebpackPlugin = require('copy-webpack-plugin'); + +module.exports = new CopyWebpackPlugin([ + { context: 'app/', from: '404.html' }, + { context: 'app/', from: 'index.html' }, + { context: 'app/', from: 'sandbox.html' }, + { context: 'app/', from: 'css/*' }, + { context: 'app/', from: 'fonts/*' }, + { context: 'app/', from: 'locales/**/*' }, + { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, + { + context: 'app/', + from: 'bower_components/font-awesome/css/font-awesome.min.css', + to: 'bower_components/font-awesome/css' + }, + { + context: 'app/', + from: 'bower_components/jquery-file-upload/css/jquery.fileupload.css', + to: 'bower_components/jquery-file-upload/css' + }, + { + context: 'app/', + from: 'bower_components/modernizr/modernizr.js', + to: 'bower_components/modernizr' + }, + { + context: 'app/', + from: 'bower_components/lodash/dist/lodash.min.js', + to: 'bower_components/lodash/dist' + }, + { + context: 'app/', + from: 'bower_components/jquery/dist/jquery.min.js', + to: 'bower_components/jquery/dist' + }, + { + context: 'app/', + from: 'bower_components/jquery-ui/jquery-ui.min.js', + to: 'bower_components/jquery-ui' + }, + { + context: 'app/', + from: 'bower_components/jquery-file-upload/js/jquery.fileupload.js', + to: 'bower_components/jquery-file-upload/js' + }, + { + context: 'app/', + from: 'bower_components/handlebars/handlebars.min.js', + to: 'bower_components/handlebars' + }, + { + context: 'app/', + from: 'bower_components/typeahead.js/dist/typeahead.bundle.min.js', + to: 'bower_components/typeahead.js/dist' + }, + { + context: 'app/', + from: 'bower_components/iframe-resizer/js/iframeResizer.min.js', + to: 'bower_components/iframe-resizer/js' + }, + { + context: 'app/', + from: 'bower_components/iframe-resizer/js/iframeResizer.contentWindow.min.js', + to: 'bower_components/iframe-resizer/js' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation.js', + to: 'bower_components/foundation/js' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation/foundation.reveal.js', + to: 'bower_components/foundation/js/foundation' + }, + { + context: 'app/', + from: 'bower_components/foundation/js/foundation/foundation.offcanvas.js', + to: 'bower_components/foundation/js/foundation' + }, + { + context: 'app/', + from: 'js/foundation/initialize_foundation.js', + to: 'js/foundation' + } +]) diff --git a/web-ui/config/package.sh b/web-ui/config/package.sh index cfb66879..97cf185a 100644 --- a/web-ui/config/package.sh +++ b/web-ui/config/package.sh @@ -25,12 +25,3 @@ mkdir -p dist # initial npm tasks ./go build-prod ./go imagemin -./go minify_sandbox - - -# concat js files and minify for sandbox.min.js -cat \ -app/js/sandbox.js \ -app/bower_components/iframe-resizer/js/iframeResizer.contentWindow.js > dist/sandbox.js -node_modules/.bin/minify dist/sandbox.js > dist/sandbox.min.js -rm dist/sandbox.js diff --git a/web-ui/package.json b/web-ui/package.json index de80bded..0d64a5df 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -59,10 +59,9 @@ "build-prod": "npm run build-statics && webpack -p --config ./webpack.production.config.js", "build-js": "webpack --colors --progress", "jshint": "jshint --config=.jshintrc app test", - "clean": "rm -rf 'dist/*' app/js/generated/hbs/* app/css/*", + "clean": "rm -rf dist/ app/js/generated/hbs/* app/css/*", "package": "/bin/bash config/package.sh", "imagemin": "node config/imagemin.js", - "minify_sandbox": "html-minifier app/sandbox.html --collapse-whitespace | sed 's|.*||' > dist/sandbox.html", "add_git_version": "/bin/bash config/add_git_version.sh" } } diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index ca795ea5..794ce08d 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -49,84 +49,5 @@ module.exports = { } ] }, - plugins: [ - new CopyWebpackPlugin([ - { context: 'app/', from: '404.html' }, - { context: 'app/', from: 'index.html' }, - { context: 'app/', from: 'css/*' }, - { context: 'app/', from: 'fonts/*' }, - { context: 'app/', from: 'locales/**/*' }, - { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, - { - context: 'app/', - from: 'bower_components/font-awesome/css/font-awesome.min.css', - to: 'bower_components/font-awesome/css' - }, - { - context: 'app/', - from: 'bower_components/jquery-file-upload/css/jquery.fileupload.css', - to: 'bower_components/jquery-file-upload/css' - }, - { - context: 'app/', - from: 'bower_components/modernizr/modernizr.js', - to: 'bower_components/modernizr' - }, - { - context: 'app/', - from: 'bower_components/lodash/dist/lodash.min.js', - to: 'bower_components/lodash/dist' - }, - { - context: 'app/', - from: 'bower_components/jquery/dist/jquery.min.js', - to: 'bower_components/jquery/dist' - }, - { - context: 'app/', - from: 'bower_components/jquery-ui/jquery-ui.min.js', - to: 'bower_components/jquery-ui' - }, - { - context: 'app/', - from: 'bower_components/jquery-file-upload/js/jquery.fileupload.js', - to: 'bower_components/jquery-file-upload/js' - }, - { - context: 'app/', - from: 'bower_components/handlebars/handlebars.min.js', - to: 'bower_components/handlebars' - }, - { - context: 'app/', - from: 'bower_components/typeahead.js/dist/typeahead.bundle.min.js', - to: 'bower_components/typeahead.js/dist' - }, - { - context: 'app/', - from: 'bower_components/iframe-resizer/js/iframeResizer.min.js', - to: 'bower_components/iframe-resizer/js' - }, - { - context: 'app/', - from: 'bower_components/foundation/js/foundation.js', - to: 'bower_components/foundation/js' - }, - { - context: 'app/', - from: 'bower_components/foundation/js/foundation/foundation.reveal.js', - to: 'bower_components/foundation/js/foundation' - }, - { - context: 'app/', - from: 'bower_components/foundation/js/foundation/foundation.offcanvas.js', - to: 'bower_components/foundation/js/foundation' - }, - { - context: 'app/', - from: 'js/foundation/initialize_foundation.js', - to: 'js/foundation' - } - ]) - ] + plugins: [copyWebpack] } diff --git a/web-ui/webpack.production.config.js b/web-ui/webpack.production.config.js index 77ff1fb9..78cfe843 100644 --- a/web-ui/webpack.production.config.js +++ b/web-ui/webpack.production.config.js @@ -50,83 +50,6 @@ module.exports = { plugins: [ new webpack.optimize.UglifyJsPlugin(), new webpack.optimize.DedupePlugin(), - new CopyWebpackPlugin([ - { context: 'app/', from: '404.html' }, - { context: 'app/', from: 'index.html' }, - { context: 'app/', from: 'css/*' }, - { context: 'app/', from: 'fonts/*' }, - { context: 'app/', from: 'locales/**/*' }, - { context: 'app/', from: 'bower_components/font-awesome/fonts/*' }, - { - context: 'app/', - from: 'bower_components/font-awesome/css/font-awesome.min.css', - to: 'bower_components/font-awesome/css' - }, - { - context: 'app/', - from: 'bower_components/jquery-file-upload/css/jquery.fileupload.css', - to: 'bower_components/jquery-file-upload/css' - }, - { - context: 'app/', - from: 'bower_components/modernizr/modernizr.js', - to: 'bower_components/modernizr' - }, - { - context: 'app/', - from: 'bower_components/lodash/dist/lodash.min.js', - to: 'bower_components/lodash/dist' - }, - { - context: 'app/', - from: 'bower_components/jquery/dist/jquery.min.js', - to: 'bower_components/jquery/dist' - }, - { - context: 'app/', - from: 'bower_components/jquery-ui/jquery-ui.min.js', - to: 'bower_components/jquery-ui' - }, - { - context: 'app/', - from: 'bower_components/jquery-file-upload/js/jquery.fileupload.js', - to: 'bower_components/jquery-file-upload/js' - }, - { - context: 'app/', - from: 'bower_components/handlebars/handlebars.min.js', - to: 'bower_components/handlebars' - }, - { - context: 'app/', - from: 'bower_components/typeahead.js/dist/typeahead.bundle.min.js', - to: 'bower_components/typeahead.js/dist' - }, - { - context: 'app/', - from: 'bower_components/iframe-resizer/js/iframeResizer.min.js', - to: 'bower_components/iframe-resizer/js' - }, - { - context: 'app/', - from: 'bower_components/foundation/js/foundation.js', - to: 'bower_components/foundation/js' - }, - { - context: 'app/', - from: 'bower_components/foundation/js/foundation/foundation.reveal.js', - to: 'bower_components/foundation/js/foundation' - }, - { - context: 'app/', - from: 'bower_components/foundation/js/foundation/foundation.offcanvas.js', - to: 'bower_components/foundation/js/foundation' - }, - { - context: 'app/', - from: 'js/foundation/initialize_foundation.js', - to: 'js/foundation' - } - ]) + copyWebpack ] } -- cgit v1.2.3 From ee82bd9ea42fe9acbe0c9750931a899ada335cfa Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 29 Dec 2016 10:54:40 -0200 Subject: Move aliases to common folder for local and production compilation --- web-ui/config/alias-webpack.js | 28 +++++++++++++++++++++++++++ web-ui/webpack.config.js | 37 ++++++++---------------------------- web-ui/webpack.production.config.js | 38 +++++++++---------------------------- 3 files changed, 45 insertions(+), 58 deletions(-) create mode 100644 web-ui/config/alias-webpack.js diff --git a/web-ui/config/alias-webpack.js b/web-ui/config/alias-webpack.js new file mode 100644 index 00000000..f4ea1b63 --- /dev/null +++ b/web-ui/config/alias-webpack.js @@ -0,0 +1,28 @@ +var path = require('path'); + +module.exports = { + 'DOMPurify': 'dompurify', + 'i18nextXHRBackend': 'i18next-xhr-backend', + 'i18nextBrowserLanguageDetector': 'i18next-browser-languagedetector', + 'flight': path.join(__dirname, '../app/bower_components/flight'), + 'found': path.join(__dirname, '../app/bower_components/foundation'), + 'js': path.join(__dirname, '../app/js'), + 'mail_list': path.join(__dirname, '../app/js/mail_list'), + 'page': path.join(__dirname, '../app/js/page'), + 'feedback': path.join(__dirname, '../app/js/feedback'), + 'hbs': path.join(__dirname, '../app/js/generated/hbs'), + 'helpers': path.join(__dirname, '../app/js/helpers'), + 'lib': path.join(__dirname, '../app/js/lib'), + 'views': path.join(__dirname, '../app/js/views'), + 'tags': path.join(__dirname, '../app/js/tags'), + 'mail_list_actions': path.join(__dirname, '../app/js/mail_list_actions'), + 'user_alerts': path.join(__dirname, '../app/js/user_alerts'), + 'mail_view': path.join(__dirname, '../app/js/mail_view'), + 'dispatchers': path.join(__dirname, '../app/js/dispatchers'), + 'services': path.join(__dirname, '../app/js/services'), + 'mixins': path.join(__dirname, '../app/js/mixins'), + 'search': path.join(__dirname, '../app/js/search'), + 'foundation': path.join(__dirname, '../app/js/foundation'), + 'features': path.join(__dirname, '../app/js/features/features'), + 'user_settings': path.join(__dirname, '../app/js/user_settings') +} diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 794ce08d..99162908 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -1,42 +1,21 @@ var path = require('path'); var webpack = require('webpack'); -var CopyWebpackPlugin = require('copy-webpack-plugin'); +var copyWebpack = require('./config/copy-webpack'); +var aliases = require('./config/alias-webpack'); module.exports = { - entry: './app/js/index.js', + entry: { + app: './app/js/index.js', + sandbox: './app/js/sandbox.js' + }, node: { fs: 'empty' }, output: { path: path.join(__dirname, 'dist'), - filename: 'app.min.js', + filename: '[name].js', publicPath: '/assets/' }, resolve: { - alias: { - 'DOMPurify': 'dompurify', - 'i18nextXHRBackend': 'i18next-xhr-backend', - 'i18nextBrowserLanguageDetector': 'i18next-browser-languagedetector', - 'flight': path.join(__dirname, '/app/bower_components/flight'), - 'found': path.join(__dirname, '/app/bower_components/foundation'), - 'js': path.join(__dirname, '/app/js'), - 'mail_list': path.join(__dirname, '/app/js/mail_list'), - 'page': path.join(__dirname, '/app/js/page'), - 'feedback': path.join(__dirname, '/app/js/feedback'), - 'hbs': path.join(__dirname, '/app/js/generated/hbs'), - 'helpers': path.join(__dirname, '/app/js/helpers'), - 'lib': path.join(__dirname, '/app/js/lib'), - 'views': path.join(__dirname, '/app/js/views'), - 'tags': path.join(__dirname, '/app/js/tags'), - 'mail_list_actions': path.join(__dirname, '/app/js/mail_list_actions'), - 'user_alerts': path.join(__dirname, '/app/js/user_alerts'), - 'mail_view': path.join(__dirname, '/app/js/mail_view'), - 'dispatchers': path.join(__dirname, '/app/js/dispatchers'), - 'services': path.join(__dirname, '/app/js/services'), - 'mixins': path.join(__dirname, '/app/js/mixins'), - 'search': path.join(__dirname, '/app/js/search'), - 'foundation': path.join(__dirname, '/app/js/foundation'), - 'features': path.join(__dirname, '/app/js/features/features'), - 'user_settings': path.join(__dirname, '/app/js/user_settings') - }, + alias: aliases, extensions: ['', '.js'] }, module: { diff --git a/web-ui/webpack.production.config.js b/web-ui/webpack.production.config.js index 78cfe843..bddbbe9c 100644 --- a/web-ui/webpack.production.config.js +++ b/web-ui/webpack.production.config.js @@ -1,41 +1,21 @@ var path = require('path'); var webpack = require('webpack'); -var CopyWebpackPlugin = require('copy-webpack-plugin'); +var copyWebpack = require('./config/copy-webpack'); +var aliases = require('./config/alias-webpack'); module.exports = { - entry: './app/js/index.js', + entry: { + app: './app/js/index.js', + sandbox: './app/js/sandbox.js' + }, node: { fs: 'empty' }, output: { - path: path.join(__dirname, '/dist/'), - filename: 'app.min.js', + path: path.join(__dirname, 'dist'), + filename: '[name].js', publicPath: '/assets/' }, resolve: { - alias: { - 'js': path.join(__dirname, '/app/js'), - 'flight': path.join(__dirname, '/app/bower_components/flight'), - 'mail_list': path.join(__dirname, '/app/js/mail_list'), - 'page': path.join(__dirname, '/app/js/page'), - 'feedback': path.join(__dirname, '/app/js/feedback'), - 'DOMPurify': 'dompurify', - 'i18nextXHRBackend': 'i18next-xhr-backend', - 'i18nextBrowserLanguageDetector': 'i18next-browser-languagedetector', - 'hbs': path.join(__dirname, '/app/js/generated/hbs'), - 'helpers': path.join(__dirname, '/app/js/helpers'), - 'lib': path.join(__dirname, '/app/js/lib'), - 'views': path.join(__dirname, '/app/js/views'), - 'tags': path.join(__dirname, '/app/js/tags'), - 'mail_list_actions': path.join(__dirname, '/app/js/mail_list_actions'), - 'user_alerts': path.join(__dirname, '/app/js/user_alerts'), - 'mail_view': path.join(__dirname, '/app/js/mail_view'), - 'dispatchers': path.join(__dirname, '/app/js/dispatchers'), - 'services': path.join(__dirname, '/app/js/services'), - 'mixins': path.join(__dirname, '/app/js/mixins'), - 'search': path.join(__dirname, '/app/js/search'), - 'foundation': path.join(__dirname, '/app/js/foundation'), - 'features': path.join(__dirname, '/app/js/features/features'), - 'user_settings': path.join(__dirname, '/app/js/user_settings') - }, + alias: aliases, extensions: ['', '.js'] }, module: { -- cgit v1.2.3 From f016c96fd479fb68f97c543382be212f383ec755 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 29 Dec 2016 11:24:04 -0200 Subject: Adds back missing foundation bower dependency to fix build --- web-ui/bower.json | 1 + 1 file changed, 1 insertion(+) diff --git a/web-ui/bower.json b/web-ui/bower.json index 2a2b57e0..b933da51 100644 --- a/web-ui/bower.json +++ b/web-ui/bower.json @@ -10,6 +10,7 @@ "i18next-xhr-backend": "~0.6.0", "i18next-browser-languagedetector": "~0.3.0", "font-awesome": "4.2.0", + "foundation": "~5.4.7", "quoted-printable": "0.2.1", "typeahead.js": "~0.10.5", "jasmine-flight": "~3.0.0", -- cgit v1.2.3 From 7dae7aaced98aba6a832faa11e61fc2e7443c88b Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 29 Dec 2016 11:39:47 -0200 Subject: Move package script to npm --- web-ui/config/package.sh | 27 --------------------------- web-ui/package.json | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 web-ui/config/package.sh diff --git a/web-ui/config/package.sh b/web-ui/config/package.sh deleted file mode 100644 index 97cf185a..00000000 --- a/web-ui/config/package.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright (c) 2014 ThoughtWorks, Inc. -# -# Pixelated is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Pixelated 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Pixelated. If not, see . - -# prepare files for .deb package - -set -e - -export PIXELATED_BUILD='package' - -mkdir -p dist - -# initial npm tasks -./go build-prod -./go imagemin diff --git a/web-ui/package.json b/web-ui/package.json index 0d64a5df..3d1720e1 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -60,7 +60,7 @@ "build-js": "webpack --colors --progress", "jshint": "jshint --config=.jshintrc app test", "clean": "rm -rf dist/ app/js/generated/hbs/* app/css/*", - "package": "/bin/bash config/package.sh", + "package": "PIXELATED_BUILD='package' npm run build-prod && npm run imagemin", "imagemin": "node config/imagemin.js", "add_git_version": "/bin/bash config/add_git_version.sh" } -- cgit v1.2.3 From 413672fdba891168301c853c679f21700ebaeb90 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 29 Dec 2016 11:42:11 -0200 Subject: Delete require config file main.js --- web-ui/app/js/main.js | 84 --------------------------------------------------- web-ui/karma.conf.js | 1 - 2 files changed, 85 deletions(-) delete mode 100644 web-ui/app/js/main.js diff --git a/web-ui/app/js/main.js b/web-ui/app/js/main.js deleted file mode 100644 index b8836a6b..00000000 --- a/web-ui/app/js/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2014 ThoughtWorks, Inc. - * - * Pixelated is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Pixelated 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Pixelated. If not, see . - */ - -requirejs.config({ - baseUrl: '../assets/', - paths: { - 'mail_list': 'js/mail_list', - 'page': 'js/page', - 'feedback': 'js/feedback', - 'flight': 'bower_components/flight', - 'DOMPurify': 'bower_components/DOMPurify/dist/purify.min', - 'he': 'bower_components/he/he', - 'hbs': 'js/generated/hbs', - 'helpers': 'js/helpers', - 'lib': 'js/lib', - 'views': 'js/views', - 'tags': 'js/tags', - 'mail_list_actions': 'js/mail_list_actions', - 'user_alerts': 'js/user_alerts', - 'mail_view': 'js/mail_view', - 'dispatchers': 'js/dispatchers', - 'services': 'js/services', - 'mixins': 'js/mixins', - 'search': 'js/search', - 'foundation': 'js/foundation', - 'features': 'js/features/features', - 'i18next': 'bower_components/i18next/i18next', - 'i18nextXHRBackend': 'bower_components/i18next-xhr-backend/i18nextXHRBackend', - 'i18nextBrowserLanguageDetector': 'bower_components/i18next-browser-languagedetector/i18nextBrowserLanguageDetector', - 'quoted-printable': 'bower_components/quoted-printable', - 'utf8': 'bower_components/utf8', - 'user_settings': 'js/user_settings' - } -}); - -require([ - 'flight/lib/compose', - 'flight/lib/debug' -], function(compose, debug){ - 'use strict'; - debug.enable(true); - debug.events.logAll(); -}); - -require( - [ - 'flight/lib/compose', - 'flight/lib/registry', - 'flight/lib/advice', - 'flight/lib/logger', - 'flight/lib/debug', - 'page/events', - 'page/default', - 'js/monkey_patching/all' - ], - - function(compose, registry, advice, withLogging, debug, events, initializeDefault, _monkeyPatched) { - 'use strict'; - - window.Pixelated = window.Pixelated || {}; - window.Pixelated.events = events; - - compose.mixin(registry, [advice.withAdvice, withLogging]); - - debug.enable(true); - debug.events.logAll(); - - initializeDefault(''); - } -); diff --git a/web-ui/karma.conf.js b/web-ui/karma.conf.js index 52b54f57..2895dc42 100644 --- a/web-ui/karma.conf.js +++ b/web-ui/karma.conf.js @@ -61,7 +61,6 @@ module.exports = function (config) { // list of files to exclude exclude: [ - 'app/js/main.js' ], // test results reporter to use -- cgit v1.2.3