forked from RefugeRestrooms/refugerestrooms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use webpacker for bundling and transpiling javascript (RefugeRestroom…
…s#484) Co-authored-by: Jason Chen <[email protected]> * Add webpacker * Add all configurations for webpacker Webpacker is the ruby gem that wraps webpack, a javascript utility for transforming and bundling. Add: - Yarn, which webpacker uses to manage javascript dependencies. - .babelrc, configuration file for Babel, the standard javascript transpiler. We're using it to transpile es6 javascript so that it's compatible with more browsers. - Config files for webpacker. - Config files to allow webpacker to process .erb files. * Install what webpacker needs inside Docker - Get the latest node.js from NodeSource, officially recommended linux binaries. link: https://github.com/nodesource/distributions - Install yarn, javascript package manager required by webpacker. - Create separate volume for /refugerestrooms/node_modules in Docker to prevent mounting /refugerestrooms from overriding what was installed by yarn. * Convert all coffeescript files to es6 javascript All changes cherry-picked and squashed from decaffeinate branch * Add javascript dependencies with yarn Remove jquery-rails gem because it's now managed with yarn * Replace old javascript tag with webpacker's * Bundle and transpile all javascript with webpacker Now we can write es6 code in any .js file! All the coffeescript has been converted into js. Changes: - Use es6 modules instead of globals. This is better encapsulation. This results in the removal of `window.Refuge`. Instead, to use a module, like Geocoder, just import it like this: `import { Geocoder } from 'path/to/geocoder';` * commit yarn * add engine * review apps * Update Yarn Lock * Update App.json * remove trailing comma * remove duplicate entry
- Loading branch information
1 parent
6a878e7
commit 0cbfd42
Showing
37 changed files
with
6,715 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"modules": false, | ||
"targets": { | ||
"browsers": "> 1%", | ||
"uglify": true | ||
}, | ||
"useBuiltIns": true | ||
}] | ||
], | ||
|
||
"plugins": [ | ||
"syntax-dynamic-import", | ||
"transform-object-rest-spread", | ||
["transform-class-properties", { "spec": true }] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
FROM ruby:2.3.7 | ||
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | ||
ENV PHANTOM_JS=2.1.1 | ||
RUN apt-get update && \ | ||
apt-get install build-essential chrpath libssl-dev libxft-dev -y && \ | ||
|
||
# Add the apt repository for yarn | ||
RUN curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | ||
|
||
# Add the apt-repository for the latest node.js | ||
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - | ||
|
||
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | ||
RUN apt-get install build-essential chrpath libssl-dev libxft-dev -y && \ | ||
apt-get install libfreetype6 libfreetype6-dev -y && \ | ||
apt-get install libfontconfig1 libfontconfig1-dev -y && \ | ||
cd ~ && \ | ||
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64" && \ | ||
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2 && \ | ||
tar xvjf $PHANTOM_JS.tar.bz2 && \ | ||
mv $PHANTOM_JS /usr/local/share && \ | ||
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin | ||
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin && \ | ||
apt-get install -y yarn | ||
RUN mkdir /refugerestrooms | ||
WORKDIR /refugerestrooms | ||
|
||
COPY Gemfile /refugerestrooms/Gemfile | ||
COPY Gemfile.lock /refugerestrooms/Gemfile.lock | ||
RUN bundle install | ||
COPY . /refugerestrooms | ||
|
||
COPY package.json yarn.lock /refugerestrooms/ | ||
RUN yarn --pure-lockfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//= require active_admin/base |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
app/assets/javascripts/views/restrooms/restrooms.js.coffee
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.