Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack Upgrade #607

Merged
merged 6 commits into from
Dec 21, 2019
Merged

Webpack Upgrade #607

merged 6 commits into from
Dec 21, 2019

Conversation

btyy77c
Copy link
Contributor

@btyy77c btyy77c commented Dec 17, 2019

Context

Summary of Changes

  • Upgrade webpacker gem to version 4
  • Added/Upgraded @rails/ujs, @rails/webpacker, rails-erb-loader, and webpack-dev-server packages
  • Changed webpack configuration files to work with webpack 4
  • Changed "include PgSearch" to "include PgSearch::Model" due to warnings in tests
  • Added .dockerignore file. Sometimes your outdated node_modules from your local computer can be pulled into your docker environment. It can cause problems when trying to compile your assets inside docker. Also, things like the .git folder will make your docker image larger without adding any value. Adding a .dockerignore file will help keep these files out of your docker image.

Checklist

  • Tested Mobile Responsiveness
  • Added Unit Tests
  • CI Passes
  • Deploys to Heroku on test Correctly (Maintainers will handle)
  • Added Documentation (Service and Code when required)

Screenshots

Before

After

@DeeDeeG
Copy link
Contributor

DeeDeeG commented Dec 18, 2019

Travis CI error is unrelated to these changes. Thank you! Overall this looks good!

In my practical testing, all of the site's functionality that I can test in Docker was working.

Key things that were checked:

  • Submitting new restrooms works
    • Submitted a dummy restroom entry
    • Geocoding is expected to fail, without providing a valid Google Geocoding API key, not related to these changes.
  • Searching for existing restrooms works
    • Search "San Francisco" to get the entries that are pre-seeded in the testing environment
  • Splash page works
    • Search box, search by text, search by location all appear to work as intended.
  • Static pages (about, business info, restroom PDF signs) appear as normal
  • Contact form works as intended
  • Pages for individual restrooms appear to work
    • "Propose an edit" functionality appears to work
    • Thumbs up / Thumbs down buttons work, ratings are updated, stored and displayed.
  • API demo page appears to work correctly
    • Dummy restroom I added during testing shows up as the most-recent entry in the database

Not checked (I don't know how to check these at this time):

  • Admin account login process
  • Confirming a proposed restroom edit as an admin

Copy link
Contributor

@DeeDeeG DeeDeeG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comments. Looks good to me!

Suggested a change to the semver for webpacker in the Gemfile, but this is a small thing. Will not be considered blocking, as we can change this after merging if need be.

Likewise, there is a tiny cleanup task in .gitignore. Also not strictly a blocker to merge this PR.

Comment on lines 59 to +68
/node_modules
yarn-debug.log*
.yarn-integrity

/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nitpick: There are a few duplicate lines in .gitignore from running the webpack install process again (once in the past for 3.x, once now for 4.x).

The new auto-generated entries in the .gitignore are good. We can delete the old ones (just above).

(I notice the difference is: the new ones include /yarn-error.log to be gitignored, which the old ones don't.)

@@ -31,7 +31,7 @@ gem 'sassc-rails'
gem 'simple_form', '~> 5.0'
gem 'turbolinks'
gem 'uglifier', '>= 1.3.0'
gem 'webpacker', '~> 3.5'
gem 'webpacker', '>= 4'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to have this be limited to the 4.x series, because major version upgrades usually need to be done intentionally or they will break something.

I tried upgrading webpacker to 4.x myself, without carefully following the instructions (or knowing how to properly follow them, truthfully), and it didn't appear to work as intended.

Suggested: 'webpacker', '~> 4' (or 'webpacker', '~> 4.0' effectively the same.)

(You may know this already, but IMO it's handy and worth sharing to everyone: bundle lock will quickly update your lockfile without needing to actually download/compile/install gems.)

include PgSearch
include PgSearch::Model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -66,5 +90,8 @@ production:
# Production depends on precompilation of packs prior to booting for performance.
compile: false

# Extract and emit a css file
extract_css: true
Copy link
Contributor

@DeeDeeG DeeDeeG Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have to watch that this works properly in staging.

Edit to clarify: This is a note-to-self for me and other maintainers. No action needed by PR author. Thank you!

@@ -1,17 +1,18 @@
{
"dependencies": {
"@rails/webpacker": "3.5",
"@rails/ujs": "^6.0.2",
Copy link
Contributor

@DeeDeeG DeeDeeG Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DeeDeeG
Copy link
Contributor

DeeDeeG commented Dec 21, 2019

I'm going to merge this, despite the failing tests, because (as you have pointed out, and I have confirmed) these same tests pass on the develop branch, on commits that previously passed. As such, these changes did not cause the tests to fail.

I will make some tweaks to follow up on this PR, as mentioned in my review comments.

(Please note that we have recently changed the merge policy to use only "squash" merges. So, for the time being, this and all future Pull Requests will be squashed into a single commit when merged.)

Thank you for doing this upgrade!

@DeeDeeG DeeDeeG merged commit 01c3c21 into RefugeRestrooms:develop Dec 21, 2019
DeeDeeG added a commit to DeeDeeG/refugerestrooms that referenced this pull request Dec 21, 2019
- Adjust Gemfile[.lock] to specify webpacker within the 4.x series,
  rather than any version 4.0 or greater.

- Delete some duplicate entries in the .gitignore file
@DeeDeeG DeeDeeG mentioned this pull request Dec 24, 2019
4 tasks
DeeDeeG added a commit to DeeDeeG/refugerestrooms that referenced this pull request Feb 8, 2020
Squashed commit of the following:

commit dd5441e
Author: DeeDeeG <DeeDeeG@users.noreply.github.com>
Date:   Tue Jan 28 15:47:41 2020 -0500

    CSS: Center logo and brand name on narrow screens (RefugeRestrooms#611)

    * _mobile.scss: Lower logo/brand on narrow screens

    Adjust the CSS "top" property to set the logo and "brand name"
    ("Refuge Restrooms") slightly lower within the navbar on narrow
    screens.

    This is to adjust for the navbar being responsively taller
    on narrower screens. "767px screen width" happens to be the responsive
    threshold for that height change for the navbar.

    * _mobile.scss: Move 342px rules, adjust whitespace

    Moved the "max 342px" rules to the bottom, so all screen-width-related
    style rules are in descending order of the sizes that they apply to.
    (For consistency).

    Adjusted the use of newlines in this stylesheet to be more consitent.

commit 61e5df4
Author: DeeDeeG <DeeDeeG@users.noreply.github.com>
Date:   Sun Jan 5 12:18:29 2020 -0500

    Tweak CSS a bit for narrow screens (e.g. mobile phones) (RefugeRestrooms#610)

    * CSS: Add some styles for narrow screens

    For screen widths ~340px or narrower.

    (Such a narrow screen is found, for example, on the original iPhone
    through to the iPhone 5S and iPhone SE.)

    - Makes the "+" icon on the "Add A Restroom" button
      appear in a more correct-looking position.

    - Fixes the overlap of the "Refuge Restrooms" text
      with the "hamburger" drop-down menu button in the header/nav section.

    - Adds a class via the haml source (.nav-column)
      to make applying one of the style rules easier.

    * CSS: No double-padding on nested `.container`s

    Eliminate double-padding in cases of
    an [element].container immediately inside another [element].container.

    (Doing this only directly under the header div, just to be conservative.)

    The 15px + 15px = 30px of padding on both sides
    seemed unintentionally wide. Also, I think this looks nicer.
    Helps with the tight fit on mobile devices, too.

    (Should affect the header/nav on all pages other than the home page,
    aka the splash page, due to the way the pages are coded.)

commit 89c8355
Author: DeeDeeG <DeeDeeG@users.noreply.github.com>
Date:   Sun Jan 5 11:54:01 2020 -0500

    Update some dependencies, fix some deprecation warnings (RefugeRestrooms#609)

    * Gemfile[.lock]: Update simplecov

    Fixes a deprecation warning

    * restrooms_spec.rb: Use 'successful' not 'success'

    Rspec's `be_success` and `.success?` are deprecated.

    Rspec's `be_successful` and `.successful?`
    are the non-deprecated versions of this check.

    (This fixes the associated deprecation warning)

    * Gemfile.lock: Bump some dependencies

    Upgraded loofah, puma, rack, and rack-cors,
    plus their dependencies.

commit 3714303
Author: DeeDeeG <DeeDeeG@users.noreply.github.com>
Date:   Tue Dec 24 17:55:25 2019 -0500

    restrooms_spec.rb: Fix a test (RefugeRestrooms#608)

    Background:

    The Mission Creek Cafe in San Francisco has been closed for some time.

    Google Maps API now resolves "Mission Creek Cafe"
    to a coffee shop in Washington state.

    Washington is too far away from our stub restroom entries;
    No stub restrooms are located near Washington,
    so no restroom results are shown on our results page for this search.

    The test expects to see a stub restroom entry on the reults page,
    but does not see it, and so the test fails.

    ---

    Fix:

    search the Maps API for "San Francisco," not "Mission Creek Cafe"

    (This returns a lat/long associated with San Francisco not Washington)

commit 297980c
Author: DeeDeeG <DeeDeeG@users.noreply.github.com>
Date:   Mon Dec 23 21:37:00 2019 -0500

    db/schema.rb: Commit with underscores in date

    The date gets underscores added automatically
    when running migrations on the database.

    Committing with the underscores so the change isn't flagged by git
    when no code has been changed.

commit da6e0e2
Author: DeeDeeG <DeeDeeG@users.noreply.github.com>
Date:   Fri Dec 20 22:46:56 2019 -0500

    CONTRIBUTING.md: Remove the reference to "Cmd + C"

    The "Cmd + C" keyboard shortcut is for copying text,
    not quitting programs in the terminal.

    The proper way to quit programs in the terminal
    under macOS is "Ctrl + C", the same as Linux.

    Referring to "Cmd + C" here was based on
    a mistaken assumption that "Ctrl" on Windows or Linux
    always gets translated to "Cmd" on macOS.

    (In fact, some uses of "Ctrl" on Windows/Linux
    are preserved as-is on macOS. It's a mixed bag.)

    Deleting the reference to "Ctrl + C", to make the guidance clearer.

commit c6dc441
Author: DeeDeeG <DeeDeeG@users.noreply.github.com>
Date:   Fri Dec 20 20:08:17 2019 -0500

    PR RefugeRestrooms#607: Minor tweaks/cleanup

    - Adjust Gemfile[.lock] to specify webpacker within the 4.x series,
      rather than any version 4.0 or greater.

    - Delete some duplicate entries in the .gitignore file

commit 01c3c21
Author: Emily Ring <emily_ring@ymail.com>
Date:   Fri Dec 20 19:53:08 2019 -0500

    Webpack Upgrade (RefugeRestrooms#607)

    * Updated webpacker gem

    * Upgraded yarn packages

    * Ran webpack:install process.  Working without rails-erb-loader

    * Added rails-erb-loader to webpack

    * Fixed include PgSearch warning

    * Added .dockerignore

commit 5154cd1
Author: DeeDeeG <DeeDeeG@users.noreply.github.com>
Date:   Fri Nov 1 16:58:40 2019 -0400

    Dockerfile: Upgrade Node from v10.x to v12.x (RefugeRestrooms#603)

    Node 12 "Erbium" is the newest Long Term Service release.

    We should either pin a version of Node in our package.json file,
    or stay on the latest LTS version of Node;

    Heroku will use the latest LTS version of Node
    in production if we don't have any versions pinned in our package.json

commit 6c96368
Author: Jason Chen <kbtpodifo@gmail.com>
Date:   Fri Nov 1 16:52:29 2019 -0400

    Fix Travis tests failing on distributions other than trusty (RefugeRestrooms#606)

    * Revert ".travis.yml: Set "dist" to "trusty" (RefugeRestrooms#600)"

    This reverts commit ac8f6ab.

    Doing this to run tests on Travis to investigate why they
    aren't passing.

    * Explicitly require locations.rb in rspec.rb

    Tentative fix for tests not passing in xenial but passing in trusty.
    This might be because different distributions load files in a
    different order. In xenial, `rspec.rb` might get loaded before
    `locations.rb`, making `Locations` uninitialized. Explicit require
    fixes this.
tkwidmer added a commit that referenced this pull request Feb 8, 2020
* db/seeds.rb: Give restroom entries an edit_id (#567)

Only applies during development and testing
when we use the "db/export.csv" data.

Doesn't affect production, which uses the real data in its db.

* Explain how to run individual tests and access psql (#570)

Also, clarify that there are two containers, web and db,
rather than just one; these can be viewed using
docker ps

* Make filter with "focus" class more readable

* Remove unused li

* Allow dropdown menu text to wrap and fit within the dropdown

Add border bottom to give each menu item more separation

* yarn.lock: Update jquery (#587)

* Dockerfile: Update and streamline steps (#586)

Does effectively the same things as before,
but now in a simpler/faster way.

Some of the changes take inspiration from
@btyy77c's dockerAlpine branch:
https://github.com/btyy77c/refugerestrooms/blob/dockerAlpine/Dockerfile

The PhantomJS install is based on (mostly copy-pasted from)
@nkovacs' phantomjs image from Docker Hub:
https://github.com/nkovacs/selenium-standalone-phantomjs/blob/c5f6bba218472270/Dockerfile#L19-L22

* Dockerfile: Get latest Node.js in a major version (#589)

(Also installs Node.js in /usr/local/
instead of installing Node.js in the root directory.)

With this updated script, we specify just a major version
and the script picks the latest minor/patch version within that.

--

Nodejs.org does most of the work by maintaining the "latest-v[MAJOR]"
folders; We only need to parse the "SHASUMS256.txt" file from there,
and pick the "linux-x64" variant, which works with our Docker setup.

At this point we can use the known directory URL, plus the filename
extracted from "SHASUMS256.txt", and download with curl, or wget, etc.

(e.g. "curl -L https://nodejs.org/dist/latest-v10.x/node-v10.16.0-linux-x64.tar.xz -o nodejs.tar.xz")

--

There is no "latest-LTS" folder or similar, so automatically getting
the latest LTS version would be more difficult.

We could search "nodejs.org/dist/" for folders with
the name "latest-[LETTERS-ONLY-STRING]", which would be the folders
of all the LTS codenames. Among these, the one with
the alphabetically last name is the latest LTS.

This would work at least until around 2040, when they may have
to loop around and re-use some earlier letters (a, b, c, etc.)

* Update Node.js and Ruby dependencies (#590)

* yarn.lock: Update Node.js packages

* Gemfile.lock: Update gems

* Add Bugsnag to readme

To fufill the open source agreement, we have to link to bugsnag now in our readme.

* .travis.yml: Use minimal base image for Travis CI

We do all the setup/build steps inside a Docker container,
so we don't need ruby tools outside of Docker
(on the Travis CI virtual machine instances).

Should save about 20 seconds of Travis CI build time.

--

Inspired by @btyy77c who did this first at their dockerAlpine branch:
  - btyy77c@393cf46

Documentation at Travis re: minimal/generic images:
  - https://docs.travis-ci.com/user/languages/minimal-and-generic/

* docker-compose.yml: Use postgresql:alpine image

This (the Alpine Linux-based postgresql image) is a smaller image
than the debian-based postgresql image,
so it should be marginally faster to download.

Seems like a good idea in general,
to speed up build times (even outside of Travis CI).

Also should save some disk space for developers.

--

Inspired by the general concept of @btyy77c's dockerAlpine branch:
  - https://github.com/btyy77c/refugerestrooms/commits/dockerAlpine

Docker Hub documentation on the alpine vs debian postgres images:
  - https://hub.docker.com/_/postgres#image-variants

* layouts/_footer.html.haml: Remove tumblr link

* stylesheets/.../common: Remove tumblr icon stlye

* en/footer.en.yml: Remove string for tumblr blog

This isn't needed anymore,
since we have removed the tumblr link from the footer.

* removed tumblr from about page (#593)

I noticed we were removing tumblr, here's one more instance

* Create about.fil.yml (#465)

* Filipino Translation devise.fil.yml (#454)

* Create devise.fil.yml

* Update devise.fil.yml

* Update for devise.fil.yml @100% Translation

* Update and rename devise.fil.yml to devise.fl.yml

* Update and rename devise.fl.yml to devise.fil.yml

* 100% completed for restroom.fil.yml file  (#467)

* Create restroom.fil.yml

* Translations for EN to FIL Issue 451 (#556)

Translated files from EN to FIL #451

* config/locales/fil/: Remove tumblr

See #592 and #593

* Updated filipino translations

* switched sass-rails gem (#595)

* switched sass-rails gem (sass-rails --> sassc-rails)

* Changed the word `restroom` to `banyo` to be mroe understandable to most Filipinos

* Fixed some unnoticed words that needed some changes in translation

* additional translation changes

* config/application.rb: Add 'fil' locale (Filipino)

Enables translations as merged in #596

* .travis.yml: Set "dist" to "trusty" (#600)

Should allow our CI tests to pass
while we investigate test failures on xenial and newer.

* production.rb: Fix i18n.fallbacks deprecation warn

* config/application.rb: Add Tagalog (:tl) locale

* production.rb: I18n fallbacks for :tl --> :fil

We don't maintain separate translations for
"Tagalog" and Filipino, since they are arguably the same language.

However, Firefox only allows users to set "Tagalog" as preferred,
and Chrome only allows users to set "Filipino" as preferred.

To support both browsers, we must support both the "Tagalog"
and the "Filipino" locales.

(These locales use the "tl" and "fil" locale codes, respectively.)

* config/application.rb: Set default locale to "en"

* package.json: Update swagger to master with patch

* yarn.lock: Commit updated (indirect) dependencies

* yarn.lock: Update all packages

* Gemfile[.lock]: Update devise, simple_form

* yarn.lock: Upgrade swagger-ui's dependencies

* Ruby: Upgrade from 2.5.3 to 2.5.7

* Dockerfile: Work around an issue with phantomjs

When running the tests, cliver tries to check that PhantomJS's version
is within a certain range, by running "phantomjs --version".

The "phantomjs --version" command fails for some reason
on the new ruby:2.5.7-slim Docker base image.

Perhaps because the new Docker image is based on Debian 10 "Buster,"
whereas the old Docker image was based on Debian 9 "Stretch"?

This commit's workaround allows "phantomjs --version" to work again.

* Fix Travis tests failing on distributions other than trusty (#606)

* Revert ".travis.yml: Set "dist" to "trusty" (#600)"

This reverts commit ac8f6ab.

Doing this to run tests on Travis to investigate why they
aren't passing.

* Explicitly require locations.rb in rspec.rb

Tentative fix for tests not passing in xenial but passing in trusty.
This might be because different distributions load files in a
different order. In xenial, `rspec.rb` might get loaded before
`locations.rb`, making `Locations` uninitialized. Explicit require
fixes this.

* Dockerfile: Upgrade Node from v10.x to v12.x (#603)

Node 12 "Erbium" is the newest Long Term Service release.

We should either pin a version of Node in our package.json file,
or stay on the latest LTS version of Node;

Heroku will use the latest LTS version of Node 
in production if we don't have any versions pinned in our package.json

* Webpack Upgrade (#607)

* Updated webpacker gem

* Upgraded yarn packages

* Ran webpack:install process.  Working without rails-erb-loader

* Added rails-erb-loader to webpack

* Fixed include PgSearch warning

* Added .dockerignore

* PR #607: Minor tweaks/cleanup

- Adjust Gemfile[.lock] to specify webpacker within the 4.x series,
  rather than any version 4.0 or greater.

- Delete some duplicate entries in the .gitignore file

* CONTRIBUTING.md: Remove the reference to "Cmd + C"

The "Cmd + C" keyboard shortcut is for copying text,
not quitting programs in the terminal.

The proper way to quit programs in the terminal
under macOS is "Ctrl + C", the same as Linux.

Referring to "Cmd + C" here was based on
a mistaken assumption that "Ctrl" on Windows or Linux
always gets translated to "Cmd" on macOS.

(In fact, some uses of "Ctrl" on Windows/Linux
are preserved as-is on macOS. It's a mixed bag.)

Deleting the reference to "Ctrl + C", to make the guidance clearer.

* db/schema.rb: Commit with underscores in date

The date gets underscores added automatically
when running migrations on the database.

Committing with the underscores so the change isn't flagged by git
when no code has been changed.

* restrooms_spec.rb: Fix a test (#608)

Background:

The Mission Creek Cafe in San Francisco has been closed for some time.

Google Maps API now resolves "Mission Creek Cafe"
to a coffee shop in Washington state.

Washington is too far away from our stub restroom entries;
No stub restrooms are located near Washington,
so no restroom results are shown on our results page for this search.

The test expects to see a stub restroom entry on the reults page,
but does not see it, and so the test fails.

---

Fix:

search the Maps API for "San Francisco," not "Mission Creek Cafe"

(This returns a lat/long associated with San Francisco not Washington)

* Update some dependencies, fix some deprecation warnings (#609)

* Gemfile[.lock]: Update simplecov

Fixes a deprecation warning

* restrooms_spec.rb: Use 'successful' not 'success'

Rspec's `be_success` and `.success?` are deprecated.

Rspec's `be_successful` and `.successful?`
are the non-deprecated versions of this check.

(This fixes the associated deprecation warning)

* Gemfile.lock: Bump some dependencies

Upgraded loofah, puma, rack, and rack-cors,
plus their dependencies.

* Tweak CSS a bit for narrow screens (e.g. mobile phones) (#610)

* CSS: Add some styles for narrow screens

For screen widths ~340px or narrower.

(Such a narrow screen is found, for example, on the original iPhone
through to the iPhone 5S and iPhone SE.)

- Makes the "+" icon on the "Add A Restroom" button
  appear in a more correct-looking position.

- Fixes the overlap of the "Refuge Restrooms" text
  with the "hamburger" drop-down menu button in the header/nav section.

- Adds a class via the haml source (.nav-column)
  to make applying one of the style rules easier.

* CSS: No double-padding on nested `.container`s

Eliminate double-padding in cases of
an [element].container immediately inside another [element].container.

(Doing this only directly under the header div, just to be conservative.)

The 15px + 15px = 30px of padding on both sides
seemed unintentionally wide. Also, I think this looks nicer.
Helps with the tight fit on mobile devices, too.

(Should affect the header/nav on all pages other than the home page,
aka the splash page, due to the way the pages are coded.)

* CSS: Center logo and brand name on narrow screens (#611)

* _mobile.scss: Lower logo/brand on narrow screens

Adjust the CSS "top" property to set the logo and "brand name"
("Refuge Restrooms") slightly lower within the navbar on narrow
screens.

This is to adjust for the navbar being responsively taller
on narrower screens. "767px screen width" happens to be the responsive
threshold for that height change for the navbar.

* _mobile.scss: Move 342px rules, adjust whitespace

Moved the "max 342px" rules to the bottom, so all screen-width-related
style rules are in descending order of the sizes that they apply to.
(For consistency).

Adjusted the use of newlines in this stylesheet to be more consitent.

Co-authored-by: Kai Middleton <kai.middleton@hingehealth.com>
Co-authored-by: H. Yiu <hannah.k.yiu@gmail.com>
Co-authored-by: Mikena Wood <mi-wood@users.noreply.github.com>
Co-authored-by: Teagan <tkwidmer@gmail.com>
Co-authored-by: Joe Wadcan <joe.wadcan@github.com>
Co-authored-by: vinzruzell <35182720+vinzruzell@users.noreply.github.com>
Co-authored-by: Bryan Mark Fajutag <fbryanmark@gmail.com>
Co-authored-by: Emily Ring <btyy77c@gmail.com>
Co-authored-by: Jason Chen <kbtpodifo@gmail.com>
mi-wood added a commit that referenced this pull request Apr 13, 2020
* db/seeds.rb: Give restroom entries an edit_id (#567)

Only applies during development and testing
when we use the "db/export.csv" data.

Doesn't affect production, which uses the real data in its db.

* Explain how to run individual tests and access psql (#570)

Also, clarify that there are two containers, web and db,
rather than just one; these can be viewed using
docker ps

* Make filter with "focus" class more readable

* Remove unused li

* Allow dropdown menu text to wrap and fit within the dropdown

Add border bottom to give each menu item more separation

* yarn.lock: Update jquery (#587)

* Dockerfile: Update and streamline steps (#586)

Does effectively the same things as before,
but now in a simpler/faster way.

Some of the changes take inspiration from
@btyy77c's dockerAlpine branch:
https://github.com/btyy77c/refugerestrooms/blob/dockerAlpine/Dockerfile

The PhantomJS install is based on (mostly copy-pasted from)
@nkovacs' phantomjs image from Docker Hub:
https://github.com/nkovacs/selenium-standalone-phantomjs/blob/c5f6bba218472270/Dockerfile#L19-L22

* Dockerfile: Get latest Node.js in a major version (#589)

(Also installs Node.js in /usr/local/
instead of installing Node.js in the root directory.)

With this updated script, we specify just a major version
and the script picks the latest minor/patch version within that.

--

Nodejs.org does most of the work by maintaining the "latest-v[MAJOR]"
folders; We only need to parse the "SHASUMS256.txt" file from there,
and pick the "linux-x64" variant, which works with our Docker setup.

At this point we can use the known directory URL, plus the filename
extracted from "SHASUMS256.txt", and download with curl, or wget, etc.

(e.g. "curl -L https://nodejs.org/dist/latest-v10.x/node-v10.16.0-linux-x64.tar.xz -o nodejs.tar.xz")

--

There is no "latest-LTS" folder or similar, so automatically getting
the latest LTS version would be more difficult.

We could search "nodejs.org/dist/" for folders with
the name "latest-[LETTERS-ONLY-STRING]", which would be the folders
of all the LTS codenames. Among these, the one with
the alphabetically last name is the latest LTS.

This would work at least until around 2040, when they may have
to loop around and re-use some earlier letters (a, b, c, etc.)

* Update Node.js and Ruby dependencies (#590)

* yarn.lock: Update Node.js packages

* Gemfile.lock: Update gems

* Add Bugsnag to readme

To fufill the open source agreement, we have to link to bugsnag now in our readme.

* .travis.yml: Use minimal base image for Travis CI

We do all the setup/build steps inside a Docker container,
so we don't need ruby tools outside of Docker
(on the Travis CI virtual machine instances).

Should save about 20 seconds of Travis CI build time.

--

Inspired by @btyy77c who did this first at their dockerAlpine branch:
  - btyy77c@393cf46

Documentation at Travis re: minimal/generic images:
  - https://docs.travis-ci.com/user/languages/minimal-and-generic/

* docker-compose.yml: Use postgresql:alpine image

This (the Alpine Linux-based postgresql image) is a smaller image
than the debian-based postgresql image,
so it should be marginally faster to download.

Seems like a good idea in general,
to speed up build times (even outside of Travis CI).

Also should save some disk space for developers.

--

Inspired by the general concept of @btyy77c's dockerAlpine branch:
  - https://github.com/btyy77c/refugerestrooms/commits/dockerAlpine

Docker Hub documentation on the alpine vs debian postgres images:
  - https://hub.docker.com/_/postgres#image-variants

* layouts/_footer.html.haml: Remove tumblr link

* stylesheets/.../common: Remove tumblr icon stlye

* en/footer.en.yml: Remove string for tumblr blog

This isn't needed anymore,
since we have removed the tumblr link from the footer.

* removed tumblr from about page (#593)

I noticed we were removing tumblr, here's one more instance

* Create about.fil.yml (#465)

* Filipino Translation devise.fil.yml (#454)

* Create devise.fil.yml

* Update devise.fil.yml

* Update for devise.fil.yml @100% Translation

* Update and rename devise.fil.yml to devise.fl.yml

* Update and rename devise.fl.yml to devise.fil.yml

* 100% completed for restroom.fil.yml file  (#467)

* Create restroom.fil.yml

* Translations for EN to FIL Issue 451 (#556)

Translated files from EN to FIL #451

* config/locales/fil/: Remove tumblr

See #592 and #593

* Updated filipino translations

* switched sass-rails gem (#595)

* switched sass-rails gem (sass-rails --> sassc-rails)

* Changed the word `restroom` to `banyo` to be mroe understandable to most Filipinos

* Fixed some unnoticed words that needed some changes in translation

* additional translation changes

* config/application.rb: Add 'fil' locale (Filipino)

Enables translations as merged in #596

* .travis.yml: Set "dist" to "trusty" (#600)

Should allow our CI tests to pass
while we investigate test failures on xenial and newer.

* production.rb: Fix i18n.fallbacks deprecation warn

* config/application.rb: Add Tagalog (:tl) locale

* production.rb: I18n fallbacks for :tl --> :fil

We don't maintain separate translations for
"Tagalog" and Filipino, since they are arguably the same language.

However, Firefox only allows users to set "Tagalog" as preferred,
and Chrome only allows users to set "Filipino" as preferred.

To support both browsers, we must support both the "Tagalog"
and the "Filipino" locales.

(These locales use the "tl" and "fil" locale codes, respectively.)

* config/application.rb: Set default locale to "en"

* package.json: Update swagger to master with patch

* yarn.lock: Commit updated (indirect) dependencies

* yarn.lock: Update all packages

* Gemfile[.lock]: Update devise, simple_form

* yarn.lock: Upgrade swagger-ui's dependencies

* Ruby: Upgrade from 2.5.3 to 2.5.7

* Dockerfile: Work around an issue with phantomjs

When running the tests, cliver tries to check that PhantomJS's version
is within a certain range, by running "phantomjs --version".

The "phantomjs --version" command fails for some reason
on the new ruby:2.5.7-slim Docker base image.

Perhaps because the new Docker image is based on Debian 10 "Buster,"
whereas the old Docker image was based on Debian 9 "Stretch"?

This commit's workaround allows "phantomjs --version" to work again.

* Fix Travis tests failing on distributions other than trusty (#606)

* Revert ".travis.yml: Set "dist" to "trusty" (#600)"

This reverts commit ac8f6ab.

Doing this to run tests on Travis to investigate why they
aren't passing.

* Explicitly require locations.rb in rspec.rb

Tentative fix for tests not passing in xenial but passing in trusty.
This might be because different distributions load files in a
different order. In xenial, `rspec.rb` might get loaded before
`locations.rb`, making `Locations` uninitialized. Explicit require
fixes this.

* Dockerfile: Upgrade Node from v10.x to v12.x (#603)

Node 12 "Erbium" is the newest Long Term Service release.

We should either pin a version of Node in our package.json file,
or stay on the latest LTS version of Node;

Heroku will use the latest LTS version of Node 
in production if we don't have any versions pinned in our package.json

* Webpack Upgrade (#607)

* Updated webpacker gem

* Upgraded yarn packages

* Ran webpack:install process.  Working without rails-erb-loader

* Added rails-erb-loader to webpack

* Fixed include PgSearch warning

* Added .dockerignore

* PR #607: Minor tweaks/cleanup

- Adjust Gemfile[.lock] to specify webpacker within the 4.x series,
  rather than any version 4.0 or greater.

- Delete some duplicate entries in the .gitignore file

* CONTRIBUTING.md: Remove the reference to "Cmd + C"

The "Cmd + C" keyboard shortcut is for copying text,
not quitting programs in the terminal.

The proper way to quit programs in the terminal
under macOS is "Ctrl + C", the same as Linux.

Referring to "Cmd + C" here was based on
a mistaken assumption that "Ctrl" on Windows or Linux
always gets translated to "Cmd" on macOS.

(In fact, some uses of "Ctrl" on Windows/Linux
are preserved as-is on macOS. It's a mixed bag.)

Deleting the reference to "Ctrl + C", to make the guidance clearer.

* db/schema.rb: Commit with underscores in date

The date gets underscores added automatically
when running migrations on the database.

Committing with the underscores so the change isn't flagged by git
when no code has been changed.

* restrooms_spec.rb: Fix a test (#608)

Background:

The Mission Creek Cafe in San Francisco has been closed for some time.

Google Maps API now resolves "Mission Creek Cafe"
to a coffee shop in Washington state.

Washington is too far away from our stub restroom entries;
No stub restrooms are located near Washington,
so no restroom results are shown on our results page for this search.

The test expects to see a stub restroom entry on the reults page,
but does not see it, and so the test fails.

---

Fix:

search the Maps API for "San Francisco," not "Mission Creek Cafe"

(This returns a lat/long associated with San Francisco not Washington)

* Update some dependencies, fix some deprecation warnings (#609)

* Gemfile[.lock]: Update simplecov

Fixes a deprecation warning

* restrooms_spec.rb: Use 'successful' not 'success'

Rspec's `be_success` and `.success?` are deprecated.

Rspec's `be_successful` and `.successful?`
are the non-deprecated versions of this check.

(This fixes the associated deprecation warning)

* Gemfile.lock: Bump some dependencies

Upgraded loofah, puma, rack, and rack-cors,
plus their dependencies.

* Tweak CSS a bit for narrow screens (e.g. mobile phones) (#610)

* CSS: Add some styles for narrow screens

For screen widths ~340px or narrower.

(Such a narrow screen is found, for example, on the original iPhone
through to the iPhone 5S and iPhone SE.)

- Makes the "+" icon on the "Add A Restroom" button
  appear in a more correct-looking position.

- Fixes the overlap of the "Refuge Restrooms" text
  with the "hamburger" drop-down menu button in the header/nav section.

- Adds a class via the haml source (.nav-column)
  to make applying one of the style rules easier.

* CSS: No double-padding on nested `.container`s

Eliminate double-padding in cases of
an [element].container immediately inside another [element].container.

(Doing this only directly under the header div, just to be conservative.)

The 15px + 15px = 30px of padding on both sides
seemed unintentionally wide. Also, I think this looks nicer.
Helps with the tight fit on mobile devices, too.

(Should affect the header/nav on all pages other than the home page,
aka the splash page, due to the way the pages are coded.)

* CSS: Center logo and brand name on narrow screens (#611)

* _mobile.scss: Lower logo/brand on narrow screens

Adjust the CSS "top" property to set the logo and "brand name"
("Refuge Restrooms") slightly lower within the navbar on narrow
screens.

This is to adjust for the navbar being responsively taller
on narrower screens. "767px screen width" happens to be the responsive
threshold for that height change for the navbar.

* _mobile.scss: Move 342px rules, adjust whitespace

Moved the "max 342px" rules to the bottom, so all screen-width-related
style rules are in descending order of the sizes that they apply to.
(For consistency).

Adjusted the use of newlines in this stylesheet to be more consitent.

* Update docker config (#616)

* Dockerfile: Use better PhantomJS URL

GitHub's CDN is more reliable than BitBucket's.

(This is the URL we originally used as of PR #435,
which was the initial implementation of our Docker setup.)

* docker-compose.yml: Add password for PostgreSQL db

This is in response to a recent change in the PostgreSQL Docker image.

Either the database must be configured to not check passwords, i.e.
`POSTGRESQL_HOST_AUTH_METHOD=trust`, or a password must now be set.

For explanation and context, see:

- docker-library/postgres#658
- docker-library/postgres#681
- docker-library/postgres#580
- https://discuss.circleci.com/t/postgresql-image-password-not-specified-issue/34555

* Ruby: Update from 2.5.7 to 2.5.8 (#618)

* Update Node.JS and Ruby Dependencies (#617)

* Gemfile[.lock]: Update rails to 5.2.4.2

Also update its dependencies, as required.

* Gemfile[.lock]: Update grape and grape-swagger

Also update their dependencies, as needed.

* Gemfile[.lock]: Update activeadmin

* Gemfile: Pin sprockets to "< 4"

The 4.x major version upgrade requires some configuration changes.

Pinning keeps the app from breaking when doing `bundle update`.

* Gemfile.lock: Update all packages

* yarn.lock: Update all packages

* Implement Google's reCAPTCHA (#566)

* Add server reCAPTCHA verification for contacts

Added a temporary secret key for testing in .env, which is loaded by
the dotenv gem. In production, just put another key in the Heroku
env variable settings.

* Add reCAPTCHA to contacts submission page

* Enable browser form validation by default

This gets form input validated on the client side, which gives faster
feedback to the user, without the need for a custom solution. This
feature is supported in all modern browsers.

* Add reCAPTCHA to restrooms page

* Make stub for reCAPTCHA verification during tests

Co-authored-by: Mikena Wood <mi-wood@users.noreply.github.com>

Co-authored-by: DeeDeeG <DeeDeeG@users.noreply.github.com>
Co-authored-by: Kai Middleton <kai.middleton@hingehealth.com>
Co-authored-by: hkly <hannah.k.yiu@gmail.com>
Co-authored-by: Teagan <tkwidmer@gmail.com>
Co-authored-by: Joe Wadcan <joe.wadcan@github.com>
Co-authored-by: vinzruzell <35182720+vinzruzell@users.noreply.github.com>
Co-authored-by: hnarasaki <hnarasaki@indeed.com>
Co-authored-by: Bryan Mark Fajutag <fbryanmark@gmail.com>
Co-authored-by: Emily Ring <emily_ring@ymail.com>
Co-authored-by: Jason Chen <kbtpodifo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade Webpack/Webpacker from 3.x to 4.x
2 participants