diff --git a/.eslintignore b/.eslintignore
index 2952f5022..c4d7d9993 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,2 +1,3 @@
src/js/vendor/*.js
-src/js/mock-data/
\ No newline at end of file
+src/js/mock-data/
+src/js/dispatcher/Dispatcher.js
diff --git a/.eslintrc b/.eslintrc
index 8f524243f..491e37665 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,5 +1,8 @@
{
"parser": "babel-eslint",
+ "parserOptions": {
+ "sourceType": "module"
+ },
"env": {
"browser": true,
@@ -7,206 +10,71 @@
"es6": true
},
- "ecmaFeatures": {
- "arrowFunctions": true,
- "binaryLiterals": true,
- "blockBindings": true,
- "classes": false,
- "defaultParams": true,
- "destructuring": true,
- "forOf": true,
- "generators": true,
- "modules": true,
- "objectLiteralComputedProperties": true,
- "objectLiteralDuplicateProperties": true,
- "objectLiteralShorthandMethods": true,
- "objectLiteralShorthandProperties": true,
- "octalLiterals": true,
- "regexUFlag": true,
- "regexYFlag": true,
- "spread": true,
- "superInFunctions": false,
- "templateStrings": true,
- "unicodeCodePointEscapes": true,
- "globalReturn": true,
- "jsx": true
- },
+ "extends": "airbnb",
"rules": {
- "block-scoped-var": [0],
- "brace-style": [2, "1tbs", {"allowSingleLine": true}],
- "camelcase": [0],
- "comma-dangle": [0],
- "comma-spacing": [1],
- "comma-style": [2, "last"],
- "complexity": [0, 11],
- "consistent-return": [1],
- "consistent-this": [0, "that"],
- "curly": [0, "multi-line"],
- "default-case": [1],
- "dot-notation": [2, {"allowKeywords": true}],
- "eol-last": [1],
- "eqeqeq": [1],
- "func-names": [0],
- "func-style": [0, "declaration"],
- "generator-star-spacing": [2, "after"],
- "guard-for-in": [0],
- "handle-callback-err": [0],
- "key-spacing": [1, {"beforeColon": false, "afterColon": true}],
- "quotes": [1, "double", "avoid-escape"],
- "max-depth": [0, 4],
+ "array-bracket-spacing": [1, "never"],
+ "camelcase": [1],
+ "class-methods-use-this": 0, // We want to allow helper functions that don't use 'this' in classes
+ "jsx-a11y/alt-text": 0,
+ "jsx-a11y/anchor-has-content": 1,
+ "jsx-a11y/anchor-is-valid": 1,
+ "jsx-a11y/click-events-have-key-events": 0,
+ "jsx-a11y/heading-has-content": 1,
+ "jsx-a11y/iframe-has-title": 1,
+ "jsx-a11y/label-has-associated-control": 1,
+ "jsx-a11y/label-has-for": 0, // Deprecated in favor of 'label-has-associated-control'
+ "jsx-a11y/mouse-events-have-key-events": 1,
+ "jsx-a11y/no-autofocus": 1,
+ "jsx-a11y/no-noninteractive-element-interactions": 1,
+ "jsx-a11y/no-static-element-interactions": 0,
+ "jsx-quotes": 2,
"max-len": [0, 80, 4],
- "max-nested-callbacks": [0, 2],
- "max-params": [0, 3],
- "max-statements": [0, 10],
- "new-parens": [2],
- "new-cap": [0],
- "newline-after-var": [0],
- "no-alert": [2],
- "no-array-constructor": [2],
- "no-bitwise": [0],
- "no-caller": [2],
- "no-catch-shadow": [2],
- "no-cond-assign": [2],
"no-console": [0],
- "no-constant-condition": [1],
- "no-continue": [2],
- "no-control-regex": [2],
- "no-debugger": [2],
- "no-delete-var": [2],
- "no-div-regex": [0],
- "no-dupe-args": [2],
- "no-dupe-keys": [2],
- "no-duplicate-case": [2],
"no-else-return": [0],
- "no-empty": [2],
- "no-empty-character-class": [2],
- "no-empty-label": [2],
- "no-eq-null": [0],
- "no-eval": [2],
- "no-ex-assign": [2],
- "no-extend-native": [1],
- "no-extra-bind": [1],
- "no-extra-boolean-cast": [2],
- "no-extra-semi": [1],
- "no-fallthrough": [2],
- "no-floating-decimal": [2],
- "no-func-assign": [2],
- "no-implied-eval": [2],
- "no-inline-comments": [0],
- "no-inner-declarations": [2, "functions"],
- "no-invalid-regexp": [2],
- "no-irregular-whitespace": [2],
- "no-iterator": [2],
- "no-label-var": [2],
- "no-labels": [2],
- "no-lone-blocks": [2],
- "no-lonely-if": [1],
- "no-loop-func": [1],
- "no-mixed-requires": [0, false],
- "no-mixed-spaces-and-tabs": [2, false],
- "no-multi-spaces": [1],
- "no-multi-str": [2],
- "no-multiple-empty-lines": [2, {"max": 2}],
- "no-native-reassign": [1],
- "no-negated-in-lhs": [2],
- "no-nested-ternary": [0],
- "no-new": [2],
- "no-new-func": [2],
- "no-new-object": [2],
- "no-new-require": [0],
- "no-new-wrappers": [2],
- "no-obj-calls": [2],
- "no-octal": [2],
- "no-octal-escape": [2],
- "no-param-reassign": [1],
- "no-path-concat": [0],
+ "no-multi-spaces": [0],
+ "no-multiple-empty-lines": [0], // allow indented comments (like this one)
"no-plusplus": [0],
- "no-process-env": [0],
- "no-process-exit": [2],
- "no-proto": [2],
- "no-redeclare": [1],
- "no-regex-spaces": [2],
- "no-reserved-keys": [0],
- "no-restricted-modules": [0],
- "no-return-assign": [2],
- "no-script-url": [2],
- "no-self-compare": [0],
- "no-sequences": [1],
- "no-shadow": [1],
- "no-shadow-restricted-names": [2],
- "no-spaced-func": [1],
- "no-sparse-arrays": [2],
- "no-sync": [0],
- "no-ternary": [0],
- "no-throw-literal": [2],
- "no-trailing-spaces": [1],
- "no-undef": [1],
- "no-undef-init": [2],
- "no-undefined": [0],
"no-underscore-dangle": [0],
- "no-unreachable": [2],
- "no-unused-expressions": [1],
- "no-unused-vars": [1],
- "no-use-before-define": [1],
- "no-void": [0],
- "no-warning-comments": [0, {"terms": ["todo", "fixme", "xxx"], "location": "start"}],
- "no-with": [2],
- "no-extra-parens": [1],
- "one-var": [1, "never"],
- "operator-assignment": [0, "always"],
- "operator-linebreak": [1, "after"],
- "padded-blocks": [0],
- "quote-props": [0],
- "radix": [0],
- "semi": [1],
- "semi-spacing": [2, {"before": false, "after": true}],
- "sort-vars": [0],
- "space-after-keywords": [2, "always"],
- "space-before-function-paren": [1, {"anonymous": "always", "named": "always"}],
- "space-before-blocks": [0, "always"],
- "space-in-brackets": [
- 0, "never", {
- "singleValue": true,
- "arraysInArrays": false,
+ "object-curly-newline": 0,
+ "object-curly-spacing": [1,
+ "always", {
"arraysInObjects": false,
- "objectsInArrays": true,
- "objectsInObjects": true,
- "propertyName": false
+ "objectsInObjects": true
}
],
- "space-in-parens": [0],
- "space-infix-ops": [1],
- "space-return-throw-case": [2],
- "space-unary-ops": [0, {"words": true, "nonwords": false}],
- "spaced-line-comment": [0, "always"],
- "strict": [0, "never"],
- "use-isnan": [2],
- "valid-jsdoc": [0],
- "valid-typeof": [2],
- "vars-on-top": [0],
- "wrap-iife": [2],
- "wrap-regex": [1],
- "yoda": [2, "never", {"exceptRange": true}],
- "react/jsx-boolean-value": 2,
- "react/jsx-no-undef": 2,
- "react/jsx-sort-props": 0,
- "react/jsx-sort-prop-types": 0,
- "react/jsx-uses-react": 2,
- "react/jsx-uses-vars": 2,
+ "operator-linebreak": [1, "after"],
+ "padded-blocks": [1],
+ "prefer-destructuring": 1,
+ "quotes": [1, "single", "avoid-escape"],
+ "radix": 0, // Dec 2018: We always use base 10, so specifying it each time seems excessive
+ "react/button-has-type": 1,
+ "react/destructuring-assignment": 0, // Dec 2018: We should do this! But right now we have 3990 warnings/errors if enabled.
+ "react/forbid-prop-types": 0, // Dec 2018: Should consider someday
+ "react/indent-prop": 0,
+ "react/jsx-first-prop-new-line": 0,
+ "react/jsx-indent-props": 0,
+ "react/jsx-no-bind": 1, // Dec 2018: Should these be errors?
+ "react/no-access-state-in-setstate": 1,
+ "react/no-array-index-key": 1,
+ "react/no-children-prop": 1,
"react/no-did-mount-set-state": 0,
- "react/no-did-update-set-state": 2,
- "react/no-multi-comp": 2,
- "react/no-unknown-property": 1,
+ "react/no-did-update-set-state": 0,
+ "react/no-string-refs": 1,
+ "react/no-unused-prop-types": 1,
+ "react/no-unused-state": 1,
+ "react/prefer-stateless-function": 0,
"react/prop-types": 1,
- "react/react-in-jsx-scope": 2,
- "react/self-closing-comp": 2,
- "jsx-quotes": 2,
+ "react/require-default-props": 0, // Dec 2018: Might have value someday
+ "react/sort-comp": 1,
+ "react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
+ "react-hooks/exhaustive-deps": "warn", // Checks effect dependencies
+ "space-before-function-paren": [1, {"anonymous": "always", "named": "always"}],
+ "space-in-parens": [1],
+ "template-curly-spacing": ["warn", "never"]
},
"plugins": [
- "react"
- ],
- "global": {
- "React": true
- }
+ "react",
+ "react-hooks"
+ ]
}
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 000000000..8418c8d11
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,3 @@
+### Please describe the issue (What happens? What do you expect?)
+
+### Steps to reproduce the problem (1, 2, 3...), including links
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..6a192ff63
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,3 @@
+### What github.com/wevote/WebApp/issues does this fix?
+
+### Changes included this pull request?
diff --git a/.gitignore b/.gitignore
index 734bedcbd..3e7ee8a2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@
# Ignore build files
build
+build-live
+package-lock.json
# TernJS
###################
@@ -24,10 +26,6 @@ pids
###################
lib-cov
-# Coverage directory used by tools like istanbul
-###################
-coverage
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
###################
.grunt
@@ -60,13 +58,8 @@ venv
*.class
*.dll
*.exe
-*.o
*.so
-
-
-
-
# PyInstaller #
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
@@ -109,11 +102,8 @@ target/
# git has its own built in compression methods
*.7z
*.dmg
-*.gz
*.iso
-*.jar
*.rar
-*.tar
*.zip
# OS generated files #
@@ -152,8 +142,6 @@ sftp-config.json
# Vim / emacs #
###############
-*~
-*#
*.swp
*.swo
@@ -161,15 +149,32 @@ sftp-config.json
##################
.sass-cache
+# Heroku Related #
+##################
+staticfiles
+
# Other #
#########
/geo/data/
/**/migrations/*.py
!/**/migrations/__init__.py
-config/environment_variables.json
+src/js/config.js
+src/js/config-qa.js
+src/js/config-www.js
+tests/browserstack/browserstack.config.js
+src/javascript/google-tag-manager.js
+src/javascript/google-tag-manager-qa.js
+src/javascript/google-tag-manager-www.js
+src/javascript/google-analytics.js
+src/javascript/google-analytics-qa.js
+src/javascript/google-analytics-www.js
web_app/build/*
+*.crt
+*.key
+.vscode
+.gitattributes
+/yarn.lock
+server.csr
+tests/browserstack/wdio.conf.js
+tests/browserstack/wdio.conf.template
-# Heroku Related #
-##################
-*.pyc
-staticfiles
diff --git a/.jscsrc b/.jscsrc
index e4b04b4dc..b6d5f679c 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -1,5 +1,11 @@
{
"preset": "airbnb",
"validateQuoteMarks": null,
- "excludeFiles": ["build/**", "node_modules"]
+ "excludeFiles": ["build/**", "node_modules"],
+ "maximumLineLength": null,
+ "maxErrors": 200,
+ "disallowSpacesInFunctionDeclaration": null,
+ "requirePaddingNewLinesBeforeLineComments": null,
+ "requirePaddingNewLinesAfterBlocks": null,
+ "disallowMultipleLineBreaks": null
}
diff --git a/.snyk b/.snyk
new file mode 100644
index 000000000..43752f637
--- /dev/null
+++ b/.snyk
@@ -0,0 +1,91 @@
+# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
+version: v1.19.0
+ignore: {}
+# patches apply the minimum changes required to fix a vulnerability
+patch:
+ SNYK-JS-LODASH-450202:
+ - lodash:
+ patched: '2019-07-04T03:07:14.083Z'
+ - node-sass > sass-graph > lodash:
+ patched: '2019-07-04T03:07:14.083Z'
+ - styled-components > babel-plugin-styled-components > lodash:
+ patched: '2019-07-04T03:07:14.083Z'
+ - node-sass > gaze > globule > lodash:
+ patched: '2019-07-04T03:07:14.083Z'
+ - styled-components > @babel/helper-module-imports > @babel/types > lodash:
+ patched: '2019-07-04T03:07:14.083Z'
+ - styled-components > babel-plugin-styled-components > @babel/helper-annotate-as-pure > @babel/types > lodash:
+ patched: '2019-07-04T03:07:14.083Z'
+ SNYK-JS-HTTPSPROXYAGENT-469131:
+ - snyk > proxy-agent > https-proxy-agent:
+ patched: '2019-10-04T03:05:20.920Z'
+ - snyk > proxy-agent > pac-proxy-agent > https-proxy-agent:
+ patched: '2019-10-04T03:05:20.920Z'
+ SNYK-JS-TREEKILL-536781:
+ - snyk > snyk-sbt-plugin > tree-kill:
+ patched: '2019-12-12T03:06:33.992Z'
+ SNYK-JS-LODASH-567746:
+ - snyk > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - react-phone-number-input > react-responsive-ui > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > @snyk/dep-graph > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > inquirer > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > snyk-config > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > snyk-mvn-plugin > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > snyk-nodejs-lockfile-parser > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > snyk-nuget-plugin > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - styled-components > @babel/traverse > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - styled-components > babel-plugin-styled-components > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > @snyk/dep-graph > graphlib > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > snyk-go-plugin > graphlib > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > snyk-nodejs-lockfile-parser > graphlib > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > @snyk/snyk-cocoapods-plugin > @snyk/dep-graph > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > snyk-nuget-plugin > dotnet-deps-parser > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > snyk-php-plugin > @snyk/composer-lockfile-parser > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - styled-components > @babel/traverse > @babel/generator > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > @snyk/snyk-cocoapods-plugin > @snyk/dep-graph > graphlib > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > @snyk/snyk-cocoapods-plugin > @snyk/cocoapods-lockfile-parser > @snyk/ruby-semver > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - styled-components > babel-plugin-styled-components > @babel/helper-annotate-as-pure > @babel/types > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - styled-components > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - snyk > @snyk/snyk-cocoapods-plugin > @snyk/cocoapods-lockfile-parser > @snyk/dep-graph > graphlib > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - styled-components > @babel/traverse > @babel/helper-function-name > @babel/template > @babel/types > lodash:
+ patched: '2020-05-01T03:05:39.212Z'
+ - wdio > selenium-standalone > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
+ - wdio > selenium-standalone > async > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
+ - wdio > webdriverio > archiver > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
+ - wdio > webdriverio > inquirer > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
+ - wdio > webdriverio > archiver > async > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
+ - wdio > webdriverio > archiver > archiver-utils > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
+ - wdio > webdriverio > archiver > zip-stream > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
+ - wdio > webdriverio > gaze > globule > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
+ - wdio > webdriverio > archiver > zip-stream > archiver-utils > lodash:
+ patched: '2020-08-22T21:58:11.586Z'
diff --git a/.stylelintrc b/.stylelintrc
new file mode 100644
index 000000000..a3cf679d6
--- /dev/null
+++ b/.stylelintrc
@@ -0,0 +1,43 @@
+{
+ "extends": "stylelint-config-standard",
+ "plugins": [
+ "stylelint-declaration-use-variable"
+ ],
+ "rules": {
+ "at-rule-empty-line-before": null,
+ "at-rule-no-unknown": [true, {
+ "ignoreAtRules": ["content", "each", "else", "error", "extend", "for", "function", "if", "include", "mixin", "return", "warn", "while"]
+ }],
+ "block-closing-brace-newline-after": ["always-multi-line", {
+ "ignoreAtRules": ["if", "else"]
+ }],
+ "block-opening-brace-space-before": "always-multi-line",
+ "color-hex-case": "lower",
+ "declaration-empty-line-before": null,
+ "font-family-no-missing-generic-family-keyword": null,
+ "max-empty-lines": 3,
+ "no-descending-specificity": null,
+ "number-leading-zero": "never",
+ "rule-empty-line-before": null,
+ "selector-max-id": 0,
+ "selector-max-type": [0, {
+ "ignoreTypes": ["a"]
+ }],
+ "shorthand-property-no-redundant-values": null,
+ "sh-waqar/declaration-use-variable": [[
+ "border-radius",
+ "/color/",
+ "/margin/",
+ "/padding/"
+ ]],
+ "string-quotes": "single"
+ },
+ "ignoreFiles": [
+ "**/index.html",
+ "**/vendor/**/*.scss",
+ "**/_normalize.scss",
+ "**/overrides/_print.scss",
+ "**/components/_bootstrap3LeftBehind.scss",
+ "**/components/_nps-input.scss"
+ ]
+}
diff --git a/.travis.yml b/.travis.yml
index 6361fa79b..29920310e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,22 @@
language: node_js
node_js:
- - "4.1"
- - "4.0"
+ - "10.12.0"
sudo: false
+before_script:
+ - "cp src/js/config-template.js src/js/config.js"
+ - "npm install -g se-interpreter"
script:
- npm run lint
+ - "npm run autoTest"
+ - "se-interpreter tests/selenium/interpreter_config.json"
+env:
+ global:
+ - SAUCE_USERNAME=WeVote
+ - SAUCE_ACCESS_KEY=eb6e0454-e844-4a1a-a695-2d5830897566
+ - secure: "xPe0mHTsisrniOOce/bgc6G9dmClm0sT3uxfw6nknfV6PdL6FglVX2+ji9RdttHzvg4aLk4QURJLQjzuZsNhxSNeHNU1qtSuoFVwvFuQ7iFNvWFF6U06vbQayK488piEDm4AxXcgAuj4jtEvAmRNSrCPO31HGiBo5wGAA3Jgn/8y0F0VXWYcEk7qr57hT6l4+qZXMVIwp+6LksptLg1obAmYmF1Gprnlixv5VBvLJqABr/HbnUUg31RIGz459sKvdOG+R6eJPMNSp73pMg5NxGpxAwh21HYQI+R4qs8aQYgCM/2UAv3ujIleqzkG2J/9uSDT0sc6RRnFfAzX6DmYZKD6Sf9pWFgk4zS4jqnVIZpry7vrMUkZK0qeQpphB7otvCJB0cPbYwoiwdWOKxkRZXFR1BPOm5FdM9thhUsdMqSfGHnGVhq9NRPl4bQJOIltn8lYHj1z84jkEyVGmpU4XTDfrlSVbRCBV5WNn9w6bFtsPgoupX99xhsjDkJ4lSOlQj6Ul5ncAFLe9KCXdsGPq+y0BK6DQwY4xoBTsxTqDl5VvrN63wtzJ2Br5REz25j+Y9aagDgsRQGX4ue/RCxdf3PHj879cskz7cE+GP1GBRca/NKts2VVzgTKsinQDTN3zyFaZQR8ggShkvPvcvW+7xJf3UKkrN+KTMU5WjeMNlw="
notifications:
slack: wevote:Ngu6uKzt4qRAvhrCPPoTIIVM
+ email:
+ - SauceLabs@WeVote.US
+addons:
+ jwt:
+ secure: "eb6e0454-e844-4a1a-a695-2d5830897566"
diff --git a/AppleSilicon.md b/AppleSilicon.md
new file mode 100644
index 000000000..f442f0021
--- /dev/null
+++ b/AppleSilicon.md
@@ -0,0 +1,20 @@
+# Apple Silicon on macOS Big Sur 11 beta, October 9, 2020
+
+Will remove these notes once Big Sur is released, and Apple Silicon (iOS app running on the desktop) is stable.
+
+1. Safari on Big Sur can not currently inspect "My Mac" targets, so the weak xCode console is all we have for now.
+See Apple [Universal App Quick Start] private forum [662281](https://developer.apple.com/forums/thread/662281?login=true). Also
+an Apple Beta Feedback Assistant issue, for Big Sur beta 8, has been lodged (FB8755308) titled "No Inspectable Applications" in Safari Debug Menu for targets with "My Mac" -- No response yet from Apple.
+1. node-sass is tied to macOS versions, so it is not available for Big Sur yet. Hopefully we will design it out
+of the "We Vote Web App" this year. In the meantime, we need to build main.css on an intel Mac, and copy it to the
+Apple Silicon (ARM64) mac in order to have all the legacy styles work.
+Manual changes have to be made to package.json and webpack.config.js on the ARM64 Mac to remove
+node-sass from the build.
+1. Firebase is not ready for Big Sur, so it has to be manually removed from WeVoteCordova, so we lose notifications
+in iOS until it is ready. Remove "cordova-plugin-firebase-analytics" and "cordova-plugin-firebase-messaging" to stop compile errors on the ARM64 DTK.
+1. cordova.plugins.diagnostic has been added to detect which processor the app is running on.
+1. A forked version of cordova-plugin-device is needed, to return the native code c++ variable `isIOSAppOnMac` so we can determine
+`isIOSAppOnMac()`. It is a small change, and I'll submit a PR to Apache, to see if they will adopt it.
+1. The Sign in with Twitter and Facebook are currently unavailable since there is a problem where opening a "tab" with corodova-plugin-inappbrowser
+opens an empty modal dialog, and then opens the actual URL you send it in a tab in the Safari desktop browser, breaking oAuth
+flow. See [Universal App Quick Start] private forum issue [662697](https://developer.apple.com/forums/thread/662697)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a1abf24e..2422d565d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
## Contents
- [WeVoteUSA Web App Change Log](#wevoteusa-web-app-change-log)
+ - [1.0.0](#100)
+ - [0.8.9](#089)
- [0.8.0](#080)
- [0.5.0](#050)
@@ -11,6 +13,83 @@
#WeVoteUSA Web App Change Log
All notable changes to this project will be documented here.
+##1.0.0
+
view commit • Rename facebookactioncreators - Lisa Cho
+ view commit • Refactor - Lisa Cho
+ view commit • Iterated on Navigation elements and changed some language per design discussions. - Dale John McGrew
+ view commit • remove duplicated jquery loading - Lisa Cho
+ view commit • Fix for Issue #233 "Two voter_device_id cookies created" - Dale John McGrew
+ view commit • Fix link - Lisa Cho
+ view commit • Turn back on Facebook login and add logout, remove message box when there is no ballot caveat - Lisa Cho
+ view commit • Fixed some Javascript errors around undefined variables. Fixed one more "npm test" warning. Made javascript modifications per Lisa's suggestions. Added measure_subtitle. - Dale John McGrew
+ view commit • removing unnecessary dependency - Nick Fiorini
+ view commit • Update package.json - Nick Fiorini
+ view commit • updating minification process to reduce the bundle size down to 1.3mb - nick fiorini
+ view commit • adding uglification proccess to production build, reducing the bundle output by ~%50, 5.5mb -> 2mb - nick fiorini
+ view commit • Fixed some Javascript errors around undefined variables. Fixed one more "npm test" warning. Made javascript modifications per Lisa's suggestions. Added measure_subtitle. - Dale John McGrew
+ view commit • Fixed some Javascript errors around undefined variables. Fixed one more "npm test" warning. - Dale John McGrew
+ view commit • Fix candidate reload bug, organize widget files - Lisa Cho
+ view commit • Add hover to button, bug fixes - Lisa Cho
+ view commit • Added twitter_description to candidate card and candidate detail page. Moved functions "numberWithCommas" and "removeTwitterNameFromDescription" to utils/textFormat.js. Fixed "toString" error Lisa found. - Dale John McGrew
+ view commit • Fixed some eslint errors from running "npm test". Added Twitter Description to organization display. - Dale John McGrew
+ view commit • Connect support toggle button on organization page - Lisa Cho
+ view commit • Added 0.8.9 to changelog - Rob Simpson
+
+
+##0.8.9
+ view commit • Update PositionItem.jsx - Dale John McGrew
+ view commit • Header icons stay in place in desktop mode - Rob Simpson
+ view commit • Button change from Following to Unfollow and change color - Rob Simpson
+ view commit • Updated components/Ballot/PositionItem.jsx to support individual voter opinions. - Dale John McGrew
+ view commit • Fixed glitch with Ballot filtering introduced, relating to missing address. Updated the project About page to give credit based on time volunteered. - Dale John McGrew
+ view commit • Fix links - Lisa Cho
+ view commit • Make submenu slidedown - Lisa Cho
+ view commit • Added political party to Candidate card on Ballot list. Changed some site text, including navigation text to be consistent. Fixed some Javascript errors on Ballot route. Updated site title. - Dale John McGrew
+ view commit • Clean up linting errors for CI build - Rob Simpson
+ view commit • fix android footer keyboard issue - Rob Simpson
+ view commit • The queries for the change in sizes are added so that the app will fit inside of smaller devices - Rob Simpson
+ view commit • At this time there will need to be refactoring of the ButtonToolbar in order for all buttons to be consistent accross the app. Until that can happen, the larger display will continue to have the smaller buttons on this view. - Rob Simpson
+ view commit • At Status - Lisa Cho
+ view commit • Prevent ballot items from immediately disappearing from filtered ballots, add titles - Lisa Cho
+ view commit • Add ballot caveat and properties to ballot - Lisa Cho
+ view commit • Fix hard refresh issues - Lisa Cho
+ view commit • Replace multiple API calls with single starAllStatusRetrieve - Lisa Cho
+ view commit • Fix bug - Lisa Cho
+ view commit • Add Choices remaining ballot - Lisa Cho
+ view commit • Add support ballot - Lisa Cho
+ view commit • Use new API endpoints for fetching multiple support/oppose count and voter support/oppose statuses - Lisa Cho
+ view commit • Note that this is static at this time until there is a better idea of what the other site is that will be created. If this is good enough, close this ticket and open another, or move this into another milestone when that site will be created. - Rob Simpson
+ view commit • #116 - Reduce vertical display of voter guide boxes - Rob Simpson
+ view commit • Fixed Link: limited scope so the "Follow"/"Ignore" buttons aren't affected. - Dale John McGrew
+ view commit • Added links to among voter guides, candidates and orgs so you can navigate easily. Changed (removed) some site text based on voter testing. Fixed some broken README links. - Dale John McGrew
+ view commit • Add organization page - Lisa Cho
+ view commit • Forgot one change - Lisa Cho
+ view commit • Fixing broken image links, bootstrap-map-css warning, address not found on page reload - Lisa Cho
+ view commit • Worked on issues #8 & #133. Added political party display on Candidate page. Modified Address edit field. Deleted deprecated Home.jsx file. Added "Find Opinions" button at the bottom of the candidate page. - Dale John McGrew
+ view commit • Add search box to IntroOpinions and Opinions - Lisa Cho
+ view commit • Removing deprecated files - Lisa Cho
+ view commit • add ternjs for repo ignoring - Rob Simpson
+ view commit • Fix IntroOpinions page - Lisa Cho
+ view commit • adding a production task, `npm run prod` that avoids browsersync and watching files for changes. also added a timestamp to the browsersync prefix and updated the server task to a module that takes production flag as input. - nick fiorini
+ view commit • update changelog with 0.8.0 commits - Rob Simpson
+ view commit • Restructured our documentation so it is easier for new developers to get started, and easier for current developers to zero-in on the specific information they need. I tried *really* hard to make sure I didn't delete any existing documentation. My apologies in advance if I removed any documentation (without moving it to a new place). There is still more clean-up of this documentation to be done, but I think it can be done incrementally, and by multiple people. PS. Can someone help create the table of contents for these pages with doctoc? - Dale John McGrew
+ view commit • Refactor voter store and initial loading of data, redirect user when ballot is empty, remove cookies, preload opinions - Lisa Cho
+ view commit • Handle rapid clicks on support/oppose items - Lisa Cho
+ view commit • Serious Karma-points checkin. :) Fixed code so we have nearly 200 fewer eslint errors when you run ‘npm test’. - Dale John McGrew
+ view commit • Made the area a voter can touch much bigger for Links in org Positions on Candidate page, and navigation items. Removed some code we won't use for several versions. Commented out sign in, but left code because several of us may need to use the code soon for testing. Added link to Candidate-specific "More Opinions" page, and built out OpinionsAboutItem.jsx page. (Debugging help needed from Lisa.) Made edits to Location page where we edit address, including adding Focus to the form box on componentDidMount. Removed old "More menu" page. Did some ESLint clean up. - Dale John McGrew
+ view commit • Added search box to More Opinions to Follow page -- ready to get working. Changed the way we react to missing data. Removed test address from config.js file. - Dale John McGrew
+ view commit • Update .travis.yml - Rob Simpson
+ view commit • Fixed browser sync to sync remote devices - Rob Simpson
+ view commit • Fix let vs var and refactor actions format - Lisa Cho
+ view commit • Link colors inline with the new style guide - Rob Simpson
+ view commit • Container for candidates more padding for icons - Rob Simpson
+ view commit • Margin and padding give space to container - Rob Simpson
+ view commit • Update README.md - Rob Simpson
+ view commit • Update README.md - Rob Simpson
+ view commit • Update CONTRIBUTING.md - Rob Simpson
+ view commit • Update BallotActions.js - Dale John McGrew
+ view commit • Now that we can return actual ballots reliably, turned off the "use_test_election" that had been built into voterBallotItemsRetrieve calls. Other assorted visual updates. - Dale John McGrew
+
##0.8.0
view commit • Contributing license agreement for those who contribute - Rob Simpson
view commit • My opinions followed stop following and ignore buttons work and refactored voterguidestore - Lisa Cho
@@ -124,7 +203,7 @@ All notable changes to this project will be documented here.
view commit • removing console log and fixing test errors
view commit • Leaving commented out code in place since we will be turning back on soon.
view commit • Turn off Account Settings page when NOT signed in.
- view commit • Made the entire CandidateItem div a link (per original designs). Changed "support/oppose" language in cases where we are using ratings. Added "source" under Vote Smart ratings. Changed "My Ballot" to "My Voter Guide", and added "demo version" per Jenifer's requests. Added "My Voter Guide" link to left menu. Added indicator in both ItemActionBar's for when the voter supports or opposes something. Did some ES lint clean up. Added _position stylesheet. Added text offering test address.
+ view commit • Made the entire CandidateItem div a link (per original designs). Changed "support/oppose" language in cases where we are using ratings. Added "source" under Vote Smart ratings. Changed "My Ballot" to "My Voter Guide", and added "demo version". Added "My Voter Guide" link to left menu. Added indicator in both ItemActionBar's for when the voter supports or opposes something. Did some ES lint clean up. Added _position stylesheet. Added text offering test address.
view commit • Iteration on "demo version" text. Cleaned up more ES lint warnings.
view commit • Added text to README as test
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 581fa2227..fecb0d3cd 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -10,9 +10,9 @@
-#WeVoteUSA Code of Conduct
+# WeVoteUSA Code of Conduct
---
-##Conduct
+## Conduct
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
* On public communication channels, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
@@ -26,7 +26,7 @@ Respect that people have differences of opinion and that every design or impleme
---
-##Moderation
+## Moderation
These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation, please contact the WeVoteUSA moderation team.
@@ -45,4 +45,4 @@ And if someone takes issue with something you said or did, resist the urge to be
The enforcement policies listed above apply to all official WeVoteUSA venues; including official [Slack channel](http://wevote.slack.com) and GitHub repositories under WeVoteUSA. For other projects adopting the WeVoteUSA Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.
-Adapted from the [Rust CoC](http://www.rust-lang.org/conduct.html), [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](http://contributor-covenant.org/version/1/3/0/)
\ No newline at end of file
+Adapted from the [Rust CoC](http://www.rust-lang.org/conduct.html), [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](http://contributor-covenant.org/version/1/3/0/)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4c97df097..1de1d893c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,18 +1,3 @@
-
-
-## Contents
-
-- [Contributing to wevote/WebApp](#contributing-to-wevotewebapp)
- - [Pull Requests](#pull-requests)
- - [Setting up your repository for work](#setting-up-your-repository-for-work)
- - [Some useful tips and tricks](#some-useful-tips-and-tricks)
- - [Git completion](#git-completion)
- - [Prompt](#prompt)
- - [How to get a change from someone’s repository into your repo before it’s pushed to master](#how-to-get-a-change-from-someone%E2%80%99s-repository-into-your-repo-before-it%E2%80%99s-pushed-to-master)
- - [How to get rid of garbage files that shouldn’t be in git](#how-to-get-rid-of-garbage-files-that-shouldn%E2%80%99t-be-in-git)
-
-
-
# Contributing to wevote/WebApp
Thank you for your interest in the We Vote WebApp project. Please let us know if we can help you get started.
@@ -20,152 +5,3 @@ Thank you for your interest in the We Vote WebApp project. Please let us know if
To get started, [sign the Contributor License Agreement](https://www.clahub.com/agreements/wevote/WebApp)
-This README outlines the proper ways to contribute to the project.
-(Feb 13, 2016 Update: This process is still a work-in-progress.)
-
-## Pull Requests
-
-**Things to never ever do (or at least try to avoid)**
-
-Especially if you have commit access to an Angular repository
-
-1.don't make changes to master, always start a new branch.
-2.don’t merge. It messes up the commit history.
-3.don’t pull upstream without
-a rebase (see above). git fetch and then rebase
- instead (or equivalently, `git pull upstream master --rebase`).
-4.don’t use `git commit -a`. You could silently commit something regrettable. Use -p instead.
-
-### Setting up your repository for work
-
-1.Install and configure git on your local machine.
-2.Create a fork of wevote/WebApp.git
-3.Clone your fork
-`git clone https://github.com/username/WebApp.git`
-4.In your local repository, set up a remote for upstream:
-`$ git remote add upstream git@github.com:wevote/WebApp.git`
-5.Create ssh keys: `ssh-keygen -t rsa -C "youremail@somedomain.com"`
-6.`ssh-add ~/.ssh/id_rsa`
-7.`pbcopy < ~/.ssh/id_rsa.pub`
-8.Go paste your keys into Github, under SSH Keys for your account.
-9.Set up a git client where origin is a fork of the repository (e.g.
- pertrai1/WebApp), and upstream is the real deal (e.g. wevote/WebApp)
-10.Before creating a branch to work in, first make sure you’re on your local
- master branch `git checkout master`
-11.Next, make sure that master is in sync with the upstream source of truth:
- `git fetch upstream` and then `git rebase upstream/master` Or, if you prefer
- `git pull upstream master --rebase`
-
-Note: if there’s a conflicting commit in the history of your master branch, you
-can destroy your branch and replace it with a fresh copy using the command `git
-checkout -B master upstream/master`.
-
-12. Now create a new branch `git checkout -b doc-script-changes`
-13. On the new branch, make edits to the files.
-
-Note: Time passes, stuff changes in the upstream repo....
-Commit your changes with `git commit -p`, or git commit and individually add
-files with `git add`
-
-To sync your changes with what's upstream, `git fetch`.
-
-To make sure your commit goes in at the top of everything else on the upstream
-repo, rebase: `git rebase upstream/master`
-
-If there are conflicts, open the file and look for the diff markers, resolve, and continue.
-
-Send your changes to your forked copy of the repo in the appropriate branch:
-`git push -f origin doc-script-changes`.
-
-In the web client, go to your fork of the repo, and initiate a pull request by pushing the Pull Request button. Submit the pull request!
-
-While the pull request is out for consideration:
-Any new changes unrelated to this one should be on a brand new branch (`git
-checkout -b some-new-thing`). Don't forget to check out the master branch first, otherwise you'll branch off of the current PR branch
-
-If you want to make changes to your earlier commit in response to comments on
-the pull request, you change back to the branch that you submitted it from (`git
-checkout doc-script-changes`), make any changes, then commit and push them (steps 6-9). These get automatically added to your pull request since they're in the same branch.
-
-If your changes are small fixes, they should not be a new commit. Instead, use
-git add and then `git commit --amend` to fix up your original commit.
-
-If you decide to abandon a pull request, you can CLOSE the issue it created and ignore it.
-
-If the pull request is good, there's nothing else for you to do, besides wait for someone to accept it.
-
-Once the pull request is accepted (or closed) you can delete your branch from the client. Or, you can wait until you have collected a bunch of them and delete all of the obsolete ones in one go.
-
-Also keep in mind that `git branch -D my-branch` deletes branches only locally, to delete them from the remote repo you have to do `git push origin :my-branch`
-
-Moving a change between branches
-Sometimes you make a change on the wrong branch. You can move it to the right branch with git stash. From the branch where you made the changes:
-`git stash`
-`git checkout branch-you-want-it-on`
-`git stash pop`
-
-
-### Some useful tips and tricks
-
-Modify your github client to pull in all the PRs and work on them
-You can set up your github client to make it easy to work with submitted pull requests.
-
-Edit your .git/config and add the two fetch lines shown below under remote “upstream”:
-[remote "upstream"]
- url = git@github.com:wevote/WebApp.git
- fetch = +refs/heads/*:refs/remotes/upstream/*
- fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
-
-Now, when you fetch upstream, you’ll get references to a bunch of PRs.
-check one out with `git checkout upstream/pr/3328` for example
-from detached head mode, create a branch with `git branch BRANCHNAME`
-fetch upstream, rebase against master, test things out.
-push to your branch to verify that CI tests are green for these changes.
-
-when everything is green and looks legit:
-`git push upstream BRANCHNAME:master`
-Pull in a specific PR for testing
-
-Drop commits from a PR
-In the branch where you created the commits you want to drop:
-`$ git rebase -i upstream/master`
-
-This opens an editor. Delete the lines you don’t want. Then:
- $ git push -f origin branchname
-Pretty colors and branch name in your command line prompt
-Add something like this to your .bashrc
-source ~/.bash_colors
-
-### Git completion
-`source $PATH_TO_GIT_CORE/git-completion.bash`
-`source $PATH_TO_GIT_CORE/git-prompt.sh`
-
-### Prompt
-`export
-PS1="\[$Green\]\t\[$Red\]:\[$Yellow\]\W\[\033[m\]\[$Blue\]\$(__git_ps1)\[$White\]\$
-"`
-And create a file .bash_colors.
-
-#### How to get a change from someone’s repository into your repo before it’s pushed to master
-Define a remote for their github repo, e.g.
-`git remote add pertrai1 https://github.com/pertrai1/WebApp.git`
-
-Now fetch their changes and rebase on top of the branch they have that change in:
-`git fetch pertrai1`
-`git rebase pertrai1/pertrai1_branchname`
-
-If there are collisions, these files are removed from your git commit. Hunt them down by searching for seven > characters ‘>>>>>>>’ in your project. Resolve any conflicts in your editor. git status will also show the affected files (in red, since they’re not part of a commit)
-
-Add the files back into tracking with `git add .`
-
-Carry on with the rebase: `git rebase --continue`
-
-#### How to get rid of garbage files that shouldn’t be in git
-
-Sometimes my Mac makes .DS_Store files in my git directories and I want to get rid of them:
-
-`$ git status` - check that you don’t have anything important that should be added first!
-`$ git clean . -f`
-
-Caution -- if you have any new files that aren’t under git control, this will remove all of them.
-
diff --git a/Gulpfile.js b/Gulpfile.js
index ef839bfc7..572d9b436 100644
--- a/Gulpfile.js
+++ b/Gulpfile.js
@@ -1,34 +1,106 @@
+/* eslint-disable */
// dependencies
const gulp = require("gulp");
const sass = require("gulp-sass");
+const autoprefixer = require("gulp-autoprefixer");
+const uglify = require("gulp-uglify");
+const sourcemaps = require("gulp-sourcemaps");
+const watchify = require("watchify");
const browserSync = require("browser-sync").create();
const browserify = require("browserify");
const babelify = require("babelify");
const source = require("vinyl-source-stream");
+const buffer = require("vinyl-buffer");
+const notifier = require('node-notifier');
+// const cssmin = require("gulp-cssnano");
+// Dec 2019: "gulp-cssnano" has not been updated for two years and is lightly used compared to gulp-clean-css -- not worth migrating since
+// gulp is not used for production bundles, so it doesn't matter if css is minified.
const del = require("del");
const server = require("./server");
const PRODUCTION = process.env.NODE_ENV === "production";
gulp.task("browserify", function () {
- return browserify({
+ const ops = {
+ debug: !PRODUCTION,
entries: "js/index.js",
+ cache: {},
+ packageCache: {},
extensions: [".js", ".jsx"],
basedir: "./src",
- transform: [babelify]
- })
- .bundle()
- .on("error", function (err) {
- console.error(err.toString());
+ transform: [babelify],
+ };
+ // const ops = {
+ // debug: !PRODUCTION,
+ // entries: "js/startReactReadyApp.js",
+ // cache: {},
+ // packageCache: {},
+ // extensions: [".js", ".jsx"],
+ // basedir: "./src",
+ // transform: [babelify],
+ // };
+
+ // 2017-04-05 Watchify is causing too many problems, so we are turning it off until we can resolve Issue 757
+ // var opsWatchify = assign({ cache: {}, packageCache: {} }, watchify.args, ops);
+ // var browserifyWithWatchify = watchify(browserify(opsWatchify));
+
+ function err (e) {
+ console.error(e.stack);
+ notifier.notify({ title: "Compile Error", message: e.stack });
this.emit("end");
- })
- .pipe(source("bundle.js"))
- .pipe(gulp.dest("./build/js"))
- .pipe(browserSync.stream());
+ }
+
+ const bundler = browserify(ops);
+
+ const bundle = function () {
+ return PRODUCTION ?
+
+ // production build with minification
+ bundler
+ .transform('uglifyify', { global: true })
+ .bundle()
+ .on("error", err)
+ .pipe(source("bundle.js"))
+ .pipe(buffer())
+ .pipe(uglify({ preserveComments: false, mangle: false }))
+ .pipe(gulp.dest("./build/js")) :
+
+ // development build
+ bundler
+ .plugin('watchify', {
+ verbose: true,
+ })
+ .bundle()
+ .on("error", err)
+ .on("update", bundle)
+ .pipe(source("bundle.js"))
+ .pipe(gulp.dest("./build/js"))
+ .pipe(browserSync.stream());
+
+ // Compressed development build - didn't work
+ // bundler
+ // .plugin('watchify', {
+ // verbose: true,
+ // })
+ // .transform('uglifyify', { global: true })
+ // .bundle()
+ // .on("error", err)
+ // .on("update", bundle)
+ // .pipe(source("bundle.js"))
+ // .pipe(buffer())
+ // .pipe(uglify({ preserveComments: false, mangle: false }))
+ // .pipe(gulp.dest("./build/js"))
+ // .pipe(browserSync.stream());
+
+
+ }
+ return bundle();
});
+// Run server
gulp.task("server", PRODUCTION ? () => server(PRODUCTION) : function () {
server();
+
// only start browserSync when this is development
browserSync.init({
proxy: "localhost:3003",
@@ -36,54 +108,152 @@ gulp.task("server", PRODUCTION ? () => server(PRODUCTION) : function () {
ghostMode: {
clicks: true,
forms: true,
- scroll: true
+ scroll: true,
},
- logPrefix: `${new Date().toString().split(" ")[4]} - We Vote USA`
+ logPrefix: `${new Date().toString().split(" ")[4]} - We Vote USA`,
});
});
+// October 2018: bootstrap-sccs is styling for bootstrap 3, so we no longer use it.
+// Pull all bootstrap styling from the node_modules package bootstrap (v4)
+gulp.task("compile-bootstrap", function () {
+ return gulp.src("./node_modules/bootstrap/scss/bootstrap.scss")
+ .pipe(sourcemaps.init())
+ .on("error", function (err) { console.error(err); })
+ .pipe(sass({ style: "expanded",
+ includePaths: [
+ "./node_modules/bootstrap/sccs",
+ "./node_modules/bootstrap/sccs/utilities",
+ "./node_modules/bootstrap/sccs/mixins",
+ ], }))
+ .pipe(autoprefixer("last 2 version"))
+ // .pipe(cssmin())
+ .pipe(sourcemaps.write(".")) // --> working directory is /build/css
+ .pipe(gulp.dest("./build/css"))
+ .pipe(browserSync.stream());
+});
+
+// Compile main and loading-screen, then copy them to the /build/css directory
+// 2020-06 Deprecated by Dale: "./src/sass/loading-screen.scss",
gulp.task("sass", function () {
- return gulp.src("./src/sass/main.scss")
- .on("error", function (err) { console.error(err); })
- .pipe(sass())
- .pipe(gulp.dest("./build/css"))
- .pipe(browserSync.stream());
+ return gulp.src(["./src/sass/main.scss",
+ ])
+ .pipe(sourcemaps.init())
+ .on("error", function (err) { console.error(err); })
+ .pipe(sass({ style: "expanded" }))
+ .pipe(autoprefixer("last 2 version"))
+ // .pipe(cssmin())
+ .pipe(sourcemaps.write(".")) // --> working directory is /build/css
+ .pipe(gulp.dest("./build/css"))
+ .pipe(browserSync.stream());
+});
+
+gulp.task("lint-css", function () {
+ const gulpStylelint = require("gulp-stylelint");
+ return gulp
+ .src("./src/sass/**/*.scss")
+ .pipe(gulpStylelint({
+ failAfterError: false,
+ reporters: [
+ { formatter: "string", console: true },
+ ],
+ }));
});
-gulp.task("clean:build", function () {
- return del.sync(["./build/**"]);
+// Clean out Build directory
+gulp.task("clean:build", function (done) {
+ return del(["./build/**"], done);
});
-gulp.task("copy-fonts", function () {
+// Copy font files to Build directory
+gulp.task("copy-fonts", function (done) {
gulp.src("./src/sass/base/fonts/**")
.pipe(gulp.dest("./build/fonts"))
.pipe(browserSync.stream());
+ done();
});
-gulp.task("copy-index", function () {
- gulp.src("./src/index.html")
+// Copy Index page to Build directory
+gulp.task("copy-index", function (done) {
+ gulp.src("./src/*.html")
.pipe(gulp.dest("./build"))
.pipe(browserSync.stream());
+ done();
});
+// Copy CSS files to Build directory
gulp.task("copy-css", function () {
- return gulp.src("./src/css/**/*.css")
+ return gulp.src("./src/css/**/*.scss")
.pipe(gulp.dest("./build/css"))
.pipe(browserSync.stream());
});
-gulp.task("build", ["copy-fonts", "copy-index", "copy-css", "browserify", "sass"]);
+// Copy image files to Build directory
+gulp.task("copy-img", function () {
+ return gulp.src("./src/img/**/*")
+ .pipe(gulp.dest("./build/img"))
+ .pipe(browserSync.stream());
+});
+
+// Copy javascript files to Build directory
+gulp.task("copy-javascript", function () {
+ return gulp.src("./src/javascript/*")
+ .pipe(gulp.dest("./build/javascript"))
+ .pipe(browserSync.stream());
+});
+
+// Build tasks
+gulp.task("build", gulp.series("copy-fonts", "copy-index", "compile-bootstrap", "copy-css", "copy-img", "copy-javascript", "browserify", "sass"));
+
+// Watch tasks
+gulp.task("watch", PRODUCTION ? ()=> {} : function (done) {
+ gulp.watch("./src/index.html", gulp.parallel("copy-index")).on("change", function (path) {
+ console.log("Watcher: " + path + " was changed.");
+ done();
+ });
+
+ gulp.watch("./src/sass/base/base/fonts/**", gulp.parallel("copy-fonts")).on("change", function (path) {
+ console.log("Watcher: " + path + " was changed.");
+ done();
+ });
+
+ gulp.watch("./src/sass/bootstrap/**", gulp.parallel("compile-bootstrap")).on("change", function (path) {
+ console.log("Watcher: " + path + " was changed.");
+ done();
+ });
+
+ gulp.watch("./src/css/**/*.scss", gulp.parallel("copy-css", "lint-css")).on("change", function (path) {
+ console.log("Watcher: " + path + " was changed.");
+ done();
+ });
+
+ gulp.watch("./src/img/**/*", gulp.parallel("copy-img")).on("change", function (path) {
+ console.log("Watcher: " + path + " was changed.");
+ done();
+ });
+
+ gulp.watch("./src/sass/**/*.scss", gulp.parallel("sass")).on("change", function (path) {
+ console.log("Watcher: " + path + " was changed.");
+ done();
+ });
+
+ gulp.watch("./src/javascript/*.js", gulp.parallel("copy-javascript")).on("change", function (path) {
+ console.log("Watcher: " + path + " was changed.");
+ done();
+ });
+
+ gulp.watch("./src/js/**/*.js?(x)", gulp.parallel("browserify")).on("change", function (path) {
+ console.log("Watcher: " + path + " was changed.");
+ done();
+ });
-gulp.task("watch", ["build"], PRODUCTION ? ()=>{} : function () {
- gulp.watch(["./src/index.html"], ["copy-index"]);
- gulp.watch(["./src/sass/base/base/fonts/**"], ["copy-fonts"]);
- gulp.watch(["./src/css/**/*.css"], ["copy-css"]);
- gulp.watch(["./src/sass/**/*.scss"], ["sass"]);
- gulp.watch(["./src/js/**/*.js?(x)"], ["browserify"]);
+ done();
});
-gulp.task("default", [
+// Default
+gulp.task("default", gulp.series(
"clean:build",
+ "build",
"watch",
"server"
-]);
+));
diff --git a/README.md b/README.md
index 2096005c7..4fbd22eb7 100644
--- a/README.md
+++ b/README.md
@@ -1,57 +1,53 @@
-
-
-## Contents
+# We Vote WebApp
-- [We Vote WebApp - README Home](#we-vote-webapp---readme-home)
-- [Installing WebApp](#installing-webapp)
-- [Working with WebApp](#working-with-webapp)
-- [Contributing to the Project](#contributing-to-the-project)
-- [How to Submit Code / Pull Requests](#how-to-submit-code--pull-requests)
-
-
-
-# We Vote WebApp - README Home
-
-[![Build Status](https://travis-ci.org/wevote/WebApp.svg?branch=develop)](https://travis-ci.org/wevote/WebApp) [![Coverage Status](https://coveralls.io/repos/github/wevote/WebApp/badge.svg?branch=master)](https://coveralls.io/github/wevote/WebApp?branch=master) [![Build status](https://ci.appveyor.com/api/projects/status/g7dvmiax01d9ydjr?svg=true)](https://ci.appveyor.com/project/pertrai1/webapp)
-
-![We Vote USA](unclesamewevote.jpg)
+[![Build Status](https://travis-ci.org/wevote/WebApp.svg?branch=develop)](https://travis-ci.org/wevote/WebApp)
+[![Sauce Test Status](https://saucelabs.com/buildstatus/WeVote)](https://saucelabs.com/u/WeVote)
This WebApp repository contains a Node/React/Flux Javascript application. Using data from
Google Civic API, Vote Smart, MapLight, TheUnitedStates.io and the Voting Information Project, we give voters a social way to interact with ballot data.
-Interested in volunteering? [Starting presentation here](https://prezi.com/5v4drd74pt6n/we-vote-introduction-strategic-landscape/). Please also [read about our values](https://wevote.hackpad.com/Community-Rules-C0sn7DhZhDt) and [see our Code of Conduct](CODE_OF_CONDUCT.md)
+Interested in [volunteering or applying for an internship](https://www.idealist.org/en/nonprofit/f917ce3db61a46cb8ad2b0d4e335f0af-we-vote-oakland#opportunities)? [Starting presentation here](https://prezi.com/5v4drd74pt6n/we-vote-introduction-strategic-landscape/).
+Please also [read about our values](https://docs.google.com/document/d/12qBXevI3mVKUsGmXL8mrDMPnWJ1SYw9zX9LGW5cozgg/edit) and
+[see our Code of Conduct](CODE_OF_CONDUCT.md)
+To join us, please [review our openings here](https://www.idealist.org/en/nonprofit/f917ce3db61a46cb8ad2b0d4e335f0af-we-vote-oakland#opportunities), and express your interest by emailing JoinUs@WeVote.US
-You can see our current wireframe mockup for a San Francisco ballot here:
-http://start.wevoteusa.org/
+Our current Beta version is here [https://WeVote.US](https://WeVote.US) and we are working on version 2 now!
-And finally, our current live version is here: https://wevote.me
+## Installing WebApp
+Our installation process is built to allow engineers all over America to contribute to We Vote.
+It may seem complicated, but it allows anyone to be in a position to make suggestions, and get involved.
-# Installing WebApp
-1. [Overview](docs/installing/README_INSTALLING.md)
+Manual Installation
+1. [Preparing the Environment on Your Machine](docs/installing/ENVIRONMENT.md)
-2. [Preparing the Environment on Your Machine](docs/installing/ENVIRONMENT.md)
+2. [Bringing Code to Your Machine](docs/installing/CLONING_CODE.md)
-3. [Bringing Code to Your Machine](docs/installing/CLONING_CODE.md)
+3. [Running WebApp for the First Time](docs/installing/RUNNING_FIRST_TIME.md)
-4. [Running WebApp for the First Time](docs/installing/RUNNING_FIRST_TIME.md)
+Automated Installation
+1. [Run automated scripts](docs/installing/AUTOMATED_INSTALLATION.md)
-# Working with WebApp
+## Working with WebApp
1. [Working with WebApp Day-to-Day](docs/working/README_WORKING_WITH_WEB_APP.md)
2. [Debugging Tools and Tips](docs/working/DEBUGGING_TOOLS.md)
3. [Issues and Reporting Bugs](docs/working/ISSUES.md)
-# Contributing to the Project
-Please read the following before you start contributing to the project. Thank you!
+4. [Styling Guidelines](docs/working/STYLING.md)
+
+5. [Want to sign in with Facebook or Twitter on localhost?](docs/working/SECURE_CERTIFICATE.md)
-1. [Overview](docs/contributing/index.md)
+Thanks to BrowserStack for helping us with automated testing!
-2. [Our Culture and Philosophy](docs/contributing/CONTRIBUTING_PHILOSOPHY.md)
+
-3. [Coding Standards and Best Practices](docs/contributing/CONTRIBUTING_STANDARDS.md)
+## Contributing to the Project
+Please read the following before you start contributing to the project. Thank you!
+
+[Coding Standards and Best Practices](docs/contributing/CONTRIBUTING_STANDARDS.md)
-# How to Submit Code / Pull Requests
+## How to Submit Code / Pull Requests
1. [What the Heck is a Pull Request?](docs/contributing/PULL_REQUEST_BACKGROUND.md)
2. [Before Your First Pull Request](docs/contributing/PULL_REQUEST_SETUP.md)
@@ -64,4 +60,12 @@ Please read the following before you start contributing to the project. Thank yo
6. [Approving Pull Requests](docs/contributing/APPROVING_PULL_REQUESTS.md)
+7. [Progressive Web App Feature](docs/working/PROGRESSIVE_WEB_APP.MD)
+
+## Testing WebApp
+
+1. [Introduction to WebApp testing](docs/testing/README_TESTING.md)
+
+2. [Explanation of various files](docs/testing/EXPLAIN_FILES.md)
+
Welcome aboard!!
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 209178257..000000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-# Thanks for Grunt for template of this file!
-
-# http://www.appveyor.com/docs/appveyor-yml
-
-# Fix line endings in Windows. (runs before repo cloning)
-init:
- - git config --global core.autocrlf input
-
-# Test against these versions of Node.js.
-environment:
- matrix:
- - nodejs_version: "0.10"
- - nodejs_version: "0.12"
- - nodejs_version: "5"
- - nodejs_version: "4"
-
-# Allow failing jobs for bleeding-edge Node.js versions.
-matrix:
- allow_failures:
- - nodejs_version: "0.10"
- - nodejs_version: "5"
-
-# Install scripts. (runs after repo cloning)
-install:
- # Get the latest stable version of Node 0.STABLE.latest
- - ps: Install-Product node $env:nodejs_version
- # Output useful info for debugging.
- - node --version
- - npm --version
- - git --version
- - svn --version
- # Install all dependencies
- - npm install
-
-# Post-install test scripts.
-test_script:
- - cmd: npm test
-
-# Don't actually build.
-build: off
-
-# Set build version format here instead of in the admin panel.
-version: "{build}"
\ No newline at end of file
diff --git a/buildDateFile.js b/buildDateFile.js
new file mode 100644
index 000000000..a41d99218
--- /dev/null
+++ b/buildDateFile.js
@@ -0,0 +1,6 @@
+const fs = require('fs');
+
+// Creates the compileDate.js file that contains the compile date as a string, so it can be displayed where wanted in the app.
+const d = new Date();
+const fileContent = `module.exports = ['${d.toLocaleString()}'];\n`;
+fs.writeFileSync('./src/js/compileDate.js', fileContent, { encoding: 'utf8', flag: 'w' });
diff --git a/docs/contributing/APPROVING_PULL_REQUESTS.md b/docs/contributing/APPROVING_PULL_REQUESTS.md
index a6dab1ab2..4b966ea6c 100644
--- a/docs/contributing/APPROVING_PULL_REQUESTS.md
+++ b/docs/contributing/APPROVING_PULL_REQUESTS.md
@@ -21,16 +21,23 @@ Add the contributor's repository as a remote repo. Here are the core contributor
git remote add pertrai1 https://github.com/pertrai1/WebApp
git fetch pertrai1
- git remote add pertrai1 https://github.com/nf071590/WebApp
+ git remote add nf071590 https://github.com/nf071590/WebApp
git fetch nf071590
- git remote add pertrai1 https://github.com/lisamcho/WebApp
+ git remote add lisamcho https://github.com/lisamcho/WebApp
git fetch lisamcho
- git remote add pertrai1 https://github.com/dalemcgrew/WebApp
+ git remote add dalemcgrew https://github.com/dalemcgrew/WebApp
git fetch dalemcgrew
Find the branch that the person is submitting:
git branch -a
-TODO: Figure out how to pull a remote branch to your local
+
+If you are wanting to test a PR on your local machine, make sure you have already done a `fetch` on the
+users repo. If you want to see if you have done so, you can do so by `git branch pertrai1 -a`. This will
+show you all of the branches for that user (from the example above for pertrai1). Now you can find the
+branch that is being worked on from the user and create a local branch based on that remote branch. Now
+you can do a `git pull ` and it will put you into a local version of that
+users branch. Running `gulp` at this point will have you seeing what has been done for this PR and allow
+you to look at the code.
---
diff --git a/docs/contributing/CONTRIBUTING_STANDARDS.md b/docs/contributing/CONTRIBUTING_STANDARDS.md
index c5af451f3..808c673d5 100644
--- a/docs/contributing/CONTRIBUTING_STANDARDS.md
+++ b/docs/contributing/CONTRIBUTING_STANDARDS.md
@@ -21,21 +21,115 @@ Please use descriptive full word variable names.
current features as painless as possible. We will have many engineers working with this code,
and we want to be welcoming to engineers who are new to the project.
* Short variable names can often create confusion, where a new engineer needs to spend time
-figuring out what a short variable name actually means. (Ex/ “per” or “p” instead of “person”.)
+figuring out what a short variable name actually means. (Ex/ Please use “person” instead of “per” or “p”.)
For this project please use descriptive full word variable names.
* Fellow engineers should be able to zoom around the code and not get stopped with riddles created by short names.
+## Variable Naming Standards
-## If there's no issue, please create one
+* Please use full words instead of abbreviations (Ex/ Please use “Person” instead of “per” or “p”.)
+* Please use lower case camel case ("camelCaseLettering")
+* Please be aware that many variables are coming from our API server lower case separated by an underscore.
+(e.g., "google_civic_election_id"),
-## Let us Know you're working on the issue
+## Art Asset Naming
+
+1. Asset names should be all lower case (ex/ "lower.png")
+
+2. If a name has multiple words, use "-" between words in the name (ex/ "lower-case.png")
+
+3. If sequential, put order word + number at start of name (ex/ "slide1-")
+
+4. For fixed size images, include width and height at the end of the name (ex/ "-200x150").
+Does not apply to svg files.
+
+5. If an image is still a "first draft", lets add "-draft" to the name + version number (ex/
+"slide3-connect-list-with-photos-draft1-300x370.png")
+
+6. If adding images that are meant to be used in one limited area of the App,
+please put them in their own folder within "src/img/global".
+
+Examples of good names:
+
+ slide1-ballot-simple.svg
+
+ slide3-connect-list-with-photos-draft1-300x370.png
+
+Examples of names we avoid:
+
+ Image1.svg
+
+
+# Code Style and eslint
+
+There is no perfect code style. If you have worked at a few different companies or on a few different open source projects, you
+will have used a few different styles.
-If you're actively working on an issue, please comment in the issue thread stating that you're working on a fix, or (if you're an official contributor) assign it to yourself.
+As of December 2018, the We Vote WebApp src directory contained 1073 files, that have been created and edited by dozens of volunteer
+software engineers. And we had dozens of different code styles in different files.
+
+Inconsistently formatted code is less reliable code, so we decided to (mostly) put aside the
+issue of "what is the best code style", and to adopt the (very widely adopted) styles
+that Airbnb came up with for React and JavaScript. Airbnb's styles have been source controlled
+as an NPM project containing eslint configuration rules for Javascript, and a few related projects for React, and those
+rules have been incorporated in our WebApp.
+
+If you use a IDE like [WebStorm](https://www.jetbrains.com/webstorm/), (sadly WebStorm is not free), all the lint [warnings will show up in amber, and lint
+errors will show up in red.](https://www.themarketingtechnologist.co/eslint-with-airbnb-javascript-style-guide-in-webstorm/) Errors will block a git commit and must be fixed. If there is just
+no reasonable way to fix the lint error, or fixing the code is too risky for some reason, it is ok
+to suppress the error on the line where it occurs by adding a comment like this...
+
+```const element = findDOMNode( // eslint-disable-line react/no-find-dom-node```
+
+If your editor does not show lint warnings, running `npm test` from the command line will provide a list of the lint output.
+The list might be quite long, so you may want to redirect it into a file that you can edit `npm test > testOutput.txt`
+
+# Code Craftsmanship
+
+We value Software Craftsmanship for the We Vote project since it makes working on the We Vote code base …
+* Fun since the product is composed of clean self documenting components that
+ * Do not repeat themselves -- each functional block has a component, or collection of components that can be widely used, or is completely unique.
+ * Are easy to rearrange on panels and pages, with less (or no) modifying of the components themselves for new uses or new UI approaches..
+* Satisfying since changes have fewer unintentioned effects
+* Easier to work on since, the architectural layout is clear, with properly named components and variables, and just enough comments to explain the area that are hard to understand.
+* Reliable, since well defined components are partially self tested by being used in many different ways for many purposes.
+
+
+
+# Code Quality Guidelines:
+* Do no harm: Stuff happens, but if you are not sure, ask before you commit.
+* Software Craftsmenship: Leave every file they touch in better shape than they found it.
+* In React JSX files: commit files that (as much as possible) comply with the “airbnb” preset for jslint (with our few modifications). If you understand the warnings in the files you work on, make small changes to clear the warnings in the areas you are modifying.
+* In /WebApp/src/sass files: [BEM Naming Conventions](../working/STYLING.md) should be followed -- BEM Naming makes it straightforward to organize where to group styles together in an object-oriented fashion. (Ex/ We can use a style named `ballot__header__title` and find where it is defined.)
+* In Python: Clear all PEP8 warnings before committing.
+* Do not copy classes and make small changes, instead examine existing classes and components to see how they modified for the new use case and then reused. If you absolutely have to copy, be sure to remove, or temporarily comment out, code that is not immediately in use.
+* Commented out code should be rare and should include the date of commenting, and why it remains in place.
+* After you have some experience with this project, carefully perform incremental refactoring to break apart monolithic components into smaller reusable components.
+* After you have some experience, carefully perform incremental refactoring to rename classes, components and variables to match their current use.
+* Don't commit refactoring changes that you are unable to test -- if you can't test it, or haven't tested it, don't check it in.
+* Delete code that you made redundant. Cautiously comment out, or delete code that has not been in use for months. If unsure, add a comment with a proposed deletion date, a few months in the future.
+* If while searching globally for a phrase, you find multiple matches, this might be a indication that a refactor is needed.
+* In code reviews:
+ * Do not allow new slightly duplicated code into our codebase (unless there is a good reason for it).
+ * If variable or class names are will be meaningless to others, flag them.
+ * Overly complex code should be commented or simplified.
+ * Flag code style changes or variable conventions, that are unlike the rest of our code.
+* Be on the lookout for abandoned, or duplicative styles. Clean them out when you find them. Before creating new styles, first look for styles that make sense to reuse.
+* Simple is better than clever code, but if "clever" really adds value, add a note to help out the next engineer who will be looking at the code.
+* Most React classes should be less than 300 lines long, at 500 lines consider breaking the class up into sub-components. If the the component’s render method contains multiple static blocks of React components and markup, consider moving them into a new React component.
+* Ask before including new open source NPM projects. Our strong preference is to include projects that NPM rates as high in popularity, quality and maintenance. Avoid projects that haven’t been updated in months or years, as they can pose security risks.
+* If you need to fix the open source projects we rely on, please make a pull request against that project.
+
+
+# If there's no issue in github.com, please create one
+
+## Let us Know you're working on the issue
-This way, others will know they shouldn't try to work on a fix at the same time.
+If you're actively working on an issue, please comment in the issue thread stating that you're working on a fix, or (if you're an official contributor) assign it to yourself. You can also keep the team updated on the work you are doing by attending a team stand-up held on the Daily Hangouts, or post a note in the #agile-stand-up Slack channel. This way, others will know they shouldn't try to work on a fix at the same time.
+# Version numbering
We use [SemVer](http://semver.org/) for version numbers. More info: [Versions: Release Names vs Version Numbers](versions/index.md)
diff --git a/docs/contributing/CREATING_PULL_REQUEST.md b/docs/contributing/CREATING_PULL_REQUEST.md
index 4effec351..b13f248dc 100644
--- a/docs/contributing/CREATING_PULL_REQUEST.md
+++ b/docs/contributing/CREATING_PULL_REQUEST.md
@@ -23,8 +23,11 @@
# Creating a Pull Request
If you have never created a pull request, please read “[What the Heck is a Pull Request?](PULL_REQUEST_BACKGROUND.md)
+We also created [this handy chart](https://docs.google.com/drawings/d/1ED4X3Gpy_UruGDSiO8FjjxQeGOmQqIApguodHDo6-ok/edit)
+to show the various steps working with pull requests.
## Get Your Command Line Ready
+
`cd /Users/DaleMcGrew/NodeEnvironments/WebAppEnv/` # Activate your node environment
`. bin/activate`
@@ -32,6 +35,7 @@ If you have never created a pull request, please read “[What the Heck is a Pul
`cd /Users/DaleMcGrew/PythonProjects/PersonalGitForks/WebApp` # Change to directory where you checked out your Personal Fork from github
## Preparing to Create a Branch
+
`git branch -a` # See what branch you are currently set to
`git checkout develop` # If you aren’t set to the develop branch, switch to that
@@ -45,7 +49,8 @@ You can see changes here: https://github.com/DaleMcGrew/WebApp
## How to Create a Branch in Your Personal Fork
We want to set up a branch on your local computer.
-`git checkout -b dale_work_feb28` # The “-b” creates the new branch
+`git checkout -b ` # The “-b” creates the new branch.
+Replace "" with your branch name.
In PyCharm: Right click WebApp > Git > Repository > Branches > New Branch
@@ -61,10 +66,24 @@ In PyCharm: Right click WebApp > Git > Repository > Branches > New Branch
`git push origin develop` # Push this latest version of develop up to your Personal Fork on the github servers
-`git checkout dale_work_feb28`
+`git checkout ` # Replace "" with your branch name
+Now you need to merge locally the latest code from "develop" with your branch name. Dale does this merging with
+the PyCharm IDE. How you do this depends on the development environment you use.
TODO: Add instructions for merging with develop via command line
+### Merging via the command line
+
+To merge your local develop branch with :
+
+`$ git checkout develop` # Switch to the develop branch
+
+`$ git merge ` # Merge your branch with develop
+
+You can than delete you branch if you are done making changes
+
+`$ git branch -d `
+
## Test Before Creating Pull Request
We use a tool that verifies our Javascript meets the eslint spec.
@@ -74,44 +93,38 @@ You may get warnings or errors. Please minimally fix the errors, and try to fix
## Commit:
-* Make sure you comply with the [.editorconfig](http://editorconfig.org/)
+* Make sure you comply with the [.editorconfig](http://editorconfig.org/)
+Reference the issue number in your commit message e.g.:
```
git commit -m '[Issue #] '
```
-### Commit Hints
-
-Reference the issue number in your commit message e.g.:
+or
```
-$ git commit -m '[#5] Make sure to follow the PR process for contributions'
+git commit -a
```
-### For large changes spanning many commits / Pull Requests
+or
-* Create a meta-issue with a bullet list using the `* [ ] item` markdown syntax.
-* Create issues for each bullet point
-* Link to the meta-issue from each bullet point issue
-* Check off the bullet list as items get completed
-
-Linking from the bullet point issues to the meta issue will create a list of issues with status indicators in the issue comments stream, which will give us a quick visual reference to see what's done and what still needs doing.
+`git commit -p` # Commit all of your changes
+or
-### PR Merge Exception
+`git commit FILENAME` and then individually add files with `git add`
-* Minor documentation grammar/spelling fixes (code example changes should be reviewed)
+#### Windows machines only
-## How to Put Your Changes on your Personal Fork on the github servers
-`git branch -a` # Make sure you are looking at the branch you want to push
+You need to commit files via the command line so git doesn't throw an error (based on the line endings)
-`git pull upstream develop` # Make sure your personal fork on your local machine has the latest code from wevote/WebApp
+1. Stage your changes using `git add .` or using your IDE.
-`git commit -p` # Commit all of your changes
+2. Run `$ git commit -n -m 'Your commit message'` in the terminal
-or
+## How to Put Your Changes on your Personal Fork on the github servers
-`git commit FILENAME` and then individually add files with `git add`
+`git branch -a` # Make sure you are looking at the branch you want to push
`git push origin ` # Push your changes to your Personal Fork on the github servers
@@ -124,10 +137,27 @@ You can go to the github web page for your Personal Fork and make sure it shows
* Please don't merge your own changes. Create a pull request so others can review the changes.
* **Wait for the reviewer to approve and merge the request**
-This guide walks through the process of sending a hypothetical pull request and using the various code review and management tools to take the change to completion.
+This guide walks through the process of sending a hypothetical pull request and using the various code review
+and management tools to take the change to completion.
https://help.github.com/articles/using-pull-requests/
+### For large changes spanning many commits / Pull Requests
+
+* Create a meta-issue with a bullet list using the `* [ ] item` markdown syntax.
+* Create issues for each bullet point
+* Link to the meta-issue from each bullet point issue
+* Check off the bullet list as items get completed
+
+Linking from the bullet point issues to the meta issue will create a list of issues with status indicators
+in the issue comments stream, which will give us a quick visual reference to see what's done and what still needs doing.
+
+
+### PR Merge Exception
+
+* Minor documentation grammar/spelling fixes (code example changes should be reviewed)
+
+
## SemVer
We follow [SemVer](http://semver.org/) for our releases. Please read if you plan to tag for any releases.
@@ -136,15 +166,15 @@ We follow [SemVer](http://semver.org/) for our releases. Please read if you plan
## I Have Submitted a Pull Request, Now What?
Sometimes pull requests can take a day or two to be approved. How do you keep working? TODO discuss this.
-
-While the pull request is out for consideration:
+While your pull request is being considered by the We Vote admins:
Any new changes unrelated to this one should be on a brand new branch (`git
-checkout -b some-new-thing`). Don't forget to check out the master branch first, otherwise you'll branch off of the current PR branch
-
+checkout -b `). Don't forget to check out the develop branch first, otherwise you'll
+branch off of the current PR branch
If you want to make changes to your earlier commit in response to comments on
the pull request, you change back to the branch that you submitted it from (`git
-checkout doc-script-changes`), make any changes, then commit and push them (steps 6-9). These get automatically added to your pull request since they're in the same branch.
+checkout `), make any changes, then commit and push them (steps 6-9).
+These get automatically added to your pull request since they're in the same branch.
If your changes are small fixes, they should not be a new commit. Instead, use
git add and then `git commit --amend` to fix up your original commit.
@@ -153,16 +183,33 @@ If you decide to abandon a pull request, you can CLOSE the issue it created and
If the pull request is good, there's nothing else for you to do, besides wait for someone to accept it.
-Once the pull request is accepted (or closed) you can delete your branch from the client. Or, you can wait until you have collected a bunch of them and delete all of the obsolete ones in one go.
-
-Also keep in mind that `git branch -D my-branch` deletes branches only locally, to delete them from the remote repo you have to do `git push origin :my-branch`
-
Moving a change between branches
-Sometimes you make a change on the wrong branch. You can move it to the right branch with git stash. From the branch where you made the changes:
+Sometimes you make a change on the wrong branch. You can move it to the right branch with git stash.
+From the branch where you made the changes:
+
`git stash`
+
`git checkout branch-you-want-it-on`
+
`git stash pop`
+## My Pull Request Was Approved
+
+Once the pull request is accepted (or closed) you can delete your branch from the client.
+Or, you can wait until you have collected a bunch of them and delete all of the obsolete ones in one go.
+For example with the branch "dale_doc_updates_mar24":
+
+`git branch -D `
+
+Also keep in mind that `git branch -D my-branch` deletes branches only locally,
+to delete them from the remote repo you have to do `git push origin :my-branch`
+
+or
+
+`git push origin --delete `
+
+`git remote prune origin`
+
---
For more advanced tips about using Pull Requests, see [Pull Request Tips & Tricks](PULL_REQUEST_ADVANCED.md)
diff --git a/docs/contributing/PULL_REQUEST_ADVANCED.md b/docs/contributing/PULL_REQUEST_ADVANCED.md
index b9a9d2015..5297493f5 100644
--- a/docs/contributing/PULL_REQUEST_ADVANCED.md
+++ b/docs/contributing/PULL_REQUEST_ADVANCED.md
@@ -101,8 +101,9 @@ Define a remote for their github repo, e.g.
`git remote add pertrai1 https://github.com/pertrai1/WebApp.git`
Now fetch their changes and rebase on top of the branch they have that change in:
-`git fetch pertrai1`
-`git rebase pertrai1/pertrai1_branchname`
+
+ git fetch pertrai1
+ git rebase pertrai1/pertrai1_branchname
If there are collisions, these files are removed from your git commit. Hunt them down by searching for seven > characters ‘>>>>>>>’ in your project. Resolve any conflicts in your editor. git status will also show the affected files (in red, since they’re not part of a commit)
diff --git a/docs/contributing/PULL_REQUEST_BACKGROUND.md b/docs/contributing/PULL_REQUEST_BACKGROUND.md
index e9fd7b23e..267c90185 100644
--- a/docs/contributing/PULL_REQUEST_BACKGROUND.md
+++ b/docs/contributing/PULL_REQUEST_BACKGROUND.md
@@ -18,6 +18,9 @@ http://nvie.com/posts/a-successful-git-branching-model/
Collaborating on projects using pull requests: https://help.github.com/categories/collaborating-on-projects-using-pull-requests/
+We also created [this handy chart](https://docs.google.com/drawings/d/1ED4X3Gpy_UruGDSiO8FjjxQeGOmQqIApguodHDo6-ok/edit)
+to show the various steps working with pull requests.
+
## Code staging areas:
1) wevote/WebApp, master branch (github servers): Used for working releases
diff --git a/docs/contributing/PULL_REQUEST_SETUP.md b/docs/contributing/PULL_REQUEST_SETUP.md
index 4e7c507c7..248635f87 100644
--- a/docs/contributing/PULL_REQUEST_SETUP.md
+++ b/docs/contributing/PULL_REQUEST_SETUP.md
@@ -37,11 +37,12 @@ Next, make sure that master is in sync with the upstream source of truth:
## Connect Your Personal Fork To wevote/WebApp
-Make sure your are connecting this way:
-`vi .git/config`
+ `cd PersonalGitForks/WebApp`
+ `vi .git/config`
Replace the “url” connection string under [remote “origin”] with:
-`url = git@github.com:YOUR_GITHUB_ACCOUNT/WebApp.git`
+
+ `url = git@github.com:YOUR_GITHUB_ACCOUNT/WebApp.git`
Make sure your `[remote “upstream”]` lines look like this:
@@ -50,7 +51,8 @@ Make sure your `[remote “upstream”]` lines look like this:
fetch = +refs/heads/*:refs/remotes/upstream/*
Run this command to confirm your setup:
-`git remote -v`
+
+ `git remote -v`
You should see:
diff --git a/docs/contributing/index.md b/docs/contributing/index.md
index aca4d8fa7..3d7e2761f 100644
--- a/docs/contributing/index.md
+++ b/docs/contributing/index.md
@@ -3,11 +3,18 @@
## Contents
-- [](#)
-
+Start here:
+1. [Our Culture and Philosophy](CONTRIBUTING_PHILOSOPHY.md)
+1. [Coding Standards](CONTRIBUTING_STANDARDS.md)
+1. `[Optional]` [What the Heck is a Pull Request?](PULL_REQUEST_BACKGROUND.md)
+1. [Before Your First Pull Request](PULL_REQUEST_SETUP.md)
+1. [Creating a Pull Request](CREATING_PULL_REQUEST.md)
+1. [Pull Request Tips & Tricks](PULL_REQUEST_ADVANCED.md)
+1. [Troubleshooting Pull Request Problems](PULL_REQUEST_TROUBLESHOOTING.md)
+1. [Approving Pull Requests](APPROVING_PULL_REQUESTS.md)
diff --git a/docs/images/ChromeDebuggerApplicationTab.png b/docs/images/ChromeDebuggerApplicationTab.png
new file mode 100644
index 000000000..4f7f5a67b
Binary files /dev/null and b/docs/images/ChromeDebuggerApplicationTab.png differ
diff --git a/docs/images/ChromeDebuggerNetworkOnline.png b/docs/images/ChromeDebuggerNetworkOnline.png
new file mode 100644
index 000000000..2572a876b
Binary files /dev/null and b/docs/images/ChromeDebuggerNetworkOnline.png differ
diff --git a/docs/images/ReactDevTools.png b/docs/images/ReactDevTools.png
new file mode 100644
index 000000000..046aadadd
Binary files /dev/null and b/docs/images/ReactDevTools.png differ
diff --git a/docs/images/SafariServiceWorkerDebug.png b/docs/images/SafariServiceWorkerDebug.png
new file mode 100644
index 000000000..795cf3c31
Binary files /dev/null and b/docs/images/SafariServiceWorkerDebug.png differ
diff --git a/docs/images/WebpackBundleAnalyzer.png b/docs/images/WebpackBundleAnalyzer.png
new file mode 100644
index 000000000..c036ac083
Binary files /dev/null and b/docs/images/WebpackBundleAnalyzer.png differ
diff --git a/docs/images/WorkboxConsoleOutput.png b/docs/images/WorkboxConsoleOutput.png
new file mode 100644
index 000000000..749a7bd30
Binary files /dev/null and b/docs/images/WorkboxConsoleOutput.png differ
diff --git a/docs/installing/AUTOMATED_INSTALLATION.md b/docs/installing/AUTOMATED_INSTALLATION.md
new file mode 100644
index 000000000..f687cc701
--- /dev/null
+++ b/docs/installing/AUTOMATED_INSTALLATION.md
@@ -0,0 +1,18 @@
+# Automated Installation
+[Go back to Readme Home](../../README.md)
+
+## For Mac Users
+
+Copy the contents of [installmac.sh](https://github.com/wevote/WebApp/blob/develop/installmac.sh) to a file and run it (Note: this script requires the root password)
+
+ $ [text editor] installmac.sh (Copy contents of file to text editor)
+ $ chmod +x installmac.sh
+ $ ./installmac.sh
+
+## For Ubuntu Users
+
+Copy the contents of [installUbuntu.sh](https://github.com/wevote/WebApp/blob/develop/installUbuntu.sh) to a file and run it (Note: this script requires the root password)
+
+ $ [text editor] installmac.sh (Copy contents of file to text editor)
+ $ chmod +x installUbuntu.sh
+ $ ./installUbuntu.sh
diff --git a/docs/installing/CHANGE_PORT.md b/docs/installing/CHANGE_PORT.md
new file mode 100644
index 000000000..3a9ac76ae
--- /dev/null
+++ b/docs/installing/CHANGE_PORT.md
@@ -0,0 +1,32 @@
+# How to run WebApp on a different port
+
+
+## December 2019: We no longer use gulp, so these instructions are obsolete, and need to be updated
+
+
+In src/js/config.js, change ```WE_VOTE_HOSTNAME```'s port:
+
+```
+module.exports = {
+ WE_VOTE_URL_PROTOCOL: "http://",
+ WE_VOTE_HOSTNAME: "localhost:8080",
+ SECURE_CERTIFICATE_INSTALLED: false,
+```
+
+In server.js, change ```port```:
+
+```
+module.exports = function (PROD) {
+ const port = 8080;
+ const opts = { redirect: true };
+```
+
+In Gulpfile.js, add the ```port``` option to the initialization parameters for browserSync:
+
+```
+browserSync.init({
+ proxy: "localhost:3003",
+ open: false,
+ port: 8080,
+ ...
+```
diff --git a/docs/installing/CLONING_CODE.md b/docs/installing/CLONING_CODE.md
index 3cbb03b12..d0590dae4 100644
--- a/docs/installing/CLONING_CODE.md
+++ b/docs/installing/CLONING_CODE.md
@@ -1,49 +1,64 @@
-
-
-## Contents
+# Bringing Code to Your Machine
+[Go back to Readme Home](../../README.md)
-- [Bringing Code to Your Machine](#bringing-code-to-your-machine)
- - [Setting up your repository for work](#setting-up-your-repository-for-work)
- - [Clone the repo](#clone-the-repo)
- - [](#)
+## Set up your environment
-
+Make sure you have created a place to put all of the code from Github, for example:
-# Bringing Code to Your Machine
+ $ mkdir /Users//MyProjects/
## Setting up your repository for work
-1.Install and configure git on your local machine.
+1. Install and configure git on your local machine if it is not already installed. See instructions [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
+
+1. Create a fork of wevote/WebApp.git repository. You can do this from https://github.com/wevote/WebApp with the "Fork" button (upper right of screen)
+
+1. Using your terminal program, change directory into the local folder on your computer where you want the WebApp repository to be downloaded (replacing "" with your login name, and with your github username) and clone your fork:
+
+ `cd /Users//MyProjects/`
+
+ `git clone https://github.com//WebApp.git`
+
+1. Change into your local WebApp repository folder, and set up a remote for upstream:
+
+ `cd /Users//MyProjects/WebApp`
-2.Create a fork of wevote/WebApp.git
+ `$ git remote add upstream git@github.com:wevote/WebApp.git`
-3.Clone your fork
+#### Windows machines only
-`git clone https://github.com/username/WebApp.git`
+5. Set the line endings to LF in git so ESLint doesn't flag CRLF line endings as errors
-4.In your local repository, set up a remote for upstream:
-`$ git remote add upstream git@github.com:wevote/WebApp.git`
+ $ git config --global core.autocrlf false
-5.Create ssh keys: `ssh-keygen -t rsa -C "youremail@somedomain.com"`
+Next, set `* text=auto` in your `.gitattributes` file (you may need to create this file in your root WebApp folder)
-6.`ssh-add ~/.ssh/id_rsa`
+ * text=auto
-7.`pbcopy < ~/.ssh/id_rsa.pub`
+Finally, set the core.eol to LF
-8.Go paste your keys into Github, under SSH Keys for your account.
+ $ git config --global core.eol lf
-9.Set up a git client where origin is a fork of the repository (e.g.
- pertrai1/WebApp), and upstream is the real deal (e.g. wevote/WebApp)
-### Clone the repo
+### Create and set up SSH keys. (For Windows machines, refer to [these instructions instead](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#platform-windows)).
-* Click the GitHub fork button to create your own fork
-* Clone your fork of the repo to your dev system
+ 1. Create SSH key:
+
+ `ssh-keygen -t rsa -C "youremail@somedomain.com"`
+
+ 2. Add SSH private keys into the SSH authentication agent:
+
+ `ssh-add ~/.ssh/id_rsa`
-```
-git clone git@github.com:pertrai1/wevote.git
-```
+ 3. Copy the contents of the *public* key file into your computer's clipboard:
+
+ `pbcopy < ~/.ssh/id_rsa.pub`
+ 4. Go to your "Settings" page in GitHub (click on your avatar on the top right). In the left navigation, choose "SSH and GPG keys".
+
+ 5. Click the "New SSH key" button on the top right.
+
+ 6. Paste the contents of the "~/.ssh/id_rsa.pub" key file (which you just copied in step 3) into the "Key" text area, and give it any Title you would like.
---
diff --git a/docs/installing/ENVIRONMENT.md b/docs/installing/ENVIRONMENT.md
index d0584805a..c64526714 100644
--- a/docs/installing/ENVIRONMENT.md
+++ b/docs/installing/ENVIRONMENT.md
@@ -1,25 +1,69 @@
-
-
-## Contents
+# Preparing the Environment on Your Machine
+[Go back to Readme Home](../../README.md)
-- [Preparing the Environment on Your Machine](#preparing-the-environment-on-your-machine)
- - [Install nodeenv ("Node Env")](#install-nodeenv-node-env)
- - [Set up your environment](#set-up-your-environment)
- - [](#)
+## Explanation
-
+In this section we are going to install or update three package managers -- software that downloads libraries and/or executable programs that we rely on to build
+the WebApp (npm, Homebrew, and pip). We are also going install or update two language interpreters (Node and Python):
+* [Node](https://nodejs.org/en/): "Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine." Node allows you to run JavaScript outside of a browser,
+at the command line, or on a server. Many of our build processes run on Node.
+* [npm](https://www.npmjs.com/): NPM is the Node package manager (installer of software modules), and is automatically installed with Node. It can be updated separately and occasionally
+this might be necessary. NPM is used extensively in WebApp to update most of the opensource JavaScript libraries that we leverage.
+* [Python](https://www.python.org/): Python is a popular interpreted language that is used most often as a server side language for handling APIs or simple web applications. The [WeVoteServer](https://github.com/wevote/WeVoteServer), our API server, is written in Python.
+* [Homebrew](https://brew.sh/): Homebrew, or simply `brew` at the command line, is "the missing package manager for MacOS." It is the package manager that is often the
+first one installed, and can be used to install other package managers and libraries.
+* [pip](https://pip.pypa.io/en/stable/installing/): "pip is [Python's] preferred installer program. Starting with Python 3.4, it is included by default with the Python binary installers."
+The Mac's built-in Python distibution does not include pip, so we need to install it manually.
+* [nodeenv](https://github.com/ekalinin/nodeenv): "nodeenv (Node.js virtual environment) is a tool to create isolated Node.js environments.
+It creates an environment that has its own installation directories, that doesn't share libraries with other Node.js virtual environments."
+* [node-sass](https://github.com/sass/node-sass): "Node-sass is a library that provides binding for Node.js to LibSass, the C version of the popular stylesheet preprocessor, Sass." We write styles in Sass (scss files), and the node-sass pre-processor compiles them to css on the fly, before the excution of the WebApp begins.
+* [Ruby](https://www.ruby-lang.org/en/): "A dynamic, open source programming language with a focus on simplicity and productivity." Ruby is yet another interpreted language, that comes pre-installed on the Mac. We use it to install Homebrew.
-# Preparing the Environment on Your Machine
+## Install nodeenv ("Node Env") - Macintosh (see below for Windows)
+
+Install [Homebrew](https://brew.sh/), and then install Python:
-## Install nodeenv ("Node Env")
+ $ cd ~
+ $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
+ $ brew install python
-Install nodeenv globally. For instructions installing it locally, see: https://github.com/ekalinin/nodeenv
+
+
+Next use Python to install pip:
+
+ $ curl https://bootstrap.pypa.io/get-pip.py | sudo python
-Create a place for your WebApp virtual environment to live on your hard drive. We recommend installing it
-away from the WebApp source code:
+Now install nodeenv with pip. Install nodeenv globally. (For instructions installing it locally, see: https://github.com/ekalinin/nodeenv):
+
+ $ sudo -H pip install nodeenv
+
+If you are already using Node and npm, confirm that your installation is at least at these minimum
+versions:
+
+ $ node -v
+ v10.12.0
+
+ $ npm -v
+ 6.4.1
+
+If you find that your Mac, does not have Node installed, install it with brew. (If you want to have
+a fresh install of Node you can `brew unlink node` first.) A fresh or initial install of Node,
+will automatically install the latest version of npm.
+
+ $ brew install node
+ $ node -v
+ $ npm -v
+
+Create a place for your WebApp virtual environment to live on your hard drive. We recommend installing it away from the WebApp source code:
$ mkdir /Users//NodeEnvironments/
$ cd /Users//NodeEnvironments/
@@ -33,16 +77,54 @@ Now activate this new virtual environment:
$ cd /Users//NodeEnvironments/WebAppEnv/
$ . bin/activate
-Confirm the versions of your main packages are >= to these versions:
+**Note** that you will need to do the step above every time before you start local development. Once you have activated this virtual Node environment, it will persist in the current Terminal tab even as you navigate to different folders (e.g., the We Vote WebApp folder). You'll see that each line on the Terminal starts with `(WebAppEnv)` while the virtual environment is in effect. You can read more about nodeenv [here](https://github.com/ekalinin/nodeenv).
+
+Just to be safe, rebuild node-sass:
+
+ (WebAppEnv) $ npm rebuild node-sass
+ (WebAppEnv) $ /usr/local/bin/node -v
+ v9.10.1
+
+Export your path to the local environment (append the `/usr/local/bin` path segment to the path that is used when in the WebAppEnv):
+
+ (WebAppEnv) $ export PATH="/usr/local/bin:$PATH"
- (WebAppEnv) $ node -v
- v5.3.0
+**Mac users are now done with this page,** go on to the next section: [Bringing Code to Your Machine](CLONING_CODE.md)
- (WebAppEnv) $ npm -v
- 3.3.12
+
+## Install Node.js - Windows
+
+The following instructions were modified from this [blog post](http://blog.teamtreehouse.com/install-node-js-npm-windows).
+
+1. Download the Windows installer from the Node.js web site (typically the .msi file):
+
+ https://nodejs.org/en/download/
+
+2. Run the installer (the .msi file you downloaded in the previous step).
+
+3. Follow the prompts in the Node installer (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).
+
+4. Restart your computer. You won’t be able to run Node.js® until you restart your computer.
+
+5. Test the installation (instructions below).
+
+Make sure you have Node and npm installed by running simple commands to see what version of each is installed and to run a simple test program:
+
+*Test Node:* To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type `node -v`. This should print a version number, so you’ll see something like this v0.10.35.
+
+*Test NPM:* To see if NPM is installed, type `npm -v` in Terminal. This should print NPM’s version number so you’ll see something like this 1.4.28
+
+Create a test file and run it. A simple way to test that Node.js works is to create a JavaScript file. For example, name a file `hello.js`, and just add the code `console.log('Node is installed!');`. To run the code simply open your command line program, navigate to the folder where you saved the file, and type `node hello.js`. This will start Node and run the code in the `hello.js` file. You should see the output `Node is installed!`.
+
+
+Make sure to run `npm install -g gulp-cli`
+
+If you are still getting errors with gulp this is a [helpful link](https://stackoverflow.com/questions/24027551/gulp-command-not-found-error-after-installing-gulp)
## Set up your environment
+If you are running Windows, we recommend installing [Git Bash](https://git-scm.com/downloads).
+
Create a place to put all of the code from Github:
$ mkdir /Users//MyProjects/
diff --git a/docs/installing/README_INSTALLING.md b/docs/installing/README_INSTALLING.md
deleted file mode 100644
index fcc484775..000000000
--- a/docs/installing/README_INSTALLING.md
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-## Contents
-
-- [Installing WebApp - Overview of Process](#installing-webapp---overview-of-process)
- - [](#)
-
-
-
-# Installing WebApp - Overview of Process
-
-Our installation process is built to allow engineers all over America to contribute to We Vote.
-
-It may seem complicated, but it allows anyone to be in a position to make suggestions, and get involved.
-
----
-
-Next: [Preparing the Environment on Your Machine](ENVIRONMENT.md)
-
-[Go back to Readme Home](../../README.md)
-
diff --git a/docs/installing/RUNNING_FIRST_TIME.md b/docs/installing/RUNNING_FIRST_TIME.md
index e10bdb130..cea923266 100644
--- a/docs/installing/RUNNING_FIRST_TIME.md
+++ b/docs/installing/RUNNING_FIRST_TIME.md
@@ -1,15 +1,5 @@
-
-
-## Contents
-
-- [Running WebApp for the First Time](#running-webapp-for-the-first-time)
- - [Install and start web application](#install-and-start-web-application)
- - [Using We Vote API server Locally](#using-we-vote-api-server-locally)
- - [](#)
-
-
-
# Running WebApp for the First Time
+[Go back to Readme Home](../../README.md)
Please make sure you have read:
@@ -17,25 +7,102 @@ Please make sure you have read:
* [Bringing Code to Your Machine](CLONING_CODE.md)
+Note that for the following steps, you must have activated the `WebAppEnv` Node virtual environment that you set up when preparing your environment. As a reminder, to activate the environment, you can run:
+
+ $ cd /Users//NodeEnvironments/WebAppEnv/
+ $ . bin/activate
+
+## Local config.js file
+
+Every developer needs to maintain their own `WebApp/src/js/config.js` file, which can be copied from `WebApp/src/js/config-template.js`. The default configuration, copied from `config-template.js`, should work as-is for new developers.
+
+Copy `WebApp/src/js/config-template.js` into `WebApp/src/js/config.js`:
+
+ (WebAppEnv) $ cd /Users//MyProjects/WebApp
+ (WebAppEnv) $ cp src/js/config-template.js src/js/config.js
+ (WebAppEnv) $ cp tests/browserstack/browserstack.config-template.js tests/browserstack/browserstack.config.js
+
+## Mac users will need to install fsevents ("Native access to OS X FSEvents in Node.js"):
+
+ (WebAppEnv) $ cd /Users//MyProjects/WebApp
+ (WebAppEnv) $ npm install fsevents
+
## Install and start web application
(WebAppEnv) $ cd /Users//MyProjects/WebApp
- (WebAppEnv) $ npm -g install gulp-cli // try sudo if it does not work
- (WebAppEnv) $ npm install
- (WebAppEnv) $ gulp
- (WebAppEnv) $ npm rebuild node-sass
+ (WebAppEnv) $ npm install // try sudo if it does not work
+ (WebAppEnv) $ npm start
You should be able to visit WebApp here:
http://localhost:3000
+(If you would like to run the WebApp on a different port follow [these instructions](CHANGE_PORT.md))
+
+## Start the WebApp in HTTPS
+
+You will need to install [OpenSSL](https://www.openssl.org/) in order to make an ssl (https) connection to the WebApp on
+your local PC/Mac. An https connection will be required for oauth logins
+via Twitter, Facebook, or Apple connect. It is also required for donation with Stripe.
+
+To install OpenSSL for Mac OS X, type in your terminal:
+
+1) `brew install openssl`
+
+1) After installation, check the version: `openssl version`
+
+1) If it's not showing the most recent version, then you need to symlink to the updated openssl version like so:
+
+ ln -s /usr/local/Cellar/openssl/1.0.2h_1/bin/openssl /usr/local/bin/openssl
+
+Now create a self signed certificate, starting from the WebApp folder.
+
+ openssl genrsa -des3 -passout pass:xxxx -out server.pass.key 2048
+ openssl rsa -passin pass:xxxx -in server.pass.key -out server.key
+ rm server.pass.key
+ openssl req -new -key server.key -out server.csr
+
+At this point you will be asked for certificate information, like this:
+
+ Country Name (2 letter code) []:US
+ State or Province Name (full name) []:California
+ Locality Name (eg, city) []:Oakland
+ Organization Name (eg, company) []:We Vote
+ Organizational Unit Name (eg, section) []:
+ Common Name (eg, fully qualified host name) []:localhost
+ Email Address []:
+
+ Please enter the following 'extra' attributes
+ to be sent with your certificate request
+ A challenge password []:
+
+Finally run this:
+
+ openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
+ mv server.key ./src/cert/
+ mv server.crt ./src/cert/
+
+Enter this into your Chrome address bar:
+
+ chrome://flags/#allow-insecure-localhost
+
+And then enable that setting. You will have to restart your browser.
+
+Then you should be able to start the WebApp using SSL
+
+ (WebAppEnv) $ npm run start-https
+
+You should be able to visit WebApp via HTTPS here:
+
+ https://localhost:3000
+
-## Using We Vote API server Locally
+## Using We Vote API server Locally: OPTIONAL
-The default configuration connections to our live API server at: https://api.wevoteusa.org
+The default configuration connections to our live API server at: https://api.wevoteusa.org, so this step is optional.
-IFF you would like to install the We Vote API server locally, start by reading the instructions
-[install WeVoteServer](https://github.com/wevote/WeVoteServer/blob/master/README_API_INSTALL.md)
+If you would like to install the We Vote API server locally, start by reading the instructions to
+[install WeVoteServer](https://github.com/wevote/WeVoteServer/blob/master/README_API_INSTALL.md).
---
diff --git a/docs/testing/EXPLAIN_FILES.md b/docs/testing/EXPLAIN_FILES.md
new file mode 100644
index 000000000..7b60b1634
--- /dev/null
+++ b/docs/testing/EXPLAIN_FILES.md
@@ -0,0 +1,81 @@
+# Understanding important files in the WebApp/tests/browserstack directory
+
+-rw-r--r-- 1 rpite rpite 6122 Jul 5 14:00 add_devices.py
+-rw-r--r-- 1 rpite rpite 3929 Jun 20 17:22 automate.py
+-rw-r--r-- 1 rpite rpite 476 Jul 27 13:13 browserstack.config.js
+-rw-r--r-- 1 rpite rpite 337 May 15 12:33 browserstack.config-template.js
+-rw-r--r-- 1 rpite rpite 5358 Jul 29 08:25 config.py
+-rw-r--r-- 1 rpite rpite 6603 Jul 15 14:16 devices_to_test.json
+-rw-r--r-- 1 rpite rpite 112 Apr 27 05:15 .eslintrc
+-rw-r--r-- 1 rpite rpite 4744 Jul 29 08:26 parallel.wdio.config.js
+-rw-r--r-- 1 rpite rpite 117 May 21 18:51 README.md
+-rw-r--r-- 1 rpite rpite 1551 Jul 13 10:33 remove_devices.py
+-rw-r--r-- 1 rpite rpite 1852 Jul 27 13:30 repl
+-rw-r--r-- 1 rpite rpite 78 Jul 29 10:42 requirements.txt
+drwxr-xr-x 2 rpite rpite 4096 Jul 29 10:25 specs
+-rwxr-xr-x 1 rpite rpite 1607 Jul 15 05:52 testScript
+-rw-r--r-- 1 rpite rpite 7979 Jul 27 13:29 utils.js
+-rw-r--r-- 1 rpite rpite 4169 Jul 29 08:21 wdio.conf.js
+-rw-r--r-- 1 rpite rpite 4564 Jul 29 07:55 wdio.conf.template
+
+## Python Scripts
+
+Requires python3+
+
+To install python3 modules do:
+
+ $ pip3 install -r requirements.txt
+
+### add_devices.py
+
+Adds device json to the devices_to_test.json file. Use -h for help.
+
+### automate.py
+
+Automatically inserts code into test script file. Requires [i3-wm](https://i3wm.org/) and xclip. Use -h for help.
+
+### remove_devices.py
+
+Removes device json from the devices_to_test.json file. Use -h for help.
+
+### config.py
+
+Uses the wdio.config.template file to generate the wdio.config.js file, which is used for running the test. Use -h for help.
+
+## Javascript files
+
+### browserstack.config.js
+
+Configuration file for test scripts.
+
+### parallel.wdio.config.js
+
+Template file for creating wdio.config.template.
+
+### utils.js
+
+Defines javascript functions used in test scripts.
+
+### wdio.conf.js
+
+Configuration for test run by webdriverio.
+
+## Bash scripts
+
+Requires bash
+
+### testScript
+
+Generates the template file named wdio.config.template which acts as a template for creating wdio.config.js as well as creates the script using the script name parameter if it does not already exist.
+
+## Miscellaneous files
+
+### repl
+
+Copied and pasted into the [wdio repl](https://webdriver.io/docs/repl.html) to use the functions defined in utils.js
+
+### wdio.conf.template
+
+Template file for creating wdio.conf.js
+
+
diff --git a/docs/testing/README_TESTING.md b/docs/testing/README_TESTING.md
new file mode 100644
index 000000000..cf3dd16e2
--- /dev/null
+++ b/docs/testing/README_TESTING.md
@@ -0,0 +1,89 @@
+# Testing WebApp - Overview of Process
+
+## Minimum Browsers
+
+[Click here to see the minimum browser versions](https://docs.google.com/spreadsheets/d/1FlUMCvg1pNIO0IzJm0jQyvUW1YC_KHh-LO4l-OVIcog/edit#gid=1774503729)
+that we support.
+
+## How to test Wevote WebApp with BrowserStack
+
+If you haven't updated your dependencies in a while, run `npm install` from your terminal to install WebdriverIO (this is a framework that lets us test both the browser app and Cordova mobile apps with a single script).
+
+### Manual installation only
+
+Copy `WebApp/tests/browserstack/browserstack.config-template.js` into `WebApp/tests/browserstack/browserstack.config.js`:
+
+ (WebAppEnv) $ cd WebApp
+ (WebAppEnv) $ cp tests/browserstack/browserstack.config-template.js tests/browserstack/browserstack.config.js
+
+### Automated installation start here
+
+You'll need to add your credentials to `browserstack.config.js`. Sign into Browserstack and navigate to the [BrowserStack Automate dashboard](https://automate.browserstack.com/). Press the down arrow next to where it says "Access Key" in the header. You should see your username ("YOUR-USERNAME" below) and access key ("ACCESS-KEY-HERE" below). You will need both of these values to upload the compiled App.
+
+You will also need the URL for the android app .apk file. You can get this by asking someone else or by uploading the file with Browserstack's REST API as described [here](https://www.browserstack.com/app-automate/rest-api?framework=appium).
+Visit this page when you are signed into Browserstack, and they will customize the command that you need to run from your terminal window:
+
+ curl -u "YOUR-USERNAME:ACCESS-KEY-HERE" -X POST https://api-cloud.browserstack.com/app-automate/upload -F "file=@/path/to/app/file/Application-debug.apk" -F 'data={"custom_id": "MyApp"}'
+
+You can find the latest We Vote APK (for Android) and IPA (for iOS) in [this Google Drive folder](https://drive.google.com/drive/u/0/folders/10tK7oqY7FKWhe0ilHDcli-DWpT9ldTFs).
+Please download it to your Download folder. For example, to find this path on a Mac:
+
+ (WebAppEnv) $ cd ~/Downloads
+ (WebAppEnv) $ pwd
+ /Users/dalemcgrew/Downloads
+
+In this example, the Android APK downloaded file is `app-debug-5-29-19.apk`. The full path to this downloaded file is now:
+
+ /Users/dalemcgrew/Downloads/app-debug-5-29-19.apk
+
+So the terminal command to upload the file would look like this:
+
+ curl -u "YOUR-USERNAME:ACCESS-KEY-HERE" -X POST https://api-cloud.browserstack.com/app-automate/upload -F "file=@/Users/dalemcgrew/Downloads/app-debug-5-29-19.apk" -F 'data={"custom_id": "MyApp"}'
+
+It will typically take 30-60 seconds to upload (without any feedback), and then return a path like this:
+
+ {"app_url":"bs://ANOTHER-GENERATED-STRING-HERE","custom_id":"MyApp","shareable_id":"dalemcgrew1/MyApp"}
+
+Copy the path `bs://ANOTHER-GENERATED-STRING-HERE` into your `WebApp/tests/browserstack/browserstack.config.js` file,
+and put it into the `BROWSERSTACK_APK_URL` value field like this:
+
+ BROWSERSTACK_APK_URL: 'bs://ANOTHER-GENERATED-STRING-HERE',
+
+With this `BROWSERSTACK_APK_URL` variable set now, we can run tests on the android mobile application.
+
+There are three scripts for running tests: config.py, testscript, and wdio.config.js. testScript generates the template file named wdio.config.template which acts as a template for creating wdio.config.js as well as creates the script using the script name parameter if it does not already exist. config.py uses the wdio.config.template file to generate the wdio.config.js file, which is used for running the test. Note that testScript requires bash and config.py requires python3.
+
+ (WebAppEnv) $ ./testscript -s
-
-
-
+
+
+
+
Your election is loading...
+
+
+
+
+
+
+
+
+