diff --git a/.eslintrc b/.eslintrc index 41c33c109..e175ad797 100644 --- a/.eslintrc +++ b/.eslintrc @@ -51,7 +51,8 @@ "no-useless-escape": 0, "quotes": [ 1, - "single" + "single", + "avoid-escape" ], "react/prop-types": 0, "semi": [1, "always"] diff --git a/package-lock.json b/package-lock.json index a2566d72e..adbaeba4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "Vulcan", - "version": "1.12.13", + "version": "1.12.16", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -702,6 +702,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -1687,22 +1688,22 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "resolved": false, "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "resolved": false, "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "aproba": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "resolved": false, "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, "are-we-there-yet": { "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "resolved": false, "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "requires": { "delegates": "^1.0.0", @@ -1711,12 +1712,12 @@ }, "balanced-match": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "resolved": false, "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "brace-expansion": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "resolved": false, "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { "balanced-match": "^1.0.0", @@ -1725,32 +1726,32 @@ }, "chownr": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", + "resolved": false, "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==" }, "code-point-at": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "resolved": false, "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "resolved": false, "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "console-control-strings": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "resolved": false, "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "resolved": false, "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "resolved": false, "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" @@ -1758,22 +1759,22 @@ }, "deep-extend": { "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "resolved": false, "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" }, "delegates": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "resolved": false, "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" }, "detect-libc": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "resolved": false, "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, "fs-minipass": { "version": "1.2.5", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", + "resolved": false, "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "requires": { "minipass": "^2.2.1" @@ -1781,12 +1782,12 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "resolved": false, "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "gauge": { "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "resolved": false, "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "requires": { "aproba": "^1.0.3", @@ -1801,7 +1802,7 @@ }, "glob": { "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "resolved": false, "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "requires": { "fs.realpath": "^1.0.0", @@ -1814,12 +1815,12 @@ }, "has-unicode": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "resolved": false, "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, "iconv-lite": { "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "resolved": false, "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "requires": { "safer-buffer": ">= 2.1.2 < 3" @@ -1827,7 +1828,7 @@ }, "ignore-walk": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "resolved": false, "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "requires": { "minimatch": "^3.0.4" @@ -1835,7 +1836,7 @@ }, "inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "resolved": false, "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { "once": "^1.3.0", @@ -1844,17 +1845,17 @@ }, "inherits": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "resolved": false, "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "resolved": false, "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "requires": { "number-is-nan": "^1.0.0" @@ -1862,12 +1863,12 @@ }, "isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "resolved": false, "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "minimatch": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "resolved": false, "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { "brace-expansion": "^1.1.7" @@ -1875,12 +1876,12 @@ }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minipass": { "version": "2.3.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.4.tgz", + "resolved": false, "integrity": "sha512-mlouk1OHlaUE8Odt1drMtG1bAJA4ZA6B/ehysgV0LUIrDHdKgo1KorZq3pK0b/7Z7LJIQ12MNM6aC+Tn6lUZ5w==", "requires": { "safe-buffer": "^5.1.2", @@ -1889,19 +1890,19 @@ "dependencies": { "safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "resolved": false, "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "yallist": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", + "resolved": false, "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" } } }, "minizlib": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz", + "resolved": false, "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", "requires": { "minipass": "^2.2.1" @@ -1909,7 +1910,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": false, "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -1917,12 +1918,12 @@ }, "ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "resolved": false, "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "needle": { "version": "2.2.3", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.3.tgz", + "resolved": false, "integrity": "sha512-GPL22d/U9cai87FcCPO6e+MT3vyHS2j+zwotakDc7kE2DtUAqFKMXLJCTtRp+5S75vXIwQPvIxkvlctxf9q4gQ==", "requires": { "debug": "^2.1.2", @@ -1932,7 +1933,7 @@ }, "node-pre-gyp": { "version": "0.11.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", + "resolved": false, "integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==", "requires": { "detect-libc": "^1.0.2", @@ -1949,7 +1950,7 @@ }, "nopt": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "resolved": false, "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "requires": { "abbrev": "1", @@ -1958,12 +1959,12 @@ }, "npm-bundled": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.5.tgz", + "resolved": false, "integrity": "sha512-m/e6jgWu8/v5niCUKQi9qQl8QdeEduFA96xHDDzFGqly0OOjI7c+60KM/2sppfnUU9JJagf+zs+yGhqSOFj71g==" }, "npm-packlist": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.11.tgz", + "resolved": false, "integrity": "sha512-CxKlZ24urLkJk+9kCm48RTQ7L4hsmgSVzEk0TLGPzzyuFxD7VNgy5Sl24tOLMzQv773a/NeJ1ce1DKeacqffEA==", "requires": { "ignore-walk": "^3.0.1", @@ -1972,7 +1973,7 @@ }, "npmlog": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "resolved": false, "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "requires": { "are-we-there-yet": "~1.1.2", @@ -1983,17 +1984,17 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "resolved": false, "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "object-assign": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "resolved": false, "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, "once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "resolved": false, "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { "wrappy": "1" @@ -2001,17 +2002,17 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": false, "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": false, "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "osenv": { "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "resolved": false, "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "requires": { "os-homedir": "^1.0.0", @@ -2020,17 +2021,17 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": false, "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "process-nextick-args": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "resolved": false, "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, "rc": { "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "resolved": false, "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "requires": { "deep-extend": "^0.6.0", @@ -2041,14 +2042,14 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": false, "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } }, "readable-stream": { "version": "2.3.5", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", + "resolved": false, "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", "requires": { "core-util-is": "~1.0.0", @@ -2062,7 +2063,7 @@ }, "rimraf": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "resolved": false, "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "requires": { "glob": "^7.0.5" @@ -2070,37 +2071,37 @@ }, "safe-buffer": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "resolved": false, "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "safer-buffer": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "resolved": false, "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sax": { "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "resolved": false, "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "semver": { "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "resolved": false, "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==" }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "resolved": false, "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "signal-exit": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "resolved": false, "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "requires": { "code-point-at": "^1.0.0", @@ -2110,7 +2111,7 @@ }, "string_decoder": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "resolved": false, "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "requires": { "safe-buffer": "~5.1.0" @@ -2118,7 +2119,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": false, "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -2126,12 +2127,12 @@ }, "strip-json-comments": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "resolved": false, "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "tar": { "version": "4.4.6", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.6.tgz", + "resolved": false, "integrity": "sha512-tMkTnh9EdzxyfW+6GK6fCahagXsnYk6kE6S9Gr9pjVdys769+laCTbodXDhPAjzVtEBazRgP0gYqOjnk9dQzLg==", "requires": { "chownr": "^1.0.1", @@ -2145,24 +2146,24 @@ "dependencies": { "safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "resolved": false, "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "yallist": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", + "resolved": false, "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" } } }, "util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "resolved": false, "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "wide-align": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "resolved": false, "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "requires": { "string-width": "^1.0.2 || 2" @@ -2170,7 +2171,7 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "resolved": false, "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" } } @@ -2303,7 +2304,7 @@ "dependencies": { "callsites": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", "dev": true } @@ -4210,33 +4211,11 @@ "mime-types": "^2.1.12" } }, - "form-data-to-object": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/form-data-to-object/-/form-data-to-object-0.2.0.tgz", - "integrity": "sha1-96jmjd2RChEApl4lrGpIQUP/gWg=" - }, "formidable": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.1.1.tgz", "integrity": "sha1-lriIb3w8NQi5Mta9cMTTqI818ak=" }, - "formsy-react": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/formsy-react/-/formsy-react-0.19.5.tgz", - "integrity": "sha1-dgpXrAETRC499MMJw2ON2SlX544=", - "requires": { - "form-data-to-object": "^0.2.0" - } - }, - "formsy-react-components": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/formsy-react-components/-/formsy-react-components-0.11.1.tgz", - "integrity": "sha1-ucMGytfeQR92UaVsd1XY9Oabm5M=", - "requires": { - "classnames": "^2.1.3", - "prop-types": "^15.5.7" - } - }, "forwarded": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", @@ -6189,7 +6168,8 @@ "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "optional": true }, "loose-envify": { "version": "1.3.1", @@ -6281,6 +6261,7 @@ "process": "^0.11.9", "punycode": "^1.4.1", "querystring-es3": "^0.2.1", + "readable-stream": "git+https://github.com/meteor/readable-stream.git", "stream-browserify": "^2.0.1", "string_decoder": "^1.0.1", "timers-browserify": "^1.4.2", @@ -6727,9 +6708,8 @@ "integrity": "sha1-Z0yZdgkBw8QRJ3GjHlIdw0nMCew=" }, "readable-stream": { - "version": "2.3.5", - "resolved": "git+https://github.com/meteor/readable-stream.git#c688cdd193549919b840e8d72a86682d91961e12", - "integrity": "sha1-DWdWLP2rIgoAJdLIHaDOofyUlao=", + "version": "git+https://github.com/meteor/readable-stream.git#c688cdd193549919b840e8d72a86682d91961e12", + "from": "git+https://github.com/meteor/readable-stream.git", "requires": { "inherits": "~2.0.3", "isarray": "~1.0.0", @@ -6737,26 +6717,6 @@ "safe-buffer": "~5.1.1", "string_decoder": "~1.1.0", "util-deprecate": "~1.0.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } } }, "rimraf": { @@ -6839,6 +6799,11 @@ "inherits": "2.0.1" } }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", diff --git a/packages/vulcan-accounts/package.js b/packages/vulcan-accounts/package.js index fcd33a713..0ef56306e 100755 --- a/packages/vulcan-accounts/package.js +++ b/packages/vulcan-accounts/package.js @@ -8,7 +8,7 @@ Package.describe({ Package.onUse(function(api) { api.versionsFrom('1.6.1'); - + api.use('vulcan:core@1.12.16'); api.use('ecmascript'); diff --git a/packages/vulcan-admin/package.js b/packages/vulcan-admin/package.js index b4de92806..32f26353f 100644 --- a/packages/vulcan-admin/package.js +++ b/packages/vulcan-admin/package.js @@ -2,7 +2,7 @@ Package.describe({ name: 'vulcan:admin', summary: 'Vulcan components package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { @@ -13,7 +13,6 @@ Package.onUse(function(api) { 'dynamic-import@0.1.1', // Vulcan packages 'vulcan:core@1.12.16', - ]); api.mainModule('lib/server/main.js', 'server'); diff --git a/packages/vulcan-cloudinary/package.js b/packages/vulcan-cloudinary/package.js index 8db886b2a..f493ca45a 100644 --- a/packages/vulcan-cloudinary/package.js +++ b/packages/vulcan-cloudinary/package.js @@ -2,15 +2,13 @@ Package.describe({ name: 'vulcan:cloudinary', summary: 'Vulcan file upload package.', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16' - ]); + api.use(['vulcan:core@1.12.16']); api.mainModule('lib/client/main.js', 'client'); api.mainModule('lib/server/main.js', 'server'); diff --git a/packages/vulcan-core/lib/modules/components/Card.jsx b/packages/vulcan-core/lib/modules/components/Card.jsx index 5999b3b3f..adedebb4f 100644 --- a/packages/vulcan-core/lib/modules/components/Card.jsx +++ b/packages/vulcan-core/lib/modules/components/Card.jsx @@ -8,12 +8,7 @@ import { Link } from 'react-router-dom'; const getLabel = (field, fieldName, collection, intl) => { const schema = collection && collection.simpleSchema()._schema; - const fieldSchema = schema && schema[fieldName]; - if (fieldSchema) { - return intl.formatMessage({ id: `${collection._name}.${fieldName}`, defaultMessage: fieldSchema.label }); - } else { - return fieldName; - } + return intl.formatLabel({ fieldName: fieldName, collectionName: collection._name, schema: schema }); }; const getTypeName = (field, fieldName, collection) => { diff --git a/packages/vulcan-core/lib/modules/components/Datatable.jsx b/packages/vulcan-core/lib/modules/components/Datatable.jsx index 2df6c2656..2e2b2d789 100644 --- a/packages/vulcan-core/lib/modules/components/Datatable.jsx +++ b/packages/vulcan-core/lib/modules/components/Datatable.jsx @@ -1,4 +1,4 @@ -import { registerComponent, getCollection, Utils } from 'meteor/vulcan:lib'; +import { registerComponent, getCollection } from 'meteor/vulcan:lib'; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import withCurrentUser from '../containers/withCurrentUser.js'; @@ -194,13 +194,12 @@ const DatatableHeader = ({ collection, column, toggleSort, currentSort, Componen use either: - 1. the column name translation + 1. the column name translation : collectionName.columnName, global.columnName, columnName 2. the column name label in the schema (if the column name matches a schema field) 3. the raw column name. */ - const defaultMessage = schema[columnName] ? schema[columnName].label : Utils.camelToSpaces(columnName); - const formattedLabel = intl.formatMessage({ id: `${collection._name}.${columnName}`, defaultMessage }); + const formattedLabel = intl.formatLabel({fieldName: columnName, collectionName: collection._name, schema: schema}); // if sortable is a string, use it as the name of the property to sort by. If it's just `true`, use column.name const sortPropertyName = typeof column.sortable === 'string' ? column.sortable : column.name; @@ -461,4 +460,3 @@ const DatatableDefaultCell = ({ column, document }) =>
{typeof column === 'string' ? getFieldValue(document[column]) : getFieldValue(document[column.name])}
; registerComponent('DatatableDefaultCell', DatatableDefaultCell); - diff --git a/packages/vulcan-core/package.js b/packages/vulcan-core/package.js index c96f8edbb..9add07e9a 100644 --- a/packages/vulcan-core/package.js +++ b/packages/vulcan-core/package.js @@ -2,7 +2,7 @@ Package.describe({ name: 'vulcan:core', summary: 'Vulcan core package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { @@ -13,7 +13,7 @@ Package.onUse(function(api) { 'vulcan:i18n@1.12.16', 'vulcan:users@1.12.16', 'vulcan:routing@1.12.16', - 'vulcan:debug@1.12.16' + 'vulcan:debug@1.12.16', ]); api.imply(['vulcan:lib@1.12.16']); diff --git a/packages/vulcan-debug/package.js b/packages/vulcan-debug/package.js index bae29cac8..e654d1011 100644 --- a/packages/vulcan-debug/package.js +++ b/packages/vulcan-debug/package.js @@ -17,7 +17,6 @@ Package.onUse(function(api) { 'vulcan:lib@1.12.16', 'vulcan:email@1.12.16', - ]); api.addFiles(['lib/stylesheets/debug.scss'], ['client']); diff --git a/packages/vulcan-email/package.js b/packages/vulcan-email/package.js index d1629a5e5..6bf9643d1 100644 --- a/packages/vulcan-email/package.js +++ b/packages/vulcan-email/package.js @@ -2,15 +2,13 @@ Package.describe({ name: 'vulcan:email', summary: 'Vulcan email package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:lib@1.12.16' - ]); + api.use(['vulcan:lib@1.12.16']); api.mainModule('lib/server.js', 'server'); api.mainModule('lib/client.js', 'client'); diff --git a/packages/vulcan-embed/package.js b/packages/vulcan-embed/package.js index 512d0c2c2..43e981864 100644 --- a/packages/vulcan-embed/package.js +++ b/packages/vulcan-embed/package.js @@ -2,18 +2,13 @@ Package.describe({ name: 'vulcan:embed', summary: 'Vulcan Embed package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'http', - 'vulcan:core@1.12.16', - 'fourseven:scss@4.10.0' - ]); - + api.use(['http', 'vulcan:core@1.12.16', 'fourseven:scss@4.10.0']); api.addFiles(['lib/stylesheets/embedly.scss'], ['client']); diff --git a/packages/vulcan-errors-sentry/package.js b/packages/vulcan-errors-sentry/package.js index f665ed91a..ff3601fd6 100755 --- a/packages/vulcan-errors-sentry/package.js +++ b/packages/vulcan-errors-sentry/package.js @@ -2,19 +2,14 @@ Package.describe({ name: 'vulcan:errors-sentry', summary: 'Vulcan Sentry error tracking package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - - api.use([ - 'ecmascript', - 'vulcan:core@1.12.16', - 'vulcan:users@1.12.16', - 'vulcan:errors@1.12.16', - ]); - + + api.use(['ecmascript', 'vulcan:core@1.12.16', 'vulcan:users@1.12.16', 'vulcan:errors@1.12.16']); + api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); }); diff --git a/packages/vulcan-errors/package.js b/packages/vulcan-errors/package.js index 73aa266e8..7e4d4c64d 100644 --- a/packages/vulcan-errors/package.js +++ b/packages/vulcan-errors/package.js @@ -2,16 +2,13 @@ Package.describe({ name: 'vulcan:errors', summary: 'Vulcan error tracking package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - - api.use([ - 'ecmascript', - 'vulcan:core@1.12.16', - ]); + + api.use(['ecmascript', 'vulcan:core@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-events-ga/package.js b/packages/vulcan-events-ga/package.js index c5a5b2229..0c10c324b 100644 --- a/packages/vulcan-events-ga/package.js +++ b/packages/vulcan-events-ga/package.js @@ -2,16 +2,13 @@ Package.describe({ name: 'vulcan:events-ga', summary: 'Vulcan Google Analytics event tracking package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - - api.use([ - 'vulcan:core@1.12.16', - 'vulcan:events@1.12.16', - ]); + + api.use(['vulcan:core@1.12.16', 'vulcan:events@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-events-intercom/package.js b/packages/vulcan-events-intercom/package.js index fde01a6e3..c3d2488d7 100644 --- a/packages/vulcan-events-intercom/package.js +++ b/packages/vulcan-events-intercom/package.js @@ -2,16 +2,13 @@ Package.describe({ name: 'vulcan:events-intercom', summary: 'Vulcan Intercom integration package.', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16', - 'vulcan:events@1.12.16' - ]); + api.use(['vulcan:core@1.12.16', 'vulcan:events@1.12.16']); api.mainModule('lib/client/main.js', 'client'); api.mainModule('lib/server/main.js', 'server'); diff --git a/packages/vulcan-events-internal/package.js b/packages/vulcan-events-internal/package.js index 69ed9959b..1354b9de7 100644 --- a/packages/vulcan-events-internal/package.js +++ b/packages/vulcan-events-internal/package.js @@ -2,16 +2,13 @@ Package.describe({ name: 'vulcan:events-internal', summary: 'Vulcan internal event tracking package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - - api.use([ - 'vulcan:core@1.12.16', - 'vulcan:events@1.12.16', - ]); + + api.use(['vulcan:core@1.12.16', 'vulcan:events@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-events-segment/package.js b/packages/vulcan-events-segment/package.js index 57aea64cf..bb993be59 100644 --- a/packages/vulcan-events-segment/package.js +++ b/packages/vulcan-events-segment/package.js @@ -2,16 +2,13 @@ Package.describe({ name: 'vulcan:events-segment', summary: 'Vulcan Segment', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16', - 'vulcan:events@1.12.16', - ]); + api.use(['vulcan:core@1.12.16', 'vulcan:events@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-events/package.js b/packages/vulcan-events/package.js index a1ccecf91..f59d943a0 100644 --- a/packages/vulcan-events/package.js +++ b/packages/vulcan-events/package.js @@ -2,15 +2,13 @@ Package.describe({ name: 'vulcan:events', summary: 'Vulcan event tracking package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - - api.use([ - 'vulcan:core@1.12.16', - ]); + + api.use(['vulcan:core@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-forms-tags/package.js b/packages/vulcan-forms-tags/package.js index ef20ac33d..cbd5067b9 100644 --- a/packages/vulcan-forms-tags/package.js +++ b/packages/vulcan-forms-tags/package.js @@ -2,16 +2,13 @@ Package.describe({ name: 'vulcan:forms-tags', summary: 'Vulcan tag input package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16', - 'vulcan:forms@1.12.16' - ]); + api.use(['vulcan:core@1.12.16', 'vulcan:forms@1.12.16']); api.mainModule('lib/export.js', ['client', 'server']); }); diff --git a/packages/vulcan-forms-upload/package.js b/packages/vulcan-forms-upload/package.js index 68ad63001..e53849775 100755 --- a/packages/vulcan-forms-upload/package.js +++ b/packages/vulcan-forms-upload/package.js @@ -2,17 +2,13 @@ Package.describe({ name: 'vulcan:forms-upload', summary: 'Vulcan package extending vulcan:forms to upload images to Cloudinary from a drop zone.', version: '1.12.16', - git: 'https://github.com/xavcz/nova-forms-upload.git' + git: 'https://github.com/xavcz/nova-forms-upload.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16', - 'vulcan:forms@1.12.16', - 'fourseven:scss@4.10.0' - ]); + api.use(['vulcan:core@1.12.16', 'vulcan:forms@1.12.16', 'fourseven:scss@4.10.0']); api.addFiles(['lib/Upload.scss'], 'client'); diff --git a/packages/vulcan-forms/lib/components/Form.jsx b/packages/vulcan-forms/lib/components/Form.jsx index 6989c5d8f..286cbb1c5 100644 --- a/packages/vulcan-forms/lib/components/Form.jsx +++ b/packages/vulcan-forms/lib/components/Form.jsx @@ -517,26 +517,15 @@ class SmartForm extends Component { */ getLabel = (fieldName, fieldLocale) => { const collectionName = this.props.collectionName.toLowerCase(); - const defaultMessage = '|*|*|'; - let id = `${collectionName}.${fieldName}`; - let intlLabel; - intlLabel = this.context.intl.formatMessage({ id, defaultMessage }); - if (intlLabel === defaultMessage) { - id = `global.${fieldName}`; - intlLabel = this.context.intl.formatMessage({ id }); - if (intlLabel === defaultMessage) { - id = fieldName; - intlLabel = this.context.intl.formatMessage({ id }); - } - } - const schemaLabel = - this.state.flatSchema[fieldName] && - this.state.flatSchema[fieldName].label; - const label = intlLabel || schemaLabel || fieldName; + const label = this.context.intl.formatLabel({ + fieldName: fieldName, + collectionName: collectionName, + schema: this.state.flatSchema, + }); if (fieldLocale) { const intlFieldLocale = this.context.intl.formatMessage({ id: `locales.${fieldLocale}`, - defaultMessage: fieldLocale + defaultMessage: fieldLocale, }); return `${label} (${intlFieldLocale})`; } else { diff --git a/packages/vulcan-forms/package.js b/packages/vulcan-forms/package.js index d8f00398e..f0c48b1b9 100644 --- a/packages/vulcan-forms/package.js +++ b/packages/vulcan-forms/package.js @@ -2,7 +2,7 @@ Package.describe({ name: 'vulcan:forms', summary: 'Form containers for React', version: '1.12.16', - git: 'https://github.com/meteor-utilities/react-form-containers.git' + git: 'https://github.com/meteor-utilities/react-form-containers.git', }); Package.onUse(function(api) { diff --git a/packages/vulcan-forms/test/components.test.js b/packages/vulcan-forms/test/components.test.js index cef0c17ba..13727bead 100644 --- a/packages/vulcan-forms/test/components.test.js +++ b/packages/vulcan-forms/test/components.test.js @@ -22,39 +22,39 @@ import SimpleSchema from 'simpl-schema'; const addressGroup = { name: 'addresses', label: 'Addresses', - order: 10 + order: 10, }; const permissions = { canRead: ['guests'], canUpdate: ['quests'], - canCreate: ['guests'] + canCreate: ['guests'], }; // just 1 input for state testing const fooSchema = { foo: { type: String, - ...permissions - } + ...permissions, + }, }; // const addressSchema = { street: { type: String, optional: true, - ...permissions - } + ...permissions, + }, }; // [{street, city,...}, {street, city, ...}] const arrayOfObjectSchema = { addresses: { type: Array, group: addressGroup, - ...permissions + ...permissions, }, 'addresses.$': { - type: new SimpleSchema(addressSchema) - } + type: new SimpleSchema(addressSchema), + }, }; // example with custom inputs for the children // ["http://maps/XYZ", "http://maps/foobar"] @@ -62,12 +62,12 @@ const arrayOfUrlSchema = { addresses: { type: Array, group: addressGroup, - ...permissions + ...permissions, }, 'addresses.$': { type: String, - input: 'url' - } + input: 'url', + }, }; // example with array and custom input const CustomObjectInput = () => 'OBJECT INPUT'; @@ -75,12 +75,12 @@ const arrayOfCustomObjectSchema = { addresses: { type: Array, group: addressGroup, - ...permissions + ...permissions, }, 'addresses.$': { type: new SimpleSchema(addressSchema), - input: CustomObjectInput - } + input: CustomObjectInput, + }, }; // example with a fully custom input for both the array and its children const ArrayInput = () => 'ARRAY INPUT'; @@ -89,12 +89,12 @@ const arrayFullCustomSchema = { type: Array, group: addressGroup, ...permissions, - input: ArrayInput + input: ArrayInput, }, 'addresses.$': { type: String, - input: 'url' - } + input: 'url', + }, }; // example with a native type // ["20 rue du Moulin PARIS", "16 rue de la poste PARIS"] @@ -104,26 +104,26 @@ const arrayOfStringSchema = { addresses: { type: Array, group: addressGroup, - ...permissions + ...permissions, }, 'addresses.$': { - type: String - } + type: String, + }, }; // object (not in an array): {street, city} const objectSchema = { addresses: { type: new SimpleSchema(addressSchema), - ...permissions - } + ...permissions, + }, }; // without calling SimpleSchema // eslint-disable-next-line no-unused-vars const bareObjectSchema = { addresses: { type: addressSchema, - ...permissions - } + ...permissions, + }, }; // stub collection @@ -134,13 +134,16 @@ const createDummyCollection = (typeName, schema) => typeName, schema, resolvers: getDefaultResolvers(typeName + 's'), - mutations: getDefaultMutations(typeName + 's') + mutations: getDefaultMutations(typeName + 's'), }); const Foos = createDummyCollection('Foo', fooSchema); const ArrayOfObjects = createDummyCollection('ArrayOfObject', arrayOfObjectSchema); const Objects = createDummyCollection('Object', objectSchema); const ArrayOfUrls = createDummyCollection('ArrayOfUrl', arrayOfUrlSchema); -const ArrayOfCustomObjects = createDummyCollection('ArrayOfCustomObject', arrayOfCustomObjectSchema); +const ArrayOfCustomObjects = createDummyCollection( + 'ArrayOfCustomObject', + arrayOfCustomObjectSchema +); const ArrayFullCustom = createDummyCollection('ArrayFullCustom', arrayFullCustomSchema); // eslint-disable-next-line no-unused-vars const ArrayOfStrings = createDummyCollection('ArrayOfString', arrayOfStringSchema); @@ -150,7 +153,7 @@ const Addresses = createCollection({ typeName: 'Address', schema: addressSchema, resolvers: getDefaultResolvers('Addresses'), - mutations: getDefaultMutations('Addresses') + mutations: getDefaultMutations('Addresses'), }); // helpers @@ -158,6 +161,7 @@ const Addresses = createCollection({ describe('vulcan-forms/components', function() { const context = { intl: { + formatLabel: () => '', formatMessage: () => '', formatDate: () => '', formatTime: () => '', @@ -165,24 +169,24 @@ describe('vulcan-forms/components', function() { formatNumber: () => '', formatPlural: () => '', formatHTMLMessage: () => '', - now: () => '' - } + now: () => '', + }, }; // eslint-disable-next-line no-unused-vars const mountWithContext = C => mount(C, { - context + context, }); const shallowWithContext = C => shallow(C, { - context + context, }); describe('Form collectionName="" (handle fields computation)', function() { // since some props are now handled by HOC we need to provide them manually const defaultProps = { collectionName: '', - typeName: '' + typeName: '', }; describe('Form generation', function() { @@ -224,17 +228,23 @@ describe('vulcan-forms/components', function() { }); describe('array of objects', function() { it('shallow render', () => { - const wrapper = shallowWithContext(
); + const wrapper = shallowWithContext( + + ); expect(wrapper).toBeDefined(); }); it('render a FormGroup for addresses', function() { - const wrapper = shallowWithContext(); + const wrapper = shallowWithContext( + + ); const formGroup = wrapper.find('FormGroup').find({ name: 'addresses' }); expect(formGroup).toBeDefined(); expect(formGroup).toHaveLength(1); }); it('passes down the array child fields', function() { - const wrapper = shallowWithContext(); + const wrapper = shallowWithContext( + + ); const formGroup = getArrayFormGroup(wrapper); const fields = getFields(formGroup); const arrayField = fields[0]; @@ -257,12 +267,16 @@ describe('vulcan-forms/components', function() { }); describe('array of objects with custom children inputs', function() { it('shallow render', function() { - const wrapper = shallowWithContext(); + const wrapper = shallowWithContext( + + ); expect(wrapper).toBeDefined(); }); // TODO: does not work, schema_utils needs an update it.skip('passes down the custom input', function() { - const wrapper = shallowWithContext(); + const wrapper = shallowWithContext( + + ); const formGroup = getArrayFormGroup(wrapper); const fields = getFields(formGroup); const arrayField = fields[0]; @@ -271,11 +285,15 @@ describe('vulcan-forms/components', function() { }); describe('array with a fully custom input (array itself and children)', function() { it('shallow render', function() { - const wrapper = shallowWithContext(); + const wrapper = shallowWithContext( + + ); expect(wrapper).toBeDefined(); }); it('passes down the custom input', function() { - const wrapper = shallowWithContext(); + const wrapper = shallowWithContext( + + ); const formGroup = getArrayFormGroup(wrapper); const fields = getFields(formGroup); const arrayField = fields[0]; @@ -293,29 +311,38 @@ describe('vulcan-forms/components', function() { wrapper .find('input') .first() - .simulate('change', { target:{value:'bar'} }); + .simulate('change', { target: { value: 'bar' } }); // eslint-disable-next-line no-console - console.log(wrapper.find('input').first().html()); + console.log( + wrapper + .find('input') + .first() + .html() + ); // eslint-disable-next-line no-console console.log(wrapper.state()); - expect(wrapper.state().currentValues).toEqual({foo:'bar'}); + expect(wrapper.state().currentValues).toEqual({ foo: 'bar' }); }); it('reset state when relevant props change', function() { - const wrapper = shallowWithContext(); + const wrapper = shallowWithContext( + + ); wrapper.setState({ currentValues: { foo: 'bar' } }); - expect(wrapper.state('currentValues')).toEqual({foo:'bar'}); + expect(wrapper.state('currentValues')).toEqual({ foo: 'bar' }); wrapper.setProps({ collectionName: 'Bars' }); expect(wrapper.state('currentValues')).toEqual({}); }); - it('does not reset state when external prop change', function(){ + it('does not reset state when external prop change', function() { //const prefilledProps = { bar: 'foo' } // TODO - const changeCallback= () => 'CHANGE'; - const wrapper = shallowWithContext(); + const changeCallback = () => 'CHANGE'; + const wrapper = shallowWithContext( + + ); wrapper.setState({ currentValues: { foo: 'bar' } }); - expect(wrapper.state('currentValues')).toEqual({foo:'bar'}); + expect(wrapper.state('currentValues')).toEqual({ foo: 'bar' }); const newChangeCallback = () => 'NEW'; wrapper.setProps({ changeCallback: newChangeCallback }); - expect(wrapper.state('currentValues')).toEqual({ foo:'bar'}); + expect(wrapper.state('currentValues')).toEqual({ foo: 'bar' }); }); }); }); @@ -324,8 +351,8 @@ describe('vulcan-forms/components', function() { const shallowWithContext = C => shallow(C, { context: { - getDocument: () => {} - } + getDocument: () => {}, + }, }); const defaultProps = { disabled: false, @@ -342,7 +369,7 @@ describe('vulcan-forms/components', function() { throwError: () => {}, updateCurrentValues: () => {}, errors: [], - clearFieldErrors: () => {} + clearFieldErrors: () => {}, }; it('shallow render', function() { const wrapper = shallowWithContext(); @@ -355,11 +382,11 @@ describe('vulcan-forms/components', function() { nestedSchema: { street: {}, country: {}, - zipCode: {} + zipCode: {}, }, nestedInput: true, nestedFields: [{}, {}, {}], - currentValues: {} + currentValues: {}, }; it('render a FormNestedArray', function() { const wrapper = shallowWithContext(); @@ -374,11 +401,11 @@ describe('vulcan-forms/components', function() { nestedSchema: { street: {}, country: {}, - zipCode: {} + zipCode: {}, }, nestedInput: true, nestedFields: [{}, {}, {}], - currentValues: {} + currentValues: {}, }; it('shallow render', function() { const wrapper = shallowWithContext(); @@ -403,7 +430,7 @@ describe('vulcan-forms/components', function() { formComponents: Components, //nestedFields: [] }; - + describe('Display the input n times', function() { it('shallow render', function() { const wrapper = shallow(); @@ -416,12 +443,16 @@ describe('vulcan-forms/components', function() { expect(addButton).toHaveLength(1); }); it.skip('shows 3 items', function() { - const wrapper = mount(); + const wrapper = mount( + + ); const nestedItem = wrapper.find('FormNestedItem'); expect(nestedItem).toHaveLength(3); }); it.skip('pass the correct path and itemIndex to each form', function() { - const wrapper = mount(); + const wrapper = mount( + + ); const nestedItem = wrapper.find('FormNestedItem'); const item0 = nestedItem.at(0); const item1 = nestedItem.at(1); @@ -434,28 +465,30 @@ describe('vulcan-forms/components', function() { describe('maxCount', function() { const props = { ...defaultProps, - maxCount: 2 - } - it('should display add button if items < maxCount', function(){ + maxCount: 2, + }; + it('should display add button if items < maxCount', function() { const wrapper = shallow(); const layout = wrapper.find('FormNestedArrayLayout').first(); const formFooter = !!layout.prop('content')[1]; expect(formFooter).toEqual(true); }); - it('should not display add button if items >= maxCount', function(){ + it('should not display add button if items >= maxCount', function() { const wrapper = shallow(); const layout = wrapper.find('FormNestedArrayLayout').first(); const formFooter = !!layout.prop('content')[1]; expect(formFooter).toEqual(false); }); }); - describe('minCount', function(){ + describe('minCount', function() { const props = { ...defaultProps, - minCount: 2 - } + minCount: 2, + }; it('should display remove item button when array length > minCount', function() { - const wrapper = shallow(); + const wrapper = shallow( + + ); const layout = wrapper.find('FormNestedArrayLayout').first(); const formNestedItems = layout.prop('content')[0]; formNestedItems.forEach((formNestedItem, idx) => { @@ -482,7 +515,7 @@ describe('vulcan-forms/components', function() { const defaultProps = { errors: [], path: 'foobar', - formComponents: Components + formComponents: Components, }; it('shallow render', function() { const wrapper = shallow(); diff --git a/packages/vulcan-i18n-en-us/lib/en_US.js b/packages/vulcan-i18n-en-us/lib/en_US.js index 86a3c215a..1beef84ac 100644 --- a/packages/vulcan-i18n-en-us/lib/en_US.js +++ b/packages/vulcan-i18n-en-us/lib/en_US.js @@ -1,7 +1,6 @@ import { addStrings } from 'meteor/vulcan:core'; addStrings('en', { - 'accounts.error_incorrect_password': 'Incorrect password', 'accounts.error_email_required': 'Email required', 'accounts.error_email_already_exists': 'Email already exists', @@ -79,8 +78,8 @@ addStrings('en', { 'users.please_sign_up_log_in': 'Please sign up or log in', 'users.cannot_post': 'Sorry, you do not have permission to post at this time', 'users.cannot_comment': 'Sorry, you do not have permission to comment at this time', - 'users.subscribe': 'Subscribe to this user\'s posts', - 'users.unsubscribe': 'Unsubscribe to this user\'s posts', + 'users.subscribe': "Subscribe to this user's posts", + 'users.unsubscribe': "Unsubscribe to this user's posts", 'users.subscribed': 'You have subscribed to “{name}” posts.', 'users.unsubscribed': 'You have unsubscribed from “{name}” posts.', 'users.subscribers': 'Subscribers', @@ -88,8 +87,9 @@ addStrings('en', { 'users.delete_confirm': 'Delete this user?', 'users.email_already_taken': 'This email is already taken: {value}', - 'settings': 'Settings', - 'settings.json_message': 'Note: settings already provided in your settings.json file will be disabled.', + settings: 'Settings', + 'settings.json_message': + 'Note: settings already provided in your settings.json file will be disabled.', 'settings.edit': 'Edit Settings', 'settings.edited': 'Settings edited (please reload).', 'settings.title': 'Title', @@ -120,31 +120,35 @@ addStrings('en', { 'settings.scoreUpdateInterval': 'Score Update Interval', 'app.loading': 'Loading…', - 'app.404': 'Sorry, we couldn\'t find what you were looking for.', - 'app.missing_document': 'Sorry, we couldn\'t find the document you were looking for.', + 'app.404': "Sorry, we couldn't find what you were looking for.", + 'app.missing_document': "Sorry, we couldn't find the document you were looking for.", 'app.powered_by': 'Built with Vulcan.js', 'app.or': 'Or', 'app.noPermission': 'Sorry, you do not have the permission to do this at this time.', - 'app.operation_not_allowed': 'Sorry, you don\'t have the rights to perform the operation "{value}"', + 'app.operation_not_allowed': + 'Sorry, you don\'t have the rights to perform the operation "{value}"', 'app.document_not_found': 'Document not found (id: {value})', 'app.disallowed_property_detected': 'Disallowed property detected: {value}', 'app.something_bad_happened': 'Something bad happened...', - 'app.embedly_not_authorized': 'Invalid Embedly API key provided in the settings file. To find your key, log into https://app.embed.ly -> API', + 'app.embedly_not_authorized': + 'Invalid Embedly API key provided in the settings file. To find your key, log into https://app.embed.ly -> API', 'cards.edit': 'Edit', 'datatable.new': 'New', 'datatable.edit': 'Edit', 'datatable.search': 'Search', - 'admin': 'Admin', - 'notifications': 'Notifications', + admin: 'Admin', + notifications: 'Notifications', - 'errors.expectedType': 'Expected type {dataType} for field “{label}”, received “{value}” instead.', + 'errors.expectedType': + 'Expected type {dataType} for field “{label}”, received “{value}” instead.', 'errors.required': 'Field “{label}” is required.', 'errors.minString': 'Field “{label}” needs to have at least {min} characters', 'errors.maxString': 'Field “{label}” is limited to {max} characters.', 'errors.generic': 'Sorry, something went wrong: {errorMessage}.', - 'errors.generic_report': 'Sorry, something went wrong: {errorMessage}.
An error report has been generated.', + 'errors.generic_report': + 'Sorry, something went wrong: {errorMessage}.
An error report has been generated.', 'errors.minNumber': 'Field “{label}” must be higher than {min}. ', 'errors.maxNumber': 'Field “{label}” must be lower than {max}. ', 'errors.minCount': 'There needs to be at least {count} in field “{label}”.', @@ -156,6 +160,5 @@ addStrings('en', { //TODO other simple schema errors 'errors.minNumberExclusive': '', 'errors.maxNumberExclusive': '', - 'errors.keyNotInSchema': '' - -}); \ No newline at end of file + 'errors.keyNotInSchema': '', +}); diff --git a/packages/vulcan-i18n-en-us/package.js b/packages/vulcan-i18n-en-us/package.js index 597b8daa7..76e473045 100644 --- a/packages/vulcan-i18n-en-us/package.js +++ b/packages/vulcan-i18n-en-us/package.js @@ -2,15 +2,13 @@ Package.describe({ name: 'vulcan:i18n-en-us', summary: 'Vulcan i18n package (en_US)', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16' - ]); + api.use(['vulcan:core@1.12.16']); api.addFiles(['lib/en_US.js'], ['client', 'server']); }); diff --git a/packages/vulcan-i18n-es-es/package.js b/packages/vulcan-i18n-es-es/package.js index 83b344c9f..ead14e095 100644 --- a/packages/vulcan-i18n-es-es/package.js +++ b/packages/vulcan-i18n-es-es/package.js @@ -2,15 +2,13 @@ Package.describe({ name: 'vulcan:i18n-es-es', summary: 'Vulcan i18n package (es_ES)', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16' - ]); + api.use(['vulcan:core@1.12.16']); api.addFiles(['lib/es_ES.js'], ['client', 'server']); }); diff --git a/packages/vulcan-i18n-fr-fr/package.js b/packages/vulcan-i18n-fr-fr/package.js index b3e6b9c9f..32314ad1d 100644 --- a/packages/vulcan-i18n-fr-fr/package.js +++ b/packages/vulcan-i18n-fr-fr/package.js @@ -2,15 +2,13 @@ Package.describe({ name: 'vulcan:i18n-fr-fr', summary: 'Vulcan i18n package (fr_FR)', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16' - ]); + api.use(['vulcan:core@1.12.16']); api.addFiles(['lib/fr_FR.js'], ['client', 'server']); }); diff --git a/packages/vulcan-i18n/lib/modules/provider.js b/packages/vulcan-i18n/lib/modules/provider.js index ed132aad0..34fb91f13 100644 --- a/packages/vulcan-i18n/lib/modules/provider.js +++ b/packages/vulcan-i18n/lib/modules/provider.js @@ -1,16 +1,56 @@ import React, { Component } from 'react'; -import { getString } from 'meteor/vulcan:lib'; +import { getString, Utils } from 'meteor/vulcan:lib'; import { intlShape } from './shape.js'; -export default class IntlProvider extends Component{ - +export default class IntlProvider extends Component { formatMessage = ({ id, defaultMessage }, values) => { return getString({ id, defaultMessage, values, locale: this.props.locale }); - } + }; - formatStuff = (something) => { + /** + * formatLabel - Get a label for a field, for a given collection, in the current language. The evaluation is as follows : i18n(collectionName.fieldName) > i18n(global.fieldName) > i18n(fieldName) > schema.fieldName.label > fieldName + * + * @param {object} params + * @param {string} params.fieldName The name of the field to evaluate (required) + * @param {string} params.collectionName The name of the collection the field belongs to + * @param {object} params.schema The schema of the collection + * @param {object} values The values to pass to format the i18n string + * @return {string} The translated label + */ + + formatLabel = ({ fieldName, collectionName, schema }, values) => { + if (!fieldName) { + throw new Error('fieldName option passed to formatLabel cannot be empty or undefined'); + } + const defaultMessage = '|*|*|'; + // Get the intl label + let intlLabel = defaultMessage; + // try collectionName.fieldName as intl id + if (collectionName) { + intlLabel = this.formatMessage( + { id: `${collectionName.toLowerCase()}.${fieldName}`, defaultMessage }, + values + ); + } + // try global.fieldName then just fieldName as intl id + if (intlLabel === defaultMessage) { + intlLabel = this.formatMessage({ id: `global.${fieldName}`, defaultMessage }, values); + if (intlLabel === defaultMessage) { + intlLabel = this.formatMessage({ id: fieldName }, values); + } + } + if (intlLabel) { + return intlLabel; + } + + // define the schemaLabel. If the schema has been initialized with SimpleSchema, the label should be here even if it has not been declared https://github.com/aldeed/simple-schema-js#label + let schemaLabel = schema && schema[fieldName] ? schema[fieldName].label : null; + return schemaLabel || Utils.camelToSpaces(fieldName); + }; + + formatStuff = something => { return something; - } + }; getChildContext() { return { @@ -19,20 +59,20 @@ export default class IntlProvider extends Component{ formatTime: this.formatStuff, formatRelative: this.formatStuff, formatNumber: this.formatStuff, - formatPlural: this.formatStuff, + formatPlural: this.formatStuff, formatMessage: this.formatMessage, + formatLabel: this.formatLabel, formatHTMLMessage: this.formatStuff, now: this.formatStuff, - } + }, }; } - - render(){ + + render() { return this.props.children; } - } IntlProvider.childContextTypes = { - intl: intlShape + intl: intlShape, }; diff --git a/packages/vulcan-i18n/lib/modules/shape.js b/packages/vulcan-i18n/lib/modules/shape.js index 46ef87da0..007b7f512 100644 --- a/packages/vulcan-i18n/lib/modules/shape.js +++ b/packages/vulcan-i18n/lib/modules/shape.js @@ -1,34 +1,35 @@ /* -* Copyright 2015, Yahoo Inc. -* Copyrights licensed under the New BSD License. -* See the accompanying LICENSE file for terms. -*/ + * Copyright 2015, Yahoo Inc. + * Copyrights licensed under the New BSD License. + * See the accompanying LICENSE file for terms. + */ import PropTypes from 'prop-types'; -const {bool, number, string, func, object, oneOf, shape, any} = PropTypes; +const { bool, number, string, func, object, oneOf, shape, any } = PropTypes; const localeMatcher = oneOf(['best fit', 'lookup']); const narrowShortLong = oneOf(['narrow', 'short', 'long']); const numeric2digit = oneOf(['numeric', '2-digit']); const funcReq = func.isRequired; export const intlConfigPropTypes = { - locale : string, - formats : object, - messages : object, + locale: string, + formats: object, + messages: object, textComponent: any, - defaultLocale : string, + defaultLocale: string, defaultFormats: object, }; export const intlFormatPropTypes = { - formatDate : funcReq, - formatTime : funcReq, - formatRelative : funcReq, - formatNumber : funcReq, - formatPlural : funcReq, - formatMessage : funcReq, + formatDate: funcReq, + formatTime: funcReq, + formatRelative: funcReq, + formatNumber: funcReq, + formatPlural: funcReq, + formatMessage: funcReq, + formatLabel: funcReq, formatHTMLMessage: funcReq, }; @@ -40,8 +41,8 @@ export const intlShape = shape({ }); export const messageDescriptorPropTypes = { - id : string.isRequired, - description : string, + id: string.isRequired, + description: string, defaultMessage: string, }; @@ -50,30 +51,30 @@ export const dateTimeFormatPropTypes = { formatMatcher: oneOf(['basic', 'best fit']), timeZone: string, - hour12 : bool, + hour12: bool, - weekday : narrowShortLong, - era : narrowShortLong, - year : numeric2digit, - month : oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']), - day : numeric2digit, - hour : numeric2digit, - minute : numeric2digit, - second : numeric2digit, + weekday: narrowShortLong, + era: narrowShortLong, + year: numeric2digit, + month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']), + day: numeric2digit, + hour: numeric2digit, + minute: numeric2digit, + second: numeric2digit, timeZoneName: oneOf(['short', 'long']), }; export const numberFormatPropTypes = { localeMatcher, - style : oneOf(['decimal', 'currency', 'percent']), - currency : string, + style: oneOf(['decimal', 'currency', 'percent']), + currency: string, currencyDisplay: oneOf(['symbol', 'code', 'name']), - useGrouping : bool, + useGrouping: bool, - minimumIntegerDigits : number, - minimumFractionDigits : number, - maximumFractionDigits : number, + minimumIntegerDigits: number, + minimumFractionDigits: number, + maximumFractionDigits: number, minimumSignificantDigits: number, maximumSignificantDigits: number, }; diff --git a/packages/vulcan-i18n/package.js b/packages/vulcan-i18n/package.js index cf5d53b13..597a51b0f 100644 --- a/packages/vulcan-i18n/package.js +++ b/packages/vulcan-i18n/package.js @@ -2,16 +2,19 @@ Package.describe({ name: 'vulcan:i18n', summary: 'i18n client polyfill', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan' + git: 'https://github.com/VulcanJS/Vulcan', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:lib@1.12.16', - ]); + api.use(['vulcan:lib@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); }); + +Package.onTest(function(api) { + api.use(['ecmascript', 'meteortesting:mocha', 'vulcan:test', 'vulcan:i18n']); + api.mainModule('./test/index.js'); +}); diff --git a/packages/vulcan-i18n/test/index.js b/packages/vulcan-i18n/test/index.js new file mode 100644 index 000000000..5c9b24d4c --- /dev/null +++ b/packages/vulcan-i18n/test/index.js @@ -0,0 +1 @@ +import './provider.test.js'; diff --git a/packages/vulcan-i18n/test/provider.test.js b/packages/vulcan-i18n/test/provider.test.js new file mode 100644 index 000000000..f786d959c --- /dev/null +++ b/packages/vulcan-i18n/test/provider.test.js @@ -0,0 +1,127 @@ +import IntlProvider from '../lib/modules/provider'; +import React from 'react'; +import expect from 'expect'; +import { shallow } from 'enzyme'; +import { addStrings, Utils } from 'meteor/vulcan:core'; + +// constants for formatMessage +const defaultMessage = 'default'; +const stringId = 'test_string'; +const ENTestString = 'English test string'; +const FRTestString = 'Phrase test en Français'; +const valueStringId = 'valueStringId'; +const valueStringValue = 'Vulcan'; +const valueTestStringStatic = 'the value is '; +const valueTestStringDynamic = 'testValue'; +const valueTestString = `${valueTestStringStatic}{${valueTestStringDynamic}}`; + +// constants for formatLabel +const fieldName = 'testFieldName'; +const fieldNameForSchema = 'fieldNameForSchema'; +const fieldNameForGlobal = 'testFieldNameGlobal'; +const fieldNameForCollection = 'testFieldNameCollection'; +const unknownFieldName = 'unknownFieldName'; +const collectionName = 'Tests'; +const labelFromCollection = 'label from collection'; +const labelFromGlobal = 'label from global'; +const labelFromSchema = 'label from schema'; +const labelFromFieldName = 'label from fieldName'; +// add the schema entries for all fields to test respect of the order too +const schema = { + [fieldName]: { + label: labelFromSchema, + }, + [fieldNameForSchema]: { + label: labelFromSchema, + }, + [fieldNameForGlobal]: { + label: labelFromSchema, + }, + [fieldNameForCollection]: { + label: labelFromSchema, + }, +}; +// add the strings for formatMessage +addStrings('en', { + [stringId]: ENTestString, + [valueStringId]: valueTestString, +}); +addStrings('fr', { + [stringId]: FRTestString, +}); + +// add the strings for formatLabel +addStrings('en', { + // fieldName only + [fieldName]: labelFromFieldName, + // fieldName + global - we expect labelFromGlobal + [fieldNameForGlobal]: labelFromFieldName, + [`global.${fieldNameForGlobal}`]: labelFromGlobal, + // fieldName + global + collectionName - we expect labelFromCollection + [fieldNameForCollection]: labelFromFieldName, + [`global.${fieldNameForCollection}`]: labelFromGlobal, + [`${collectionName.toLowerCase()}.${fieldNameForCollection}`]: labelFromCollection, +}); + +describe('vulcan:i18n/IntlProvider', function() { + it('shallow render', function() { + const wrapper = shallow(); + expect(wrapper).toBeDefined(); + }); + describe('formatMessage', function() { + it('format a message according to locale', function() { + const wrapper = shallow(); + const ENString = wrapper.instance().formatMessage({ id: stringId }); + expect(ENString).toEqual(ENTestString); + wrapper.setProps({ locale: 'fr' }); + const FRString = wrapper.instance().formatMessage({ id: stringId }); + expect(FRString).toEqual(FRTestString); + }); + it('format a message according to a value', function() { + const wrapper = shallow(); + const dynamicString = wrapper + .instance() + .formatMessage({ id: valueStringId }, { [valueTestStringDynamic]: valueStringValue }); + expect(dynamicString).toEqual(valueTestStringStatic + valueStringValue); + }); + it('return a default message when no string is found', function() { + const wrapper = shallow(); + const ENString = wrapper.instance().formatMessage({ + id: 'unknownStringId', + defaultMessage: defaultMessage, + }); + expect(ENString).toEqual(defaultMessage); + }); + }); + describe('formatLabel', function() { + const wrapper = shallow(); + it('return the fieldName when there is no matching string or label', function() { + const ENString = wrapper + .instance() + .formatLabel({ fieldName: unknownFieldName, schema, collectionName }); + expect(ENString).toEqual(Utils.camelToSpaces(unknownFieldName)); + }); + it('return the matching schema label when there is no matching string', function() { + const ENString = wrapper + .instance() + .formatLabel({ fieldName: fieldNameForSchema, schema, collectionName }); + expect(ENString).toEqual(schema[fieldName].label); + }); + it('return the label from a matched `fieldName`', function() { + const ENString = wrapper.instance().formatLabel({ fieldName, schema, collectionName }); + expect(ENString).toEqual(labelFromFieldName); + }); + it('return the label from a matched `global.fieldName`', function() { + const ENString = wrapper + .instance() + .formatLabel({ fieldName: fieldNameForGlobal, schema, collectionName }); + expect(ENString).toEqual(labelFromGlobal); + }); + it('return the label from a matched `collectionName.fieldName`', function() { + const ENString = wrapper + .instance() + .formatLabel({ fieldName: fieldNameForCollection, schema, collectionName }); + expect(ENString).toEqual(labelFromCollection); + }); + }); +}); diff --git a/packages/vulcan-lib/lib/modules/components.js b/packages/vulcan-lib/lib/modules/components.js index 35cd005fe..91c273816 100644 --- a/packages/vulcan-lib/lib/modules/components.js +++ b/packages/vulcan-lib/lib/modules/components.js @@ -42,9 +42,9 @@ export const coreComponents = [ * @param {...Function} hocs The HOCs to compose with the raw component. * * Note: when a component is registered without higher order component, `hocs` will be - * an empty array, and it's ok! + * an empty array, and it's ok! * See https://github.com/reactjs/redux/blob/master/src/compose.js#L13-L15 - * + * * @returns Structure of a component in the list: * * ComponentsTable.Foo = { @@ -112,10 +112,9 @@ export const populateComponentsApp = () => { // loop over each component in the list registeredComponents.map(name => { - // populate an entry in the lookup table Components[name] = getComponent(name); - + // uncomment for debug // console.log('init component:', name); }); @@ -124,9 +123,12 @@ export const populateComponentsApp = () => { if (missingComponents.length) { // eslint-disable-next-line no-console - console.warn(`Found the following missing core components: ${missingComponents.join(', ')}. Include a UI package such as vulcan:ui-bootstrap to add them.`); + console.warn( + `Found the following missing core components: ${missingComponents.join( + ', ' + )}. Include a UI package such as vulcan:ui-bootstrap to add them.` + ); } - }; /** @@ -136,12 +138,12 @@ export const populateComponentsApp = () => { * @param {String} name The name of the component to get. * @returns {Function|React Component} An interchangeable/extendable React component */ - export const getRawComponent = (name) => { +export const getRawComponent = name => { return ComponentsTable[name].rawComponent; }; /** - * Replace a Vulcan component with the same name with a new component or + * Replace a Vulcan component with the same name with a new component or * an extension of the raw component and one or more optional higher order components. * This function keeps track of the previous HOCs and wrap the new HOCs around previous ones * @@ -151,11 +153,10 @@ export const populateComponentsApp = () => { * @returns {Function|React Component} A component callable with Components[name] * * Note: when a component is registered without higher order component, `hocs` will be - * an empty array, and it's ok! + * an empty array, and it's ok! * See https://github.com/reactjs/redux/blob/master/src/compose.js#L13-L15 */ - export function replaceComponent(name, newComponent, ...newHocs) { - +export function replaceComponent(name, newComponent, ...newHocs) { // support single argument syntax if (typeof arguments[0] === 'object') { // eslint-disable-next-line no-redeclare @@ -165,20 +166,20 @@ export const populateComponentsApp = () => { } const previousComponent = ComponentsTable[name]; - const previousHocs = previousComponent && previousComponent.hocs || []; + const previousHocs = (previousComponent && previousComponent.hocs) || []; if (!previousComponent) { // eslint-disable-next-line no-console console.warn( `Trying to replace non-registered component ${name}. The component is ` + - 'being registered. If you were trying to replace a component defined by ' + - 'another package, make sure that you haven\'t misspelled the name. Check ' + - 'also if the original component is still being registered or that it ' + - 'hasn\'t been renamed.', + 'being registered. If you were trying to replace a component defined by ' + + "another package, make sure that you haven't misspelled the name. Check " + + 'also if the original component is still being registered or that it ' + + "hasn't been renamed." ); } - return registerComponent(name, newComponent, ...newHocs, ...previousHocs); + return registerComponent(name, newComponent, ...newHocs, ...previousHocs); } export const copyHoCs = (sourceComponent, targetComponent) => { @@ -196,10 +197,14 @@ export const instantiateComponent = (component, props) => { return null; } else if (typeof component === 'string') { const Component = getComponent(component); - return ; - } else if (typeof component === 'function' && component.prototype && component.prototype.isReactComponent) { + return ; + } else if ( + typeof component === 'function' && + component.prototype && + component.prototype.isReactComponent + ) { const Component = component; - return ; + return ; } else if (typeof component === 'function') { return component(props); } else { @@ -237,7 +242,6 @@ export const delayedComponent = name => { }; }; - // Example with Proxy (might be unstable/hard to reason about) //const mergeWithComponents = (myComponents = {}) => { // const handler = { @@ -248,4 +252,5 @@ export const delayedComponent = name => { // const proxy = new Proxy(myComponents, handler); // return proxy; //}; -export const mergeWithComponents = myComponents => (myComponents ? { ...Components, ...myComponents } : Components); +export const mergeWithComponents = myComponents => + myComponents ? { ...Components, ...myComponents } : Components; diff --git a/packages/vulcan-lib/lib/modules/dynamic_loader.js b/packages/vulcan-lib/lib/modules/dynamic_loader.js index 6ddc35640..d0b0cd620 100644 --- a/packages/vulcan-lib/lib/modules/dynamic_loader.js +++ b/packages/vulcan-lib/lib/modules/dynamic_loader.js @@ -29,13 +29,12 @@ import { delayedComponent } from './components'; * @return {React.Component} * Component that will load the dynamic import on mount */ -export const dynamicLoader = importComponent => loadable({ - loader: isFunction(importComponent) - ? importComponent - : () => importComponent, // backwards compatibility, - // use delayedComponent, as this function can be used when Components is not populated yet - loading: delayedComponent('DynamicLoading'), -}); +export const dynamicLoader = importComponent => + loadable({ + loader: isFunction(importComponent) ? importComponent : () => importComponent, // backwards compatibility, + // use delayedComponent, as this function can be used when Components is not populated yet + loading: delayedComponent('DynamicLoading'), + }); /** * Renders a dynamic component with the given props. @@ -51,7 +50,7 @@ export const getDynamicComponent = componentImport => { console.warn( 'getDynamicComponent is deprecated, use renderDynamicComponent instead.', 'If you want to retrieve the component instead that of just rendering it,', - 'use dynamicLoader. See this issue to know how to do it: https://github.com/VulcanJS/Vulcan/issues/1997', + 'use dynamicLoader. See this issue to know how to do it: https://github.com/VulcanJS/Vulcan/issues/1997' ); return renderDynamicComponent(componentImport); }; diff --git a/packages/vulcan-lib/lib/server/mutators.js b/packages/vulcan-lib/lib/server/mutators.js index 0cc08afb4..825f0ddab 100644 --- a/packages/vulcan-lib/lib/server/mutators.js +++ b/packages/vulcan-lib/lib/server/mutators.js @@ -317,12 +317,13 @@ export const updateMutator = async ({ autoValue = await schema[fieldName].onUpdate(properties); // eslint-disable-line no-await-in-loop } else if (schema[fieldName].onEdit) { // OpenCRUD backwards compatibility + // eslint-disable-next-line no-await-in-loop autoValue = await schema[fieldName].onEdit( dataToModifier(clone(data)), document, currentUser, document - ); // eslint-disable-line no-await-in-loop + ); } if (typeof autoValue !== 'undefined') { data[fieldName] = autoValue; diff --git a/packages/vulcan-lib/package.js b/packages/vulcan-lib/package.js index a9aae2f8e..8ace56575 100644 --- a/packages/vulcan-lib/package.js +++ b/packages/vulcan-lib/package.js @@ -2,7 +2,7 @@ Package.describe({ name: 'vulcan:lib', summary: 'Vulcan libraries.', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { diff --git a/packages/vulcan-newsletter/package.js b/packages/vulcan-newsletter/package.js index 5b7d16447..ccd29ba27 100644 --- a/packages/vulcan-newsletter/package.js +++ b/packages/vulcan-newsletter/package.js @@ -2,16 +2,13 @@ Package.describe({ name: 'vulcan:newsletter', summary: 'Vulcan email newsletter package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:core@1.12.16', - 'vulcan:email@1.12.16' - ]); + api.use(['vulcan:core@1.12.16', 'vulcan:email@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-payments/package.js b/packages/vulcan-payments/package.js index ee9d89cd2..1a57e17dd 100644 --- a/packages/vulcan-payments/package.js +++ b/packages/vulcan-payments/package.js @@ -2,18 +2,13 @@ Package.describe({ name: 'vulcan:payments', summary: 'Vulcan payments package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'promise', - 'vulcan:core@1.12.16', - - 'fourseven:scss@4.5.4', - ]); + api.use(['promise', 'vulcan:core@1.12.16', 'fourseven:scss@4.5.4']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-routing/package.js b/packages/vulcan-routing/package.js index 1b600691b..d174ace80 100644 --- a/packages/vulcan-routing/package.js +++ b/packages/vulcan-routing/package.js @@ -2,15 +2,13 @@ Package.describe({ name: 'vulcan:routing', summary: 'Vulcan router package', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:lib@1.12.16', - ]); + api.use(['vulcan:lib@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-subscribe/package.js b/packages/vulcan-subscribe/package.js index 9b1e32c54..223038ca3 100644 --- a/packages/vulcan-subscribe/package.js +++ b/packages/vulcan-subscribe/package.js @@ -2,7 +2,7 @@ Package.describe({ name: 'vulcan:subscribe', summary: 'Subscribe to posts, users, etc. to be notified of new activity', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { @@ -12,12 +12,10 @@ Package.onUse(function(api) { 'vulcan:core@1.12.16', // dependencies on posts, categories are done with nested imports to reduce explicit dependencies ]); - - api.use([ - 'vulcan:posts@1.12.16', - 'vulcan:comments@1.12.16', - 'vulcan:categories@1.12.16', - ], {weak: true}); + + api.use(['vulcan:posts@1.12.16', 'vulcan:comments@1.12.16', 'vulcan:categories@1.12.16'], { + weak: true, + }); api.mainModule('lib/modules.js', ['client']); api.mainModule('lib/modules.js', ['server']); diff --git a/packages/vulcan-ui-bootstrap/lib/modules/components.js b/packages/vulcan-ui-bootstrap/lib/modules/components.js index 15220741a..a080032ef 100644 --- a/packages/vulcan-ui-bootstrap/lib/modules/components.js +++ b/packages/vulcan-ui-bootstrap/lib/modules/components.js @@ -16,7 +16,7 @@ import '../components/forms/Url.jsx'; import '../components/forms/StaticText.jsx'; import '../components/forms/FormComponentInner.jsx'; import '../components/forms/FormControl.jsx'; // note: only used by old accounts package, remove soon? -import '../components/forms/FormItem.jsx'; +import '../components/forms/FormItem.jsx'; import '../components/ui/Button.jsx'; import '../components/ui/Alert.jsx'; diff --git a/packages/vulcan-ui-bootstrap/package.js b/packages/vulcan-ui-bootstrap/package.js index 65b18487a..166afd50f 100644 --- a/packages/vulcan-ui-bootstrap/package.js +++ b/packages/vulcan-ui-bootstrap/package.js @@ -2,21 +2,15 @@ Package.describe({ name: 'vulcan:ui-bootstrap', summary: 'Vulcan Bootstrap UI components.', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:lib@1.12.16', - 'fourseven:scss@4.10.0', - ]); - - api.addFiles([ - 'lib/stylesheets/style.scss', - 'lib/stylesheets/datetime.scss' - ], 'client'); + api.use(['vulcan:lib@1.12.16', 'fourseven:scss@4.10.0']); + + api.addFiles(['lib/stylesheets/style.scss', 'lib/stylesheets/datetime.scss'], 'client'); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-users/lib/server/on_create_user.js b/packages/vulcan-users/lib/server/on_create_user.js index 97c41fcc5..05c36e8a0 100644 --- a/packages/vulcan-users/lib/server/on_create_user.js +++ b/packages/vulcan-users/lib/server/on_create_user.js @@ -1,5 +1,12 @@ import Users from '../modules/index.js'; -import { runCallbacks, runCallbacksAsync, Utils, debug, debugGroup, debugGroupEnd } from 'meteor/vulcan:lib'; // import from vulcan:lib because vulcan:core isn't loaded yet +import { + runCallbacks, + runCallbacksAsync, + Utils, + debug, + debugGroup, + debugGroupEnd, +} from 'meteor/vulcan:lib'; // import from vulcan:lib because vulcan:core isn't loaded yet import clone from 'lodash/clone'; // TODO: the following should use async/await, but async/await doesn't seem to work with Accounts.onCreateUser @@ -25,7 +32,9 @@ function onCreateUserCallback(options, user) { _.keys(options).forEach(fieldName => { var field = schema[fieldName]; if (!field || !Users.canCreateField(user, field)) { - throw new Error(Utils.encodeIntlError({ id: 'app.disallowed_property_detected', value: fieldName })); + throw new Error( + Utils.encodeIntlError({ id: 'app.disallowed_property_detected', value: fieldName }) + ); } }); diff --git a/packages/vulcan-users/package.js b/packages/vulcan-users/package.js index 01764545c..e884fd498 100644 --- a/packages/vulcan-users/package.js +++ b/packages/vulcan-users/package.js @@ -2,15 +2,13 @@ Package.describe({ name: 'vulcan:users', summary: 'Vulcan permissions.', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'vulcan:lib@1.12.16' - ]); + api.use(['vulcan:lib@1.12.16']); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client'); diff --git a/packages/vulcan-voting/package.js b/packages/vulcan-voting/package.js index 498145d8a..11d16a604 100644 --- a/packages/vulcan-voting/package.js +++ b/packages/vulcan-voting/package.js @@ -2,17 +2,16 @@ Package.describe({ name: 'vulcan:voting', summary: 'Vulcan scoring package.', version: '1.12.16', - git: 'https://github.com/VulcanJS/Vulcan.git' + git: 'https://github.com/VulcanJS/Vulcan.git', }); Package.onUse(function(api) { api.versionsFrom('1.6.1'); - api.use([ - 'fourseven:scss@4.10.0', - 'vulcan:core@1.12.16', - 'vulcan:i18n@1.12.16', - ], ['client', 'server']); + api.use( + ['fourseven:scss@4.10.0', 'vulcan:core@1.12.16', 'vulcan:i18n@1.12.16'], + ['client', 'server'], + ); api.mainModule('lib/server/main.js', 'server'); api.mainModule('lib/client/main.js', 'client');