From 501cda91daed8f4a7c301486d86cc5526f85601d Mon Sep 17 00:00:00 2001 From: Dano Morrison Date: Tue, 22 Sep 2020 23:46:31 -0400 Subject: [PATCH 1/5] Added markdown to webpack --- configs/webpack.config.renderer.dev.babel.js | 15 ++ configs/webpack.config.renderer.prod.babel.js | 15 ++ package.json | 2 + yarn.lock | 140 +++++++++++++++++- 4 files changed, 169 insertions(+), 3 deletions(-) diff --git a/configs/webpack.config.renderer.dev.babel.js b/configs/webpack.config.renderer.dev.babel.js index 093ba545..a20cc4f3 100644 --- a/configs/webpack.config.renderer.dev.babel.js +++ b/configs/webpack.config.renderer.dev.babel.js @@ -189,6 +189,21 @@ export default merge(baseConfig, { test: /\.(?:ico|gif|png|jpg|jpeg|webp)$/, use: 'url-loader', }, + // Markdown for copy + { + test: /\.md$/, + use: [ + { + loader: 'html-loader', + }, + { + loader: 'markdown-loader', + options: { + /* your options here */ + }, + }, + ], + }, ], }, resolve: { diff --git a/configs/webpack.config.renderer.prod.babel.js b/configs/webpack.config.renderer.prod.babel.js index 70d8593b..f412948c 100644 --- a/configs/webpack.config.renderer.prod.babel.js +++ b/configs/webpack.config.renderer.prod.babel.js @@ -174,6 +174,21 @@ export default merge(baseConfig, { test: /\.(?:ico|gif|png|jpg|jpeg|webp)$/, use: 'url-loader', }, + // Markdown for copy + { + test: /\.md$/, + use: [ + { + loader: 'html-loader', + }, + { + loader: 'markdown-loader', + options: { + /* your options here */ + }, + }, + ], + }, ], }, diff --git a/package.json b/package.json index f55ca0c0..1de683ef 100644 --- a/package.json +++ b/package.json @@ -231,10 +231,12 @@ "eslint-plugin-react-hooks": "^4.0.8", "eslint-plugin-testcafe": "^0.2.1", "file-loader": "^6.0.0", + "html-loader": "^1.3.1", "husky": "^4.2.5", "identity-obj-proxy": "^3.0.0", "jest": "^26.1.0", "lint-staged": "^10.2.11", + "markdown-loader": "^5.1.0", "mini-css-extract-plugin": "^0.9.0", "opencollective-postinstall": "^2.0.3", "optimize-css-assets-webpack-plugin": "^5.0.3", diff --git a/yarn.lock b/yarn.lock index 419522c3..d9ee8d5f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2113,6 +2113,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd" integrity sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ== +"@types/json-schema@^7.0.5": + version "7.0.6" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0" + integrity sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -2719,6 +2724,11 @@ ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.0.tgz#5c894537098785926d71e696114a53ce768ed773" integrity sha512-eyoaac3btgU8eJlvh01En8OCKzRqlLe2G5jDsCr3RiE2uLGMEEB1aaGwVVpwR8M95956tGH6R+9edC++OvzaVw== +ajv-keywords@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" + integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== + ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.0, ajv@^6.12.2, ajv@^6.5.5: version "6.12.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd" @@ -2729,6 +2739,16 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.0, ajv@^6.12.2, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^6.12.4: + version "6.12.5" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.5.tgz#19b0e8bae8f476e5ba666300387775fb1a00a4da" + integrity sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -4669,6 +4689,14 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== +camel-case@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-4.1.1.tgz#1fc41c854f00e2f7d0139dfeba1542d6896fe547" + integrity sha512-7fa2WcG4fYFkclIvEmxBbTvmibwF2/agfEBc6q3lOpVu0A13ltLsA+Hr/8Hp6kp5f+G7hKi6t8lys6XxP+1K6Q== + dependencies: + pascal-case "^3.1.1" + tslib "^1.10.0" + camelcase-keys@^6.2.2: version "6.2.2" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" @@ -4984,6 +5012,13 @@ classnames@2.x, classnames@^2.2.5, classnames@^2.2.6: resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce" integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q== +clean-css@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78" + integrity sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA== + dependencies: + source-map "~0.6.0" + clean-pslg@^1.1.0, clean-pslg@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/clean-pslg/-/clean-pslg-1.1.2.tgz#bd35c7460b7e8ab5a9f761a5ed51796aa3c86c11" @@ -5254,6 +5289,11 @@ commander@2.11.x: resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" integrity sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ== +commander@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + commander@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" @@ -6719,6 +6759,14 @@ domutils@^2.0.0: domelementtype "^2.0.1" domhandler "^3.0.0" +dot-case@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.3.tgz#21d3b52efaaba2ea5fda875bb1aa8124521cf4aa" + integrity sha512-7hwEmg6RiSQfm/GwPL4AAWXKy3YNNZA3oFv2Pdiey0mwkRCPZ9x6SZbkLcn8Ma5PYeVokzoD4Twv2n7LKp5WeA== + dependencies: + no-case "^3.0.3" + tslib "^1.10.0" + dot-prop@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.2.0.tgz#c34ecc29556dc45f1f4c22697b6f4904e0cc4fcb" @@ -9442,6 +9490,11 @@ hazardous@^0.3.0: dependencies: callsite "^1.0.0" +he@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + hex-color-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" @@ -9585,6 +9638,29 @@ html-escaper@^2.0.0: resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== +html-loader@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/html-loader/-/html-loader-1.3.1.tgz#16ae142e23daa4f0d67a2ac2fccaa087be5d64e2" + integrity sha512-zL+z9mIhcXEXuHqzriTwZR4ZslZHi5IFNhjyJHyhJlhEgR8VtLTPbqeR5TdbNtHtb88zbVmlNB8ia2vr/GTrbA== + dependencies: + html-minifier-terser "^5.1.1" + htmlparser2 "^4.1.0" + loader-utils "^2.0.0" + schema-utils "^2.7.1" + +html-minifier-terser@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz#922e96f1f3bb60832c2634b79884096389b1f054" + integrity sha512-ZPr5MNObqnV/T9akshPKbVgyOqLmy+Bxo7juKCfTfnjNniTAMdy4hz21YQqoofMBJD2kdREaqPPdThoR78Tgxg== + dependencies: + camel-case "^4.1.1" + clean-css "^4.2.3" + commander "^4.1.1" + he "^1.2.0" + param-case "^3.0.3" + relateurl "^0.2.7" + terser "^4.6.3" + html-tags@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.1.0.tgz#7b5e6f7e665e9fb41f30007ed9e0d41e97fb2140" @@ -11584,6 +11660,13 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3 dependencies: js-tokens "^3.0.0 || ^4.0.0" +lower-case@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.1.tgz#39eeb36e396115cc05e29422eaea9e692c9408c7" + integrity sha512-LiWgfDLLb1dwbFQZsSglpRj+1ctGnayXz3Uv0/WO8n558JycT5fg6zkNcnW0G68Nn0aEldTFeEfmjCfmqry/rQ== + dependencies: + tslib "^1.10.0" + lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" @@ -11717,6 +11800,14 @@ markdown-escapes@^1.0.0: resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.4.tgz#c95415ef451499d7602b91095f3c8e8975f78535" integrity sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg== +markdown-loader@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/markdown-loader/-/markdown-loader-5.1.0.tgz#4efd5006b1514ca966141c661a47e542a9836e6e" + integrity sha512-xtQNozLEL+55ZSPTNwro8epZqf1h7HjAZd/69zNe8lbckDiGVHeLQm849bXzocln2pwRK2A/GrW/7MAmwjcFog== + dependencies: + loader-utils "^1.2.3" + marked "^0.7.0" + markdown-table@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b" @@ -11724,6 +11815,11 @@ markdown-table@^2.0.0: dependencies: repeat-string "^1.0.0" +marked@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/marked/-/marked-0.7.0.tgz#b64201f051d271b1edc10a04d1ae9b74bb8e5c0e" + integrity sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg== + mat4-decompose@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/mat4-decompose/-/mat4-decompose-1.0.4.tgz#65eb4fe39d70878f7a444eb4624d52f7e7eb2faf" @@ -12416,6 +12512,14 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== +no-case@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.3.tgz#c21b434c1ffe48b39087e86cfb4d2582e9df18f8" + integrity sha512-ehY/mVQCf9BL0gKfsJBvFJen+1V//U+0HQMPrWct40ixE4jnv0bfvxDbWtAHL9EcaPEOJHVVYKoQn1TlZUB8Tw== + dependencies: + lower-case "^2.0.1" + tslib "^1.10.0" + node-abi@^2.11.0: version "2.18.0" resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.18.0.tgz#1f5486cfd7d38bd4f5392fa44a4ad4d9a0dffbf4" @@ -13098,6 +13202,14 @@ parallel-transform@^1.1.0: inherits "^2.0.3" readable-stream "^2.1.5" +param-case@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/param-case/-/param-case-3.0.3.tgz#4be41f8399eff621c56eebb829a5e451d9801238" + integrity sha512-VWBVyimc1+QrzappRs7waeN2YmoZFCGXWASRYX1/rGHtXqEcrGEIDm+jqIwFa2fRXNgQEwrxaYuIrX0WcAguTA== + dependencies: + dot-case "^3.0.3" + tslib "^1.10.0" + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -13220,6 +13332,14 @@ parseurl@~1.3.2, parseurl@~1.3.3: resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== +pascal-case@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.1.tgz#5ac1975133ed619281e88920973d2cd1f279de5f" + integrity sha512-XIeHKqIrsquVTQL2crjq3NfJUxmdLasn3TYOU0VBM+UX2a6ztAWBlJQBePLGY7VHW8+2dRadeIPK5+KImwTxQA== + dependencies: + no-case "^3.0.3" + tslib "^1.10.0" + pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" @@ -15005,6 +15125,11 @@ regl@^1.3.11, regl@^1.6.1: resolved "https://registry.yarnpkg.com/regl/-/regl-1.6.1.tgz#6930172cda9b8fb65724abc0d4930d79333f5460" integrity sha512-7Z9rmpEqmLNwC9kCYCyfyu47eWZaQWeNpwZfwz99QueXN8B/Ow40DB0N+OeUeM/yu9pZAB01+JgJ+XghGveVoA== +relateurl@^0.2.7: + version "0.2.7" + resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" + integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk= + remark-parse@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95" @@ -15597,6 +15722,15 @@ schema-utils@^2.6.5, schema-utils@^2.6.6, schema-utils@^2.7.0: ajv "^6.12.2" ajv-keywords "^3.4.1" +schema-utils@^2.7.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.1.tgz#1ca4f32d1b24c590c203b8e7a50bf0ea4cd394d7" + integrity sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg== + dependencies: + "@types/json-schema" "^7.0.5" + ajv "^6.12.4" + ajv-keywords "^3.5.2" + seedrandom@^3.0.5: version "3.0.5" resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.5.tgz#54edc85c95222525b0c7a6f6b3543d8e0b3aa0a7" @@ -16081,7 +16215,7 @@ source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -16922,7 +17056,7 @@ terser-webpack-plugin@^3.0.7: terser "^4.8.0" webpack-sources "^1.4.3" -terser@^4.1.2, terser@^4.6.12, terser@^4.8.0: +terser@^4.1.2, terser@^4.6.12, terser@^4.6.3, terser@^4.8.0: version "4.8.0" resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== @@ -17464,7 +17598,7 @@ tsconfig-paths@^3.9.0: minimist "^1.2.0" strip-bom "^3.0.0" -tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: version "1.13.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== From bc25a3a46cdc4a43216003d6060a8314b59fa807 Mon Sep 17 00:00:00 2001 From: Dano Morrison Date: Wed, 23 Sep 2020 01:06:33 -0400 Subject: [PATCH 2/5] Added strings dir and glob bundling of strings --- .../default_experiments/faces_houses/index.ts | 11 +++++-- .../faces_houses/overview.md | 5 +++ .../default_experiments/stroop/params.js | 2 +- app/components/DesignComponent/index.tsx | 6 ++-- app/components/HomeComponent/index.tsx | 13 ++++++++ .../facesHouses_/background.md | 9 ++++++ .../facesHouses_/overview.md | 3 ++ .../facesHouses_/protocol.md | 19 +++++++++++ .../defaultExperiments_/stroop_/background.md | 9 ++++++ app/strings/index.ts | 32 +++++++++++++++++++ 10 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 app/assets/default_experiments/faces_houses/overview.md create mode 100644 app/strings/defaultExperiments_/facesHouses_/background.md create mode 100644 app/strings/defaultExperiments_/facesHouses_/overview.md create mode 100644 app/strings/defaultExperiments_/facesHouses_/protocol.md create mode 100644 app/strings/defaultExperiments_/stroop_/background.md create mode 100644 app/strings/index.ts diff --git a/app/assets/default_experiments/faces_houses/index.ts b/app/assets/default_experiments/faces_houses/index.ts index fb6e74c4..a00df4a5 100644 --- a/app/assets/default_experiments/faces_houses/index.ts +++ b/app/assets/default_experiments/faces_houses/index.ts @@ -1,10 +1,15 @@ import { params } from './params'; import { background } from './content_background'; -import { overview } from './content_overview'; import { protocol } from './content_protocol'; +import overview from './overview.md'; + +console.log(overview); const buildTimeline = () => ({ - params, background, overview, protocol + params, + background, + overview, + protocol, }); -export default buildTimeline; \ No newline at end of file +export default buildTimeline; diff --git a/app/assets/default_experiments/faces_houses/overview.md b/app/assets/default_experiments/faces_houses/overview.md new file mode 100644 index 00000000..b10ba096 --- /dev/null +++ b/app/assets/default_experiments/faces_houses/overview.md @@ -0,0 +1,5 @@ +# Faces and Houses + +Oh boy I love faces and houses. + +I love [rambler-style houses](https://google.com) the best. diff --git a/app/assets/default_experiments/stroop/params.js b/app/assets/default_experiments/stroop/params.js index 5f4f0653..c47967b7 100644 --- a/app/assets/default_experiments/stroop/params.js +++ b/app/assets/default_experiments/stroop/params.js @@ -20,4 +20,4 @@ export const params = { type: EVENTS.STIMULUS_2, response: '9', }, -}, \ No newline at end of file +}; diff --git a/app/components/DesignComponent/index.tsx b/app/components/DesignComponent/index.tsx index 368fe90b..aac0c5fe 100644 --- a/app/components/DesignComponent/index.tsx +++ b/app/components/DesignComponent/index.tsx @@ -66,10 +66,10 @@ export interface Props { overview: { title: string; overview: string; - links: { address: string; name: string }[], + links: { address: string; name: string }[]; }; background: { - links: { address: string; name: string }[], + links: { address: string; name: string }[]; first_column_statement: string; first_column_question: string; second_column_statement: string; @@ -85,7 +85,7 @@ export interface Props { condition_second_title: string; condition_second: string; }; -}; +} interface State { activeStep: string; diff --git a/app/components/HomeComponent/index.tsx b/app/components/HomeComponent/index.tsx index 05fd68fe..12756452 100644 --- a/app/components/HomeComponent/index.tsx +++ b/app/components/HomeComponent/index.tsx @@ -40,6 +40,7 @@ import OverviewComponent from './OverviewComponent'; import { loadProtocol } from '../../utils/labjs/functions'; import EEGExplorationComponent from '../EEGExplorationComponent'; import { SignalQualityData } from '../../constants/interfaces'; +import strings from '../../strings'; const { dialog } = remote; @@ -95,6 +96,7 @@ export default class Home extends Component { componentDidMount() { this.setState({ recentWorkspaces: readWorkspaces() }); + console.log(strings); } handleStepClick(step: string) { @@ -334,6 +336,17 @@ export default class Home extends Component { /> + + + + +
+ + diff --git a/app/strings/defaultExperiments_/facesHouses_/background.md b/app/strings/defaultExperiments_/facesHouses_/background.md new file mode 100644 index 00000000..c764b2df --- /dev/null +++ b/app/strings/defaultExperiments_/facesHouses_/background.md @@ -0,0 +1,9 @@ +Did you know that we spend more time looking at faces than any other type of stimuli? Faces contain a lot of information that is relevant to our day-to-day lives. + +For example, by looking at someone’s face we can assess their emotional state. This has led researchers speculate that faces may be processed differently than other stimuli. + +In fact, there is a special area in your brain, the Fusiform Face Area, that has been shown to be selective for faces. People who have damage in this area may have a hard time recognizing faces, a condition called face blindness, or prosopagnosia. + +In [this video](https://www.cnn.com/videos/health/2011/01/04/sacks.face.blindness.cnn) the famous neurologist Oliver Sacks explains what it is like to have face blindness to the extent that he sometimes didn’t even recognize his own face (!). + +Fun fact: Brad Pitt claims he has face blindness, but he has not been tested. Do you know anyone who has face blindness? diff --git a/app/strings/defaultExperiments_/facesHouses_/overview.md b/app/strings/defaultExperiments_/facesHouses_/overview.md new file mode 100644 index 00000000..a606046a --- /dev/null +++ b/app/strings/defaultExperiments_/facesHouses_/overview.md @@ -0,0 +1,3 @@ +# Faces Houses Experiment + +When you scroll through your social media feed, you may find that you are more likely to pause when a picture contains a face, than, for example, a tree. In this experiment, you will explore whether our brains process faces differently than other objects (in this case, houses). diff --git a/app/strings/defaultExperiments_/facesHouses_/protocol.md b/app/strings/defaultExperiments_/facesHouses_/protocol.md new file mode 100644 index 00000000..89b60f2e --- /dev/null +++ b/app/strings/defaultExperiments_/facesHouses_/protocol.md @@ -0,0 +1,19 @@ +# What participants are shown + +In the Faces/Houses experiment, participants will see pictures of different faces and houses. + + + +![](../../../assets/default_experiments/faces_houses/stimuli/faces/Face1.jpg) + +## Faces + +When participants see a face, they should press the key “1”. + +![](../../../assets/default_experiments/faces_houses/stimuli/houses/House1.jpg) + +## Houses + +If participants see a house, they should press “9”. diff --git a/app/strings/defaultExperiments_/stroop_/background.md b/app/strings/defaultExperiments_/stroop_/background.md new file mode 100644 index 00000000..c764b2df --- /dev/null +++ b/app/strings/defaultExperiments_/stroop_/background.md @@ -0,0 +1,9 @@ +Did you know that we spend more time looking at faces than any other type of stimuli? Faces contain a lot of information that is relevant to our day-to-day lives. + +For example, by looking at someone’s face we can assess their emotional state. This has led researchers speculate that faces may be processed differently than other stimuli. + +In fact, there is a special area in your brain, the Fusiform Face Area, that has been shown to be selective for faces. People who have damage in this area may have a hard time recognizing faces, a condition called face blindness, or prosopagnosia. + +In [this video](https://www.cnn.com/videos/health/2011/01/04/sacks.face.blindness.cnn) the famous neurologist Oliver Sacks explains what it is like to have face blindness to the extent that he sometimes didn’t even recognize his own face (!). + +Fun fact: Brad Pitt claims he has face blindness, but he has not been tested. Do you know anyone who has face blindness? diff --git a/app/strings/index.ts b/app/strings/index.ts new file mode 100644 index 00000000..846bd163 --- /dev/null +++ b/app/strings/index.ts @@ -0,0 +1,32 @@ +/** + * This file allows webpack to bundle all of the html generated by the markdown + * files in this directory into one object that can be imported into the app + * e.g.
+ */ + +import set from 'set-value'; + +// Unfortunately, recursive globbing doesn't work here, +// so we have to do this somewhat ugly hack. +// @ts-expect-error +import * as firstLevel from 'glob:./**.md'; +// @ts-expect-error +import * as secondLevel from 'glob:./**/**.md'; +// @ts-expect-error +import * as thirdLevel from 'glob:./**/**/**.md'; + +// babel-plugin-import-glob separates path with this character +// TODO: directory seperator is not being added so I had to do it manually +const DIRECTORY_SEPARATOR = /_/g; +const buildStrings = () => { + const entries = { ...firstLevel, ...secondLevel, ...thirdLevel }; + const nested: any = {}; + Object.keys(entries).forEach((key) => { + const keyWithDots = key.replace(DIRECTORY_SEPARATOR, '.'); + set(nested, keyWithDots, entries[key]); + }); + return nested; +}; + +const strings = buildStrings(); +export default strings; From f1f213005d0d0acc972c4ab1cc5d803231ad8ad1 Mon Sep 17 00:00:00 2001 From: Dano Morrison Date: Wed, 23 Sep 2020 01:06:56 -0400 Subject: [PATCH 3/5] Added glob to babel config --- configs/webpack.config.renderer.dev.babel.js | 1 + configs/webpack.config.renderer.prod.babel.js | 2 ++ package.json | 2 ++ yarn.lock | 35 +++++++++++++++++-- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/configs/webpack.config.renderer.dev.babel.js b/configs/webpack.config.renderer.dev.babel.js index a20cc4f3..19ad4fc0 100644 --- a/configs/webpack.config.renderer.dev.babel.js +++ b/configs/webpack.config.renderer.dev.babel.js @@ -11,6 +11,7 @@ import webpack from 'webpack'; import chalk from 'chalk'; import { merge } from 'webpack-merge'; import { spawn, execSync } from 'child_process'; +import ImportGlobPlugin from 'babel-plugin-import-glob'; import baseConfig from './webpack.config.base'; import CheckNodeEnv from '../internals/scripts/CheckNodeEnv'; diff --git a/configs/webpack.config.renderer.prod.babel.js b/configs/webpack.config.renderer.prod.babel.js index f412948c..ef13c35e 100644 --- a/configs/webpack.config.renderer.prod.babel.js +++ b/configs/webpack.config.renderer.prod.babel.js @@ -9,6 +9,7 @@ import OptimizeCSSAssetsPlugin from 'optimize-css-assets-webpack-plugin'; import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; import { merge } from 'webpack-merge'; import TerserPlugin from 'terser-webpack-plugin'; +import ImportGlobPlugin from 'babel-plugin-import-glob'; import baseConfig from './webpack.config.base'; import CheckNodeEnv from '../internals/scripts/CheckNodeEnv'; import DeleteSourceMaps from '../internals/scripts/DeleteSourceMaps'; @@ -237,5 +238,6 @@ export default merge(baseConfig, { process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled', openAnalyzer: process.env.OPEN_ANALYZER === 'true', }), + new ImportGlobPlugin({}), ], }); diff --git a/package.json b/package.json index 1de683ef..6b6ef38a 100644 --- a/package.json +++ b/package.json @@ -200,6 +200,7 @@ "babel-jest": "^26.1.0", "babel-loader": "^8.1.0", "babel-plugin-dev-expression": "^0.2.2", + "babel-plugin-import-glob": "^2.0.0", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "browserslist-config-erb": "^0.0.1", "chalk": "^4.1.0", @@ -311,6 +312,7 @@ "rxjs-compat": "^6.5.5", "semantic-ui-css": "^2.4.1", "semantic-ui-react": "^0.88.2", + "set-value": "^3.0.2", "simple-statistics": "^7.1.0", "simplify-js": "^1.2.4", "source-map-support": "^0.5.19", diff --git a/yarn.lock b/yarn.lock index d9ee8d5f..0777bf33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3494,6 +3494,15 @@ babel-plugin-dynamic-import-node@^2.3.3: dependencies: object.assign "^4.1.0" +babel-plugin-import-glob@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-import-glob/-/babel-plugin-import-glob-2.0.0.tgz#80e34809732885c5bcb8763744c34cddb37163ca" + integrity sha1-gONICXMohcW8uHY3RMNM3bNxY8o= + dependencies: + glob "^7.0.0" + identifierfy "^1.1.0" + minimatch-capture "^1.1.0" + babel-plugin-istanbul@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz#e159ccdc9af95e0b570c75b4573b7c34d671d765" @@ -3997,7 +4006,7 @@ babel-register@^6.26.0: mkdirp "^0.5.1" source-map-support "^0.4.15" -babel-runtime@6.x, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.25.0, babel-runtime@^6.26.0, babel-runtime@^6.6.1: +babel-runtime@6.x, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.25.0, babel-runtime@^6.26.0, babel-runtime@^6.3.19, babel-runtime@^6.6.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= @@ -8967,7 +8976,7 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.6: +glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -9832,6 +9841,14 @@ icss-utils@^4.0.0, icss-utils@^4.1.1: dependencies: postcss "^7.0.14" +identifierfy@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/identifierfy/-/identifierfy-1.1.1.tgz#8f963650afa36aeb42f2ff0ed15f295ff040aff0" + integrity sha1-j5Y2UK+jautC8v8O0V8pX/BAr/A= + dependencies: + babel-runtime "^6.3.19" + esutils "^2.0.2" + identity-obj-proxy@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz#94d2bda96084453ef36fbc5aaec37e0f79f1fc14" @@ -12109,6 +12126,13 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= +minimatch-capture@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/minimatch-capture/-/minimatch-capture-1.1.0.tgz#d6c8c2acdba92dc2f66921d8007ed0e42b2f9855" + integrity sha1-1sjCrNupLcL2aSHYAH7Q5CsvmFU= + dependencies: + minimatch "^3.0.4" + minimatch@3.0.4, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -15892,6 +15916,13 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" +set-value@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-3.0.2.tgz#74e8ecd023c33d0f77199d415409a40f21e61b90" + integrity sha512-npjkVoz+ank0zjlV9F47Fdbjfj/PfXyVhZvGALWsyIYU/qrMzpi6avjKW3/7KeSU2Df3I46BrN1xOI1+6vW0hA== + dependencies: + is-plain-object "^2.0.4" + setimmediate@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" From baaf0e0eee6cfe505e91d6f13ae371db4ff9294a Mon Sep 17 00:00:00 2001 From: Dano Morrison Date: Wed, 23 Sep 2020 01:07:34 -0400 Subject: [PATCH 4/5] Added to babel actually --- babel.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/babel.config.js b/babel.config.js index efad5dcd..77d6ce70 100644 --- a/babel.config.js +++ b/babel.config.js @@ -56,6 +56,9 @@ module.exports = (api) => { [require('@babel/plugin-proposal-class-properties'), { loose: true }], require('@babel/plugin-proposal-json-strings'), + // glob for easily handling html from markdown + require('babel-plugin-import-glob'), + ...(development ? developmentPlugins : productionPlugins), ], }; From ad602431e56b216f797a1422702f2e3cc3e1e1f0 Mon Sep 17 00:00:00 2001 From: Teon L Brooks Date: Wed, 23 Sep 2020 10:22:54 -0400 Subject: [PATCH 5/5] more cleanup --- .../default_experiments/custom}/custom.ts | 0 .../default_experiments/custom/labjs_script.js} | 0 .../default_experiments/stroop/content_protocol.js | 2 +- app/utils/labjs/functions.ts | 11 +++++------ keys.js | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) rename app/{utils/labjs/protocols => assets/default_experiments/custom}/custom.ts (100%) rename app/{utils/labjs/scripts/custom.js => assets/default_experiments/custom/labjs_script.js} (100%) diff --git a/app/utils/labjs/protocols/custom.ts b/app/assets/default_experiments/custom/custom.ts similarity index 100% rename from app/utils/labjs/protocols/custom.ts rename to app/assets/default_experiments/custom/custom.ts diff --git a/app/utils/labjs/scripts/custom.js b/app/assets/default_experiments/custom/labjs_script.js similarity index 100% rename from app/utils/labjs/scripts/custom.js rename to app/assets/default_experiments/custom/labjs_script.js diff --git a/app/assets/default_experiments/stroop/content_protocol.js b/app/assets/default_experiments/stroop/content_protocol.js index dce93021..7b512223 100644 --- a/app/assets/default_experiments/stroop/content_protocol.js +++ b/app/assets/default_experiments/stroop/content_protocol.js @@ -13,5 +13,5 @@ export const protocol = { condition_second_img: `conditionIncongruent`, condition_second_title: `"Green" written in red`, condition_second: `The color is red, so the correct response is ‘r’.`, - links: [] + links: [], }; diff --git a/app/utils/labjs/functions.ts b/app/utils/labjs/functions.ts index 602cb40e..efbb7b9d 100644 --- a/app/utils/labjs/functions.ts +++ b/app/utils/labjs/functions.ts @@ -1,10 +1,9 @@ import { EXPERIMENTS } from '../../constants/constants'; -import * as buildN170Timeline from '../../assets/default_experiments/faces_houses'; -import * as buildStroopTimeline from '../../assets/default_experiments/stroop'; -import * as buildMultiTimeline from '../../assets/default_experiments/multitasking'; -import * as buildSearchTimeline from '../../assets/default_experiments/search'; -import * as buildCustomTimeline from './protocols/custom'; +import buildN170Timeline from '../../assets/default_experiments/faces_houses'; +import buildStroopTimeline from '../../assets/default_experiments/stroop'; +import buildMultiTimeline from '../../assets/default_experiments/multitasking'; +import buildSearchTimeline from '../../assets/default_experiments/search'; // loads a protocol of the experiment // TODO refactor this experiment description system to be much more predictable @@ -29,7 +28,7 @@ export const loadProtocol = (paradigm: EXPERIMENTS) => { case EXPERIMENTS.CUSTOM: default: - protocol = buildCustomTimeline(); + protocol = {}; break; } return protocol; diff --git a/keys.js b/keys.js index 7f783eff..161be766 100644 --- a/keys.js +++ b/keys.js @@ -1,5 +1,5 @@ -// These values must be filled with the appropriate Emotiv credentials to be able to use the Cortex SDK -// We have our credentials stored in environement variables +// These values must be filled with the appropriate Emotiv credentials to be able to use the Cortex SDK +// We have our credentials stored in environment variables const USERNAME = process.env.EMOTIV_USERNAME; const PASSWORD = process.env.EMOTIV_PASSWORD;