From f1d8f2e6190bc1fbaca7d618fbeb24b502b5a80a Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Tue, 22 Aug 2017 12:23:16 +0200 Subject: [PATCH] moment: load translations in browser, moment: only load necessary data, remove jquery, remove bluebird --- npm-shrinkwrap.json | 24 +++++------------- package.json | 1 - webpack/config/index.js | 2 +- webpack/webpack.base.conf.js | 8 ++---- website/client/.eslintrc | 3 --- .../client/components/chat/chatMessages.vue | 3 +-- .../components/settings/subscription.vue | 4 ++- website/client/libs/encodeParams.js | 7 ++++++ website/client/libs/i18n.js | 23 ++++++++++++++++- website/server/controllers/api-v3/i18n.js | 25 +++++++++++++++++-- 10 files changed, 65 insertions(+), 35 deletions(-) create mode 100644 website/client/libs/encodeParams.js diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 137bbd39465..9fd4d5fdd37 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "habitica", - "version": "3.110.0", + "version": "3.111.0", "dependencies": { "@gulp-sourcemaps/map-sources": { "version": "1.0.0", @@ -2433,13 +2433,11 @@ "version": "4.0.0", "from": "cross-env@>=4.0.0 <5.0.0", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-4.0.0.tgz", - "dev": true, "dependencies": { "is-windows": { "version": "1.0.1", "from": "is-windows@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz" } } }, @@ -2447,19 +2445,16 @@ "version": "5.1.0", "from": "cross-spawn@>=5.0.1 <6.0.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "dev": true, "dependencies": { "lru-cache": { "version": "4.1.1", "from": "lru-cache@>=4.0.1 <5.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz" }, "which": { "version": "1.3.0", "from": "which@>=1.2.9 <2.0.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz" } } }, @@ -7385,11 +7380,6 @@ "resolved": "https://registry.npmjs.org/jpegtran-bin/-/jpegtran-bin-3.2.0.tgz", "optional": true }, - "jquery": { - "version": "3.2.1", - "from": "jquery@>=3.1.1 <4.0.0", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz" - }, "js-base64": { "version": "2.1.9", "from": "js-base64@>=2.1.9 <3.0.0", @@ -11687,14 +11677,12 @@ "shebang-command": { "version": "1.2.0", "from": "shebang-command@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz" }, "shebang-regex": { "version": "1.0.0", "from": "shebang-regex@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz" }, "shell-quote": { "version": "1.4.3", diff --git a/package.json b/package.json index 38ff4abea96..96f90fa1b0c 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,6 @@ "in-app-purchase": "^1.1.6", "intro.js": "^2.6.0", "jade": "~1.11.0", - "jquery": "^3.1.1", "js2xmlparser": "~1.0.0", "lodash": "^4.17.4", "merge-stream": "^1.0.0", diff --git a/webpack/config/index.js b/webpack/config/index.js index 5f07ce52a8d..ee409f46e57 100644 --- a/webpack/config/index.js +++ b/webpack/config/index.js @@ -21,7 +21,7 @@ module.exports = { productionGzipExtensions: ['js', 'css'], // Run the build command with an extra argument to // View the bundle analyzer report after build finishes: - // `npm run build --report` + // `npm run client:build --report` // Set to `true` or `false` to always turn it on or off bundleAnalyzerReport: process.env.npm_config_report, // eslint-disable-line no-process-env }, diff --git a/webpack/webpack.base.conf.js b/webpack/webpack.base.conf.js index 6d7a041d092..6717b9ab842 100644 --- a/webpack/webpack.base.conf.js +++ b/webpack/webpack.base.conf.js @@ -3,8 +3,8 @@ const path = require('path'); const config = require('./config'); const utils = require('./utils'); -const projectRoot = path.resolve(__dirname, '../'); const webpack = require('webpack'); +const projectRoot = path.resolve(__dirname, '../'); const autoprefixer = require('autoprefixer'); const postcssEasyImport = require('postcss-easy-import'); const IS_PROD = process.env.NODE_ENV === 'production'; @@ -36,7 +36,6 @@ const baseConfig = { path.join(projectRoot, 'node_modules'), ], alias: { - jquery: 'jquery/src/jquery', website: path.resolve(projectRoot, 'website'), common: path.resolve(projectRoot, 'website/common'), client: path.resolve(projectRoot, 'website/client'), @@ -45,10 +44,7 @@ const baseConfig = { }, }, plugins: [ - new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery', - }), + new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(NOT_EXISTING)$/), ], module: { rules: [ diff --git a/website/client/.eslintrc b/website/client/.eslintrc index 2a1dea094ad..124afd60365 100644 --- a/website/client/.eslintrc +++ b/website/client/.eslintrc @@ -6,9 +6,6 @@ "plugins": [ "html" ], - "globals": { - "$": true, - }, "parser": "babel-eslint", "rules": { "strict": 0 diff --git a/website/client/components/chat/chatMessages.vue b/website/client/components/chat/chatMessages.vue index f349291bfb4..e833fdfdc9d 100644 --- a/website/client/components/chat/chatMessages.vue +++ b/website/client/components/chat/chatMessages.vue @@ -125,7 +125,6 @@