From 341a7320f9fe9458dd59d59d1b7de38a8058b656 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 23 Mar 2017 11:48:32 -0300 Subject: [PATCH 01/87] Adding dynamic imports --- client/.babelrc | 1 + client/coral-embed-stream/src/Comment.js | 1 + package.json | 13 +- yarn.lock | 177 +++++++++++++++++++---- 4 files changed, 155 insertions(+), 37 deletions(-) diff --git a/client/.babelrc b/client/.babelrc index 27289288c..d4a414b9f 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -2,5 +2,6 @@ "extends": "../.babelrc", "plugins": [ "transform-async-to-generator", + "syntax-dynamic-import" ] } diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index caffb6894..b89958278 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -168,6 +168,7 @@ class Comment extends React.Component { deleteAction={deleteAction} showSignInDialog={showSignInDialog} currentUser={currentUser} /> + { !disableReply && diff --git a/package.json b/package.json index 909452231..e4153d55d 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ }, "homepage": "https://github.com/coralproject/talk#readme", "dependencies": { + "babel-plugin-syntax-dynamic-import": "^6.18.0", "bcrypt": "^1.0.2", "body-parser": "^1.15.2", "cli-table": "^0.3.1", @@ -62,8 +63,8 @@ "env-rewrite": "^1.0.2", "express": "^4.14.0", "express-session": "^1.14.2", - "gql-merge": "^0.0.4", "form-data": "^2.1.2", + "gql-merge": "^0.0.4", "graphql": "^0.8.2", "graphql-errors": "^2.1.0", "graphql-server-express": "^0.5.0", @@ -93,10 +94,10 @@ "devDependencies": { "apollo-client": "^0.8.3", "autoprefixer": "^6.5.2", - "babel-core": "^6.21.0", + "babel-core": "^6.24.0", "babel-eslint": "^7.1.0", "babel-jest": "^15.0.0", - "babel-loader": "^6.2.7", + "babel-loader": "^6.4.1", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-transform-async-to-generator": "^6.16.0", "babel-plugin-transform-class-properties": "^6.18.0", @@ -105,7 +106,7 @@ "babel-plugin-transform-object-rest-spread": "^6.16.0", "babel-plugin-transform-react-jsx": "^6.8.0", "babel-polyfill": "^6.16.0", - "babel-preset-es2015": "^6.18.0", + "babel-preset-es2015": "^6.24.0", "babel-preset-stage-0": "^6.16.0", "chai": "^3.5.0", "chai-as-promised": "^6.0.0", @@ -148,9 +149,9 @@ "pre-git": "^3.10.0", "precss": "^1.4.0", "pym.js": "^1.1.1", - "react": "15.3.2", + "react": "next", "react-addons-test-utils": "15.3.2", - "react-dom": "15.3.2", + "react-dom": "next", "react-highlight-words": "^0.6.0", "react-linkify": "^0.1.3", "react-mdl": "^1.7.2", diff --git a/yarn.lock b/yarn.lock index 25171f74d..fc62aee77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -368,7 +368,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-core@^6.0.0, babel-core@^6.21.0, babel-core@^6.22.0: +babel-core@^6.0.0, babel-core@^6.22.0: version "6.22.1" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.22.1.tgz#9c5fd658ba1772d28d721f6d25d968fc7ae21648" dependencies: @@ -392,6 +392,30 @@ babel-core@^6.0.0, babel-core@^6.21.0, babel-core@^6.22.0: slash "^1.0.0" source-map "^0.5.0" +babel-core@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" + dependencies: + babel-code-frame "^6.22.0" + babel-generator "^6.24.0" + babel-helpers "^6.23.0" + babel-messages "^6.23.0" + babel-register "^6.24.0" + babel-runtime "^6.22.0" + babel-template "^6.23.0" + babel-traverse "^6.23.1" + babel-types "^6.23.0" + babylon "^6.11.0" + convert-source-map "^1.1.0" + debug "^2.1.1" + json5 "^0.5.0" + lodash "^4.2.0" + minimatch "^3.0.2" + path-is-absolute "^1.0.0" + private "^0.1.6" + slash "^1.0.0" + source-map "^0.5.0" + babel-eslint@^7.1.0: version "7.1.1" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.1.1.tgz#8a6a884f085aa7060af69cfc77341c2f99370fb2" @@ -414,6 +438,19 @@ babel-generator@^6.18.0, babel-generator@^6.22.0: lodash "^4.2.0" source-map "^0.5.0" +babel-generator@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-types "^6.23.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.2.0" + source-map "^0.5.0" + trim-right "^1.0.1" + babel-helper-bindify-decorators@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.22.0.tgz#d7f5bc261275941ac62acfc4e20dacfb8a3fe952" @@ -541,6 +578,13 @@ babel-helpers@^6.22.0: babel-runtime "^6.22.0" babel-template "^6.22.0" +babel-helpers@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.23.0.tgz#4f8f2e092d0b6a8808a4bde79c27f1e2ecf0d992" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.23.0" + babel-jest@^15.0.0: version "15.0.0" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-15.0.0.tgz#6a9e2e3999f241383db9ab1e2ef6704401d74242" @@ -549,12 +593,12 @@ babel-jest@^15.0.0: babel-plugin-istanbul "^2.0.0" babel-preset-jest "^15.0.0" -babel-loader@^6.2.7: - version "6.2.10" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-6.2.10.tgz#adefc2b242320cd5d15e65b31cea0e8b1b02d4b0" +babel-loader@^6.4.1: + version "6.4.1" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-6.4.1.tgz#0b34112d5b0748a8dcdbf51acf6f9bd42d50b8ca" dependencies: find-cache-dir "^0.1.1" - loader-utils "^0.2.11" + loader-utils "^0.2.16" mkdirp "^0.5.1" object-assign "^4.0.1" @@ -564,6 +608,12 @@ babel-messages@^6.22.0: dependencies: babel-runtime "^6.22.0" +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + dependencies: + babel-runtime "^6.22.0" + babel-plugin-add-module-exports@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz#9ae9a1f4a8dc67f0cdec4f4aeda1e43a5ff65e25" @@ -773,22 +823,22 @@ babel-plugin-transform-es2015-literals@^6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-modules-amd@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.22.0.tgz#bf69cd34889a41c33d90dfb740e0091ccff52f21" +babel-plugin-transform-es2015-modules-amd@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.0.tgz#a1911fb9b7ec7e05a43a63c5995007557bcf6a2e" dependencies: - babel-plugin-transform-es2015-modules-commonjs "^6.22.0" + babel-plugin-transform-es2015-modules-commonjs "^6.24.0" babel-runtime "^6.22.0" babel-template "^6.22.0" -babel-plugin-transform-es2015-modules-commonjs@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.22.0.tgz#6ca04e22b8e214fb50169730657e7a07dc941145" +babel-plugin-transform-es2015-modules-commonjs@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.0.tgz#e921aefb72c2cc26cb03d107626156413222134f" dependencies: babel-plugin-transform-strict-mode "^6.22.0" babel-runtime "^6.22.0" - babel-template "^6.22.0" - babel-types "^6.22.0" + babel-template "^6.23.0" + babel-types "^6.23.0" babel-plugin-transform-es2015-modules-systemjs@^6.22.0: version "6.22.0" @@ -798,13 +848,13 @@ babel-plugin-transform-es2015-modules-systemjs@^6.22.0: babel-runtime "^6.22.0" babel-template "^6.22.0" -babel-plugin-transform-es2015-modules-umd@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.22.0.tgz#60d0ba3bd23258719c64391d9bf492d648dc0fae" +babel-plugin-transform-es2015-modules-umd@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.0.tgz#fd5fa63521cae8d273927c3958afd7c067733450" dependencies: - babel-plugin-transform-es2015-modules-amd "^6.22.0" + babel-plugin-transform-es2015-modules-amd "^6.24.0" babel-runtime "^6.22.0" - babel-template "^6.22.0" + babel-template "^6.23.0" babel-plugin-transform-es2015-object-super@^6.22.0: version "6.22.0" @@ -929,9 +979,9 @@ babel-polyfill@^6.16.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-preset-es2015@^6.18.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.22.0.tgz#af5a98ecb35eb8af764ad8a5a05eb36dc4386835" +babel-preset-es2015@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.0.tgz#c162d68b1932696e036cd3110dc1ccd303d2673a" dependencies: babel-plugin-check-es2015-constants "^6.22.0" babel-plugin-transform-es2015-arrow-functions "^6.22.0" @@ -944,10 +994,10 @@ babel-preset-es2015@^6.18.0: babel-plugin-transform-es2015-for-of "^6.22.0" babel-plugin-transform-es2015-function-name "^6.22.0" babel-plugin-transform-es2015-literals "^6.22.0" - babel-plugin-transform-es2015-modules-amd "^6.22.0" - babel-plugin-transform-es2015-modules-commonjs "^6.22.0" + babel-plugin-transform-es2015-modules-amd "^6.24.0" + babel-plugin-transform-es2015-modules-commonjs "^6.24.0" babel-plugin-transform-es2015-modules-systemjs "^6.22.0" - babel-plugin-transform-es2015-modules-umd "^6.22.0" + babel-plugin-transform-es2015-modules-umd "^6.24.0" babel-plugin-transform-es2015-object-super "^6.22.0" babel-plugin-transform-es2015-parameters "^6.22.0" babel-plugin-transform-es2015-shorthand-properties "^6.22.0" @@ -1011,6 +1061,18 @@ babel-register@^6.22.0: mkdirp "^0.5.1" source-map-support "^0.4.2" +babel-register@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.0.tgz#5e89f8463ba9970356d02eb07dabe3308b080cfd" + dependencies: + babel-core "^6.24.0" + babel-runtime "^6.22.0" + core-js "^2.4.0" + home-or-tmp "^2.0.0" + lodash "^4.2.0" + mkdirp "^0.5.1" + source-map-support "^0.4.2" + babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0, babel-runtime@^6.6.1: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.22.0.tgz#1cf8b4ac67c77a4ddb0db2ae1f74de52ac4ca611" @@ -1028,6 +1090,16 @@ babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.3.0: babylon "^6.11.0" lodash "^4.2.0" +babel-template@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" + dependencies: + babel-runtime "^6.22.0" + babel-traverse "^6.23.0" + babel-types "^6.23.0" + babylon "^6.11.0" + lodash "^4.2.0" + babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.22.1: version "6.22.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.22.1.tgz#3b95cd6b7427d6f1f757704908f2fc9748a5f59f" @@ -1042,6 +1114,20 @@ babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-tr invariant "^2.2.0" lodash "^4.2.0" +babel-traverse@^6.23.0, babel-traverse@^6.23.1: + version "6.23.1" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" + dependencies: + babel-code-frame "^6.22.0" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-types "^6.23.0" + babylon "^6.15.0" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + babel-types@^6.15.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.22.0.tgz#2a447e8d0ea25d2512409e4175479fd78cc8b1db" @@ -1051,6 +1137,15 @@ babel-types@^6.15.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22 lodash "^4.2.0" to-fast-properties "^1.0.1" +babel-types@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" + dependencies: + babel-runtime "^6.22.0" + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: version "6.15.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" @@ -2819,9 +2914,9 @@ fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" -fbjs@^0.8.4: - version "0.8.8" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.8.tgz#02f1b6e0ea0d46c24e0b51a2d24df069563a5ad6" +fbjs@^0.8.4, fbjs@^0.8.9: + version "0.8.11" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.11.tgz#340b590b8a2278a01ef7467c07a16da9b753db24" dependencies: core-js "^1.0.0" isomorphic-fetch "^2.1.1" @@ -4457,7 +4552,7 @@ loader-runner@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" -loader-utils@0.2.x, loader-utils@^0.2.11, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.7, loader-utils@~0.2.2: +loader-utils@0.2.x, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.7, loader-utils@~0.2.2: version "0.2.16" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d" dependencies: @@ -6442,10 +6537,18 @@ react-apollo@^0.10.0: optionalDependencies: react-dom "0.14.x || 15.* || ^15.0.0" -"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@15.3.2, react-dom@^15.3.1: +"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1: version "15.3.2" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.3.2.tgz#c46b0aa5380d7b838e7a59c4a7beff2ed315531f" +react-dom@next: + version "16.0.0-alpha.5" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.0.0-alpha.5.tgz#2e1b8efc3ba1c3000210ad364a6b385f1306655c" + dependencies: + fbjs "^0.8.9" + loose-envify "^1.1.0" + object-assign "^4.1.0" + react-highlight-words@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/react-highlight-words/-/react-highlight-words-0.6.0.tgz#e12e9fedda4333e410ea408cdedffc77122020aa" @@ -6508,7 +6611,7 @@ react-tagsinput@^3.14.0: version "3.14.0" resolved "https://registry.yarnpkg.com/react-tagsinput/-/react-tagsinput-3.14.0.tgz#6729f8d5b313ed8fbb35496205ec2a97654af6bc" -react@15.3.2, react@^15.3.1: +react@^15.3.1: version "15.3.2" resolved "https://registry.yarnpkg.com/react/-/react-15.3.2.tgz#a7bccd2fee8af126b0317e222c28d1d54528d09e" dependencies: @@ -6516,6 +6619,14 @@ react@15.3.2, react@^15.3.1: loose-envify "^1.1.0" object-assign "^4.1.0" +react@next: + version "16.0.0-alpha.5" + resolved "https://registry.yarnpkg.com/react/-/react-16.0.0-alpha.5.tgz#ba5ca2058e7f39b010661497286e37133eb1c9fa" + dependencies: + fbjs "^0.8.9" + loose-envify "^1.1.0" + object-assign "^4.1.0" + read-all-stream@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/read-all-stream/-/read-all-stream-3.1.0.tgz#35c3e177f2078ef789ee4bfafa4373074eaef4fa" @@ -7575,6 +7686,10 @@ tr46@~0.0.1, tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + tryit@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" From 2e80d2a36e486a30bed9c287842106512429be45 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 23 Mar 2017 12:27:30 -0300 Subject: [PATCH 02/87] fixing and separating broken tests /client /server --- package.json | 5 +- test/mocha.opts | 4 +- test/{ => server}/graph/context.js | 6 +- test/{ => server}/graph/loaders/metrics.js | 14 +- .../graph/mutations/addCommentTag.js | 10 +- .../graph/mutations/createComment.js | 12 +- .../graph/mutations/removeCommentTag.js | 10 +- test/{ => server}/kue.js | 2 +- test/{ => server}/mongoose.js | 2 +- test/{ => server}/passport.js | 2 +- test/{ => server}/routes/api/account/index.js | 6 +- test/{ => server}/routes/api/assets/index.js | 8 +- test/{ => server}/routes/api/auth/index.js | 6 +- .../{ => server}/routes/api/settings/index.js | 4 +- test/{ => server}/routes/api/user/index.js | 8 +- test/{ => server}/services/actions.js | 4 +- test/{ => server}/services/assets.js | 6 +- test/{ => server}/services/comments.js | 12 +- test/{ => server}/services/domainlist.js | 4 +- test/{ => server}/services/scraper.js | 0 test/{ => server}/services/settings.js | 2 +- test/{ => server}/services/users.js | 4 +- test/{ => server}/services/wordlist.js | 6 +- yarn.lock | 163 ++++-------------- 24 files changed, 104 insertions(+), 196 deletions(-) rename test/{ => server}/graph/context.js (91%) rename test/{ => server}/graph/loaders/metrics.js (92%) rename test/{ => server}/graph/mutations/addCommentTag.js (86%) rename test/{ => server}/graph/mutations/createComment.js (95%) rename test/{ => server}/graph/mutations/removeCommentTag.js (87%) rename test/{ => server}/kue.js (73%) rename test/{ => server}/mongoose.js (80%) rename test/{ => server}/passport.js (90%) rename test/{ => server}/routes/api/account/index.js (92%) rename test/{ => server}/routes/api/assets/index.js (94%) rename test/{ => server}/routes/api/auth/index.js (94%) rename test/{ => server}/routes/api/settings/index.js (91%) rename test/{ => server}/routes/api/user/index.js (92%) rename test/{ => server}/services/actions.js (96%) rename test/{ => server}/services/assets.js (95%) rename test/{ => server}/services/comments.js (96%) rename test/{ => server}/services/domainlist.js (90%) rename test/{ => server}/services/scraper.js (100%) rename test/{ => server}/services/settings.js (96%) rename test/{ => server}/services/users.js (98%) rename test/{ => server}/services/wordlist.js (93%) diff --git a/package.json b/package.json index e4153d55d..a0e959c2f 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,7 @@ "passport-facebook": "^2.1.1", "passport-local": "^1.0.0", "react-apollo": "^0.10.0", + "react-dom": "^15.4.2", "react-recaptcha": "^2.2.6", "redis": "^2.6.5", "uuid": "^2.0.3" @@ -150,15 +151,13 @@ "precss": "^1.4.0", "pym.js": "^1.1.1", "react": "next", - "react-addons-test-utils": "15.3.2", - "react-dom": "next", "react-highlight-words": "^0.6.0", "react-linkify": "^0.1.3", "react-mdl": "^1.7.2", "react-mdl-selectfield": "^0.2.0", "react-onclickoutside": "^5.7.1", "react-redux": "^4.4.5", - "react-router": "^3.0.0", + "react-router": "next", "react-tagsinput": "^3.14.0", "redux": "^3.6.0", "redux-mock-store": "^1.2.1", diff --git a/test/mocha.opts b/test/mocha.opts index a159ae7aa..36be84461 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,5 +1,7 @@ test/helpers/*.js -test + +test/e2e +test/server --compilers js:babel-core/register --require ignore-styles --recursive diff --git a/test/graph/context.js b/test/server/graph/context.js similarity index 91% rename from test/graph/context.js rename to test/server/graph/context.js index 413622678..b01917289 100644 --- a/test/graph/context.js +++ b/test/server/graph/context.js @@ -1,8 +1,8 @@ const expect = require('chai').expect; -const User = require('../../models/user'); -const Context = require('../../graph/context'); -const errors = require('../../errors'); +const User = require('../../../models/user'); +const Context = require('../../../graph/context'); +const errors = require('../../../errors'); describe('graph.Context', () => { diff --git a/test/graph/loaders/metrics.js b/test/server/graph/loaders/metrics.js similarity index 92% rename from test/graph/loaders/metrics.js rename to test/server/graph/loaders/metrics.js index 29f2eeff1..f095e201f 100644 --- a/test/graph/loaders/metrics.js +++ b/test/server/graph/loaders/metrics.js @@ -1,13 +1,13 @@ const {expect} = require('chai'); const {graphql} = require('graphql'); -const schema = require('../../../graph/schema'); -const Context = require('../../../graph/context'); -const UserModel = require('../../../models/user'); -const AssetModel = require('../../../models/asset'); -const SettingsService = require('../../../services/settings'); -const ActionModel = require('../../../models/action'); -const CommentModel = require('../../../models/comment'); +const schema = require('../../../../graph/schema'); +const Context = require('../../../../graph/context'); +const UserModel = require('../../../../models/user'); +const AssetModel = require('../../../../models/asset'); +const SettingsService = require('../../../../services/settings'); +const ActionModel = require('../../../../models/action'); +const CommentModel = require('../../../../models/comment'); describe('graph.loaders.Metrics', () => { beforeEach(() => SettingsService.init()); diff --git a/test/graph/mutations/addCommentTag.js b/test/server/graph/mutations/addCommentTag.js similarity index 86% rename from test/graph/mutations/addCommentTag.js rename to test/server/graph/mutations/addCommentTag.js index 0835e81bc..018e96631 100644 --- a/test/graph/mutations/addCommentTag.js +++ b/test/server/graph/mutations/addCommentTag.js @@ -1,11 +1,11 @@ const expect = require('chai').expect; const {graphql} = require('graphql'); -const schema = require('../../../graph/schema'); -const Context = require('../../../graph/context'); -const UserModel = require('../../../models/user'); -const SettingsService = require('../../../services/settings'); -const CommentsService = require('../../../services/comments'); +const schema = require('../../../../graph/schema'); +const Context = require('../../../../graph/context'); +const UserModel = require('../../../../models/user'); +const SettingsService = require('../../../../services/settings'); +const CommentsService = require('../../../../services/comments'); describe('graph.mutations.addCommentTag', () => { let comment; diff --git a/test/graph/mutations/createComment.js b/test/server/graph/mutations/createComment.js similarity index 95% rename from test/graph/mutations/createComment.js rename to test/server/graph/mutations/createComment.js index 26775933c..b3bdd459a 100644 --- a/test/graph/mutations/createComment.js +++ b/test/server/graph/mutations/createComment.js @@ -1,12 +1,12 @@ const expect = require('chai').expect; const {graphql} = require('graphql'); -const schema = require('../../../graph/schema'); -const Context = require('../../../graph/context'); -const UserModel = require('../../../models/user'); -const AssetModel = require('../../../models/asset'); -const SettingsService = require('../../../services/settings'); -const ActionModel = require('../../../models/action'); +const schema = require('../../../../graph/schema'); +const Context = require('../../../../graph/context'); +const UserModel = require('../../../../models/user'); +const AssetModel = require('../../../../models/asset'); +const SettingsService = require('../../../../services/settings'); +const ActionModel = require('../../../../models/action'); describe('graph.mutations.createComment', () => { beforeEach(() => SettingsService.init()); diff --git a/test/graph/mutations/removeCommentTag.js b/test/server/graph/mutations/removeCommentTag.js similarity index 87% rename from test/graph/mutations/removeCommentTag.js rename to test/server/graph/mutations/removeCommentTag.js index 99def095d..c0d452f37 100644 --- a/test/graph/mutations/removeCommentTag.js +++ b/test/server/graph/mutations/removeCommentTag.js @@ -1,11 +1,11 @@ const expect = require('chai').expect; const {graphql} = require('graphql'); -const schema = require('../../../graph/schema'); -const Context = require('../../../graph/context'); -const UserModel = require('../../../models/user'); -const SettingsService = require('../../../services/settings'); -const CommentsService = require('../../../services/comments'); +const schema = require('../../../../graph/schema'); +const Context = require('../../../../graph/context'); +const UserModel = require('../../../../models/user'); +const SettingsService = require('../../../../services/settings'); +const CommentsService = require('../../../../services/comments'); describe('graph.mutations.removeCommentTag', () => { let comment; diff --git a/test/kue.js b/test/server/kue.js similarity index 73% rename from test/kue.js rename to test/server/kue.js index 504760b82..8bdc9b398 100644 --- a/test/kue.js +++ b/test/server/kue.js @@ -1,4 +1,4 @@ -const kue = require('../services/kue'); +const kue = require('../../services/kue'); beforeEach(() => { diff --git a/test/mongoose.js b/test/server/mongoose.js similarity index 80% rename from test/mongoose.js rename to test/server/mongoose.js index 6fac193fa..a1bac6150 100644 --- a/test/mongoose.js +++ b/test/server/mongoose.js @@ -1,4 +1,4 @@ -const mongoose = require('./helpers/mongoose'); +const mongoose = require('../helpers/mongoose'); before(function(done) { this.timeout(30000); diff --git a/test/passport.js b/test/server/passport.js similarity index 90% rename from test/passport.js rename to test/server/passport.js index 2d1c53ab9..401e50b77 100644 --- a/test/passport.js +++ b/test/server/passport.js @@ -1,4 +1,4 @@ -const authorization = require('../middleware/authorization'); +const authorization = require('../../middleware/authorization'); // Add the passport middleware here before it's setup. authorization.middleware.push((req, res, next) => { diff --git a/test/routes/api/account/index.js b/test/server/routes/api/account/index.js similarity index 92% rename from test/routes/api/account/index.js rename to test/server/routes/api/account/index.js index 3a4493279..67744f9bc 100644 --- a/test/routes/api/account/index.js +++ b/test/server/routes/api/account/index.js @@ -1,17 +1,17 @@ const passport = require('../../../passport'); -const app = require('../../../../app'); +const app = require('../../../../../app'); const chai = require('chai'); const expect = chai.expect; -const SettingsService = require('../../../../services/settings'); +const SettingsService = require('../../../../../services/settings'); const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; // Setup chai. chai.should(); chai.use(require('chai-http')); -const UsersService = require('../../../../services/users'); +const UsersService = require('../../../../../services/users'); describe('/api/v1/account/username', () => { let mockUser; diff --git a/test/routes/api/assets/index.js b/test/server/routes/api/assets/index.js similarity index 94% rename from test/routes/api/assets/index.js rename to test/server/routes/api/assets/index.js index 9f1e4ad66..80708688b 100644 --- a/test/routes/api/assets/index.js +++ b/test/server/routes/api/assets/index.js @@ -1,6 +1,6 @@ const passport = require('../../../passport'); -const app = require('../../../../app'); +const app = require('../../../../../app'); const chai = require('chai'); const expect = chai.expect; @@ -8,9 +8,9 @@ const expect = chai.expect; chai.should(); chai.use(require('chai-http')); -const AssetModel = require('../../../../models/asset'); -const AssetsService = require('../../../../services/assets'); -const SettingsService = require('../../../../services/settings'); +const AssetModel = require('../../../../../models/asset'); +const AssetsService = require('../../../../../services/assets'); +const SettingsService = require('../../../../../services/settings'); describe('/api/v1/assets', () => { diff --git a/test/routes/api/auth/index.js b/test/server/routes/api/auth/index.js similarity index 94% rename from test/routes/api/auth/index.js rename to test/server/routes/api/auth/index.js index 38b867b7d..1d0ed6b3a 100644 --- a/test/routes/api/auth/index.js +++ b/test/server/routes/api/auth/index.js @@ -1,10 +1,10 @@ -const app = require('../../../../app'); +const app = require('../../../../../app'); const chai = require('chai'); const expect = chai.expect; chai.use(require('chai-http')); -const UsersService = require('../../../../services/users'); +const UsersService = require('../../../../../services/users'); describe('/api/v1/auth', () => { describe('#get', () => { @@ -19,7 +19,7 @@ describe('/api/v1/auth', () => { }); }); -const SettingsService = require('../../../../services/settings'); +const SettingsService = require('../../../../../services/settings'); describe('/api/v1/auth/local', () => { diff --git a/test/routes/api/settings/index.js b/test/server/routes/api/settings/index.js similarity index 91% rename from test/routes/api/settings/index.js rename to test/server/routes/api/settings/index.js index dfe846edf..54a8f357f 100644 --- a/test/routes/api/settings/index.js +++ b/test/server/routes/api/settings/index.js @@ -1,13 +1,13 @@ const passport = require('../../../passport'); -const app = require('../../../../app'); +const app = require('../../../../../app'); const chai = require('chai'); const expect = chai.expect; chai.should(); chai.use(require('chai-http')); -const SettingsService = require('../../../../services/settings'); +const SettingsService = require('../../../../../services/settings'); const defaults = {id: '1', moderation: 'PRE'}; describe('/api/v1/settings', () => { diff --git a/test/routes/api/user/index.js b/test/server/routes/api/user/index.js similarity index 92% rename from test/routes/api/user/index.js rename to test/server/routes/api/user/index.js index f6e202243..fc1feb66e 100644 --- a/test/routes/api/user/index.js +++ b/test/server/routes/api/user/index.js @@ -1,18 +1,18 @@ const passport = require('../../../passport'); -const app = require('../../../../app'); -const mailer = require('../../../../services/mailer'); +const app = require('../../../../../app'); +const mailer = require('../../../../../services/mailer'); const chai = require('chai'); const expect = chai.expect; -const SettingsService = require('../../../../services/settings'); +const SettingsService = require('../../../../../services/settings'); const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; // Setup chai. chai.should(); chai.use(require('chai-http')); -const UsersService = require('../../../../services/users'); +const UsersService = require('../../../../../services/users'); describe('/api/v1/users/:user_id/email/confirm', () => { diff --git a/test/services/actions.js b/test/server/services/actions.js similarity index 96% rename from test/services/actions.js rename to test/server/services/actions.js index 7fdec0a12..4d22dff6f 100644 --- a/test/services/actions.js +++ b/test/server/services/actions.js @@ -1,5 +1,5 @@ -const ActionModel = require('../../models/action'); -const ActionsService = require('../../services/actions'); +const ActionModel = require('../../../models/action'); +const ActionsService = require('../../../services/actions'); const expect = require('chai').expect; diff --git a/test/services/assets.js b/test/server/services/assets.js similarity index 95% rename from test/services/assets.js rename to test/server/services/assets.js index 3bbe8ee6e..e46e75576 100644 --- a/test/services/assets.js +++ b/test/server/services/assets.js @@ -1,6 +1,6 @@ -const AssetModel = require('../../models/asset'); -const AssetsService = require('../../services/assets'); -const SettingsService = require('../../services/settings'); +const AssetModel = require('../../../models/asset'); +const AssetsService = require('../../../services/assets'); +const SettingsService = require('../../../services/settings'); const chai = require('chai'); const expect = chai.expect; diff --git a/test/services/comments.js b/test/server/services/comments.js similarity index 96% rename from test/services/comments.js rename to test/server/services/comments.js index 782c00560..5b9cbf4d1 100644 --- a/test/services/comments.js +++ b/test/server/services/comments.js @@ -1,10 +1,10 @@ -const CommentModel = require('../../models/comment'); -const ActionModel = require('../../models/action'); +const CommentModel = require('../../../models/comment'); +const ActionModel = require('../../../models/action'); -const ActionsService = require('../../services/actions'); -const UsersService = require('../../services/users'); -const SettingsService = require('../../services/settings'); -const CommentsService = require('../../services/comments'); +const ActionsService = require('../../../services/actions'); +const UsersService = require('../../../services/users'); +const SettingsService = require('../../../services/settings'); +const CommentsService = require('../../../services/comments'); const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; diff --git a/test/services/domainlist.js b/test/server/services/domainlist.js similarity index 90% rename from test/services/domainlist.js rename to test/server/services/domainlist.js index db53b77b4..9dafa438a 100644 --- a/test/services/domainlist.js +++ b/test/server/services/domainlist.js @@ -1,6 +1,6 @@ const expect = require('chai').expect; -const Domainlist = require('../../services/domainlist'); -const SettingsService = require('../../services/settings'); +const Domainlist = require('../../../services/domainlist'); +const SettingsService = require('../../../services/settings'); describe('services.Domainlist', () => { diff --git a/test/services/scraper.js b/test/server/services/scraper.js similarity index 100% rename from test/services/scraper.js rename to test/server/services/scraper.js diff --git a/test/services/settings.js b/test/server/services/settings.js similarity index 96% rename from test/services/settings.js rename to test/server/services/settings.js index 3620ae633..e23548a83 100644 --- a/test/services/settings.js +++ b/test/server/services/settings.js @@ -1,4 +1,4 @@ -const SettingsService = require('../../services/settings'); +const SettingsService = require('../../../services/settings'); const expect = require('chai').expect; describe('services.SettingsService', () => { diff --git a/test/services/users.js b/test/server/services/users.js similarity index 98% rename from test/services/users.js rename to test/server/services/users.js index 94aa92432..aeb62d106 100644 --- a/test/services/users.js +++ b/test/server/services/users.js @@ -1,5 +1,5 @@ -const UsersService = require('../../services/users'); -const SettingsService = require('../../services/settings'); +const UsersService = require('../../../services/users'); +const SettingsService = require('../../../services/settings'); const expect = require('chai').expect; diff --git a/test/services/wordlist.js b/test/server/services/wordlist.js similarity index 93% rename from test/services/wordlist.js rename to test/server/services/wordlist.js index 6bd05e640..4a8b117ea 100644 --- a/test/services/wordlist.js +++ b/test/server/services/wordlist.js @@ -1,7 +1,7 @@ const expect = require('chai').expect; -const Errors = require('../../errors'); -const Wordlist = require('../../services/wordlist'); -const SettingsService = require('../../services/settings'); +const Errors = require('../../../errors'); +const Wordlist = require('../../../services/wordlist'); +const SettingsService = require('../../../services/settings'); describe('services.Wordlist', () => { diff --git a/yarn.lock b/yarn.lock index fc62aee77..99c623050 100644 --- a/yarn.lock +++ b/yarn.lock @@ -368,31 +368,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-core@^6.0.0, babel-core@^6.22.0: - version "6.22.1" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.22.1.tgz#9c5fd658ba1772d28d721f6d25d968fc7ae21648" - dependencies: - babel-code-frame "^6.22.0" - babel-generator "^6.22.0" - babel-helpers "^6.22.0" - babel-messages "^6.22.0" - babel-register "^6.22.0" - babel-runtime "^6.22.0" - babel-template "^6.22.0" - babel-traverse "^6.22.1" - babel-types "^6.22.0" - babylon "^6.11.0" - convert-source-map "^1.1.0" - debug "^2.1.1" - json5 "^0.5.0" - lodash "^4.2.0" - minimatch "^3.0.2" - path-is-absolute "^1.0.0" - private "^0.1.6" - slash "^1.0.0" - source-map "^0.5.0" - -babel-core@^6.24.0: +babel-core@^6.0.0, babel-core@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" dependencies: @@ -426,19 +402,7 @@ babel-eslint@^7.1.0: babylon "^6.13.0" lodash.pickby "^4.6.0" -babel-generator@^6.18.0, babel-generator@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.22.0.tgz#d642bf4961911a8adc7c692b0c9297f325cda805" - dependencies: - babel-messages "^6.22.0" - babel-runtime "^6.22.0" - babel-types "^6.22.0" - detect-indent "^4.0.0" - jsesc "^1.3.0" - lodash "^4.2.0" - source-map "^0.5.0" - -babel-generator@^6.24.0: +babel-generator@^6.18.0, babel-generator@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" dependencies: @@ -571,13 +535,6 @@ babel-helper-replace-supers@^6.22.0: babel-traverse "^6.22.0" babel-types "^6.22.0" -babel-helpers@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.22.0.tgz#d275f55f2252b8101bff07bc0c556deda657392c" - dependencies: - babel-runtime "^6.22.0" - babel-template "^6.22.0" - babel-helpers@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.23.0.tgz#4f8f2e092d0b6a8808a4bde79c27f1e2ecf0d992" @@ -602,13 +559,7 @@ babel-loader@^6.4.1: mkdirp "^0.5.1" object-assign "^4.0.1" -babel-messages@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.22.0.tgz#36066a214f1217e4ed4164867669ecb39e3ea575" - dependencies: - babel-runtime "^6.22.0" - -babel-messages@^6.23.0: +babel-messages@^6.22.0, babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" dependencies: @@ -1049,18 +1000,6 @@ babel-preset-stage-3@^6.22.0: babel-plugin-transform-exponentiation-operator "^6.22.0" babel-plugin-transform-object-rest-spread "^6.22.0" -babel-register@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.22.0.tgz#a61dd83975f9ca4a9e7d6eff3059494cd5ea4c63" - dependencies: - babel-core "^6.22.0" - babel-runtime "^6.22.0" - core-js "^2.4.0" - home-or-tmp "^2.0.0" - lodash "^4.2.0" - mkdirp "^0.5.1" - source-map-support "^0.4.2" - babel-register@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.0.tgz#5e89f8463ba9970356d02eb07dabe3308b080cfd" @@ -1080,17 +1019,7 @@ babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtim core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.3.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.22.0.tgz#403d110905a4626b317a2a1fcb8f3b73204b2edb" - dependencies: - babel-runtime "^6.22.0" - babel-traverse "^6.22.0" - babel-types "^6.22.0" - babylon "^6.11.0" - lodash "^4.2.0" - -babel-template@^6.23.0: +babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0, babel-template@^6.3.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" dependencies: @@ -1100,21 +1029,7 @@ babel-template@^6.23.0: babylon "^6.11.0" lodash "^4.2.0" -babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.22.1: - version "6.22.1" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.22.1.tgz#3b95cd6b7427d6f1f757704908f2fc9748a5f59f" - dependencies: - babel-code-frame "^6.22.0" - babel-messages "^6.22.0" - babel-runtime "^6.22.0" - babel-types "^6.22.0" - babylon "^6.15.0" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - -babel-traverse@^6.23.0, babel-traverse@^6.23.1: +babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: @@ -1128,16 +1043,7 @@ babel-traverse@^6.23.0, babel-traverse@^6.23.1: invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.15.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.22.0.tgz#2a447e8d0ea25d2512409e4175479fd78cc8b1db" - dependencies: - babel-runtime "^6.22.0" - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" - -babel-types@^6.23.0: +babel-types@^6.15.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: @@ -2914,7 +2820,7 @@ fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" -fbjs@^0.8.4, fbjs@^0.8.9: +fbjs@^0.8.1, fbjs@^0.8.4, fbjs@^0.8.9: version "0.8.11" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.11.tgz#340b590b8a2278a01ef7467c07a16da9b753db24" dependencies: @@ -3602,13 +3508,14 @@ highlight-words-core@^1.0.2: dependencies: babel-runtime "^6.11.6" -history@^3.0.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/history/-/history-3.2.1.tgz#71c7497f4e6090363d19a6713bb52a1bfcdd99aa" +history@^4.6.0: + version "4.6.1" + resolved "https://registry.yarnpkg.com/history/-/history-4.6.1.tgz#911cf8eb65728555a94f2b12780a0c531a14d2fd" dependencies: invariant "^2.2.1" loose-envify "^1.2.0" - query-string "^4.2.2" + resolve-pathname "^2.0.0" + value-equal "^0.2.0" warning "^3.0.0" hoek@2.x.x: @@ -3881,7 +3788,7 @@ interpret@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" -invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.1: +invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: @@ -4815,7 +4722,7 @@ longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" -loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: @@ -5678,7 +5585,7 @@ path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" -path-to-regexp@^1.7.0: +path-to-regexp@^1.5.3, path-to-regexp@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" dependencies: @@ -6455,7 +6362,7 @@ qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" -query-string@^4.1.0, query-string@^4.2.2: +query-string@^4.1.0: version "4.3.1" resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.1.tgz#54baada6713eafc92be75c47a731f2ebd09cd11d" dependencies: @@ -6518,10 +6425,6 @@ rc@^1.0.1, rc@~1.1.6: minimist "^1.2.0" strip-json-comments "~1.0.4" -react-addons-test-utils@15.3.2: - version "15.3.2" - resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.3.2.tgz#c09a44f583425a4a9c1b38444d7a6c3e6f0f41f6" - react-apollo@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-0.10.1.tgz#97fd50855f8575672aa68330b9c64a201cd13343" @@ -6537,15 +6440,11 @@ react-apollo@^0.10.0: optionalDependencies: react-dom "0.14.x || 15.* || ^15.0.0" -"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1: - version "15.3.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.3.2.tgz#c46b0aa5380d7b838e7a59c4a7beff2ed315531f" - -react-dom@next: - version "16.0.0-alpha.5" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.0.0-alpha.5.tgz#2e1b8efc3ba1c3000210ad364a6b385f1306655c" +"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1, react-dom@^15.4.2: + version "15.4.2" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.2.tgz#015363f05b0a1fd52ae9efdd3a0060d90695208f" dependencies: - fbjs "^0.8.9" + fbjs "^0.8.1" loose-envify "^1.1.0" object-assign "^4.1.0" @@ -6597,14 +6496,14 @@ react-redux@^4.4.5: lodash "^4.2.0" loose-envify "^1.1.0" -react-router@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-3.0.2.tgz#5a19156678810e01d81901f9c0fef63284b8a514" +react-router@next: + version "4.0.0-beta.8" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.0.0-beta.8.tgz#368cfe540d23d5d23419b42fb915d465f268b66b" dependencies: - history "^3.0.0" - hoist-non-react-statics "^1.2.0" - invariant "^2.2.1" - loose-envify "^1.2.0" + history "^4.6.0" + invariant "^2.2.2" + loose-envify "^1.3.1" + path-to-regexp "^1.5.3" warning "^3.0.0" react-tagsinput@^3.14.0: @@ -6956,6 +6855,10 @@ resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" +resolve-pathname@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.0.2.tgz#e55c016eb2e9df1de98e85002282bfb38c630436" + resolve@^1.1.6, resolve@^1.1.7: version "1.2.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" @@ -7870,6 +7773,10 @@ validate-npm-package-license@^3.0.1: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" +value-equal@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.2.0.tgz#4f41c60a3fc011139a2ec3d3340a8998ae8b69c0" + vary@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.0.tgz#e1e5affbbd16ae768dd2674394b9ad3022653140" From 3be9b136919f23df0d2d10adb25922ece72b79c7 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 23 Mar 2017 16:59:11 -0300 Subject: [PATCH 03/87] First draft of plugins working :) --- .eslintrc.json | 14 ++++++++++++-- client/.babelrc | 4 +++- client/coral-embed-stream/src/Comment.js | 3 ++- client/coral-embed-stream/src/Pluggable.js | 4 ++++ package.json | 4 +++- webpack.config.js | 4 ++++ 6 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 client/coral-embed-stream/src/Pluggable.js diff --git a/.eslintrc.json b/.eslintrc.json index 293657679..5cdd4dfa9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,8 +5,16 @@ }, "extends": "eslint:recommended", "parserOptions": { - "ecmaVersion": 2017 + "ecmaVersion": 2017, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true, + "experimentalObjectRestSpread": true + } }, + "plugins": [ + "react" + ], "rules": { "indent": ["error", 2 @@ -53,6 +61,8 @@ }], "newline-per-chained-call": ["error", { "ignoreChainWithDepth": 2 - }] + }], + "react/jsx-uses-react": "error", + "react/jsx-uses-vars": "error" } } diff --git a/client/.babelrc b/client/.babelrc index d4a414b9f..e054da899 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -2,6 +2,8 @@ "extends": "../.babelrc", "plugins": [ "transform-async-to-generator", - "syntax-dynamic-import" + "syntax-dynamic-import", + "transform-regenerator", + "transform-runtime" ] } diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index b89958278..20c4de893 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -19,6 +19,7 @@ import FlagComment from 'coral-plugin-flags/FlagComment'; import LikeButton from 'coral-plugin-likes/LikeButton'; import {BestButton, IfUserCanModifyBest, BEST_TAG, commentIsBest, BestIndicator} from 'coral-plugin-best/BestButton'; import LoadMore from 'coral-embed-stream/src/LoadMore'; +import Pluggable from './Pluggable'; import styles from './Comment.css'; @@ -168,7 +169,6 @@ class Comment extends React.Component { deleteAction={deleteAction} showSignInDialog={showSignInDialog} currentUser={currentUser} /> - { !disableReply && @@ -189,6 +189,7 @@ class Comment extends React.Component { +
diff --git a/client/coral-embed-stream/src/Pluggable.js b/client/coral-embed-stream/src/Pluggable.js new file mode 100644 index 000000000..ee07a031f --- /dev/null +++ b/client/coral-embed-stream/src/Pluggable.js @@ -0,0 +1,4 @@ +import React from 'react'; +import * as Plugins from 'plugins'; + +export default () =>
{Object.keys(Plugins).map((component, i) => Plugins[component]({key: i}))}
; diff --git a/package.json b/package.json index a0e959c2f..310891f33 100644 --- a/package.json +++ b/package.json @@ -100,12 +100,14 @@ "babel-jest": "^15.0.0", "babel-loader": "^6.4.1", "babel-plugin-add-module-exports": "^0.2.1", - "babel-plugin-transform-async-to-generator": "^6.16.0", + "babel-plugin-transform-async-to-generator": "^6.22.0", "babel-plugin-transform-class-properties": "^6.18.0", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-object-assign": "^6.8.0", "babel-plugin-transform-object-rest-spread": "^6.16.0", "babel-plugin-transform-react-jsx": "^6.8.0", + "babel-plugin-transform-regenerator": "^6.22.0", + "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.16.0", "babel-preset-es2015": "^6.24.0", "babel-preset-stage-0": "^6.16.0", diff --git a/webpack.config.js b/webpack.config.js index 432bb6155..014588e86 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -121,8 +121,12 @@ module.exports = { }) ], resolve: { + alias: { + plugins: path.resolve(__dirname, 'plugins/index.js'), + }, modules: [ path.resolve(__dirname, 'client'), + path.resolve(__dirname, 'plugins'), ...buildTargets.map(target => path.join(__dirname, 'client', target, 'src')), ...buildEmbeds.map(embed => path.join(__dirname, 'client', `coral-embed-${embed}`, 'src')), 'node_modules' From e85ebba21b543d596bbdaf53d9c8fa701754271b Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 27 Mar 2017 13:02:57 -0300 Subject: [PATCH 04/87] Working plugin importer --- client/.babelrc | 3 - client/coral-embed-stream/src/Pluggable.js | 10 ++- client/coral-framework/helpers/importer.js | 12 ++++ package.json | 21 +++--- webpack.config.js | 5 +- yarn.lock | 81 ++++++++++++---------- 6 files changed, 76 insertions(+), 56 deletions(-) create mode 100644 client/coral-framework/helpers/importer.js diff --git a/client/.babelrc b/client/.babelrc index e054da899..27289288c 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -2,8 +2,5 @@ "extends": "../.babelrc", "plugins": [ "transform-async-to-generator", - "syntax-dynamic-import", - "transform-regenerator", - "transform-runtime" ] } diff --git a/client/coral-embed-stream/src/Pluggable.js b/client/coral-embed-stream/src/Pluggable.js index ee07a031f..fd5b1aa4e 100644 --- a/client/coral-embed-stream/src/Pluggable.js +++ b/client/coral-embed-stream/src/Pluggable.js @@ -1,4 +1,10 @@ import React from 'react'; -import * as Plugins from 'plugins'; +import injectedPlugins from 'coral-framework/helpers/importer'; -export default () =>
{Object.keys(Plugins).map((component, i) => Plugins[component]({key: i}))}
; +export default function pluginContainer () { + return ( +
+ {Object.keys(injectedPlugins).map((component, i) => injectedPlugins[component]({key: i}))} +
+ ) +}; diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js new file mode 100644 index 000000000..5fc057610 --- /dev/null +++ b/client/coral-framework/helpers/importer.js @@ -0,0 +1,12 @@ +function importer () { + const context = require.context("../../../plugins", true, /\.\/(.*)\/client\/index.js$/); + let res = {}; + + context.keys().forEach(function (key) { + res[key] = context(key) + }); + + return res; +} + +export default importer(); \ No newline at end of file diff --git a/package.json b/package.json index 310891f33..4269fff72 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ }, "homepage": "https://github.com/coralproject/talk#readme", "dependencies": { - "babel-plugin-syntax-dynamic-import": "^6.18.0", "bcrypt": "^1.0.2", "body-parser": "^1.15.2", "cli-table": "^0.3.1", @@ -63,8 +62,8 @@ "env-rewrite": "^1.0.2", "express": "^4.14.0", "express-session": "^1.14.2", - "form-data": "^2.1.2", "gql-merge": "^0.0.4", + "form-data": "^2.1.2", "graphql": "^0.8.2", "graphql-errors": "^2.1.0", "graphql-server-express": "^0.5.0", @@ -87,7 +86,6 @@ "passport-facebook": "^2.1.1", "passport-local": "^1.0.0", "react-apollo": "^0.10.0", - "react-dom": "^15.4.2", "react-recaptcha": "^2.2.6", "redis": "^2.6.5", "uuid": "^2.0.3" @@ -95,25 +93,24 @@ "devDependencies": { "apollo-client": "^0.8.3", "autoprefixer": "^6.5.2", - "babel-core": "^6.24.0", + "babel-core": "^6.21.0", "babel-eslint": "^7.1.0", "babel-jest": "^15.0.0", - "babel-loader": "^6.4.1", + "babel-loader": "^6.2.7", "babel-plugin-add-module-exports": "^0.2.1", - "babel-plugin-transform-async-to-generator": "^6.22.0", + "babel-plugin-transform-async-to-generator": "^6.16.0", "babel-plugin-transform-class-properties": "^6.18.0", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-object-assign": "^6.8.0", "babel-plugin-transform-object-rest-spread": "^6.16.0", "babel-plugin-transform-react-jsx": "^6.8.0", - "babel-plugin-transform-regenerator": "^6.22.0", - "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.16.0", - "babel-preset-es2015": "^6.24.0", + "babel-preset-es2015": "^6.18.0", "babel-preset-stage-0": "^6.16.0", "chai": "^3.5.0", "chai-as-promised": "^6.0.0", "chai-http": "^3.0.0", + "contents-loader": "^1.0.0", "copy-webpack-plugin": "^4.0.0", "css-loader": "^0.25.0", "dialog-polyfill": "^0.4.4", @@ -152,14 +149,16 @@ "pre-git": "^3.10.0", "precss": "^1.4.0", "pym.js": "^1.1.1", - "react": "next", + "react": "15.3.2", + "react-addons-test-utils": "15.3.2", + "react-dom": "15.3.2", "react-highlight-words": "^0.6.0", "react-linkify": "^0.1.3", "react-mdl": "^1.7.2", "react-mdl-selectfield": "^0.2.0", "react-onclickoutside": "^5.7.1", "react-redux": "^4.4.5", - "react-router": "next", + "react-router": "^3.0.0", "react-tagsinput": "^3.14.0", "redux": "^3.6.0", "redux-mock-store": "^1.2.1", diff --git a/webpack.config.js b/webpack.config.js index 014588e86..8c7119bd2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,8 @@ const precss = require('precss'); const Copy = require('copy-webpack-plugin'); const LicenseWebpackPlugin = require('license-webpack-plugin'); const webpack = require('webpack'); - +// const plugins = require('./plugins.json'); +// 'plugins': plugins.client.map(name => path.join(__dirname, `plugins/${name}/index`)) // Edit the build targets and embeds below. const buildTargets = [ @@ -122,7 +123,7 @@ module.exports = { ], resolve: { alias: { - plugins: path.resolve(__dirname, 'plugins/index.js'), + plugins: path.resolve(__dirname, 'plugins/'), }, modules: [ path.resolve(__dirname, 'client'), diff --git a/yarn.lock b/yarn.lock index 99c623050..62247999c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -368,7 +368,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-core@^6.0.0, babel-core@^6.24.0: +babel-core@^6.0.0, babel-core@^6.21.0, babel-core@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" dependencies: @@ -550,7 +550,7 @@ babel-jest@^15.0.0: babel-plugin-istanbul "^2.0.0" babel-preset-jest "^15.0.0" -babel-loader@^6.4.1: +babel-loader@^6.2.7: version "6.4.1" resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-6.4.1.tgz#0b34112d5b0748a8dcdbf51acf6f9bd42d50b8ca" dependencies: @@ -930,7 +930,7 @@ babel-polyfill@^6.16.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-preset-es2015@^6.24.0: +babel-preset-es2015@^6.18.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.0.tgz#c162d68b1932696e036cd3110dc1ccd303d2673a" dependencies: @@ -1787,6 +1787,12 @@ content-type@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.2.tgz#b7d113aee7a8dd27bd21133c4dc2529df1721eed" +contents-loader@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/contents-loader/-/contents-loader-1.0.0.tgz#8ca18fbe70d63837c020737de55d29fa0823ce3f" + dependencies: + loader-utils "^1.0.2" + conventional-commit-message@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/conventional-commit-message/-/conventional-commit-message-1.1.0.tgz#ece8c661a168e983692e1d5a14875acb59510f6a" @@ -2820,7 +2826,7 @@ fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" -fbjs@^0.8.1, fbjs@^0.8.4, fbjs@^0.8.9: +fbjs@^0.8.1, fbjs@^0.8.4: version "0.8.11" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.11.tgz#340b590b8a2278a01ef7467c07a16da9b753db24" dependencies: @@ -3508,14 +3514,13 @@ highlight-words-core@^1.0.2: dependencies: babel-runtime "^6.11.6" -history@^4.6.0: - version "4.6.1" - resolved "https://registry.yarnpkg.com/history/-/history-4.6.1.tgz#911cf8eb65728555a94f2b12780a0c531a14d2fd" +history@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/history/-/history-3.3.0.tgz#fcedcce8f12975371545d735461033579a6dae9c" dependencies: invariant "^2.2.1" loose-envify "^1.2.0" - resolve-pathname "^2.0.0" - value-equal "^0.2.0" + query-string "^4.2.2" warning "^3.0.0" hoek@2.x.x: @@ -3788,7 +3793,7 @@ interpret@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" -invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2: +invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: @@ -4468,6 +4473,14 @@ loader-utils@0.2.x, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0. json5 "^0.5.0" object-assign "^4.0.1" +loader-utils@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd" + dependencies: + big.js "^3.1.3" + emojis-list "^2.0.0" + json5 "^0.5.0" + lodash-es@^4.2.1: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.4.tgz#dcc1d7552e150a0640073ba9cb31d70f032950e7" @@ -4722,7 +4735,7 @@ longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" -loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: @@ -5585,7 +5598,7 @@ path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" -path-to-regexp@^1.5.3, path-to-regexp@^1.7.0: +path-to-regexp@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" dependencies: @@ -6362,7 +6375,7 @@ qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" -query-string@^4.1.0: +query-string@^4.1.0, query-string@^4.2.2: version "4.3.1" resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.1.tgz#54baada6713eafc92be75c47a731f2ebd09cd11d" dependencies: @@ -6425,6 +6438,10 @@ rc@^1.0.1, rc@~1.1.6: minimist "^1.2.0" strip-json-comments "~1.0.4" +react-addons-test-utils@15.3.2: + version "15.3.2" + resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.3.2.tgz#c09a44f583425a4a9c1b38444d7a6c3e6f0f41f6" + react-apollo@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-0.10.1.tgz#97fd50855f8575672aa68330b9c64a201cd13343" @@ -6440,7 +6457,7 @@ react-apollo@^0.10.0: optionalDependencies: react-dom "0.14.x || 15.* || ^15.0.0" -"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1, react-dom@^15.4.2: +"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1: version "15.4.2" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.2.tgz#015363f05b0a1fd52ae9efdd3a0060d90695208f" dependencies: @@ -6448,6 +6465,10 @@ react-apollo@^0.10.0: loose-envify "^1.1.0" object-assign "^4.1.0" +react-dom@15.3.2: + version "15.3.2" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.3.2.tgz#c46b0aa5380d7b838e7a59c4a7beff2ed315531f" + react-highlight-words@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/react-highlight-words/-/react-highlight-words-0.6.0.tgz#e12e9fedda4333e410ea408cdedffc77122020aa" @@ -6496,21 +6517,21 @@ react-redux@^4.4.5: lodash "^4.2.0" loose-envify "^1.1.0" -react-router@next: - version "4.0.0-beta.8" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.0.0-beta.8.tgz#368cfe540d23d5d23419b42fb915d465f268b66b" +react-router@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-3.0.2.tgz#5a19156678810e01d81901f9c0fef63284b8a514" dependencies: - history "^4.6.0" - invariant "^2.2.2" - loose-envify "^1.3.1" - path-to-regexp "^1.5.3" + history "^3.0.0" + hoist-non-react-statics "^1.2.0" + invariant "^2.2.1" + loose-envify "^1.2.0" warning "^3.0.0" react-tagsinput@^3.14.0: version "3.14.0" resolved "https://registry.yarnpkg.com/react-tagsinput/-/react-tagsinput-3.14.0.tgz#6729f8d5b313ed8fbb35496205ec2a97654af6bc" -react@^15.3.1: +react@15.3.2, react@^15.3.1: version "15.3.2" resolved "https://registry.yarnpkg.com/react/-/react-15.3.2.tgz#a7bccd2fee8af126b0317e222c28d1d54528d09e" dependencies: @@ -6518,14 +6539,6 @@ react@^15.3.1: loose-envify "^1.1.0" object-assign "^4.1.0" -react@next: - version "16.0.0-alpha.5" - resolved "https://registry.yarnpkg.com/react/-/react-16.0.0-alpha.5.tgz#ba5ca2058e7f39b010661497286e37133eb1c9fa" - dependencies: - fbjs "^0.8.9" - loose-envify "^1.1.0" - object-assign "^4.1.0" - read-all-stream@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/read-all-stream/-/read-all-stream-3.1.0.tgz#35c3e177f2078ef789ee4bfafa4373074eaef4fa" @@ -6855,10 +6868,6 @@ resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" -resolve-pathname@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.0.2.tgz#e55c016eb2e9df1de98e85002282bfb38c630436" - resolve@^1.1.6, resolve@^1.1.7: version "1.2.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" @@ -7773,10 +7782,6 @@ validate-npm-package-license@^3.0.1: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" -value-equal@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.2.0.tgz#4f41c60a3fc011139a2ec3d3340a8998ae8b69c0" - vary@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.0.tgz#e1e5affbbd16ae768dd2674394b9ad3022653140" From 697d2f0ec1f23d2928892f0d59033e2379432089 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 28 Mar 2017 09:58:33 -0300 Subject: [PATCH 05/87] Importer, Slots and suport for multiple plugins and props! --- client/coral-embed-stream/src/Comment.js | 23 ++++--- client/coral-embed-stream/src/Pluggable.js | 10 ++- client/coral-framework/components/Slot.js | 15 ++++ client/coral-framework/helpers/importer.js | 80 ++++++++++++++++++++-- client/coral-framework/index.js | 2 + webpack.config.js | 10 ++- 6 files changed, 115 insertions(+), 25 deletions(-) create mode 100644 client/coral-framework/components/Slot.js diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 20c4de893..4c358b99a 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -20,6 +20,7 @@ import LikeButton from 'coral-plugin-likes/LikeButton'; import {BestButton, IfUserCanModifyBest, BEST_TAG, commentIsBest, BestIndicator} from 'coral-plugin-best/BestButton'; import LoadMore from 'coral-embed-stream/src/LoadMore'; import Pluggable from './Pluggable'; +import {Slot} from 'coral-framework'; import styles from './Comment.css'; @@ -148,16 +149,20 @@ class Comment extends React.Component { id={`c_${comment.id}`} style={{marginLeft: depth * 30}}>
- - { isStaff(comment.tags) - ? Staff - : null } - { commentIsBest(comment) - ? - : null } - +
+ + { isStaff(comment.tags) + ? Staff + : null } + + { commentIsBest(comment) + ? + : null } + + +
diff --git a/client/coral-embed-stream/src/Pluggable.js b/client/coral-embed-stream/src/Pluggable.js index fd5b1aa4e..5f636c7c5 100644 --- a/client/coral-embed-stream/src/Pluggable.js +++ b/client/coral-embed-stream/src/Pluggable.js @@ -4,7 +4,11 @@ import injectedPlugins from 'coral-framework/helpers/importer'; export default function pluginContainer () { return (
- {Object.keys(injectedPlugins).map((component, i) => injectedPlugins[component]({key: i}))} + { + Object.keys(injectedPlugins).map((component, i) => { + return injectedPlugins[component]({key: i}); + }) + }
- ) -}; + ); +} diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js new file mode 100644 index 000000000..65a12c668 --- /dev/null +++ b/client/coral-framework/components/Slot.js @@ -0,0 +1,15 @@ +import React, {Component} from 'react'; + +// { "slot": "Comment.DetailArea"}, + +class Slot extends Component { + render() { + return ( +
+ This is a slot +
+ ); + } +} + +export default Slot; diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index 5fc057610..ae77f472d 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -1,12 +1,78 @@ +import {client as clientPlugins} from 'pluginsConfig'; + function importer () { - const context = require.context("../../../plugins", true, /\.\/(.*)\/client\/index.js$/); - let res = {}; + let context, + importedFiles; - context.keys().forEach(function (key) { - res[key] = context(key) - }); + function buildContext() { - return res; + /** + * buildContext creates the context for the plugins + * require.context(, true, + * path: The path where the importer builds the context. 'plugins' is allowed as path because it's an alias + * regxp: A Regular Expression to match the files that the importer needs. i.e (index.js, config.json) + * data such as path and regexp cannot be passed as arguments or variables + */ + context = require.context('plugins', true, /\.\/(.*)\/client\/(index|config).(js|json)$/); + return importedFiles = context + .keys() + .map(key => shapeData(key)); + } + + function shapeData(test) { + + /** + * shapeData shapes each item in the plugins array with useful data + * returns an Object with the name of the plugin, the format, and it's key(filename) + */ + const match = test.match(/\.\/(.*)\/client\/.*.(json|js)$/); + return { + name: match[1], + format: match[2], + key: match[0] + }; + } + + function getConfig (name) { + + /** + * getConfig finds a the config file for each plugin + * returns the config.json as an object to be passed as props to the plugin + */ + return importedFiles + .filter(key => key.format === 'json' && key.name === name) + .reduce((acc, plugin) => { + return context(plugin.key); + }, {}); + } + + function filterByUserConfig (list) { + + /** + * filterByUserConfig will filter the imported files and will only keep the allowed plugins + */ + return list + .filter(plugin => clientPlugins.indexOf(plugin.name) > -1); + } + + function init() { + + /** + * init will build the context and + * returns a map with each plugin and its instance + */ + buildContext(); + + return filterByUserConfig(importedFiles) + .filter(key => key.format === 'js') + .reduce((entry, plugin) => { + entry[plugin.name] = () => context(plugin.key)(getConfig(plugin.name)); + return entry; + }, {}); + } + + return init(); } -export default importer(); \ No newline at end of file +export default importer(); + diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js index 2900466ee..6350d29b1 100644 --- a/client/coral-framework/index.js +++ b/client/coral-framework/index.js @@ -4,9 +4,11 @@ import I18n from './modules/i18n/i18n'; import * as authActions from './actions/auth'; import * as assetActions from './actions/asset'; import * as notificationActions from './actions/notification'; +import Slot from './components/Slot'; export { pym, + Slot, I18n, store, authActions, diff --git a/webpack.config.js b/webpack.config.js index 8c7119bd2..59dc58b33 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,8 +4,7 @@ const precss = require('precss'); const Copy = require('copy-webpack-plugin'); const LicenseWebpackPlugin = require('license-webpack-plugin'); const webpack = require('webpack'); -// const plugins = require('./plugins.json'); -// 'plugins': plugins.client.map(name => path.join(__dirname, `plugins/${name}/index`)) + // Edit the build targets and embeds below. const buildTargets = [ @@ -18,7 +17,7 @@ const buildEmbeds = [ ]; module.exports = { - devtool: '#cheap-module-source-map', + devtool: 'cheap-module-source-map', entry: Object.assign({}, { 'embed': [ 'babel-polyfill', @@ -59,8 +58,7 @@ module.exports = { exclude: /node_modules/, test: /\.js$/, query: { - cacheDirectory: true, - sourceMap: true + cacheDirectory: true } }, { @@ -124,10 +122,10 @@ module.exports = { resolve: { alias: { plugins: path.resolve(__dirname, 'plugins/'), + pluginsConfig: path.resolve(__dirname, 'plugins.json') }, modules: [ path.resolve(__dirname, 'client'), - path.resolve(__dirname, 'plugins'), ...buildTargets.map(target => path.join(__dirname, 'client', target, 'src')), ...buildEmbeds.map(embed => path.join(__dirname, 'client', `coral-embed-${embed}`, 'src')), 'node_modules' From 1a115e4f2c58d4ec3681ee4ea3b58995715af548 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 28 Mar 2017 14:20:12 -0300 Subject: [PATCH 06/87] Stable version --- client/coral-embed-stream/src/Comment.js | 3 +-- client/coral-embed-stream/src/Pluggable.js | 14 -------------- client/coral-framework/components/Slot.js | 9 ++++++--- client/coral-framework/helpers/importer.js | 6 +++--- 4 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 client/coral-embed-stream/src/Pluggable.js diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 4c358b99a..bdccb7f66 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -19,7 +19,6 @@ import FlagComment from 'coral-plugin-flags/FlagComment'; import LikeButton from 'coral-plugin-likes/LikeButton'; import {BestButton, IfUserCanModifyBest, BEST_TAG, commentIsBest, BestIndicator} from 'coral-plugin-best/BestButton'; import LoadMore from 'coral-embed-stream/src/LoadMore'; -import Pluggable from './Pluggable'; import {Slot} from 'coral-framework'; import styles from './Comment.css'; @@ -193,8 +192,8 @@ class Comment extends React.Component { removeBest={removeBestTag} /> +
-
diff --git a/client/coral-embed-stream/src/Pluggable.js b/client/coral-embed-stream/src/Pluggable.js deleted file mode 100644 index 5f636c7c5..000000000 --- a/client/coral-embed-stream/src/Pluggable.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import injectedPlugins from 'coral-framework/helpers/importer'; - -export default function pluginContainer () { - return ( -
- { - Object.keys(injectedPlugins).map((component, i) => { - return injectedPlugins[component]({key: i}); - }) - } -
- ); -} diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 65a12c668..c711efe56 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -1,12 +1,15 @@ import React, {Component} from 'react'; - -// { "slot": "Comment.DetailArea"}, +import injectedPlugins from 'coral-framework/helpers/importer'; class Slot extends Component { + componentDidMount() { + console.log('Slot Mounted'); + } render() { + const {slot} = this.props; return (
- This is a slot + {injectedPlugins}
); } diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index ae77f472d..196353bcb 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -1,6 +1,6 @@ import {client as clientPlugins} from 'pluginsConfig'; -function importer () { +function importer (slot) { let context, importedFiles; @@ -66,9 +66,9 @@ function importer () { return filterByUserConfig(importedFiles) .filter(key => key.format === 'js') .reduce((entry, plugin) => { - entry[plugin.name] = () => context(plugin.key)(getConfig(plugin.name)); + entry.push(context(plugin.key)(getConfig(plugin.name))) return entry; - }, {}); + }, []); } return init(); From b76fa943544c2c4b54b306f72cff0a7436a07682 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 28 Mar 2017 14:21:06 -0300 Subject: [PATCH 07/87] Stable version --- client/coral-framework/components/Slot.js | 1 - client/coral-framework/helpers/importer.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index c711efe56..f3549340a 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -6,7 +6,6 @@ class Slot extends Component { console.log('Slot Mounted'); } render() { - const {slot} = this.props; return (
{injectedPlugins} diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index 196353bcb..8b1ee93c0 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -1,6 +1,6 @@ import {client as clientPlugins} from 'pluginsConfig'; -function importer (slot) { +function importer () { let context, importedFiles; @@ -66,7 +66,7 @@ function importer (slot) { return filterByUserConfig(importedFiles) .filter(key => key.format === 'js') .reduce((entry, plugin) => { - entry.push(context(plugin.key)(getConfig(plugin.name))) + entry.push(context(plugin.key)(getConfig(plugin.name))); return entry; }, []); } From 2513ef2df5249f25bab2083e4cdb59741b1b07ea Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 28 Mar 2017 15:56:24 -0300 Subject: [PATCH 08/87] add plugins --- .gitignore | 4 +- client/.babelrc | 2 +- client/coral-docs/src/index.js | 4 +- client/coral-embed-stream/src/Embed.js | 2 + client/coral-framework/components/Slot.js | 3 +- client/coral-framework/helpers/importer.js | 19 +- client/coral-framework/index.js | 8 +- package.json | 57 +- plugins.json | 8 + plugins/coral-plugin-love/client/config.json | 4 + plugins/coral-plugin-love/client/index.js | 8 + plugins/coral-plugin-love/client/style.css | 9 + plugins/coral-plugin-love/index.js | 0 .../coral-plugin-monitor/client/config.json | 4 + plugins/coral-plugin-monitor/client/index.js | 12 + plugins/coral-plugin-monitor/index.js | 0 .../coral-plugin-respect/client/config.json | 4 + plugins/coral-plugin-respect/client/index.js | 9 + plugins/coral-plugin-respect/client/style.css | 9 + plugins/coral-plugin-respect/index.js | 0 .../coral-plugin-sideview/client/actions.js | 1 + .../coral-plugin-sideview/client/config.json | 3 + plugins/coral-plugin-sideview/client/index.js | 0 .../coral-plugin-sideview/client/reducer.js | 0 plugins/coral-plugin-sideview/index.js | 0 yarn.lock | 685 +++++++++++------- 26 files changed, 567 insertions(+), 288 deletions(-) create mode 100644 plugins.json create mode 100644 plugins/coral-plugin-love/client/config.json create mode 100644 plugins/coral-plugin-love/client/index.js create mode 100644 plugins/coral-plugin-love/client/style.css create mode 100644 plugins/coral-plugin-love/index.js create mode 100644 plugins/coral-plugin-monitor/client/config.json create mode 100644 plugins/coral-plugin-monitor/client/index.js create mode 100644 plugins/coral-plugin-monitor/index.js create mode 100644 plugins/coral-plugin-respect/client/config.json create mode 100644 plugins/coral-plugin-respect/client/index.js create mode 100644 plugins/coral-plugin-respect/client/style.css create mode 100644 plugins/coral-plugin-respect/index.js create mode 100644 plugins/coral-plugin-sideview/client/actions.js create mode 100644 plugins/coral-plugin-sideview/client/config.json create mode 100644 plugins/coral-plugin-sideview/client/index.js create mode 100644 plugins/coral-plugin-sideview/client/reducer.js create mode 100644 plugins/coral-plugin-sideview/index.js diff --git a/.gitignore b/.gitignore index d91635c94..9ce1637d4 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,5 @@ coverage/ .tags1 # remove plugin folders -plugins -plugins.json +# plugins +# plugins.json diff --git a/client/.babelrc b/client/.babelrc index 27289288c..1d4fe2508 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -1,6 +1,6 @@ { "extends": "../.babelrc", "plugins": [ - "transform-async-to-generator", + "transform-async-to-generator" ] } diff --git a/client/coral-docs/src/index.js b/client/coral-docs/src/index.js index 5d8c49d9d..e706203a8 100644 --- a/client/coral-docs/src/index.js +++ b/client/coral-docs/src/index.js @@ -1,8 +1,8 @@ import React from 'react'; -import ReactDOM from 'react-dom'; +import {render} from 'react-dom'; import {GraphQLDocs} from 'graphql-docs'; import fetcher from './services/fetcher'; // Render the application into the DOM -ReactDOM.render(, document.querySelector('#root')); +render(, document.querySelector('#root')); diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index 4722a44b1..6ac3ab68a 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -34,6 +34,7 @@ import ConfigureStreamContainer from 'coral-configure/containers/ConfigureStream import Comment from './Comment'; import LoadMore from './LoadMore'; import NewCount from './NewCount'; +import {Slot} from 'coral-framework'; class Embed extends Component { @@ -119,6 +120,7 @@ class Embed extends Component { return (
+ {lang.t('profile')} diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index f3549340a..313a7d114 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -6,9 +6,10 @@ class Slot extends Component { console.log('Slot Mounted'); } render() { + const {fill} = this.props; return (
- {injectedPlugins} + {injectedPlugins(fill)}
); } diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index 8b1ee93c0..c653cde54 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -1,6 +1,6 @@ import {client as clientPlugins} from 'pluginsConfig'; -function importer () { +function importer (fill) { let context, importedFiles; @@ -55,6 +55,15 @@ function importer () { .filter(plugin => clientPlugins.indexOf(plugin.name) > -1); } + function addProps (plugin) { + plugin.props = getConfig(plugin.name); + return plugin; + } + + function filterBySlot (plugin) { + return plugin.props.slot === fill; + } + function init() { /** @@ -65,8 +74,10 @@ function importer () { return filterByUserConfig(importedFiles) .filter(key => key.format === 'js') - .reduce((entry, plugin) => { - entry.push(context(plugin.key)(getConfig(plugin.name))); + .map(addProps) + .filter(filterBySlot) + .reduce((entry, plugin, i) => { + entry.push(context(plugin.key)(plugin.props)); return entry; }, []); } @@ -74,5 +85,5 @@ function importer () { return init(); } -export default importer(); +export default importer; diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js index 6350d29b1..88044b2a8 100644 --- a/client/coral-framework/index.js +++ b/client/coral-framework/index.js @@ -6,6 +6,11 @@ import * as assetActions from './actions/asset'; import * as notificationActions from './actions/notification'; import Slot from './components/Slot'; +const context = require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/); +const pluginsActions = context + .keys() + .reduce(entry, key => entry[key] = context(key), {}); + export { pym, Slot, @@ -13,5 +18,6 @@ export { store, authActions, assetActions, - notificationActions + notificationActions, + pluginsActions }; diff --git a/package.json b/package.json index 4269fff72..19db0b7e7 100644 --- a/package.json +++ b/package.json @@ -50,34 +50,34 @@ "homepage": "https://github.com/coralproject/talk#readme", "dependencies": { "bcrypt": "^1.0.2", - "body-parser": "^1.15.2", + "body-parser": "^1.17.1", "cli-table": "^0.3.1", "commander": "^2.9.0", "connect-redis": "^3.1.0", "csurf": "^1.9.0", - "dataloader": "^1.2.0", - "debug": "^2.2.0", + "dataloader": "^1.3.0", + "debug": "^2.6.3", "dotenv": "^4.0.0", - "ejs": "^2.5.2", + "ejs": "^2.5.6", "env-rewrite": "^1.0.2", - "express": "^4.14.0", - "express-session": "^1.14.2", - "gql-merge": "^0.0.4", + "express": "^4.15.2", + "express-session": "^1.15.1", "form-data": "^2.1.2", + "gql-merge": "^0.0.4", "graphql": "^0.8.2", "graphql-errors": "^2.1.0", "graphql-server-express": "^0.5.0", "graphql-tools": "^0.9.0", - "helmet": "^3.1.0", - "inquirer": "^3.0.1", - "jsonwebtoken": "^7.1.9", + "helmet": "^3.5.0", + "inquirer": "^3.0.6", + "jsonwebtoken": "^7.3.0", "kue": "^0.11.5", "linkify-it": "^2.0.3", "lodash": "^4.16.6", "metascraper": "^1.0.6", "minimist": "^1.2.0", - "mongoose": "^4.6.5", - "morgan": "^1.7.0", + "mongoose": "^4.9.1", + "morgan": "^1.8.1", "natural": "^0.4.0", "node-fetch": "^1.6.3", "nodemailer": "^2.6.4", @@ -87,32 +87,31 @@ "passport-local": "^1.0.0", "react-apollo": "^0.10.0", "react-recaptcha": "^2.2.6", - "redis": "^2.6.5", + "redis": "^2.7.1", "uuid": "^2.0.3" }, "devDependencies": { "apollo-client": "^0.8.3", "autoprefixer": "^6.5.2", - "babel-core": "^6.21.0", - "babel-eslint": "^7.1.0", - "babel-jest": "^15.0.0", - "babel-loader": "^6.2.7", + "babel-core": "^6.24.0", + "babel-eslint": "^7.2.1", + "babel-jest": "^19.0.0", + "babel-loader": "^6.4.1", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-transform-async-to-generator": "^6.16.0", - "babel-plugin-transform-class-properties": "^6.18.0", + "babel-plugin-transform-class-properties": "^6.23.0", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-object-assign": "^6.8.0", - "babel-plugin-transform-object-rest-spread": "^6.16.0", - "babel-plugin-transform-react-jsx": "^6.8.0", - "babel-polyfill": "^6.16.0", - "babel-preset-es2015": "^6.18.0", + "babel-plugin-transform-object-rest-spread": "^6.23.0", + "babel-plugin-transform-react-jsx": "^6.23.0", + "babel-polyfill": "^6.23.0", + "babel-preset-es2015": "^6.24.0", "babel-preset-stage-0": "^6.16.0", "chai": "^3.5.0", "chai-as-promised": "^6.0.0", "chai-http": "^3.0.0", - "contents-loader": "^1.0.0", "copy-webpack-plugin": "^4.0.0", - "css-loader": "^0.25.0", + "css-loader": "^0.27.3", "dialog-polyfill": "^0.4.4", "enzyme": "^2.6.0", "eslint": "^3.12.1", @@ -125,14 +124,14 @@ "eslint-plugin-promise": "^3.3.1", "eslint-plugin-react": "^6.6.0", "eslint-plugin-standard": "^2.0.1", - "exports-loader": "^0.6.3", + "exports-loader": "^0.6.4", "fetch-mock": "^5.5.0", "graphql-docs": "^0.2.0", "graphql-tag": "^1.2.3", "hammerjs": "^2.0.8", "ignore-styles": "^5.0.1", "immutable": "^3.8.1", - "imports-loader": "^0.6.5", + "imports-loader": "^0.7.1", "istanbul": "^1.1.0-alpha.1", "jsdom": "^9.8.3", "json-loader": "^0.5.4", @@ -143,7 +142,7 @@ "mocha-junit-reporter": "^1.12.1", "nightwatch": "^0.9.11", "nodemon": "^1.11.0", - "postcss-loader": "^1.1.0", + "postcss-loader": "^1.3.3", "postcss-modules": "^0.5.2", "postcss-smart-import": "^0.5.1", "pre-git": "^3.10.0", @@ -165,10 +164,10 @@ "redux-thunk": "^2.1.0", "regenerator": "^0.8.46", "selenium-standalone": "^5.11.2", - "style-loader": "^0.13.1", + "style-loader": "^0.16.0", "supertest": "^2.0.1", "timeago.js": "^2.0.3", - "webpack": "^2.2.1" + "webpack": "^2.3.1" }, "engines": { "node": "^7.7.0" diff --git a/plugins.json b/plugins.json new file mode 100644 index 000000000..fa5d703a8 --- /dev/null +++ b/plugins.json @@ -0,0 +1,8 @@ +{ + "server": [], + "client": [ + "coral-plugin-respect", + "coral-plugin-love", + "coral-plugin-monitor" + ] +} \ No newline at end of file diff --git a/plugins/coral-plugin-love/client/config.json b/plugins/coral-plugin-love/client/config.json new file mode 100644 index 000000000..cf846a647 --- /dev/null +++ b/plugins/coral-plugin-love/client/config.json @@ -0,0 +1,4 @@ +{ + "name": "Coral Plugin Love", + "slot": "Comment.InfoBar" +} \ No newline at end of file diff --git a/plugins/coral-plugin-love/client/index.js b/plugins/coral-plugin-love/client/index.js new file mode 100644 index 000000000..6af9c8d8c --- /dev/null +++ b/plugins/coral-plugin-love/client/index.js @@ -0,0 +1,8 @@ +import React from 'react'; +import styles from './style.css'; + +export default (props) => ( +
+ +
+); diff --git a/plugins/coral-plugin-love/client/style.css b/plugins/coral-plugin-love/client/style.css new file mode 100644 index 000000000..a83bb003b --- /dev/null +++ b/plugins/coral-plugin-love/client/style.css @@ -0,0 +1,9 @@ +.Love { + display: inline-block; + button { + padding: 10px 2px; + border-radius: 3px; + background: deepskyblue; + color: #161616; + } +} \ No newline at end of file diff --git a/plugins/coral-plugin-love/index.js b/plugins/coral-plugin-love/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/coral-plugin-monitor/client/config.json b/plugins/coral-plugin-monitor/client/config.json new file mode 100644 index 000000000..9f39c4e6c --- /dev/null +++ b/plugins/coral-plugin-monitor/client/config.json @@ -0,0 +1,4 @@ +{ + "name": "Coral Plugin Tab Monitor", + "slot": "Stream" +} \ No newline at end of file diff --git a/plugins/coral-plugin-monitor/client/index.js b/plugins/coral-plugin-monitor/client/index.js new file mode 100644 index 000000000..a2585c42f --- /dev/null +++ b/plugins/coral-plugin-monitor/client/index.js @@ -0,0 +1,12 @@ +import React from 'react'; +import {TabBar, Tab} from 'coral-ui'; + +console.log('exported'); + +export default (props) => ( + + + Monitor + + +); diff --git a/plugins/coral-plugin-monitor/index.js b/plugins/coral-plugin-monitor/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/coral-plugin-respect/client/config.json b/plugins/coral-plugin-respect/client/config.json new file mode 100644 index 000000000..7d822b10f --- /dev/null +++ b/plugins/coral-plugin-respect/client/config.json @@ -0,0 +1,4 @@ +{ + "name": "Coral Plugin Respect", + "slot": "Comment.Detail" +} \ No newline at end of file diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js new file mode 100644 index 000000000..9969420b5 --- /dev/null +++ b/plugins/coral-plugin-respect/client/index.js @@ -0,0 +1,9 @@ +import React from 'react'; +import styles from './style.css'; + +export default (props) => ( +
+ +
+); + diff --git a/plugins/coral-plugin-respect/client/style.css b/plugins/coral-plugin-respect/client/style.css new file mode 100644 index 000000000..c10503213 --- /dev/null +++ b/plugins/coral-plugin-respect/client/style.css @@ -0,0 +1,9 @@ +.Respect { + display: inline-block; + button { + padding: 10px 2px; + border-radius: 3px; + background: #ffa16e; + color: #161616; + } +} \ No newline at end of file diff --git a/plugins/coral-plugin-respect/index.js b/plugins/coral-plugin-respect/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/coral-plugin-sideview/client/actions.js b/plugins/coral-plugin-sideview/client/actions.js new file mode 100644 index 000000000..0f38834c9 --- /dev/null +++ b/plugins/coral-plugin-sideview/client/actions.js @@ -0,0 +1 @@ +export const SomeAction = () => ({type: 'SomeAction'}); \ No newline at end of file diff --git a/plugins/coral-plugin-sideview/client/config.json b/plugins/coral-plugin-sideview/client/config.json new file mode 100644 index 000000000..18ac9fa2d --- /dev/null +++ b/plugins/coral-plugin-sideview/client/config.json @@ -0,0 +1,3 @@ +{ + "name": "Coral Plugin" +} \ No newline at end of file diff --git a/plugins/coral-plugin-sideview/client/index.js b/plugins/coral-plugin-sideview/client/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/coral-plugin-sideview/client/reducer.js b/plugins/coral-plugin-sideview/client/reducer.js new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/coral-plugin-sideview/index.js b/plugins/coral-plugin-sideview/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/yarn.lock b/yarn.lock index 62247999c..d014022e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -368,7 +368,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-core@^6.0.0, babel-core@^6.21.0, babel-core@^6.24.0: +babel-core@^6.0.0, babel-core@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" dependencies: @@ -392,15 +392,14 @@ babel-core@^6.0.0, babel-core@^6.21.0, babel-core@^6.24.0: slash "^1.0.0" source-map "^0.5.0" -babel-eslint@^7.1.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.1.1.tgz#8a6a884f085aa7060af69cfc77341c2f99370fb2" +babel-eslint@^7.2.1: + version "7.2.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.2.1.tgz#079422eb73ba811e3ca0865ce87af29327f8c52f" dependencies: - babel-code-frame "^6.16.0" - babel-traverse "^6.15.0" - babel-types "^6.15.0" - babylon "^6.13.0" - lodash.pickby "^4.6.0" + babel-code-frame "^6.22.0" + babel-traverse "^6.23.1" + babel-types "^6.23.0" + babylon "^6.16.1" babel-generator@^6.18.0, babel-generator@^6.24.0: version "6.24.0" @@ -431,12 +430,12 @@ babel-helper-builder-binary-assignment-operator-visitor@^6.22.0: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-helper-builder-react-jsx@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-helper-builder-react-jsx/-/babel-helper-builder-react-jsx-6.22.0.tgz#aafb31913e47761fd4d0b6987756a144a65fca0d" +babel-helper-builder-react-jsx@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-helper-builder-react-jsx/-/babel-helper-builder-react-jsx-6.23.0.tgz#d53fc8c996e0bc56d0de0fc4cc55a7138395ea4b" dependencies: babel-runtime "^6.22.0" - babel-types "^6.22.0" + babel-types "^6.23.0" esutils "^2.0.0" lodash "^4.2.0" @@ -485,6 +484,16 @@ babel-helper-function-name@^6.22.0: babel-traverse "^6.22.0" babel-types "^6.22.0" +babel-helper-function-name@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.23.0.tgz#25742d67175c8903dbe4b6cb9d9e1fcb8dcf23a6" + dependencies: + babel-helper-get-function-arity "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.23.0" + babel-traverse "^6.23.0" + babel-types "^6.23.0" + babel-helper-get-function-arity@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.22.0.tgz#0beb464ad69dc7347410ac6ade9f03a50634f5ce" @@ -542,15 +551,15 @@ babel-helpers@^6.23.0: babel-runtime "^6.22.0" babel-template "^6.23.0" -babel-jest@^15.0.0: - version "15.0.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-15.0.0.tgz#6a9e2e3999f241383db9ab1e2ef6704401d74242" +babel-jest@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-19.0.0.tgz#59323ced99a3a84d359da219ca881074ffc6ce3f" dependencies: babel-core "^6.0.0" - babel-plugin-istanbul "^2.0.0" - babel-preset-jest "^15.0.0" + babel-plugin-istanbul "^4.0.0" + babel-preset-jest "^19.0.0" -babel-loader@^6.2.7: +babel-loader@^6.4.1: version "6.4.1" resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-6.4.1.tgz#0b34112d5b0748a8dcdbf51acf6f9bd42d50b8ca" dependencies: @@ -575,18 +584,17 @@ babel-plugin-check-es2015-constants@^6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-istanbul@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-2.0.3.tgz#266b304b9109607d60748474394676982f660df4" +babel-plugin-istanbul@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.1.tgz#c12de0fc6fe42adfb16be56f1ad11e4a9782eca9" dependencies: - find-up "^1.1.2" - istanbul-lib-instrument "^1.1.4" - object-assign "^4.1.0" - test-exclude "^2.1.1" + find-up "^2.1.0" + istanbul-lib-instrument "^1.6.2" + test-exclude "^4.0.3" -babel-plugin-jest-hoist@^15.0.0: - version "15.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-15.0.0.tgz#7b2fdbd0cd12fc36a84d3f5ff001ec504262bb59" +babel-plugin-jest-hoist@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-19.0.0.tgz#4ae2a04ea612a6e73651f3fde52c178991304bea" babel-plugin-syntax-async-functions@^6.8.0: version "6.13.0" @@ -664,7 +672,7 @@ babel-plugin-transform-class-constructor-call@^6.22.0: babel-runtime "^6.22.0" babel-template "^6.22.0" -babel-plugin-transform-class-properties@^6.18.0, babel-plugin-transform-class-properties@^6.22.0: +babel-plugin-transform-class-properties@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.22.0.tgz#aa78f8134495c7de06c097118ba061844e1dc1d8" dependencies: @@ -673,6 +681,15 @@ babel-plugin-transform-class-properties@^6.18.0, babel-plugin-transform-class-pr babel-runtime "^6.22.0" babel-template "^6.22.0" +babel-plugin-transform-class-properties@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.23.0.tgz#187b747ee404399013563c993db038f34754ac3b" + dependencies: + babel-helper-function-name "^6.23.0" + babel-plugin-syntax-class-properties "^6.8.0" + babel-runtime "^6.22.0" + babel-template "^6.23.0" + babel-plugin-transform-decorators-legacy@^1.3.4: version "1.3.4" resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators-legacy/-/babel-plugin-transform-decorators-legacy-1.3.4.tgz#741b58f6c5bce9e6027e0882d9c994f04f366925" @@ -894,18 +911,18 @@ babel-plugin-transform-object-assign@^6.8.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-object-rest-spread@^6.16.0, babel-plugin-transform-object-rest-spread@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.22.0.tgz#1d419b55e68d2e4f64a5ff3373bd67d73c8e83bc" +babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz#875d6bc9be761c58a2ae3feee5dc4895d8c7f921" dependencies: babel-plugin-syntax-object-rest-spread "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-react-jsx@^6.8.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.22.0.tgz#48556b7dd4c3fe97d1c943bcd54fc3f2561c1817" +babel-plugin-transform-react-jsx@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.23.0.tgz#23e892f7f2e759678eb5e4446a8f8e94e81b3470" dependencies: - babel-helper-builder-react-jsx "^6.22.0" + babel-helper-builder-react-jsx "^6.23.0" babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.22.0" @@ -922,15 +939,15 @@ babel-plugin-transform-strict-mode@^6.22.0: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-polyfill@^6.16.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.22.0.tgz#1ac99ebdcc6ba4db1e2618c387b2084a82154a3b" +babel-polyfill@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d" dependencies: babel-runtime "^6.22.0" core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-preset-es2015@^6.18.0: +babel-preset-es2015@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.0.tgz#c162d68b1932696e036cd3110dc1ccd303d2673a" dependencies: @@ -959,11 +976,11 @@ babel-preset-es2015@^6.18.0: babel-plugin-transform-es2015-unicode-regex "^6.22.0" babel-plugin-transform-regenerator "^6.22.0" -babel-preset-jest@^15.0.0: - version "15.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-15.0.0.tgz#f23988f1f918673ff9b470fdfd60fcc19bc618f5" +babel-preset-jest@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-19.0.0.tgz#22d67201d02324a195811288eb38294bb3cac396" dependencies: - babel-plugin-jest-hoist "^15.0.0" + babel-plugin-jest-hoist "^19.0.0" babel-preset-stage-0@^6.16.0: version "6.22.0" @@ -1029,7 +1046,7 @@ babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0, babel-te babylon "^6.11.0" lodash "^4.2.0" -babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: +babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: @@ -1043,7 +1060,7 @@ babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-tr invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.15.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: +babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: @@ -1056,6 +1073,10 @@ babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: version "6.15.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" +babylon@^6.16.1: + version "6.16.1" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" + balanced-match@0.1.0, balanced-match@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.1.0.tgz#b504bd05869b39259dd0c5efc35d843176dccc4a" @@ -1080,9 +1101,9 @@ base64url@2.0.0, base64url@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/base64url/-/base64url-2.0.0.tgz#eac16e03ea1438eff9423d69baa36262ed1f70bb" -basic-auth@~1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-1.0.4.tgz#030935b01de7c9b94a824b29f3fccb750d3a5290" +basic-auth@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-1.1.0.tgz#45221ee429f7ee1e5035be3f51533f1cdfd29884" bcrypt-pbkdf@^1.0.0: version "1.0.0" @@ -1146,7 +1167,7 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: version "4.11.6" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" -body-parser@^1.12.2, body-parser@^1.15.2: +body-parser@^1.12.2: version "1.16.0" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.16.0.tgz#924a5e472c6229fb9d69b85a20d5f2532dec788b" dependencies: @@ -1161,6 +1182,21 @@ body-parser@^1.12.2, body-parser@^1.15.2: raw-body "~2.2.0" type-is "~1.6.14" +body-parser@^1.17.1: + version "1.17.1" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.17.1.tgz#75b3bc98ddd6e7e0d8ffe750dfaca5c66993fa47" + dependencies: + bytes "2.4.0" + content-type "~1.0.2" + debug "2.6.1" + depd "~1.1.0" + http-errors "~1.6.1" + iconv-lite "0.4.15" + on-finished "~2.3.0" + qs "6.4.0" + raw-body "~2.2.0" + type-is "~1.6.14" + boolbase@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" @@ -1735,12 +1771,12 @@ connect-redis@^3.1.0: debug "^2.2.0" redis "^2.1.0" -connect@3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/connect/-/connect-3.5.0.tgz#b357525a0b4c1f50599cd983e1d9efeea9677198" +connect@3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/connect/-/connect-3.6.0.tgz#f09a4f7dcd17324b663b725c815bdb1c4158a46e" dependencies: - debug "~2.2.0" - finalhandler "0.5.0" + debug "2.6.1" + finalhandler "1.0.0" parseurl "~1.3.1" utils-merge "1.0.0" @@ -1787,12 +1823,6 @@ content-type@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.2.tgz#b7d113aee7a8dd27bd21133c4dc2529df1721eed" -contents-loader@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/contents-loader/-/contents-loader-1.0.0.tgz#8ca18fbe70d63837c020737de55d29fa0823ce3f" - dependencies: - loader-utils "^1.0.2" - conventional-commit-message@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/conventional-commit-message/-/conventional-commit-message-1.1.0.tgz#ece8c661a168e983692e1d5a14875acb59510f6a" @@ -1928,22 +1958,22 @@ css-color-names@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" -css-loader@^0.25.0: - version "0.25.0" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.25.0.tgz#c3febc8ce28f4c83576b6b13707f47f90c390223" +css-loader@^0.27.3: + version "0.27.3" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.27.3.tgz#69ab6f47b69bfb1b5acee61bac2aab14302ff0dc" dependencies: babel-code-frame "^6.11.0" - css-selector-tokenizer "^0.6.0" + css-selector-tokenizer "^0.7.0" cssnano ">=2.6.1 <4" - loader-utils "~0.2.2" - lodash.camelcase "^3.0.1" + loader-utils "^1.0.2" + lodash.camelcase "^4.3.0" object-assign "^4.0.1" postcss "^5.0.6" postcss-modules-extract-imports "^1.0.0" postcss-modules-local-by-default "^1.0.1" postcss-modules-scope "^1.0.0" postcss-modules-values "^1.1.0" - source-list-map "^0.1.4" + source-list-map "^0.1.7" css-modules-loader-core@^1.0.1: version "1.0.1" @@ -1977,6 +2007,14 @@ css-selector-tokenizer@^0.6.0: fastparse "^1.1.1" regexpu-core "^1.0.0" +css-selector-tokenizer@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz#e6988474ae8c953477bf5e7efecfceccd9cf4c86" + dependencies: + cssesc "^0.1.0" + fastparse "^1.1.1" + regexpu-core "^1.0.0" + css-what@2.1: version "2.1.0" resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.0.tgz#9467d032c38cfaefb9f2d79501253062f87fa1bd" @@ -2082,9 +2120,9 @@ data-uri-to-buffer@0: version "0.0.4" resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-0.0.4.tgz#46e13ab9da8e309745c8d01ce547213ebdb2fe3f" -dataloader@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-1.2.0.tgz#3f73ea657c492c860c1633348adc55ca9bf2107e" +dataloader@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-1.3.0.tgz#6fec5be4b30a712e4afd30b86b4334566b97673b" date-format@^0.0.0: version "0.0.0" @@ -2112,6 +2150,18 @@ debug@2.3.3: dependencies: ms "0.7.2" +debug@2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.1.tgz#79855090ba2c4e3115cc7d8769491d58f0491351" + dependencies: + ms "0.7.2" + +debug@2.6.3, debug@^2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" + dependencies: + ms "0.7.2" + debug@^0.7.2, debug@~0.7.4: version "0.7.4" resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39" @@ -2198,7 +2248,7 @@ delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" -depd@~1.1.0: +depd@1.1.0, depd@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.0.tgz#e1bd82c6aab6ced965b97b88b17ed3e528ca18c3" @@ -2335,9 +2385,9 @@ ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" -ejs@^2.5.2: - version "2.5.5" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.5.tgz#6ef4e954ea7dcf54f66aad2fe7aa421932d9ed77" +ejs@^2.5.6: + version "2.5.6" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.6.tgz#479636bfa3fe3b1debd52087f0acb204b4f19c88" ejs@~0.8.3: version "0.8.8" @@ -2697,6 +2747,10 @@ etag@~1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8" +etag@~1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.0.tgz#6f631aef336d6c46362b51764044ce216be3c051" + event-emitter@~0.3.4: version "0.3.4" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.4.tgz#8d63ddfb4cfe1fae3b32ca265c4c720222080bb5" @@ -2742,28 +2796,28 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -exports-loader@^0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/exports-loader/-/exports-loader-0.6.3.tgz#57dc78917f709b96f247fa91e69b554c855013c8" +exports-loader@^0.6.4: + version "0.6.4" + resolved "https://registry.yarnpkg.com/exports-loader/-/exports-loader-0.6.4.tgz#d70fc6121975b35fc12830cf52754be2740fc886" dependencies: - loader-utils "0.2.x" - source-map "0.1.x" + loader-utils "^1.0.2" + source-map "0.5.x" -express-session@^1.14.2: - version "1.15.0" - resolved "https://registry.yarnpkg.com/express-session/-/express-session-1.15.0.tgz#67131dd5b78a42bc57b50af0a14880265c03f919" +express-session@^1.15.1: + version "1.15.2" + resolved "https://registry.yarnpkg.com/express-session/-/express-session-1.15.2.tgz#d98516443a4ccb8688e1725ae584c02daa4093d4" dependencies: cookie "0.3.1" cookie-signature "1.0.6" crc "3.4.4" - debug "2.6.0" + debug "2.6.3" depd "~1.1.0" on-headers "~1.0.1" parseurl "~1.3.1" - uid-safe "~2.1.3" + uid-safe "~2.1.4" utils-merge "1.0.0" -express@^4.12.2, express@^4.14.0: +express@^4.12.2: version "4.14.1" resolved "https://registry.yarnpkg.com/express/-/express-4.14.1.tgz#646c237f766f148c2120aff073817b9e4d7e0d33" dependencies: @@ -2794,6 +2848,39 @@ express@^4.12.2, express@^4.14.0: utils-merge "1.0.0" vary "~1.1.0" +express@^4.15.2: + version "4.15.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.15.2.tgz#af107fc148504457f2dca9a6f2571d7129b97b35" + dependencies: + accepts "~1.3.3" + array-flatten "1.1.1" + content-disposition "0.5.2" + content-type "~1.0.2" + cookie "0.3.1" + cookie-signature "1.0.6" + debug "2.6.1" + depd "~1.1.0" + encodeurl "~1.0.1" + escape-html "~1.0.3" + etag "~1.8.0" + finalhandler "~1.0.0" + fresh "0.5.0" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "~2.3.0" + parseurl "~1.3.1" + path-to-regexp "0.1.7" + proxy-addr "~1.1.3" + qs "6.4.0" + range-parser "~1.2.0" + send "0.15.1" + serve-static "1.12.1" + setprototypeof "1.0.3" + statuses "~1.3.1" + type-is "~1.6.14" + utils-merge "1.0.0" + vary "~1.1.0" + extend@3, extend@^3.0.0, extend@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" @@ -2826,7 +2913,7 @@ fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" -fbjs@^0.8.1, fbjs@^0.8.4: +fbjs@^0.8.4: version "0.8.11" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.11.tgz#340b590b8a2278a01ef7467c07a16da9b753db24" dependencies: @@ -2897,16 +2984,6 @@ fill-range@^2.1.0: repeat-element "^1.1.2" repeat-string "^1.5.2" -finalhandler@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-0.5.0.tgz#e9508abece9b6dba871a6942a1d7911b91911ac7" - dependencies: - debug "~2.2.0" - escape-html "~1.0.3" - on-finished "~2.3.0" - statuses "~1.3.0" - unpipe "~1.0.0" - finalhandler@0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-0.5.1.tgz#2c400d8d4530935bc232549c5fa385ec07de6fcd" @@ -2917,6 +2994,30 @@ finalhandler@0.5.1: statuses "~1.3.1" unpipe "~1.0.0" +finalhandler@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.0.0.tgz#b5691c2c0912092f18ac23e9416bde5cd7dc6755" + dependencies: + debug "2.6.1" + encodeurl "~1.0.1" + escape-html "~1.0.3" + on-finished "~2.3.0" + parseurl "~1.3.1" + statuses "~1.3.1" + unpipe "~1.0.0" + +finalhandler@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.0.1.tgz#bcd15d1689c0e5ed729b6f7f541a6df984117db8" + dependencies: + debug "2.6.3" + encodeurl "~1.0.1" + escape-html "~1.0.3" + on-finished "~2.3.0" + parseurl "~1.3.1" + statuses "~1.3.1" + unpipe "~1.0.0" + find-cache-dir@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" @@ -2925,13 +3026,19 @@ find-cache-dir@^0.1.1: mkdirp "^0.5.1" pkg-dir "^1.0.0" -find-up@^1.0.0, find-up@^1.1.2: +find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" dependencies: path-exists "^2.0.0" pinkie-promise "^2.0.0" +find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + findup@0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/findup/-/findup-0.1.5.tgz#8ad929a3393bac627957a7e5de4623b06b0e2ceb" @@ -3010,6 +3117,10 @@ fresh@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.3.0.tgz#651f838e22424e7566de161d8358caa199f83d4f" +fresh@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.0.tgz#f474ca5e6a9246d6fd8e0953cfa9b9c805afa78e" + from@~0: version "0.1.3" resolved "https://registry.yarnpkg.com/from/-/from-0.1.3.tgz#ef63ac2062ac32acf7862e0d40b44b896f22f3bc" @@ -3477,9 +3588,9 @@ hawk@~3.1.3: hoek "2.x.x" sntp "1.x.x" -helmet-csp@2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/helmet-csp/-/helmet-csp-2.3.0.tgz#bc341939dfef5266cc817abcf53f079f61fe7e3f" +helmet-csp@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/helmet-csp/-/helmet-csp-2.4.0.tgz#7e53a157167a0645aadd7177d12ae6c605c1842e" dependencies: camelize "1.0.0" content-security-policy-builder "1.1.0" @@ -3487,15 +3598,15 @@ helmet-csp@2.3.0: lodash.reduce "4.6.0" platform "1.3.3" -helmet@^3.1.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/helmet/-/helmet-3.4.0.tgz#05a9437486b05ca219ed8d21dc5e3b6ec0c18118" +helmet@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/helmet/-/helmet-3.5.0.tgz#e1d6de27d2e3317d3182e00d672df3d0e1e12539" dependencies: - connect "3.5.0" + connect "3.6.0" dns-prefetch-control "0.1.0" dont-sniff-mimetype "1.0.0" frameguard "3.0.0" - helmet-csp "2.3.0" + helmet-csp "2.4.0" hide-powered-by "1.0.0" hpkp "2.0.0" hsts "2.0.0" @@ -3538,9 +3649,9 @@ home-or-tmp@^2.0.0: os-homedir "^1.0.0" os-tmpdir "^1.0.1" -hooks-fixed@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/hooks-fixed/-/hooks-fixed-1.2.0.tgz#0d2772d4d7d685ff9244724a9f0b5b2559aac96b" +hooks-fixed@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hooks-fixed/-/hooks-fixed-2.0.0.tgz#a01d894d52ac7f6599bbb1f63dfc9c411df70cba" hosted-git-info@^2.1.4: version "2.1.5" @@ -3599,6 +3710,15 @@ http-errors@~1.5.0, http-errors@~1.5.1: setprototypeof "1.0.2" statuses ">= 1.3.1 < 2" +http-errors@~1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.1.tgz#5f8b8ed98aca545656bf572997387f904a722257" + dependencies: + depd "1.1.0" + inherits "2.0.3" + setprototypeof "1.0.3" + statuses ">= 1.3.1 < 2" + http-proxy-agent@1: version "1.0.0" resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-1.0.0.tgz#cc1ce38e453bf984a0f7702d2dd59c73d081284a" @@ -3674,12 +3794,12 @@ immutable@^3.8.1: version "3.8.1" resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz#200807f11ab0f72710ea485542de088075f68cd2" -imports-loader@^0.6.5: - version "0.6.5" - resolved "https://registry.yarnpkg.com/imports-loader/-/imports-loader-0.6.5.tgz#ae74653031d59e37b3c2fb2544ac61aeae3530a6" +imports-loader@^0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/imports-loader/-/imports-loader-0.7.1.tgz#f204b5f34702a32c1db7d48d89d5e867a0441253" dependencies: - loader-utils "0.2.x" - source-map "0.1.x" + loader-utils "^1.0.2" + source-map "^0.5.6" imurmurhash@^0.1.4: version "0.1.4" @@ -3771,9 +3891,9 @@ inquirer@0.8.2: rx "^2.4.3" through "^2.3.6" -inquirer@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.1.tgz#6dfbffaf4d697dd76c8fe349f919de01c28afc4d" +inquirer@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.6.tgz#e04aaa9d05b7a3cb9b0f407d04375f0447190347" dependencies: ansi-escapes "^1.1.0" chalk "^1.0.0" @@ -4089,13 +4209,17 @@ istanbul-lib-coverage@^1.0.0, istanbul-lib-coverage@^1.0.0-alpha, istanbul-lib-c version "1.0.1" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.1.tgz#f263efb519c051c5f1f3343034fc40e7b43ff212" +istanbul-lib-coverage@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz#87a0c015b6910651cb3b184814dfb339337e25e1" + istanbul-lib-hook@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.0.tgz#fc5367ee27f59268e8f060b0c7aaf051d9c425c5" dependencies: append-transform "^0.4.0" -istanbul-lib-instrument@^1.1.4, istanbul-lib-instrument@^1.3.0: +istanbul-lib-instrument@^1.3.0: version "1.4.2" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.4.2.tgz#0e2fdfac93c1dabf2e31578637dc78a19089f43e" dependencies: @@ -4107,6 +4231,18 @@ istanbul-lib-instrument@^1.1.4, istanbul-lib-instrument@^1.3.0: istanbul-lib-coverage "^1.0.0" semver "^5.3.0" +istanbul-lib-instrument@^1.6.2: + version "1.7.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.0.tgz#b8e0dc25709bb44e17336ab47b7bb5c97c23f659" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.13.0" + istanbul-lib-coverage "^1.0.2" + semver "^5.3.0" + istanbul-lib-report@^1.0.0-alpha.3: version "1.0.0-alpha.3" resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.0.0-alpha.3.tgz#32d5f6ec7f33ca3a602209e278b2e6ff143498af" @@ -4288,9 +4424,9 @@ jsonpointer@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" -jsonwebtoken@^7.1.9: - version "7.2.1" - resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-7.2.1.tgz#0fc7217473fc02b4c9aa1e188aa70b51bba4fccb" +jsonwebtoken@^7.3.0: + version "7.3.0" + resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-7.3.0.tgz#85118d6a70e3fccdf14389f4e7a1c3f9c8a9fbba" dependencies: joi "^6.10.1" jws "^3.1.4" @@ -4337,9 +4473,9 @@ jws@^3.1.4: jwa "^1.1.4" safe-buffer "^5.0.1" -kareem@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/kareem/-/kareem-1.2.0.tgz#59851e833feb1ce6cf60000e0c23acf75c8a3547" +kareem@1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/kareem/-/kareem-1.2.1.tgz#acdb8c8119845834abbfa58ade1cf9dea63dc752" keymaster@^1.6.2: version "1.6.2" @@ -4464,7 +4600,7 @@ loader-runner@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" -loader-utils@0.2.x, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.7, loader-utils@~0.2.2: +loader-utils@^0.2.15, loader-utils@^0.2.16: version "0.2.16" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d" dependencies: @@ -4481,6 +4617,13 @@ loader-utils@^1.0.2: emojis-list "^2.0.0" json5 "^0.5.0" +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + lodash-es@^4.2.1: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.4.tgz#dcc1d7552e150a0640073ba9cb31d70f032950e7" @@ -4535,13 +4678,6 @@ lodash._createassigner@^3.0.0: lodash._isiterateecall "^3.0.0" lodash.restparam "^3.0.0" -lodash._createcompounder@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash._createcompounder/-/lodash._createcompounder-3.0.0.tgz#5dd2cb55372d6e70e0e2392fb2304d6631091075" - dependencies: - lodash.deburr "^3.0.0" - lodash.words "^3.0.0" - lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" @@ -4550,10 +4686,6 @@ lodash._isiterateecall@^3.0.0: version "3.0.9" resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" -lodash._root@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" - lodash.assign@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-3.2.0.tgz#3ce9f0234b4b2223e296b8fa0ac1fee8ebca64fa" @@ -4574,11 +4706,9 @@ lodash.bind@^4.1.4: version "4.2.1" resolved "https://registry.yarnpkg.com/lodash.bind/-/lodash.bind-4.2.1.tgz#7ae3017e939622ac31b7d7d7dcb1b34db1690d35" -lodash.camelcase@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-3.0.1.tgz#932c8b87f8a4377897c67197533282f97aeac298" - dependencies: - lodash._createcompounder "^3.0.0" +lodash.camelcase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" lodash.clone@^3.0.3: version "3.0.3" @@ -4600,12 +4730,6 @@ lodash.create@3.1.1, lodash.create@^3.1.1: lodash._basecreate "^3.0.0" lodash._isiterateecall "^3.0.0" -lodash.deburr@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash.deburr/-/lodash.deburr-3.2.0.tgz#6da8f54334a366a7cf4c4c76ef8d80aa1b365ed5" - dependencies: - lodash._root "^3.0.0" - lodash.defaults@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-3.1.2.tgz#c7308b18dbf8bc9372d701a73493c61192bd2e2c" @@ -4681,10 +4805,6 @@ lodash.pick@^4.2.1, lodash.pick@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" -lodash.pickby@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" - lodash.reduce@4.6.0, lodash.reduce@^4.4.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.reduce/-/lodash.reduce-4.6.0.tgz#f1ab6b839299ad48f784abbf476596f03b914d3b" @@ -4705,12 +4825,6 @@ lodash.uniq@^4.3.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" -lodash.words@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash.words/-/lodash.words-3.2.0.tgz#4e2a8649bc08745b17c695b1a3ce8fee596623b3" - dependencies: - lodash._root "^3.0.0" - lodash@3.10.1, lodash@^3.3.1: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" @@ -4984,44 +5098,44 @@ moment@2.x.x, moment@^2.10.3: version "2.17.1" resolved "https://registry.yarnpkg.com/moment/-/moment-2.17.1.tgz#fed9506063f36b10f066c8b59a144d7faebe1d82" -mongodb-core@2.1.7: - version "2.1.7" - resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.7.tgz#6a27909b98142ef2508d924c274969008954fa29" +mongodb-core@2.1.9: + version "2.1.9" + resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.9.tgz#85aa71ee4fb716196e06b787557bf139f801daf5" dependencies: bson "~1.0.4" require_optional "~1.0.0" -mongodb@2.2.22: - version "2.2.22" - resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-2.2.22.tgz#d67c588fc08f922db19754b1d2e03e2d7d1319fb" +mongodb@2.2.25: + version "2.2.25" + resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-2.2.25.tgz#d3b25dad00eda2bdfcbc996210ba082ac686a6b6" dependencies: es6-promise "3.2.1" - mongodb-core "2.1.7" + mongodb-core "2.1.9" readable-stream "2.1.5" -mongoose@^4.6.5: - version "4.8.1" - resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-4.8.1.tgz#1dbd3014fb39e9344271a53ec5dd741205864aae" +mongoose@^4.9.1: + version "4.9.2" + resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-4.9.2.tgz#df137675eed76a14dc1e6952ede54497c7547926" dependencies: async "2.1.4" bson "~1.0.4" - hooks-fixed "1.2.0" - kareem "1.2.0" - mongodb "2.2.22" + hooks-fixed "2.0.0" + kareem "1.2.1" + mongodb "2.2.25" mpath "0.2.1" mpromise "0.5.5" - mquery "2.2.1" + mquery "2.3.0" ms "0.7.2" - muri "1.2.0" + muri "1.2.1" regexp-clone "0.0.1" sliced "1.0.1" -morgan@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.7.0.tgz#eb10ca8e50d1abe0f8d3dad5c0201d052d981c62" +morgan@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.8.1.tgz#f93023d3887bd27b78dfd6023cea7892ee27a4b1" dependencies: - basic-auth "~1.0.3" - debug "~2.2.0" + basic-auth "~1.1.0" + debug "2.6.1" depd "~1.1.0" on-finished "~2.3.0" on-headers "~1.0.1" @@ -5034,9 +5148,9 @@ mpromise@0.5.5: version "0.5.5" resolved "https://registry.yarnpkg.com/mpromise/-/mpromise-0.5.5.tgz#f5b24259d763acc2257b0a0c8c6d866fd51732e6" -mquery@2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/mquery/-/mquery-2.2.1.tgz#aa31076419adce2b06e9757f4cfc5d7f371b47ce" +mquery@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/mquery/-/mquery-2.3.0.tgz#3d1717ad8958d0c99e42ea2461a109f3e5f3e458" dependencies: bluebird "2.10.2" debug "2.2.0" @@ -5051,9 +5165,9 @@ ms@0.7.2, ms@^0.7.1: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" -muri@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/muri/-/muri-1.2.0.tgz#b86383c902920b09ebe62af0e75c94de5f33cd3d" +muri@1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/muri/-/muri-1.2.1.tgz#ec7ea5ce6ca6a523eb1ab35bacda5fa816c9aa3c" mute-stream@0.0.4: version "0.0.4" @@ -5341,7 +5455,7 @@ object-assign@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2" -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -5461,6 +5575,16 @@ osenv@^0.1.0: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +p-limit@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + dependencies: + p-limit "^1.1.0" + pac-proxy-agent@1: version "1.0.0" resolved "https://registry.yarnpkg.com/pac-proxy-agent/-/pac-proxy-agent-1.0.0.tgz#dcd5b746581367430a236e88eacfd4e5b8d068a5" @@ -5582,6 +5706,10 @@ path-exists@^2.0.0: dependencies: pinkie-promise "^2.0.0" +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -5802,37 +5930,37 @@ postcss-filter-plugins@^2.0.0: postcss "^5.0.4" uniqid "^4.0.0" -postcss-load-config@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-1.1.0.tgz#1c3c217608642448c03bebf3c32b1b28985293f9" +postcss-load-config@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-1.2.0.tgz#539e9afc9ddc8620121ebf9d8c3673e0ce50d28a" dependencies: cosmiconfig "^2.1.0" object-assign "^4.1.0" - postcss-load-options "^1.1.0" - postcss-load-plugins "^2.2.0" + postcss-load-options "^1.2.0" + postcss-load-plugins "^2.3.0" -postcss-load-options@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/postcss-load-options/-/postcss-load-options-1.1.0.tgz#e39215d154a19f69f9cb6052bffad4a82f09f354" +postcss-load-options@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/postcss-load-options/-/postcss-load-options-1.2.0.tgz#b098b1559ddac2df04bc0bb375f99a5cfe2b6d8c" dependencies: cosmiconfig "^2.1.0" object-assign "^4.1.0" -postcss-load-plugins@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/postcss-load-plugins/-/postcss-load-plugins-2.2.0.tgz#84ef9cf36e637810ac5265e03f6d4c48ead83314" +postcss-load-plugins@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/postcss-load-plugins/-/postcss-load-plugins-2.3.0.tgz#745768116599aca2f009fad426b00175049d8d92" dependencies: cosmiconfig "^2.1.1" object-assign "^4.1.0" -postcss-loader@^1.1.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-1.2.2.tgz#bbf4e19a8cde85597e0c9bfd96015fe775a157ac" +postcss-loader@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-1.3.3.tgz#a621ea1fa29062a83972a46f54486771301916eb" dependencies: - loader-utils "^0.2.16" - object-assign "^4.1.0" - postcss "^5.2.9" - postcss-load-config "^1.1.0" + loader-utils "^1.0.2" + object-assign "^4.1.1" + postcss "^5.2.15" + postcss-load-config "^1.2.0" postcss-media-minmax@^2.1.0: version "2.1.2" @@ -5909,18 +6037,12 @@ postcss-mixins@^2.1.0: postcss "^5.0.10" postcss-simple-vars "^1.0.1" -postcss-modules-extract-imports@1.0.0: +postcss-modules-extract-imports@1.0.0, postcss-modules-extract-imports@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.0.0.tgz#5b07f368e350cda6fd5c8844b79123a7bd3e37be" dependencies: postcss "^5.0.4" -postcss-modules-extract-imports@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.0.1.tgz#8fb3fef9a6dd0420d3f6d4353cf1ff73f2b2a341" - dependencies: - postcss "^5.0.4" - postcss-modules-local-by-default@1.1.1, postcss-modules-local-by-default@^1.0.1: version "1.1.1" resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.1.1.tgz#29a10673fa37d19251265ca2ba3150d9040eb4ce" @@ -6109,7 +6231,7 @@ postcss@5.1.2: source-map "^0.5.6" supports-color "^3.1.2" -postcss@^5.0.0, postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.14, postcss@^5.0.16, postcss@^5.0.19, postcss@^5.0.2, postcss@^5.0.4, postcss@^5.0.5, postcss@^5.0.6, postcss@^5.0.8, postcss@^5.1.2, postcss@^5.2.11, postcss@^5.2.4, postcss@^5.2.5, postcss@^5.2.9: +postcss@^5.0.0, postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.14, postcss@^5.0.16, postcss@^5.0.19, postcss@^5.0.2, postcss@^5.0.4, postcss@^5.0.5, postcss@^5.0.6, postcss@^5.0.8, postcss@^5.1.2, postcss@^5.2.11, postcss@^5.2.4, postcss@^5.2.5: version "5.2.11" resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.11.tgz#ff29bcd6d2efb98bfe08a022055ec599bbe7b761" dependencies: @@ -6118,6 +6240,15 @@ postcss@^5.0.0, postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0. source-map "^0.5.6" supports-color "^3.2.3" +postcss@^5.2.15: + version "5.2.16" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.16.tgz#732b3100000f9ff8379a48a53839ed097376ad57" + dependencies: + chalk "^1.1.3" + js-base64 "^2.1.9" + source-map "^0.5.6" + supports-color "^3.2.3" + pre-git@^3.10.0: version "3.12.0" resolved "https://registry.yarnpkg.com/pre-git/-/pre-git-3.12.0.tgz#8291899a15ba86f9cdaa8ca180e47096deff8dc3" @@ -6371,6 +6502,10 @@ qs@6.2.1, qs@^6.1.0, qs@^6.2.0: version "6.2.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.2.1.tgz#ce03c5ff0935bc1d9d69a9f14cbd18e568d67625" +qs@6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" + qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" @@ -6457,15 +6592,7 @@ react-apollo@^0.10.0: optionalDependencies: react-dom "0.14.x || 15.* || ^15.0.0" -"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1: - version "15.4.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.2.tgz#015363f05b0a1fd52ae9efdd3a0060d90695208f" - dependencies: - fbjs "^0.8.1" - loose-envify "^1.1.0" - object-assign "^4.1.0" - -react-dom@15.3.2: +"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@15.3.2, react-dom@^15.3.1: version "15.3.2" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.3.2.tgz#c46b0aa5380d7b838e7a59c4a7beff2ed315531f" @@ -6656,11 +6783,15 @@ redis-parser@^2.0.0: version "2.4.0" resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-2.4.0.tgz#018ea743077aae944d0b798b2fd12587320bf3c9" +redis-parser@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-2.5.0.tgz#79fc2b1d4a6e4d2870b35368433639271fca2617" + redis@^0.12.1: version "0.12.1" resolved "https://registry.yarnpkg.com/redis/-/redis-0.12.1.tgz#64df76ad0fc8acebaebd2a0645e8a48fac49185e" -redis@^2.1.0, redis@^2.6.5, redis@~2.6.0-2: +redis@^2.1.0, redis@~2.6.0-2: version "2.6.5" resolved "https://registry.yarnpkg.com/redis/-/redis-2.6.5.tgz#87c1eff4a489f94b70871f3d08b6988f23a95687" dependencies: @@ -6668,6 +6799,14 @@ redis@^2.1.0, redis@^2.6.5, redis@~2.6.0-2: redis-commands "^1.2.0" redis-parser "^2.0.0" +redis@^2.7.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/redis/-/redis-2.7.1.tgz#7d56f7875b98b20410b71539f1d878ed58ebf46a" + dependencies: + double-ended-queue "^2.1.0-0" + redis-commands "^1.2.0" + redis-parser "^2.5.0" + reds@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/reds/-/reds-0.2.5.tgz#38a767f7663cd749036848697d82c74fd29bc01f" @@ -7002,6 +7141,33 @@ send@0.14.2: range-parser "~1.2.0" statuses "~1.3.1" +send@0.15.1: + version "0.15.1" + resolved "https://registry.yarnpkg.com/send/-/send-0.15.1.tgz#8a02354c26e6f5cca700065f5f0cdeba90ec7b5f" + dependencies: + debug "2.6.1" + depd "~1.1.0" + destroy "~1.0.4" + encodeurl "~1.0.1" + escape-html "~1.0.3" + etag "~1.8.0" + fresh "0.5.0" + http-errors "~1.6.1" + mime "1.3.4" + ms "0.7.2" + on-finished "~2.3.0" + range-parser "~1.2.0" + statuses "~1.3.1" + +serve-static@1.12.1: + version "1.12.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.12.1.tgz#7443a965e3ced647aceb5639fa06bf4d1bbe0039" + dependencies: + encodeurl "~1.0.1" + escape-html "~1.0.3" + parseurl "~1.3.1" + send "0.15.1" + serve-static@~1.11.2: version "1.11.2" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.11.2.tgz#2cf9889bd4435a320cc36895c9aa57bd662e6ac7" @@ -7027,6 +7193,10 @@ setprototypeof@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.2.tgz#81a552141ec104b88e89ce383103ad5c66564d08" +setprototypeof@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04" + sha.js@^2.3.6: version "2.4.8" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.8.tgz#37068c2c476b6baf402d14a49c67f597921f634f" @@ -7132,10 +7302,14 @@ sort-keys@^1.0.0: dependencies: is-plain-obj "^1.0.0" -source-list-map@^0.1.4, source-list-map@~0.1.7: +source-list-map@^0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106" +source-list-map@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.1.tgz#1a33ac210ca144d1e561f906ebccab5669ff4cb4" + source-map-support@^0.4.2: version "0.4.11" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.11.tgz#647f939978b38535909530885303daf23279f322" @@ -7154,7 +7328,7 @@ source-map@0.4.x, source-map@^0.4.4: dependencies: amdefine ">=0.0.4" -source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3: +source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" @@ -7211,7 +7385,7 @@ stable@~0.1.3: version "0.1.5" resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.5.tgz#08232f60c732e9890784b5bed0734f8b32a887b9" -"statuses@>= 1.3.1 < 2", statuses@~1.3.0, statuses@~1.3.1: +"statuses@>= 1.3.1 < 2", statuses@~1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" @@ -7335,11 +7509,11 @@ strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" -style-loader@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.13.1.tgz#468280efbc0473023cd3a6cd56e33b5a1d7fc3a9" +style-loader@^0.16.0: + version "0.16.1" + resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.16.1.tgz#50e325258d4e78421dd9680636b41e8661595d10" dependencies: - loader-utils "^0.2.7" + loader-utils "^1.0.2" stylus@0.54.5, stylus@~0.54.5: version "0.54.5" @@ -7384,7 +7558,7 @@ supports-color@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-1.2.0.tgz#ff1ed1e61169d06b3cf2d588e188b18d8847e17e" -supports-color@3.1.2, supports-color@^3.1.0: +supports-color@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" dependencies: @@ -7398,7 +7572,7 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^3.1.2, supports-color@^3.2.3: +supports-color@^3.1.0, supports-color@^3.1.2, supports-color@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" dependencies: @@ -7477,9 +7651,9 @@ tcomb@^2.5.1: version "2.7.0" resolved "https://registry.yarnpkg.com/tcomb/-/tcomb-2.7.0.tgz#10d62958041669a5d53567b9a4ee8cde22b1c2b0" -test-exclude@^2.1.1: - version "2.1.3" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-2.1.3.tgz#a8d8968e1da83266f9864f2852c55e220f06434a" +test-exclude@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.0.3.tgz#86a13ce3effcc60e6c90403cf31a27a60ac6c4e7" dependencies: arrify "^1.0.1" micromatch "^2.3.11" @@ -7659,7 +7833,7 @@ uc.micro@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.3.tgz#7ed50d5e0f9a9fb0a573379259f2a77458d50192" -uglify-js@^2.6, uglify-js@^2.6.1, uglify-js@^2.7.5: +uglify-js@^2.6, uglify-js@^2.6.1: version "2.7.5" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8" dependencies: @@ -7668,6 +7842,15 @@ uglify-js@^2.6, uglify-js@^2.6.1, uglify-js@^2.7.5: uglify-to-browserify "~1.0.0" yargs "~3.10.0" +uglify-js@^2.8.5: + version "2.8.17" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.17.tgz#b68ea00a1cef853960bc99b8dec7740d2553f20b" + dependencies: + source-map "~0.5.1" + yargs "~3.10.0" + optionalDependencies: + uglify-to-browserify "~1.0.0" + uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" @@ -7676,13 +7859,19 @@ uid-number@~0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" -uid-safe@2.1.3, uid-safe@~2.1.3: +uid-safe@2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.3.tgz#077e264a00b3187936b270bb7376a26473631071" dependencies: base64-url "1.3.3" random-bytes "~1.0.0" +uid-safe@~2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.4.tgz#3ad6f38368c6d4c8c75ec17623fb79aa1d071d81" + dependencies: + random-bytes "~1.0.0" + uid2@0.0.x: version "0.0.3" resolved "https://registry.yarnpkg.com/uid2/-/uid2-0.0.3.tgz#483126e11774df2f71b8b639dcd799c376162b82" @@ -7812,9 +8001,9 @@ warning@^3.0.0: dependencies: loose-envify "^1.0.0" -watchpack@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.2.0.tgz#15d4620f1e7471f13fcb551d5c030d2c3eb42dbb" +watchpack@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.3.1.tgz#7d8693907b28ce6013e7f3610aa2a1acf07dad87" dependencies: async "^2.1.2" chokidar "^1.4.3" @@ -7832,16 +8021,16 @@ webidl-conversions@^3.0.0, webidl-conversions@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" -webpack-sources@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.4.tgz#ccc2c817e08e5fa393239412690bb481821393cd" +webpack-sources@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.2.3.tgz#17c62bfaf13c707f9d02c479e0dcdde8380697fb" dependencies: - source-list-map "~0.1.7" + source-list-map "^1.1.1" source-map "~0.5.3" -webpack@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.2.1.tgz#7bb1d72ae2087dd1a4af526afec15eed17dda475" +webpack@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.3.2.tgz#7d521e6f0777a3a58985c69425263fdfe977b458" dependencies: acorn "^4.0.4" acorn-dynamic-import "^2.0.0" @@ -7859,9 +8048,9 @@ webpack@^2.2.1: source-map "^0.5.3" supports-color "^3.1.0" tapable "~0.2.5" - uglify-js "^2.7.5" - watchpack "^1.2.0" - webpack-sources "^0.1.4" + uglify-js "^2.8.5" + watchpack "^1.3.1" + webpack-sources "^0.2.3" yargs "^6.0.0" whatwg-encoding@^1.0.1: From 520392829bc0009cb1b55a3d5f8c1e43a0736f21 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 29 Mar 2017 14:45:59 -0300 Subject: [PATCH 09/87] Stable Version with reducers and actions --- client/coral-framework/actions/index.js | 11 ++++ client/coral-framework/components/Slot.js | 4 +- client/coral-framework/helpers/importer.js | 58 ++++++++++++++----- client/coral-framework/index.js | 17 ++---- client/coral-framework/reducers/index.js | 2 + plugins/coral-plugin-love/client/config.json | 4 -- plugins/coral-plugin-love/client/index.js | 8 --- plugins/coral-plugin-love/client/style.css | 9 --- plugins/coral-plugin-love/index.js | 0 .../coral-plugin-monitor/client/config.json | 4 -- plugins/coral-plugin-monitor/client/index.js | 12 ---- plugins/coral-plugin-monitor/index.js | 0 .../coral-plugin-respect/client/actions.js | 1 + .../coral-plugin-respect/client/reducer.js | 12 ++++ .../coral-plugin-sideview/client/actions.js | 1 - .../coral-plugin-sideview/client/config.json | 3 - plugins/coral-plugin-sideview/client/index.js | 0 .../coral-plugin-sideview/client/reducer.js | 0 plugins/coral-plugin-sideview/index.js | 0 19 files changed, 75 insertions(+), 71 deletions(-) create mode 100644 client/coral-framework/actions/index.js delete mode 100644 plugins/coral-plugin-love/client/config.json delete mode 100644 plugins/coral-plugin-love/client/index.js delete mode 100644 plugins/coral-plugin-love/client/style.css delete mode 100644 plugins/coral-plugin-love/index.js delete mode 100644 plugins/coral-plugin-monitor/client/config.json delete mode 100644 plugins/coral-plugin-monitor/client/index.js delete mode 100644 plugins/coral-plugin-monitor/index.js create mode 100644 plugins/coral-plugin-respect/client/actions.js create mode 100644 plugins/coral-plugin-respect/client/reducer.js delete mode 100644 plugins/coral-plugin-sideview/client/actions.js delete mode 100644 plugins/coral-plugin-sideview/client/config.json delete mode 100644 plugins/coral-plugin-sideview/client/index.js delete mode 100644 plugins/coral-plugin-sideview/client/reducer.js delete mode 100644 plugins/coral-plugin-sideview/index.js diff --git a/client/coral-framework/actions/index.js b/client/coral-framework/actions/index.js new file mode 100644 index 000000000..be107a613 --- /dev/null +++ b/client/coral-framework/actions/index.js @@ -0,0 +1,11 @@ +import * as authActions from './auth'; +import * as assetActions from './asset'; +import * as notificationActions from './notification'; +import {actionsImporter} from '../helpers/importer'; + +export default { + authActions, + assetActions, + notificationActions, + pluginActions: actionsImporter +}; diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 313a7d114..4e9dca9ac 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -1,5 +1,5 @@ import React, {Component} from 'react'; -import injectedPlugins from 'coral-framework/helpers/importer'; +import { importer as injectPlugins } from 'coral-framework/helpers/importer'; class Slot extends Component { componentDidMount() { @@ -9,7 +9,7 @@ class Slot extends Component { const {fill} = this.props; return (
- {injectedPlugins(fill)} + {injectPlugins(fill)}
); } diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index c653cde54..e42441ff7 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -19,20 +19,6 @@ function importer (fill) { .map(key => shapeData(key)); } - function shapeData(test) { - - /** - * shapeData shapes each item in the plugins array with useful data - * returns an Object with the name of the plugin, the format, and it's key(filename) - */ - const match = test.match(/\.\/(.*)\/client\/.*.(json|js)$/); - return { - name: match[1], - format: match[2], - key: match[0] - }; - } - function getConfig (name) { /** @@ -85,5 +71,47 @@ function importer (fill) { return init(); } -export default importer; +function shapeData(test) { + + /** + * shapeData shapes each item in the plugins array with useful data + * returns an Object with the name of the plugin, the format, and it's key(filename) + */ + const match = test.match(/\.\/(.*)\/client\/.*.(json|js)$/); + return { + name: match[1], + format: match[2], + key: match[0] + }; +} + +function actionsImporter () { + const context = require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/); + + return context + .keys() + .map(key => shapeData(key)) + .reduce((entry, actionsPlugin, i) => { + entry[actionsPlugin.name] = context(actionsPlugin.key); + return entry; + }, {}); +} + +function reducersImporter () { + const context = require.context('plugins', true, /\.\/(.*)\/client\/reducer.js$/); + + return context + .keys() + .map(key => shapeData(key)) + .reduce((entry, reducerPlugin, i) => { + entry[reducerPlugin.name] = context(reducerPlugin.key); + return entry; + }, {}); +} + +export default { + importer, + actionsImporter: actionsImporter(), + reducersImporter: reducersImporter() +}; diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js index 88044b2a8..4de928168 100644 --- a/client/coral-framework/index.js +++ b/client/coral-framework/index.js @@ -1,23 +1,14 @@ import store from './services/store'; import pym from './services/PymConnection'; import I18n from './modules/i18n/i18n'; -import * as authActions from './actions/auth'; -import * as assetActions from './actions/asset'; -import * as notificationActions from './actions/notification'; +import actions from './actions'; import Slot from './components/Slot'; -const context = require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/); -const pluginsActions = context - .keys() - .reduce(entry, key => entry[key] = context(key), {}); - -export { +console.log(actions) +export default { pym, Slot, I18n, store, - authActions, - assetActions, - notificationActions, - pluginsActions + ...actions }; diff --git a/client/coral-framework/reducers/index.js b/client/coral-framework/reducers/index.js index 9e98c901a..c97c13f45 100644 --- a/client/coral-framework/reducers/index.js +++ b/client/coral-framework/reducers/index.js @@ -1,9 +1,11 @@ import auth from './auth'; import user from './user'; import asset from './asset'; +import {reducersImporter} from '../helpers/importer'; export default { auth, user, asset, + ...reducersImporter }; diff --git a/plugins/coral-plugin-love/client/config.json b/plugins/coral-plugin-love/client/config.json deleted file mode 100644 index cf846a647..000000000 --- a/plugins/coral-plugin-love/client/config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Coral Plugin Love", - "slot": "Comment.InfoBar" -} \ No newline at end of file diff --git a/plugins/coral-plugin-love/client/index.js b/plugins/coral-plugin-love/client/index.js deleted file mode 100644 index 6af9c8d8c..000000000 --- a/plugins/coral-plugin-love/client/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import styles from './style.css'; - -export default (props) => ( -
- -
-); diff --git a/plugins/coral-plugin-love/client/style.css b/plugins/coral-plugin-love/client/style.css deleted file mode 100644 index a83bb003b..000000000 --- a/plugins/coral-plugin-love/client/style.css +++ /dev/null @@ -1,9 +0,0 @@ -.Love { - display: inline-block; - button { - padding: 10px 2px; - border-radius: 3px; - background: deepskyblue; - color: #161616; - } -} \ No newline at end of file diff --git a/plugins/coral-plugin-love/index.js b/plugins/coral-plugin-love/index.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/plugins/coral-plugin-monitor/client/config.json b/plugins/coral-plugin-monitor/client/config.json deleted file mode 100644 index 9f39c4e6c..000000000 --- a/plugins/coral-plugin-monitor/client/config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Coral Plugin Tab Monitor", - "slot": "Stream" -} \ No newline at end of file diff --git a/plugins/coral-plugin-monitor/client/index.js b/plugins/coral-plugin-monitor/client/index.js deleted file mode 100644 index a2585c42f..000000000 --- a/plugins/coral-plugin-monitor/client/index.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import {TabBar, Tab} from 'coral-ui'; - -console.log('exported'); - -export default (props) => ( - - - Monitor - - -); diff --git a/plugins/coral-plugin-monitor/index.js b/plugins/coral-plugin-monitor/index.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/plugins/coral-plugin-respect/client/actions.js b/plugins/coral-plugin-respect/client/actions.js new file mode 100644 index 000000000..5259ef664 --- /dev/null +++ b/plugins/coral-plugin-respect/client/actions.js @@ -0,0 +1 @@ +export const clickButton = () => ({type: 'BUTTON_CLICKED'}); \ No newline at end of file diff --git a/plugins/coral-plugin-respect/client/reducer.js b/plugins/coral-plugin-respect/client/reducer.js new file mode 100644 index 000000000..3809aaf46 --- /dev/null +++ b/plugins/coral-plugin-respect/client/reducer.js @@ -0,0 +1,12 @@ +import {Map} from 'immutable'; + +const initialState = Map({ + clicked: false +}); + +export default function reducer (state = initialState, action) { + switch (action.type) { + default: + return state; + } +} diff --git a/plugins/coral-plugin-sideview/client/actions.js b/plugins/coral-plugin-sideview/client/actions.js deleted file mode 100644 index 0f38834c9..000000000 --- a/plugins/coral-plugin-sideview/client/actions.js +++ /dev/null @@ -1 +0,0 @@ -export const SomeAction = () => ({type: 'SomeAction'}); \ No newline at end of file diff --git a/plugins/coral-plugin-sideview/client/config.json b/plugins/coral-plugin-sideview/client/config.json deleted file mode 100644 index 18ac9fa2d..000000000 --- a/plugins/coral-plugin-sideview/client/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "Coral Plugin" -} \ No newline at end of file diff --git a/plugins/coral-plugin-sideview/client/index.js b/plugins/coral-plugin-sideview/client/index.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/plugins/coral-plugin-sideview/client/reducer.js b/plugins/coral-plugin-sideview/client/reducer.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/plugins/coral-plugin-sideview/index.js b/plugins/coral-plugin-sideview/index.js deleted file mode 100644 index e69de29bb..000000000 From 6bb9d23fdc5dccb1d867efd11cacf756c4f98580 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 29 Mar 2017 14:46:45 -0300 Subject: [PATCH 10/87] Stable Version with reducers and actions --- plugins.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins.json b/plugins.json index fa5d703a8..a60d08acd 100644 --- a/plugins.json +++ b/plugins.json @@ -1,8 +1,6 @@ { "server": [], "client": [ - "coral-plugin-respect", - "coral-plugin-love", - "coral-plugin-monitor" + "coral-plugin-respect" ] } \ No newline at end of file From 5dc9811e069aca054f7a2d610ba509a68000a4c7 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 29 Mar 2017 16:24:09 -0300 Subject: [PATCH 11/87] Stable Version with reducers and actions --- client/coral-framework/components/Slot.js | 3 --- client/coral-framework/helpers/importer.js | 16 ++++++++++------ plugins/coral-plugin-respect/client/index.js | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 4e9dca9ac..75a71fee4 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -2,9 +2,6 @@ import React, {Component} from 'react'; import { importer as injectPlugins } from 'coral-framework/helpers/importer'; class Slot extends Component { - componentDidMount() { - console.log('Slot Mounted'); - } render() { const {fill} = this.props; return ( diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index e42441ff7..1613dfc73 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -63,7 +63,7 @@ function importer (fill) { .map(addProps) .filter(filterBySlot) .reduce((entry, plugin, i) => { - entry.push(context(plugin.key)(plugin.props)); + entry.push(context(plugin.key)({...plugin.props, key: i})); return entry; }, []); } @@ -85,25 +85,29 @@ function shapeData(test) { }; } -function actionsImporter () { - const context = require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/); - +function importAll(context) { return context .keys() .map(key => shapeData(key)) - .reduce((entry, actionsPlugin, i) => { + .reduce((entry, actionsPlugin) => { entry[actionsPlugin.name] = context(actionsPlugin.key); return entry; }, {}); } +function actionsImporter () { + return importAll(require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/)) + + +} + function reducersImporter () { const context = require.context('plugins', true, /\.\/(.*)\/client\/reducer.js$/); return context .keys() .map(key => shapeData(key)) - .reduce((entry, reducerPlugin, i) => { + .reduce((entry, reducerPlugin) => { entry[reducerPlugin.name] = context(reducerPlugin.key); return entry; }, {}); diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 9969420b5..2ea5751a8 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -2,7 +2,7 @@ import React from 'react'; import styles from './style.css'; export default (props) => ( -
+
); From 635df54a2c7dd873620045df8bbd06a148749822 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 29 Mar 2017 17:21:31 -0300 Subject: [PATCH 12/87] Extended context --- .babelrc | 14 ++++++++++++++ .nodemon.json | 2 +- client/coral-embed-stream/src/Embed.js | 3 +-- client/coral-framework/components/Slot.js | 2 +- client/coral-framework/helpers/importer.js | 14 ++------------ client/coral-framework/index.js | 1 - package.json | 2 ++ plugins/coral-plugin-respect/client/actions.js | 2 +- plugins/coral-plugin-respect/client/reducer.js | 4 ++-- 9 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..63b1c53de --- /dev/null +++ b/.babelrc @@ -0,0 +1,14 @@ +{ + "presets": [ + "es2015" + ], + "plugins": [ + "add-module-exports", + "transform-class-properties", + "transform-decorators-legacy", + "transform-object-assign", + "transform-object-rest-spread", + "transform-async-to-generator", + "transform-react-jsx" + ] +} diff --git a/.nodemon.json b/.nodemon.json index 4c48c707e..7f7fd3d59 100644 --- a/.nodemon.json +++ b/.nodemon.json @@ -1,5 +1,5 @@ { "verbose": true, - "ignore": ["test/*", "client/*", "dist/*"], + "ignore": ["test/*", "client/*", "dist/*", "plugins/*/client"], "ext": "js,json,graphql" } diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index 2edca12c5..791f4ef5f 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -16,7 +16,7 @@ import {queryStream} from 'coral-framework/graphql/queries'; import {postComment, postFlag, postLike, postDontAgree, deleteAction, addCommentTag, removeCommentTag} from 'coral-framework/graphql/mutations'; import {editName} from 'coral-framework/actions/user'; import {updateCountCache} from 'coral-framework/actions/asset'; -import {notificationActions, authActions, assetActions, pym} from 'coral-framework'; +import {notificationActions, authActions, assetActions, pym, Slot} from 'coral-framework'; import Stream from './Stream'; import InfoBox from 'coral-plugin-infobox/InfoBox'; @@ -34,7 +34,6 @@ import ConfigureStreamContainer from 'coral-configure/containers/ConfigureStream import Comment from './Comment'; import LoadMore from './LoadMore'; import NewCount from './NewCount'; -import {Slot} from 'coral-framework'; class Embed extends Component { diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 75a71fee4..850c86835 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -1,5 +1,5 @@ import React, {Component} from 'react'; -import { importer as injectPlugins } from 'coral-framework/helpers/importer'; +import {importer as injectPlugins} from 'coral-framework/helpers/importer'; class Slot extends Component { render() { diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index 1613dfc73..904673075 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -96,21 +96,11 @@ function importAll(context) { } function actionsImporter () { - return importAll(require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/)) - - + return importAll(require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/)); } function reducersImporter () { - const context = require.context('plugins', true, /\.\/(.*)\/client\/reducer.js$/); - - return context - .keys() - .map(key => shapeData(key)) - .reduce((entry, reducerPlugin) => { - entry[reducerPlugin.name] = context(reducerPlugin.key); - return entry; - }, {}); + return importAll(require.context('plugins', true, /\.\/(.*)\/client\/reducer.js$/)); } export default { diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js index 4de928168..5f923e908 100644 --- a/client/coral-framework/index.js +++ b/client/coral-framework/index.js @@ -4,7 +4,6 @@ import I18n from './modules/i18n/i18n'; import actions from './actions'; import Slot from './components/Slot'; -console.log(actions) export default { pym, Slot, diff --git a/package.json b/package.json index 6fdf4560a..f5e0652a6 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ "devDependencies": { "apollo-client": "^0.8.3", "autoprefixer": "^6.5.2", + "babel-cli": "^6.24.0", "babel-core": "^6.24.0", "babel-eslint": "^7.2.1", "babel-jest": "^19.0.0", @@ -106,6 +107,7 @@ "babel-plugin-transform-react-jsx": "^6.23.0", "babel-polyfill": "^6.23.0", "babel-preset-es2015": "^6.24.0", + "babel-preset-react": "^6.23.0", "babel-preset-stage-0": "^6.16.0", "chai": "^3.5.0", "chai-as-promised": "^6.0.0", diff --git a/plugins/coral-plugin-respect/client/actions.js b/plugins/coral-plugin-respect/client/actions.js index 5259ef664..e3dd724f2 100644 --- a/plugins/coral-plugin-respect/client/actions.js +++ b/plugins/coral-plugin-respect/client/actions.js @@ -1 +1 @@ -export const clickButton = () => ({type: 'BUTTON_CLICKED'}); \ No newline at end of file +export const clickButton = () => ({type: 'BUTTON_CLICKED'}); diff --git a/plugins/coral-plugin-respect/client/reducer.js b/plugins/coral-plugin-respect/client/reducer.js index 3809aaf46..399765f6f 100644 --- a/plugins/coral-plugin-respect/client/reducer.js +++ b/plugins/coral-plugin-respect/client/reducer.js @@ -6,7 +6,7 @@ const initialState = Map({ export default function reducer (state = initialState, action) { switch (action.type) { - default: - return state; + default: + return state; } } From 4ca2a48bc94c17743f4bf43bfc065cd402402639 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 29 Mar 2017 17:40:29 -0300 Subject: [PATCH 13/87] typeDefs for respect added --- plugins.json | 4 +- plugins/coral-plugin-respect/index.js | 5 ++ .../coral-plugin-respect/server/typeDefs.js | 47 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 plugins/coral-plugin-respect/server/typeDefs.js diff --git a/plugins.json b/plugins.json index a60d08acd..6ac303c35 100644 --- a/plugins.json +++ b/plugins.json @@ -1,5 +1,7 @@ { - "server": [], + "server": [ + "coral-plugin-respect" + ], "client": [ "coral-plugin-respect" ] diff --git a/plugins/coral-plugin-respect/index.js b/plugins/coral-plugin-respect/index.js index e69de29bb..bd87e11d7 100644 --- a/plugins/coral-plugin-respect/index.js +++ b/plugins/coral-plugin-respect/index.js @@ -0,0 +1,5 @@ +const typeDefs = require('./server/typeDefs'); + +module.exports = { + typeDefs +}; \ No newline at end of file diff --git a/plugins/coral-plugin-respect/server/typeDefs.js b/plugins/coral-plugin-respect/server/typeDefs.js new file mode 100644 index 000000000..f7666debf --- /dev/null +++ b/plugins/coral-plugin-respect/server/typeDefs.js @@ -0,0 +1,47 @@ +module.exports = ` + enum ACTION_TYPE { + + # Represents a Respect. + RESPECT + } + + input CreateRespectInput { + + # The item's id for which we are to create a respect. + item_id: ID! + + # The type of the item for which we are to create the respect. + item_type: ACTION_ITEM_TYPE! + } + + # RespectAction is used by users who "respect" a specific entity. + type RespectAction implements Action { + + # The ID of the action. + id: ID! + + # The author of the action. + user: User + + # The time when the Action was updated. + updated_at: Date + + # The time when the Action was created. + created_at: Date + } + + type CreateRespectResponse implements Response { + + # The respect that was created. + respect: RespectAction + + # An array of errors relating to the mutation that occurred. + errors: [UserError] + } + + type RootMutation { + + # Creates a respect on an entity. + createRespect(respect: CreateRespectInput!): CreateRespectResponse + } +`; From 9df334866d83083b2912d0742189a89dcbf0cab5 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 29 Mar 2017 19:11:43 -0300 Subject: [PATCH 14/87] Adds graph functionality for plugins --- client/coral-embed-stream/src/Embed.js | 4 +++- client/coral-framework/helpers/importer.js | 16 +++++++++++++++- .../client/mutations/index.js | 13 +++++++++++++ .../client/mutations/postRespect.graphql | 10 ++++++++++ plugins/coral-plugin-respect/index.js | 11 +++++++++-- 5 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 plugins/coral-plugin-respect/client/mutations/index.js create mode 100644 plugins/coral-plugin-respect/client/mutations/postRespect.graphql diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index 791f4ef5f..b3244d56b 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -5,6 +5,7 @@ import isEqual from 'lodash/isEqual'; import I18n from 'coral-framework/modules/i18n/i18n'; import translations from 'coral-framework/translations'; const lang = new I18n(translations); +import {graphImporter} from 'coral-framework/helpers/importer'; import {TabBar, Tab, TabContent, Spinner} from 'coral-ui'; @@ -277,5 +278,6 @@ export default compose( addCommentTag, removeCommentTag, deleteAction, - queryStream + queryStream, + ...graphImporter )(Embed); diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index 904673075..de031a744 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -103,9 +103,23 @@ function reducersImporter () { return importAll(require.context('plugins', true, /\.\/(.*)\/client\/reducer.js$/)); } +function graphImporter () { + const context = require.context('plugins', true, /\.\/(.*)\/client\/(queries|mutations)\/index.js$/); + return context + .keys() + .map(key => shapeData(key)) + .reduce((entry, actionsPlugin) => { + const input = context(actionsPlugin.key); + const res = Object.keys(input) + .map(key => input[key]); + return [...entry, ...res]; + }, []); +} + export default { importer, actionsImporter: actionsImporter(), - reducersImporter: reducersImporter() + reducersImporter: reducersImporter(), + graphImporter: graphImporter() }; diff --git a/plugins/coral-plugin-respect/client/mutations/index.js b/plugins/coral-plugin-respect/client/mutations/index.js new file mode 100644 index 000000000..9b78ee40c --- /dev/null +++ b/plugins/coral-plugin-respect/client/mutations/index.js @@ -0,0 +1,13 @@ +import {graphql} from 'react-apollo'; +import POST_RESPECT from './postRespect.graphql'; + +export const postRespect = graphql(POST_RESPECT, { + props: ({mutate}) => ({ + postRespect: (respect) => { + return mutate({ + variables: { + respect + } + }); + }}) +}); diff --git a/plugins/coral-plugin-respect/client/mutations/postRespect.graphql b/plugins/coral-plugin-respect/client/mutations/postRespect.graphql new file mode 100644 index 000000000..a7edc97e3 --- /dev/null +++ b/plugins/coral-plugin-respect/client/mutations/postRespect.graphql @@ -0,0 +1,10 @@ +mutation CreateRespect ($respect: CreateRespectInput!) { + createRespect(respect: $respect) { + respect { + id + } + errors { + translation_key + } + } +} diff --git a/plugins/coral-plugin-respect/index.js b/plugins/coral-plugin-respect/index.js index bd87e11d7..915d14ac0 100644 --- a/plugins/coral-plugin-respect/index.js +++ b/plugins/coral-plugin-respect/index.js @@ -1,5 +1,12 @@ const typeDefs = require('./server/typeDefs'); module.exports = { - typeDefs -}; \ No newline at end of file + typeDefs, + resolvers: { + RootMutation: { + createRespect(_, {respect: {item_id, item_type}}, {mutators: {Action}}) { + return Action.create({item_id, item_type, action_type: 'RESPECT'}); + } + } + } +}; From 659c63e5cb7e7f71918394d5dc2c2629c10dda1b Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 29 Mar 2017 22:14:56 -0300 Subject: [PATCH 15/87] Adds graph functionality for plugins --- client/coral-framework/helpers/importer.js | 12 +++++++++--- client/coral-framework/index.js | 2 ++ plugins/coral-plugin-respect/client/index.js | 1 + test/client/.babelrc | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index de031a744..f152757c2 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -1,3 +1,5 @@ +import asd from 'coral-framework'; +console.log(asd) import {client as clientPlugins} from 'pluginsConfig'; function importer (fill) { @@ -42,7 +44,11 @@ function importer (fill) { } function addProps (plugin) { - plugin.props = getConfig(plugin.name); + + /** + * addProps add properties to the injected plugins + */ + plugin.props = {...getConfig(plugin.name), plugin: 'true'}; return plugin; } @@ -108,8 +114,8 @@ function graphImporter () { return context .keys() .map(key => shapeData(key)) - .reduce((entry, actionsPlugin) => { - const input = context(actionsPlugin.key); + .reduce((entry, graphPlugin) => { + const input = context(graphPlugin.key); const res = Object.keys(input) .map(key => input[key]); return [...entry, ...res]; diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js index 5f923e908..081de80cd 100644 --- a/client/coral-framework/index.js +++ b/client/coral-framework/index.js @@ -4,10 +4,12 @@ import I18n from './modules/i18n/i18n'; import actions from './actions'; import Slot from './components/Slot'; +console.log(actions); export default { pym, Slot, I18n, store, + actions, ...actions }; diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 2ea5751a8..9db812fcc 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -3,6 +3,7 @@ import styles from './style.css'; export default (props) => (
+ {console.log(props)}
); diff --git a/test/client/.babelrc b/test/client/.babelrc index 9bd819c32..633f93f42 100644 --- a/test/client/.babelrc +++ b/test/client/.babelrc @@ -1,3 +1,3 @@ { - "extends": "../../client/.babelrc" + "extends": "../../.babelrc" } From ab6f455ec797dfffe2d7efffde6ba1f88f068c83 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 11:10:11 -0300 Subject: [PATCH 16/87] Plugins: Reducers and Actions - Working --- client/coral-framework/components/Slot.js | 1 + client/coral-framework/helpers/importer.js | 68 ++++++++++++------- client/coral-framework/index.js | 1 - plugins/coral-plugin-respect/client/index.js | 1 - .../coral-plugin-respect/client/reducer.js | 2 +- 5 files changed, 44 insertions(+), 29 deletions(-) diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 850c86835..1f5e5829d 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -1,5 +1,6 @@ import React, {Component} from 'react'; import {importer as injectPlugins} from 'coral-framework/helpers/importer'; +import actions from 'coral-framework/actions'; class Slot extends Component { render() { diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index f152757c2..96adc799e 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -1,5 +1,3 @@ -import asd from 'coral-framework'; -console.log(asd) import {client as clientPlugins} from 'pluginsConfig'; function importer (fill) { @@ -34,25 +32,23 @@ function importer (fill) { }, {}); } - function filterByUserConfig (list) { - - /** - * filterByUserConfig will filter the imported files and will only keep the allowed plugins - */ - return list - .filter(plugin => clientPlugins.indexOf(plugin.name) > -1); - } - function addProps (plugin) { /** * addProps add properties to the injected plugins */ - plugin.props = {...getConfig(plugin.name), plugin: 'true'}; + plugin.props = { + ...actionsImporter(), + ...getConfig(plugin.name) + }; + return plugin; } function filterBySlot (plugin) { + /** + * filterBySlot + */ return plugin.props.slot === fill; } @@ -64,12 +60,13 @@ function importer (fill) { */ buildContext(); - return filterByUserConfig(importedFiles) + return importedFiles + .filter(filterByUserConfig) .filter(key => key.format === 'js') .map(addProps) .filter(filterBySlot) .reduce((entry, plugin, i) => { - entry.push(context(plugin.key)({...plugin.props, key: i})); + entry = [...entry, context(plugin.key)({...plugin.props, key: i})]; return entry; }, []); } @@ -91,16 +88,44 @@ function shapeData(test) { }; } +function filterByUserConfig (plugin) { + + /** + * filterByUserConfig will filter the imported files and will only keep the allowed plugins + */ + return clientPlugins.indexOf(plugin.name) > -1; +} + function importAll(context) { + /** + * importAll builds the map to import + */ return context .keys() .map(key => shapeData(key)) + .filter(filterByUserConfig) .reduce((entry, actionsPlugin) => { - entry[actionsPlugin.name] = context(actionsPlugin.key); - return entry; + const input = context(actionsPlugin.key); + return {...entry, ...input}; }, {}); } +function importAllAsArr(context) { + /** + * importAllAsArr builds the array to import + */ + return context + .keys() + .map(key => shapeData(key)) + .filter(filterByUserConfig) + .reduce((entry, graphPlugin) => { + const input = context(graphPlugin.key); + const res = Object.keys(input) + .map(key => input[key]); + return [...entry, ...res]; + }, []); +} + function actionsImporter () { return importAll(require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/)); } @@ -110,16 +135,7 @@ function reducersImporter () { } function graphImporter () { - const context = require.context('plugins', true, /\.\/(.*)\/client\/(queries|mutations)\/index.js$/); - return context - .keys() - .map(key => shapeData(key)) - .reduce((entry, graphPlugin) => { - const input = context(graphPlugin.key); - const res = Object.keys(input) - .map(key => input[key]); - return [...entry, ...res]; - }, []); + return importAllAsArr(require.context('plugins', true, /\.\/(.*)\/client\/(queries|mutations)\/index.js$/)); } export default { diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js index 081de80cd..3b653b043 100644 --- a/client/coral-framework/index.js +++ b/client/coral-framework/index.js @@ -4,7 +4,6 @@ import I18n from './modules/i18n/i18n'; import actions from './actions'; import Slot from './components/Slot'; -console.log(actions); export default { pym, Slot, diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 9db812fcc..2ea5751a8 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -3,7 +3,6 @@ import styles from './style.css'; export default (props) => (
- {console.log(props)}
); diff --git a/plugins/coral-plugin-respect/client/reducer.js b/plugins/coral-plugin-respect/client/reducer.js index 399765f6f..224677585 100644 --- a/plugins/coral-plugin-respect/client/reducer.js +++ b/plugins/coral-plugin-respect/client/reducer.js @@ -4,7 +4,7 @@ const initialState = Map({ clicked: false }); -export default function reducer (state = initialState, action) { +export function respect (state = initialState, action) { switch (action.type) { default: return state; From 17a8f48b4f31bc29567fd7148d8f70cd13af1caf Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 11:15:20 -0300 Subject: [PATCH 17/87] Plugins have access to ParentComponent Properties --- client/coral-embed-stream/src/Comment.js | 4 ++-- client/coral-embed-stream/src/Embed.js | 6 ++++-- client/coral-framework/components/Slot.js | 4 ++-- client/coral-framework/helpers/importer.js | 5 +++-- plugins/coral-plugin-respect/client/index.js | 1 + 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index bdccb7f66..44bdad88e 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -160,7 +160,7 @@ class Comment extends React.Component { ? : null } - +
@@ -192,7 +192,7 @@ class Comment extends React.Component { removeBest={removeBestTag} /> - +
diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index b3244d56b..603de44cb 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -120,7 +120,7 @@ class Embed extends Component { return (
- + {lang.t('MY_COMMENTS')} @@ -192,7 +192,9 @@ class Embed extends Component { showSignInDialog={this.props.showSignInDialog} key={highlightedComment.id} reactKey={highlightedComment.id} - comment={highlightedComment} /> + comment={highlightedComment} + {...this.props} + /> } - {injectPlugins(fill)} + {injectPlugins(slotProps)}
); } diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index 96adc799e..929048088 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -1,6 +1,6 @@ import {client as clientPlugins} from 'pluginsConfig'; -function importer (fill) { +function importer ({fill, ...props}) { let context, importedFiles; @@ -39,7 +39,8 @@ function importer (fill) { */ plugin.props = { ...actionsImporter(), - ...getConfig(plugin.name) + ...getConfig(plugin.name), + ...props }; return plugin; diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 2ea5751a8..9db812fcc 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -3,6 +3,7 @@ import styles from './style.css'; export default (props) => (
+ {console.log(props)}
); From 679962168c0101efcc31b87d47c1c06aeba2f111 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 12:24:19 -0300 Subject: [PATCH 18/87] Plugins can trigger own actions with core reducers --- client/coral-embed-stream/src/Comment.js | 9 ++++--- client/coral-embed-stream/src/Embed.js | 24 +++++++++++++++---- client/coral-embed-stream/src/Stream.js | 7 ++++-- client/coral-framework/components/Slot.js | 4 +--- client/coral-framework/helpers/importer.js | 1 - .../coral-plugin-respect/client/actions.js | 7 +++++- plugins/coral-plugin-respect/client/index.js | 3 +-- .../coral-plugin-respect/client/reducer.js | 3 +++ 8 files changed, 42 insertions(+), 16 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 44bdad88e..c43200c71 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -112,6 +112,7 @@ class Comment extends React.Component { addCommentTag, removeCommentTag, disableReply, + pluginProps } = this.props; const like = getActionSummary('LikeActionSummary', comment); @@ -160,7 +161,7 @@ class Comment extends React.Component { ? : null } - +
@@ -192,7 +193,7 @@ class Comment extends React.Component { removeBest={removeBestTag} />
- +
@@ -246,7 +247,9 @@ class Comment extends React.Component { showSignInDialog={showSignInDialog} reactKey={reply.id} key={reply.id} - comment={reply} />; + comment={reply} + pluginProps={pluginProps} + />; }) } { diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index 603de44cb..f329ba230 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -1,5 +1,6 @@ import React, {Component} from 'react'; import {compose} from 'react-apollo'; +import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; import isEqual from 'lodash/isEqual'; import I18n from 'coral-framework/modules/i18n/i18n'; @@ -17,7 +18,7 @@ import {queryStream} from 'coral-framework/graphql/queries'; import {postComment, postFlag, postLike, postDontAgree, deleteAction, addCommentTag, removeCommentTag} from 'coral-framework/graphql/mutations'; import {editName} from 'coral-framework/actions/user'; import {updateCountCache} from 'coral-framework/actions/asset'; -import {notificationActions, authActions, assetActions, pym, Slot} from 'coral-framework'; +import {notificationActions, authActions, assetActions, pym, Slot, actions} from 'coral-framework'; import Stream from './Stream'; import InfoBox from 'coral-plugin-infobox/InfoBox'; @@ -117,10 +118,23 @@ class Embed extends Component { ? asset.comments[0].created_at : new Date(Date.now() - 1000 * 60 * 60 * 24 * 7).toISOString(); + /** + * Plugins Section + * + */ + const {dispatch} = this.props; + const {pluginActions} = actions; + let boundActionCreators = bindActionCreators(pluginActions, dispatch); + + const pluginProps = { + ...this.props, + ...boundActionCreators + }; + return (
- + {lang.t('MY_COMMENTS')} @@ -193,7 +207,7 @@ class Embed extends Component { key={highlightedComment.id} reactKey={highlightedComment.id} comment={highlightedComment} - {...this.props} + pluginProps={pluginProps} /> } + comments={asset.comments} + pluginProps={pluginProps} + />
+ comment={comment} + pluginProps={pluginProps} + /> ) }
diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 756a25a68..d5a364aee 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -1,13 +1,11 @@ import React, {Component} from 'react'; import {importer as injectPlugins} from 'coral-framework/helpers/importer'; -import actions from 'coral-framework/actions'; class Slot extends Component { render() { - const slotProps = {...this.props, ...actions}; return (
- {injectPlugins(slotProps)} + {injectPlugins(this.props)}
); } diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index 929048088..f8130d9d2 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -38,7 +38,6 @@ function importer ({fill, ...props}) { * addProps add properties to the injected plugins */ plugin.props = { - ...actionsImporter(), ...getConfig(plugin.name), ...props }; diff --git a/plugins/coral-plugin-respect/client/actions.js b/plugins/coral-plugin-respect/client/actions.js index e3dd724f2..21705e201 100644 --- a/plugins/coral-plugin-respect/client/actions.js +++ b/plugins/coral-plugin-respect/client/actions.js @@ -1 +1,6 @@ -export const clickButton = () => ({type: 'BUTTON_CLICKED'}); +const buttonClicked = () => ({type: 'BUTTON_CLICKED'}); + +export const clickButton = () => dispatch => { + console.log('here'); + dispatch(buttonClicked()); +}; diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 9db812fcc..d5ecc5f0d 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -3,8 +3,7 @@ import styles from './style.css'; export default (props) => (
- {console.log(props)} - +
); diff --git a/plugins/coral-plugin-respect/client/reducer.js b/plugins/coral-plugin-respect/client/reducer.js index 224677585..aa7bbda5e 100644 --- a/plugins/coral-plugin-respect/client/reducer.js +++ b/plugins/coral-plugin-respect/client/reducer.js @@ -6,6 +6,9 @@ const initialState = Map({ export function respect (state = initialState, action) { switch (action.type) { + case 'BUTTON_CLICKED' : + return state + .set('clicked', !state.get('clicked')); default: return state; } From 7efbdc8b59bc6b7f2ec9c5654bc32da54aa66762 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 12:40:04 -0300 Subject: [PATCH 19/87] Plugins can trigger own actions with core reducers --- client/coral-framework/components/Slot.js | 3 ++- plugins/coral-plugin-respect/client/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index d5a364aee..54cb96271 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -3,9 +3,10 @@ import {importer as injectPlugins} from 'coral-framework/helpers/importer'; class Slot extends Component { render() { + const {pluginProps: actions, ...props} = this.props; return (
- {injectPlugins(this.props)} + {injectPlugins({...props, actions})}
); } diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index d5ecc5f0d..9eb9b7cb9 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -3,7 +3,8 @@ import styles from './style.css'; export default (props) => (
- + {console.log(props)} +
); From a7def6fc2b4854daa668bdf321fb497f429a2282 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 12:57:05 -0300 Subject: [PATCH 20/87] Adding the state of plugins to the main --- client/coral-embed-stream/src/Embed.js | 14 +++++++++----- plugins/coral-plugin-respect/client/style.css | 8 +++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index f329ba230..b79c387f0 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -269,11 +269,15 @@ class Embed extends Component { } } -const mapStateToProps = state => ({ - auth: state.auth.toJS(), - userData: state.user.toJS(), - asset: state.asset.toJS() -}); +const mapStateToProps = (state) => Object + .keys(state) + .reduce((entry, key) => { + if (key !== 'apollo') { + entry[key] = state[key].toJS(); + } + console.log(entry); + return entry; + }, {}); const mapDispatchToProps = dispatch => ({ requestConfirmEmail: () => dispatch(requestConfirmEmail()), diff --git a/plugins/coral-plugin-respect/client/style.css b/plugins/coral-plugin-respect/client/style.css index c10503213..32773ed26 100644 --- a/plugins/coral-plugin-respect/client/style.css +++ b/plugins/coral-plugin-respect/client/style.css @@ -1,9 +1,11 @@ .Respect { display: inline-block; button { - padding: 10px 2px; - border-radius: 3px; - background: #ffa16e; color: #161616; + margin: 5px 10px 5px 0px; + background: none; + padding: 0px; + border: none; + font-size: inherit; } } \ No newline at end of file From 52b6ce06e6d03f481c518497b50c3362d04d2a70 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 13:07:32 -0300 Subject: [PATCH 21/87] Linting --- client/coral-embed-stream/src/Embed.js | 1 - client/coral-framework/helpers/importer.js | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index b79c387f0..42f41874c 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -275,7 +275,6 @@ const mapStateToProps = (state) => Object if (key !== 'apollo') { entry[key] = state[key].toJS(); } - console.log(entry); return entry; }, {}); diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index f8130d9d2..6e7e5b251 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -46,6 +46,7 @@ function importer ({fill, ...props}) { } function filterBySlot (plugin) { + /** * filterBySlot */ @@ -97,6 +98,7 @@ function filterByUserConfig (plugin) { } function importAll(context) { + /** * importAll builds the map to import */ @@ -111,6 +113,7 @@ function importAll(context) { } function importAllAsArr(context) { + /** * importAllAsArr builds the array to import */ From 1bb3ed23993b58755b056ab64e490a305b4f7a05 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 14:52:17 -0300 Subject: [PATCH 22/87] importer renamed, and properties changed --- client/coral-embed-stream/src/Embed.js | 4 ++-- client/coral-framework/actions/index.js | 2 +- client/coral-framework/components/Slot.js | 6 +++--- client/coral-framework/helpers/{importer.js => plugins.js} | 4 ++-- client/coral-framework/reducers/index.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) rename client/coral-framework/helpers/{importer.js => plugins.js} (98%) diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index 42f41874c..ab5033c5a 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -6,7 +6,7 @@ import isEqual from 'lodash/isEqual'; import I18n from 'coral-framework/modules/i18n/i18n'; import translations from 'coral-framework/translations'; const lang = new I18n(translations); -import {graphImporter} from 'coral-framework/helpers/importer'; +import {graphImporter} from 'coral-framework/helpers/plugins'; import {TabBar, Tab, TabContent, Spinner} from 'coral-ui'; @@ -128,7 +128,7 @@ class Embed extends Component { const pluginProps = { ...this.props, - ...boundActionCreators + actions: boundActionCreators }; return ( diff --git a/client/coral-framework/actions/index.js b/client/coral-framework/actions/index.js index be107a613..1168c9c9a 100644 --- a/client/coral-framework/actions/index.js +++ b/client/coral-framework/actions/index.js @@ -1,7 +1,7 @@ import * as authActions from './auth'; import * as assetActions from './asset'; import * as notificationActions from './notification'; -import {actionsImporter} from '../helpers/importer'; +import {actionsImporter} from '../helpers/plugins'; export default { authActions, diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 54cb96271..0288bbc51 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -1,12 +1,12 @@ import React, {Component} from 'react'; -import {importer as injectPlugins} from 'coral-framework/helpers/importer'; +import {injectPlugins} from 'coral-framework/helpers/plugins'; class Slot extends Component { render() { - const {pluginProps: actions, ...props} = this.props; + const {pluginProps, ...props} = this.props; return (
- {injectPlugins({...props, actions})} + {injectPlugins({...props, ...pluginProps})}
); } diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/plugins.js similarity index 98% rename from client/coral-framework/helpers/importer.js rename to client/coral-framework/helpers/plugins.js index 6e7e5b251..7a0f2e2f3 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/plugins.js @@ -1,6 +1,6 @@ import {client as clientPlugins} from 'pluginsConfig'; -function importer ({fill, ...props}) { +function injectPlugins ({fill, ...props}) { let context, importedFiles; @@ -142,7 +142,7 @@ function graphImporter () { } export default { - importer, + injectPlugins, actionsImporter: actionsImporter(), reducersImporter: reducersImporter(), graphImporter: graphImporter() diff --git a/client/coral-framework/reducers/index.js b/client/coral-framework/reducers/index.js index c97c13f45..e2e003f7d 100644 --- a/client/coral-framework/reducers/index.js +++ b/client/coral-framework/reducers/index.js @@ -1,7 +1,7 @@ import auth from './auth'; import user from './user'; import asset from './asset'; -import {reducersImporter} from '../helpers/importer'; +import {reducersImporter} from '../helpers/plugins'; export default { auth, From 2d99206b5185eb63f571d347328a0c835dca7571 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 18:25:25 -0300 Subject: [PATCH 23/87] Plugin api, state, actions, context --- client/coral-embed-stream/src/Comment.js | 13 +++++++-- client/coral-embed-stream/src/Embed.js | 16 ++++++---- client/coral-framework/components/Slot.js | 3 +- .../coral-plugin-respect/client/actions.js | 1 + plugins/coral-plugin-respect/client/index.js | 29 +++++++++++++++---- plugins/coral-plugin-respect/client/style.css | 4 +++ 6 files changed, 50 insertions(+), 16 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index c43200c71..622d48b90 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -112,7 +112,6 @@ class Comment extends React.Component { addCommentTag, removeCommentTag, disableReply, - pluginProps } = this.props; const like = getActionSummary('LikeActionSummary', comment); @@ -143,6 +142,14 @@ class Comment extends React.Component { tag: BEST_TAG, }), () => 'Failed to remove best comment tag'); + const {context, ...rest} = this.props.pluginProps; + const pluginProps = { + context: {...context, ...this.props}, + ...rest + }; + + console.log('Commnet --------', pluginProps) + return (
: null } - +
@@ -193,7 +200,7 @@ class Comment extends React.Component { removeBest={removeBestTag} />
- +
diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index ab5033c5a..b42b54f03 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -122,19 +122,20 @@ class Embed extends Component { * Plugins Section * */ - const {dispatch} = this.props; + const {dispatch, state, ...currentProps} = this.props; const {pluginActions} = actions; let boundActionCreators = bindActionCreators(pluginActions, dispatch); const pluginProps = { - ...this.props, + state, + context: currentProps, actions: boundActionCreators }; return (
- + {/**/} {lang.t('MY_COMMENTS')} @@ -273,10 +274,15 @@ const mapStateToProps = (state) => Object .keys(state) .reduce((entry, key) => { if (key !== 'apollo') { - entry[key] = state[key].toJS(); + entry.state[key] = state[key].toJS(); } return entry; - }, {}); + }, { + auth: state.auth.toJS(), + userData: state.user.toJS(), + asset: state.asset.toJS(), + state: {} +}); const mapDispatchToProps = dispatch => ({ requestConfirmEmail: () => dispatch(requestConfirmEmail()), diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 0288bbc51..ecadd716c 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -3,10 +3,9 @@ import {injectPlugins} from 'coral-framework/helpers/plugins'; class Slot extends Component { render() { - const {pluginProps, ...props} = this.props; return (
- {injectPlugins({...props, ...pluginProps})} + {injectPlugins(this.props)}
); } diff --git a/plugins/coral-plugin-respect/client/actions.js b/plugins/coral-plugin-respect/client/actions.js index 21705e201..14964cc26 100644 --- a/plugins/coral-plugin-respect/client/actions.js +++ b/plugins/coral-plugin-respect/client/actions.js @@ -4,3 +4,4 @@ export const clickButton = () => dispatch => { console.log('here'); dispatch(buttonClicked()); }; + diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 9eb9b7cb9..234a3178d 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -1,10 +1,27 @@ import React from 'react'; import styles from './style.css'; +import {Icon} from 'coral-ui'; -export default (props) => ( -
- {console.log(props)} - -
-); +export default (props) => { + const handleClick = () => { + props.actions.clickButton(); + // props.postRespect({ + // item_id: props.comment.id, + // item_type: 'COMMENTS' + // }); + }; + const {clicked} = props.state.respect; + + return ( +
+ +
+ ); +}; diff --git a/plugins/coral-plugin-respect/client/style.css b/plugins/coral-plugin-respect/client/style.css index 32773ed26..6bb7746d3 100644 --- a/plugins/coral-plugin-respect/client/style.css +++ b/plugins/coral-plugin-respect/client/style.css @@ -8,4 +8,8 @@ border: none; font-size: inherit; } + + .clicked { + color: #ffcc00; + } } \ No newline at end of file From 5fec7c3a11a378f94bb6003c421d921aef57f998 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 30 Mar 2017 15:55:41 -0600 Subject: [PATCH 24/87] Added support for resolveType post hooks --- .babelrc | 14 ------ graph/hooks.js | 78 +++++++++++++++++++++++++++++++-- yarn.lock | 115 +++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 172 insertions(+), 35 deletions(-) delete mode 100644 .babelrc diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 63b1c53de..000000000 --- a/.babelrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - "es2015" - ], - "plugins": [ - "add-module-exports", - "transform-class-properties", - "transform-decorators-legacy", - "transform-object-assign", - "transform-object-rest-spread", - "transform-async-to-generator", - "transform-react-jsx" - ] -} diff --git a/graph/hooks.js b/graph/hooks.js index 3fe1306cf..499eb60b1 100644 --- a/graph/hooks.js +++ b/graph/hooks.js @@ -1,4 +1,7 @@ -const {forEachField} = require('graphql-tools'); +const { + GraphQLObjectType, + GraphQLInterfaceType +} = require('graphql'); const debug = require('debug')('talk:graph:schema'); /** @@ -22,6 +25,33 @@ const defaultResolveFn = (source, args, context, {fieldName}) => { } }; +// This function is pretty much copied verbatim from the graphql-tools repo: +// https://github.com/apollographql/graphql-tools/blob/b12973c86e00be209d04af0184780998056051c4/src/schemaGenerator.ts#L180-L194 +// With the small alteration that we look for the `resolveType` function on the +// schema so we can wrap post hooks around it to provide additional resolve +// points. +const forEachField = (schema, fn) => { + const typeMap = schema.getTypeMap(); + Object.keys(typeMap).forEach((typeName) => { + const type = typeMap[typeName]; + + if (type instanceof GraphQLObjectType || type instanceof GraphQLInterfaceType) { + + // Here we capture the change to extract the resolve type. We pass this + // with the `isResolveType = true` to introduce the specific beheviour. + if ('resolveType' in type) { + fn(type, typeName, '__resolveType', true); + } + + const fields = type.getFields(); + Object.keys(fields).forEach((fieldName) => { + const field = fields[fieldName]; + fn(field, typeName, fieldName); + }); + } + }); +}; + /** * Decorates the schema with pre and post hooks as provided by the Plugin * Manager. @@ -29,7 +59,7 @@ const defaultResolveFn = (source, args, context, {fieldName}) => { * @param {Array} hooks hooks to apply to the schema * @return {void} */ -const decorateWithHooks = (schema, hooks) => forEachField(schema, (field, typeName, fieldName) => { +const decorateWithHooks = (schema, hooks) => forEachField(schema, (field, typeName, fieldName, isResolveType = false) => { // Pull out the pre/post hooks from the available hooks. const { @@ -85,6 +115,48 @@ const decorateWithHooks = (schema, hooks) => forEachField(schema, (field, typeNa return; } + // If this is a resolve type, we need to do some specific things to handle + // this type of field. + if (isResolveType) { + + // Warn if we have any pre hooks. + if (pre.length !== 0) { + throw new Error(`invalid pre hooks were found for ${typeName}.${fieldName}, only post hooks are supported on the __resolveType hook`); + } + + // This only needs to do something if post hooks are defined. + if (post.length === 0) { + return; + } + + // Cache the original resolverType function. + let resolveType = field.resolveType; + + // Return the function to handle the resolveType hooks. + field.resolveType = (obj, context, info) => { + let type = resolveType(obj, context, info); + + // Only if a previous resolver was unable to resolve the field type do we + // progress to the hooks (in order!) to resolve the field name until we + // have resolved it. + if (typeof type !== 'undefined' && type != null) { + return type; + } + + // We will walk through the post hooks until we find the right one. This + // follows what redux does to combine existing reducers. + for (let i = 0; i < post.length; i++) { + let resolveType = post[i]; + type = resolveType(obj, context, info); + if (typeof type !== 'undefined' && type != null) { + return type; + } + } + }; + + return; + } + // Cache the original resolve function, this emulates the beheviour found in // graphql-tools: https://github.com/apollographql/graphql-tools/blob/6e9cc124b10d673448386041e6c3d058bc205a02/src/schemaGenerator.ts#L423-L425 let resolve = field.resolve; @@ -102,7 +174,7 @@ const decorateWithHooks = (schema, hooks) => forEachField(schema, (field, typeNa await Promise.all(pre.map((pre) => pre(obj, args, context, info))); // Resolve the field. - let result = resolve(obj, args, context, info); + let result = await resolve(obj, args, context, info); // Insure all post hooks after we've resolved the field with the result // passed in as the fifth argument. diff --git a/yarn.lock b/yarn.lock index 51b5aaff0..bde912515 100644 --- a/yarn.lock +++ b/yarn.lock @@ -356,6 +356,27 @@ aws4@^1.2.1: version "1.5.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.5.0.tgz#0a29ffb79c31c9e712eeb087e8e7a64b4a56d755" +babel-cli@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-cli/-/babel-cli-6.24.0.tgz#a05ffd210dca0c288a26d5319c5ac8669a265ad0" + dependencies: + babel-core "^6.24.0" + babel-polyfill "^6.23.0" + babel-register "^6.24.0" + babel-runtime "^6.22.0" + commander "^2.8.1" + convert-source-map "^1.1.0" + fs-readdir-recursive "^1.0.0" + glob "^7.0.0" + lodash "^4.2.0" + output-file-sync "^1.1.0" + path-is-absolute "^1.0.0" + slash "^1.0.0" + source-map "^0.5.0" + v8flags "^2.0.10" + optionalDependencies: + chokidar "^1.6.1" + babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" @@ -618,11 +639,15 @@ babel-plugin-syntax-export-extensions@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz#70a1484f0f9089a4e84ad44bac353c95b9b12721" +babel-plugin-syntax-flow@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d" + babel-plugin-syntax-function-bind@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-function-bind/-/babel-plugin-syntax-function-bind-6.13.0.tgz#48c495f177bdf31a981e732f55adc0bdd2601f46" -babel-plugin-syntax-jsx@^6.8.0: +babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" @@ -875,6 +900,13 @@ babel-plugin-transform-export-extensions@^6.22.0: babel-plugin-syntax-export-extensions "^6.8.0" babel-runtime "^6.22.0" +babel-plugin-transform-flow-strip-types@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz#84cb672935d43714fdc32bce84568d87441cf7cf" + dependencies: + babel-plugin-syntax-flow "^6.18.0" + babel-runtime "^6.22.0" + babel-plugin-transform-function-bind@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-function-bind/-/babel-plugin-transform-function-bind-6.22.0.tgz#c6fb8e96ac296a310b8cf8ea401462407ddf6a97" @@ -895,6 +927,26 @@ babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object babel-plugin-syntax-object-rest-spread "^6.8.0" babel-runtime "^6.22.0" +babel-plugin-transform-react-display-name@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.23.0.tgz#4398910c358441dc4cef18787264d0412ed36b37" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-react-jsx-self@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-self/-/babel-plugin-transform-react-jsx-self-6.22.0.tgz#df6d80a9da2612a121e6ddd7558bcbecf06e636e" + dependencies: + babel-plugin-syntax-jsx "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-react-jsx-source@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-source/-/babel-plugin-transform-react-jsx-source-6.22.0.tgz#66ac12153f5cd2d17b3c19268f4bf0197f44ecd6" + dependencies: + babel-plugin-syntax-jsx "^6.8.0" + babel-runtime "^6.22.0" + babel-plugin-transform-react-jsx@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.23.0.tgz#23e892f7f2e759678eb5e4446a8f8e94e81b3470" @@ -953,12 +1005,29 @@ babel-preset-es2015@^6.24.0: babel-plugin-transform-es2015-unicode-regex "^6.22.0" babel-plugin-transform-regenerator "^6.22.0" +babel-preset-flow@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz#e71218887085ae9a24b5be4169affb599816c49d" + dependencies: + babel-plugin-transform-flow-strip-types "^6.22.0" + babel-preset-jest@^19.0.0: version "19.0.0" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-19.0.0.tgz#22d67201d02324a195811288eb38294bb3cac396" dependencies: babel-plugin-jest-hoist "^19.0.0" +babel-preset-react@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-preset-react/-/babel-preset-react-6.23.0.tgz#eb7cee4de98a3f94502c28565332da9819455195" + dependencies: + babel-plugin-syntax-jsx "^6.3.13" + babel-plugin-transform-react-display-name "^6.23.0" + babel-plugin-transform-react-jsx "^6.23.0" + babel-plugin-transform-react-jsx-self "^6.22.0" + babel-plugin-transform-react-jsx-source "^6.22.0" + babel-preset-flow "^6.23.0" + babel-preset-stage-0@^6.16.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-preset-stage-0/-/babel-preset-stage-0-6.22.0.tgz#707eeb5b415da769eff9c42f4547f644f9296ef9" @@ -1479,7 +1548,7 @@ cheerio@^0.22.0: lodash.reject "^4.4.0" lodash.some "^4.4.0" -chokidar@^1.4.3: +chokidar@^1.4.3, chokidar@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" dependencies: @@ -1679,7 +1748,7 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@2.9.0, commander@^2.5.0, commander@^2.9.0: +commander@2.9.0, commander@^2.5.0, commander@^2.8.1, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -3067,6 +3136,10 @@ fs-promise@^0.3.1: dependencies: any-promise "~0.1.0" +fs-readdir-recursive@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz#8cd1745c8b4f8a29c8caec392476921ba195f560" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -3360,7 +3433,7 @@ gql-utils@^0.0.2: bluebird "^3.4.6" glob "^7.1.1" -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -5475,6 +5548,14 @@ osenv@^0.1.0: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +output-file-sync@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-1.1.2.tgz#d0a33eefe61a205facb90092e826598d5245ce76" + dependencies: + graceful-fs "^4.1.4" + mkdirp "^0.5.1" + object-assign "^4.1.0" + p-limit@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" @@ -6487,11 +6568,7 @@ react-apollo@^0.10.0: optionalDependencies: react-dom "0.14.x || 15.* || ^15.0.0" -"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1: - version "15.3.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.3.2.tgz#c46b0aa5380d7b838e7a59c4a7beff2ed315531f" - -react-dom@^15.4.2: +"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1, react-dom@^15.4.2: version "15.4.2" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.2.tgz#015363f05b0a1fd52ae9efdd3a0060d90695208f" dependencies: @@ -6561,15 +6638,7 @@ react-tagsinput@^3.14.0: version "3.14.0" resolved "https://registry.yarnpkg.com/react-tagsinput/-/react-tagsinput-3.14.0.tgz#6729f8d5b313ed8fbb35496205ec2a97654af6bc" -react@^15.3.1: - version "15.3.2" - resolved "https://registry.yarnpkg.com/react/-/react-15.3.2.tgz#a7bccd2fee8af126b0317e222c28d1d54528d09e" - dependencies: - fbjs "^0.8.4" - loose-envify "^1.1.0" - object-assign "^4.1.0" - -react@^15.4.2: +react@^15.3.1, react@^15.4.2: version "15.4.2" resolved "https://registry.yarnpkg.com/react/-/react-15.4.2.tgz#41f7991b26185392ba9bae96c8889e7e018397ef" dependencies: @@ -7806,6 +7875,10 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" +user-home@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" + user-home@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" @@ -7834,6 +7907,12 @@ uuid@^3.0.0, uuid@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" +v8flags@^2.0.10: + version "2.0.11" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.0.11.tgz#bca8f30f0d6d60612cc2c00641e6962d42ae6881" + dependencies: + user-home "^1.1.1" + validate-commit-msg@2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/validate-commit-msg/-/validate-commit-msg-2.5.0.tgz#a7d0a68aa3917171b560664689a2ac59c25908b6" From 492d9190532f5100a9c6a967ff956534801f0788 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 30 Mar 2017 15:59:49 -0600 Subject: [PATCH 25/87] Added babelrc to plugin --- plugins/coral-plugin-respect/client/.babelrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/coral-plugin-respect/client/.babelrc diff --git a/plugins/coral-plugin-respect/client/.babelrc b/plugins/coral-plugin-respect/client/.babelrc new file mode 100644 index 000000000..63b1c53de --- /dev/null +++ b/plugins/coral-plugin-respect/client/.babelrc @@ -0,0 +1,14 @@ +{ + "presets": [ + "es2015" + ], + "plugins": [ + "add-module-exports", + "transform-class-properties", + "transform-decorators-legacy", + "transform-object-assign", + "transform-object-rest-spread", + "transform-async-to-generator", + "transform-react-jsx" + ] +} From cd08987502d4851e704e1f368c539250517cb1e2 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 19:17:22 -0300 Subject: [PATCH 26/87] postRespect --- client/coral-embed-stream/src/Comment.js | 2 -- client/coral-embed-stream/src/Embed.js | 4 ++-- client/coral-framework/helpers/plugins.js | 4 ++++ plugins/coral-plugin-respect/client/index.js | 11 ++++++----- plugins/coral-plugin-respect/index.js | 12 ++++++++++++ 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 622d48b90..4f7827d3d 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -148,8 +148,6 @@ class Comment extends React.Component { ...rest }; - console.log('Commnet --------', pluginProps) - return (
- {/**/} + {/* */} {lang.t('MY_COMMENTS')} @@ -282,7 +282,7 @@ const mapStateToProps = (state) => Object userData: state.user.toJS(), asset: state.asset.toJS(), state: {} -}); + }); const mapDispatchToProps = dispatch => ({ requestConfirmEmail: () => dispatch(requestConfirmEmail()), diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index 7a0f2e2f3..af9079e6d 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -67,6 +67,10 @@ function injectPlugins ({fill, ...props}) { .map(addProps) .filter(filterBySlot) .reduce((entry, plugin, i) => { + // const element = React.cloneElement( + // context(plugin.key), + // {...plugin.props, key: i} + // ); entry = [...entry, context(plugin.key)({...plugin.props, key: i})]; return entry; }, []); diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 234a3178d..df729f096 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -4,11 +4,12 @@ import {Icon} from 'coral-ui'; export default (props) => { const handleClick = () => { - props.actions.clickButton(); - // props.postRespect({ - // item_id: props.comment.id, - // item_type: 'COMMENTS' - // }); + // props.actions.clic kButton(); + + props.context.postRespect({ + item_id: props.context.comment.id, + item_type: 'COMMENTS' + }); }; const {clicked} = props.state.respect; diff --git a/plugins/coral-plugin-respect/index.js b/plugins/coral-plugin-respect/index.js index 915d14ac0..a1f9a0c1c 100644 --- a/plugins/coral-plugin-respect/index.js +++ b/plugins/coral-plugin-respect/index.js @@ -8,5 +8,17 @@ module.exports = { return Action.create({item_id, item_type, action_type: 'RESPECT'}); } } + }, + hooks: { + ActionSummary: { + __resolveType: { + post({action_type}) { + switch (action_type) { + case 'RESPECT': + return 'HappyActionSummary'; + } + } + } + } } }; From 78d072a04a4c1ced347386dd82d075b759539223 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 30 Mar 2017 16:28:06 -0600 Subject: [PATCH 27/87] Fixed server plugi --- plugins/coral-plugin-respect/index.js | 14 ++++++++++++-- plugins/coral-plugin-respect/server/typeDefs.js | 9 +++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/coral-plugin-respect/index.js b/plugins/coral-plugin-respect/index.js index a1f9a0c1c..140a19ddf 100644 --- a/plugins/coral-plugin-respect/index.js +++ b/plugins/coral-plugin-respect/index.js @@ -10,12 +10,22 @@ module.exports = { } }, hooks: { + Action: { + __resolveType: { + post({action_type}) { + switch (action_type) { + case 'RESPECT': + return 'RespectAction'; + } + } + } + }, ActionSummary: { __resolveType: { post({action_type}) { switch (action_type) { - case 'RESPECT': - return 'HappyActionSummary'; + case 'RESPECT': + return 'RespectActionSummary'; } } } diff --git a/plugins/coral-plugin-respect/server/typeDefs.js b/plugins/coral-plugin-respect/server/typeDefs.js index f7666debf..f13aa71ca 100644 --- a/plugins/coral-plugin-respect/server/typeDefs.js +++ b/plugins/coral-plugin-respect/server/typeDefs.js @@ -29,6 +29,15 @@ module.exports = ` # The time when the Action was created. created_at: Date } + + type RespectActionSummary implements ActionSummary { + + # The count of actions with this group. + count: Int + + # The current user's action. + current_user: RespectAction + } type CreateRespectResponse implements Response { From 3d245c20294e43573bce9f00a53ee8f54bab9e4a Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 19:41:40 -0300 Subject: [PATCH 28/87] Working respect count --- client/coral-embed-stream/src/Embed.js | 3 +-- plugins/coral-plugin-respect/client/index.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index c3c0e78f7..54630847a 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -18,7 +18,7 @@ import {queryStream} from 'coral-framework/graphql/queries'; import {postComment, postFlag, postLike, postDontAgree, deleteAction, addCommentTag, removeCommentTag} from 'coral-framework/graphql/mutations'; import {editName} from 'coral-framework/actions/user'; import {updateCountCache} from 'coral-framework/actions/asset'; -import {notificationActions, authActions, assetActions, pym, Slot, actions} from 'coral-framework'; +import {notificationActions, authActions, assetActions, pym, actions} from 'coral-framework'; import Stream from './Stream'; import InfoBox from 'coral-plugin-infobox/InfoBox'; @@ -135,7 +135,6 @@ class Embed extends Component { return (
- {/* */} {lang.t('MY_COMMENTS')} diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index df729f096..a89f4046c 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -2,25 +2,28 @@ import React from 'react'; import styles from './style.css'; import {Icon} from 'coral-ui'; -export default (props) => { - const handleClick = () => { - // props.actions.clic kButton(); +const getActionSummary = (type, comment) => comment.action_summaries + .filter((a) => a.__typename === type)[0]; +export default (props) => { + const {comment} = props.context; + + const handleClick = () => { props.context.postRespect({ - item_id: props.context.comment.id, + item_id: comment.id, item_type: 'COMMENTS' }); }; - const {clicked} = props.state.respect; + + const respectActionSummary = getActionSummary('RespectActionSummary', comment); return (
); From 1ee49f76f6abc94a56492ad4df82a810b227a8b8 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 20:08:53 -0300 Subject: [PATCH 29/87] Styles, utils and state --- client/coral-embed-stream/style/default.css | 4 ++-- client/coral-framework/utils/index.js | 2 ++ plugins/coral-plugin-respect/client/components/Icon.js | 5 +++++ plugins/coral-plugin-respect/client/index.js | 7 +++---- plugins/coral-plugin-respect/client/style.css | 9 +++++++++ views/embed/stream.ejs | 1 + 6 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 client/coral-framework/utils/index.js create mode 100644 plugins/coral-plugin-respect/client/components/Icon.js diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css index 4c427543e..599925758 100644 --- a/client/coral-embed-stream/style/default.css +++ b/client/coral-embed-stream/style/default.css @@ -254,13 +254,13 @@ hr { .commentActionsRight, .replyActionsRight { display: flex; justify-content: flex-end; - width: 50%; + width: 30%; } .commentActionsLeft, .replyActionsLeft { display: flex; justify-content: flex-start; float: left; - width: 50%; + width: 70%; } .comment__action-container .material-icons { diff --git a/client/coral-framework/utils/index.js b/client/coral-framework/utils/index.js new file mode 100644 index 000000000..5a78b09d2 --- /dev/null +++ b/client/coral-framework/utils/index.js @@ -0,0 +1,2 @@ +export const getActionSummary = (type, comment) => comment.action_summaries + .filter((a) => a.__typename === type)[0]; \ No newline at end of file diff --git a/plugins/coral-plugin-respect/client/components/Icon.js b/plugins/coral-plugin-respect/client/components/Icon.js new file mode 100644 index 000000000..8a39218dc --- /dev/null +++ b/plugins/coral-plugin-respect/client/components/Icon.js @@ -0,0 +1,5 @@ +import React from 'react'; + +export default () => ( + +); diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index a89f4046c..91424e315 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -1,9 +1,8 @@ import React from 'react'; import styles from './style.css'; -import {Icon} from 'coral-ui'; +import Icon from './components/Icon'; -const getActionSummary = (type, comment) => comment.action_summaries - .filter((a) => a.__typename === type)[0]; +import {getActionSummary} from 'coral-framework/utils'; export default (props) => { const {comment} = props.context; @@ -22,7 +21,7 @@ export default (props) => {
diff --git a/plugins/coral-plugin-respect/client/style.css b/plugins/coral-plugin-respect/client/style.css index 6bb7746d3..7933f8d8e 100644 --- a/plugins/coral-plugin-respect/client/style.css +++ b/plugins/coral-plugin-respect/client/style.css @@ -7,9 +7,18 @@ padding: 0px; border: none; font-size: inherit; + + &:hover { + color: #d6ab00; + cursor: pointer; + } } .clicked { color: #ffcc00; } + + i { + padding: 0 5px; + } } \ No newline at end of file diff --git a/views/embed/stream.ejs b/views/embed/stream.ejs index 129895fc4..97cd0c796 100644 --- a/views/embed/stream.ejs +++ b/views/embed/stream.ejs @@ -5,6 +5,7 @@ + <% if (locals.customCssUrl) { %> <% } %> From e1c4b69038ec3fc8020bd29510545be5f03ffe3e Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 22:10:24 -0300 Subject: [PATCH 30/87] Plugin now support statefull components --- .eslintrc.json | 1 + client/coral-framework/helpers/plugins.js | 13 +++--- client/coral-framework/utils/index.js | 2 +- plugins.json | 3 +- plugins/coral-plugin-love/client/.babelrc | 14 +++++++ plugins/coral-plugin-love/client/config.json | 4 ++ plugins/coral-plugin-love/client/index.js | 7 ++++ plugins/coral-plugin-love/index.js | 0 plugins/coral-plugin-respect/client/.babelrc | 2 +- plugins/coral-plugin-respect/client/index.js | 43 ++++++++++++-------- 10 files changed, 64 insertions(+), 25 deletions(-) create mode 100644 plugins/coral-plugin-love/client/.babelrc create mode 100644 plugins/coral-plugin-love/client/config.json create mode 100644 plugins/coral-plugin-love/client/index.js create mode 100644 plugins/coral-plugin-love/index.js diff --git a/.eslintrc.json b/.eslintrc.json index 5cdd4dfa9..285f5f7dc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,6 +4,7 @@ "node": true }, "extends": "eslint:recommended", + "parser": "babel-eslint", "parserOptions": { "ecmaVersion": 2017, "sourceType": "module", diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index af9079e6d..e5ab297c8 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -1,4 +1,5 @@ import {client as clientPlugins} from 'pluginsConfig'; +import React from 'react'; function injectPlugins ({fill, ...props}) { let context, @@ -67,11 +68,13 @@ function injectPlugins ({fill, ...props}) { .map(addProps) .filter(filterBySlot) .reduce((entry, plugin, i) => { - // const element = React.cloneElement( - // context(plugin.key), - // {...plugin.props, key: i} - // ); - entry = [...entry, context(plugin.key)({...plugin.props, key: i})]; + const component = context(plugin.key); + const element = React.createElement(component, { + key: i, + ...plugin.props + }, null); + + entry = [...entry, element]; return entry; }, []); } diff --git a/client/coral-framework/utils/index.js b/client/coral-framework/utils/index.js index 5a78b09d2..7c0767fe2 100644 --- a/client/coral-framework/utils/index.js +++ b/client/coral-framework/utils/index.js @@ -1,2 +1,2 @@ export const getActionSummary = (type, comment) => comment.action_summaries - .filter((a) => a.__typename === type)[0]; \ No newline at end of file + .filter((a) => a.__typename === type)[0]; diff --git a/plugins.json b/plugins.json index 6ac303c35..cbe97c6bf 100644 --- a/plugins.json +++ b/plugins.json @@ -3,6 +3,7 @@ "coral-plugin-respect" ], "client": [ - "coral-plugin-respect" + "coral-plugin-respect", + "coral-plugin-love" ] } \ No newline at end of file diff --git a/plugins/coral-plugin-love/client/.babelrc b/plugins/coral-plugin-love/client/.babelrc new file mode 100644 index 000000000..63b1c53de --- /dev/null +++ b/plugins/coral-plugin-love/client/.babelrc @@ -0,0 +1,14 @@ +{ + "presets": [ + "es2015" + ], + "plugins": [ + "add-module-exports", + "transform-class-properties", + "transform-decorators-legacy", + "transform-object-assign", + "transform-object-rest-spread", + "transform-async-to-generator", + "transform-react-jsx" + ] +} diff --git a/plugins/coral-plugin-love/client/config.json b/plugins/coral-plugin-love/client/config.json new file mode 100644 index 000000000..7f2faa52c --- /dev/null +++ b/plugins/coral-plugin-love/client/config.json @@ -0,0 +1,4 @@ +{ + "name": "Coral Plugin Love", + "slot": "Comment.Detail" +} \ No newline at end of file diff --git a/plugins/coral-plugin-love/client/index.js b/plugins/coral-plugin-love/client/index.js new file mode 100644 index 000000000..d65d1522f --- /dev/null +++ b/plugins/coral-plugin-love/client/index.js @@ -0,0 +1,7 @@ +import React from 'react'; + +export default () => { + return ( +
Love
+ ); +}; diff --git a/plugins/coral-plugin-love/index.js b/plugins/coral-plugin-love/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/coral-plugin-respect/client/.babelrc b/plugins/coral-plugin-respect/client/.babelrc index 63b1c53de..60be246eb 100644 --- a/plugins/coral-plugin-respect/client/.babelrc +++ b/plugins/coral-plugin-respect/client/.babelrc @@ -11,4 +11,4 @@ "transform-async-to-generator", "transform-react-jsx" ] -} +} \ No newline at end of file diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 91424e315..fefdc1f72 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -4,27 +4,36 @@ import Icon from './components/Icon'; import {getActionSummary} from 'coral-framework/utils'; -export default (props) => { - const {comment} = props.context; +class RespectButton extends React.Component { + constructor(props) { + super(props); + } - const handleClick = () => { - props.context.postRespect({ + handleClick = () => { + const {comment} = this.props.context; + + this.props.context.postRespect({ item_id: comment.id, item_type: 'COMMENTS' }); - }; + } + + render() { + const {comment} = this.props.context; + const respectActionSummary = getActionSummary('RespectActionSummary', comment); - const respectActionSummary = getActionSummary('RespectActionSummary', comment); + return ( +
+ +
+ ); + } +} - return ( -
- -
- ); -}; +export default RespectButton; From 173e1c16ea9479955502d28e9eeb94322bfe2f79 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 22:51:16 -0300 Subject: [PATCH 31/87] Plugin now support statefull components --- client/coral-embed-stream/src/Embed.js | 1 + plugins.json | 3 +- .../coral-plugin-respect/client/actions.js | 1 - plugins/coral-plugin-respect/client/index.js | 63 ++++++++++++++++--- .../client/translations.json | 10 +++ 5 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 plugins/coral-plugin-respect/client/translations.json diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index 54630847a..fb130d26e 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -135,6 +135,7 @@ class Embed extends Component { return (
+ {/* */} {lang.t('MY_COMMENTS')} diff --git a/plugins.json b/plugins.json index cbe97c6bf..6ac303c35 100644 --- a/plugins.json +++ b/plugins.json @@ -3,7 +3,6 @@ "coral-plugin-respect" ], "client": [ - "coral-plugin-respect", - "coral-plugin-love" + "coral-plugin-respect" ] } \ No newline at end of file diff --git a/plugins/coral-plugin-respect/client/actions.js b/plugins/coral-plugin-respect/client/actions.js index 14964cc26..9af883182 100644 --- a/plugins/coral-plugin-respect/client/actions.js +++ b/plugins/coral-plugin-respect/client/actions.js @@ -1,7 +1,6 @@ const buttonClicked = () => ({type: 'BUTTON_CLICKED'}); export const clickButton = () => dispatch => { - console.log('here'); dispatch(buttonClicked()); }; diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index fefdc1f72..341363571 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -7,28 +7,71 @@ import {getActionSummary} from 'coral-framework/utils'; class RespectButton extends React.Component { constructor(props) { super(props); + + this.state = { + localPost: null, // Set to the ID of an action if one is posted + localDelete: false // Set to true is the user deletes an action, unless localPost is already set. + }; } handleClick = () => { - const {comment} = this.props.context; + const {comment, postRespect, showSignInDialog, currentUser} = this.props.context; + const {localPost, localDelete} = this.state; + const respect = getActionSummary('RespectActionSummary', comment); + const respected = (respect && respect.current_user && !localDelete) || localPost; - this.props.context.postRespect({ - item_id: comment.id, - item_type: 'COMMENTS' - }); + /** + * If the current user does not exist, trigger signIn Box + */ + + if (!currentUser) { + const offset = document.getElementById(`c_${comment.id}`).getBoundingClientRect().top - 75; + showSignInDialog(offset); + return; + } + + /** + * If the current user is banned, do nothing + */ + + if (currentUser.banned) { + return; + } + + if (!respected) { + this.setState({ + localPost: 'temp' + }); + + postRespect({ + item_id: comment.id, + item_type: 'COMMENTS' + }).then(({data}) => { + this.setState({ + localPost: data.createRespect.respect.id + }); + }); + + } else { + this.setState((prev) => prev.localPost ? {...prev, localPost: null} : {...prev, localDelete: true}); + } } - + render() { const {comment} = this.props.context; - const respectActionSummary = getActionSummary('RespectActionSummary', comment); + const {localPost, localDelete} = this.state; + const respect = getActionSummary('RespectActionSummary', comment); + let count = respect ? respect.count : 0; + + if (localPost) {count += 1;} + if (localDelete) {count -= 1;} return (
-
); diff --git a/plugins/coral-plugin-respect/client/translations.json b/plugins/coral-plugin-respect/client/translations.json new file mode 100644 index 000000000..643f32ccf --- /dev/null +++ b/plugins/coral-plugin-respect/client/translations.json @@ -0,0 +1,10 @@ +{ + "en": { + "respect": "Respect", + "respected": "Respected" + }, + "es": { + "respect": "Respeto", + "respected": "Respetado" + } +} From 004e8d5fe9d78cc47ca79573f761e42d27a7511e Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 31 Mar 2017 12:37:11 -0300 Subject: [PATCH 32/87] Using wrapResponse --- graph/helpers/response.js | 31 +++++++++++++++++++ graph/resolvers/root_mutation.js | 29 +---------------- .../client/components/Icon.js | 2 +- plugins/coral-plugin-respect/index.js | 3 +- 4 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 graph/helpers/response.js diff --git a/graph/helpers/response.js b/graph/helpers/response.js new file mode 100644 index 000000000..ebdbc02ec --- /dev/null +++ b/graph/helpers/response.js @@ -0,0 +1,31 @@ +const errors = require('../../errors'); +const {Error: {ValidationError}} = require('mongoose'); + +/** + * Wraps up a promise to return an object with the resolution of the promise + * keyed at `key` or an error caught at `errors`. + */ + +const wrapResponse = (key) => (promise) => { + return promise.then((value) => { + let res = {}; + if (key) { + res[key] = value; + } + return res; + }).catch((err) => { + if (err instanceof errors.APIError) { + return { + errors: [err] + }; + } else if (err instanceof ValidationError) { + + // TODO: wrap this with one of our internal errors. + throw err; + } + + throw err; + }); +}; + +module.exports = wrapResponse; diff --git a/graph/resolvers/root_mutation.js b/graph/resolvers/root_mutation.js index a474407d2..3d5ea9ad9 100644 --- a/graph/resolvers/root_mutation.js +++ b/graph/resolvers/root_mutation.js @@ -1,33 +1,6 @@ -const {Error: {ValidationError}} = require('mongoose'); -const errors = require('../../errors'); +const wrapResponse = require('../helpers/response'); const CommentsService = require('../../services/comments'); -/** - * Wraps up a promise to return an object with the resolution of the promise - * keyed at `key` or an error caught at `errors`. - */ -const wrapResponse = (key) => (promise) => { - return promise.then((value) => { - let res = {}; - if (key) { - res[key] = value; - } - return res; - }).catch((err) => { - if (err instanceof errors.APIError) { - return { - errors: [err] - }; - } else if (err instanceof ValidationError) { - - // TODO: wrap this with one of our internal errors. - throw err; - } - - throw err; - }); -}; - const RootMutation = { createComment(_, {asset_id, parent_id, body}, {mutators: {Comment}}) { return wrapResponse('comment')(Comment.create({asset_id, parent_id, body})); diff --git a/plugins/coral-plugin-respect/client/components/Icon.js b/plugins/coral-plugin-respect/client/components/Icon.js index 8a39218dc..1e4dd30b9 100644 --- a/plugins/coral-plugin-respect/client/components/Icon.js +++ b/plugins/coral-plugin-respect/client/components/Icon.js @@ -1,5 +1,5 @@ import React from 'react'; export default () => ( - +