├── .babelrc
├── .env.docker
├── .gitignore
├── .node-version
├── .postcssrc.yml
├── .rspec
├── .tmp
└── mocha-webpack
│ ├── 41b95b2827c5c444d6082d96fc35bf1d-entry.js
│ └── 41b95b2827c5c444d6082d96fc35bf1d
│ ├── 41b95b2827c5c444d6082d96fc35bf1d-output.js
│ └── manifest.json
├── Dockerfile
├── Gemfile
├── Gemfile.lock
├── Procfile
├── Procfile.dev
├── README.md
├── Rakefile
├── app
├── assets
│ ├── config
│ │ └── manifest.js
│ ├── images
│ │ └── .keep
│ ├── javascript
│ │ ├── Main.elm
│ │ ├── app.vue
│ │ ├── counter.jsx
│ │ ├── counter
│ │ │ ├── components
│ │ │ │ └── counter.js
│ │ │ ├── fonts
│ │ │ │ ├── lacuna-webfont.eot
│ │ │ │ ├── lacuna-webfont.svg
│ │ │ │ ├── lacuna-webfont.ttf
│ │ │ │ └── lacuna-webfont.woff
│ │ │ ├── images
│ │ │ │ └── clock.png
│ │ │ ├── index.js
│ │ │ └── styles
│ │ │ │ ├── container.css
│ │ │ │ └── style.sass
│ │ ├── entries
│ │ │ ├── application.js
│ │ │ ├── hello.coffee
│ │ │ ├── hello_angular.js
│ │ │ ├── hello_elm.js
│ │ │ ├── hello_react.jsx
│ │ │ ├── hello_vue.js
│ │ │ ├── hello_world.js
│ │ │ ├── hola.js
│ │ │ ├── math.js
│ │ │ └── puchi.js
│ │ ├── hello.sass
│ │ ├── hello_angular
│ │ │ ├── app
│ │ │ │ ├── app.component.ts
│ │ │ │ └── app.module.ts
│ │ │ ├── index.ts
│ │ │ └── polyfills.ts
│ │ ├── hello_elm
│ │ │ └── index.elm
│ │ ├── hello_example.jsx
│ │ ├── hello_react
│ │ │ ├── forward-partners.svg
│ │ │ ├── index.jsx
│ │ │ ├── react.png
│ │ │ └── style.sass
│ │ ├── hello_vue
│ │ │ ├── index.vue
│ │ │ ├── style.scss
│ │ │ └── vue.png
│ │ ├── images
│ │ │ ├── react.png
│ │ │ └── vue.png
│ │ ├── math.js
│ │ └── packs
│ │ │ └── application.js
│ ├── javascripts
│ │ ├── application.js
│ │ ├── cable.js
│ │ └── channels
│ │ │ └── .keep
│ └── stylesheets
│ │ └── application.css
├── channels
│ └── application_cable
│ │ ├── channel.rb
│ │ └── connection.rb
├── controllers
│ ├── application_controller.rb
│ ├── concerns
│ │ └── .keep
│ └── pages_controller.rb
├── helpers
│ └── application_helper.rb
├── jobs
│ └── application_job.rb
├── lib
│ └── server_render.rb
├── mailers
│ └── application_mailer.rb
├── models
│ ├── application_record.rb
│ └── concerns
│ │ └── .keep
└── views
│ ├── layouts
│ ├── application.html.erb
│ ├── mailer.html.erb
│ └── mailer.text.erb
│ └── pages
│ └── index.html.erb
├── benchmark.md
├── bin
├── bundle
├── byebug
├── foreman
├── listen
├── nokogiri
├── puma
├── pumactl
├── rackup
├── rails
├── rake
├── sass
├── sass-convert
├── scss
├── server
├── setup
├── spring
├── sprockets
├── thor
├── update
├── webpack
├── webpack-dev-server
└── yarn
├── config.ru
├── config
├── application.rb
├── boot.rb
├── cable.yml
├── database.yml
├── environment.rb
├── environments
│ ├── development.rb
│ ├── production.rb
│ └── test.rb
├── initializers
│ ├── application_controller_renderer.rb
│ ├── assets.rb
│ ├── backtrace_silencers.rb
│ ├── cookies_serializer.rb
│ ├── filter_parameter_logging.rb
│ ├── hypernova.rb
│ ├── inflections.rb
│ ├── mime_types.rb
│ ├── new_framework_defaults.rb
│ └── wrap_parameters.rb
├── locales
│ └── en.yml
├── puma.rb
├── routes.rb
├── secrets.yml
├── spring.rb
├── webpack
│ ├── custom.js
│ ├── development.js
│ ├── dll.js
│ ├── environment.js
│ ├── production.js
│ ├── server.js
│ └── test.js
└── webpacker.yml
├── db
├── schema.rb
└── seeds.rb
├── docker-compose.yml
├── elm-package.json
├── hypernova.js
├── lib
├── assets
│ └── .keep
└── tasks
│ └── .keep
├── localhost.crt
├── localhost.key
├── log
└── .keep
├── package.json
├── public
├── 404.html
├── 422.html
├── 500.html
├── apple-touch-icon-precomposed.png
├── apple-touch-icon.png
├── favicon.ico
└── robots.txt
├── test
├── application_system_test_case.rb
├── controllers
│ └── .keep
├── fixtures
│ ├── .keep
│ └── files
│ │ └── .keep
├── helpers
│ └── .keep
├── integration
│ └── home_test.rb
├── mailers
│ └── .keep
├── models
│ └── .keep
├── system
│ ├── .keep
│ └── homes_test.rb
└── test_helper.rb
├── tsconfig.json
├── yarn-error.log
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "env",
5 | {
6 | "modules": false,
7 | "targets": {
8 | "browsers": "> 1%",
9 | "uglify": true
10 | },
11 | "useBuiltIns": true
12 | }
13 | ],
14 | "react"
15 | ],
16 | "plugins": [
17 | "syntax-dynamic-import",
18 | "transform-object-rest-spread",
19 | [
20 | "transform-class-properties",
21 | {
22 | "spec": true
23 | }
24 | ]
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/.env.docker:
--------------------------------------------------------------------------------
1 | NODE_ENV=development
2 | RAILS_ENV=development
3 | WEBPACKER_DEV_SERVER_HOST: 0.0.0.0
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*
16 | /tmp/*
17 | !/log/.keep
18 | !/tmp/.keep
19 |
20 | /vendor/elm-stuff
21 | /node_modules
22 | /vendor/yarn-error.log
23 |
24 | .byebug_history
25 | /public/packs
26 | /node_modules/*
27 | /public/bundles
28 | /elm-stuff
29 | /node_modules
30 | /public/packs
31 | /public/entries
32 | /elm-stuff
33 | /node_modules
34 | /public/packs
35 | /elm-stuff
36 | /node_modules
37 | /public/packs
38 | /node_modules
39 | /public/packs
40 | /public/packs-test
41 | /node_modules
42 |
--------------------------------------------------------------------------------
/.node-version:
--------------------------------------------------------------------------------
1 | 9.2.0
2 |
--------------------------------------------------------------------------------
/.postcssrc.yml:
--------------------------------------------------------------------------------
1 | plugins:
2 | postcss-smart-import: {}
3 | postcss-cssnext: {}
4 |
--------------------------------------------------------------------------------
/.rspec:
--------------------------------------------------------------------------------
1 | --require spec_helper
2 |
--------------------------------------------------------------------------------
/.tmp/mocha-webpack/41b95b2827c5c444d6082d96fc35bf1d-entry.js:
--------------------------------------------------------------------------------
1 |
2 | var testsContext = require.context("../../spec/javascripts/components", false);
3 |
4 | var runnable = testsContext.keys();
5 |
6 | runnable.forEach(testsContext);
7 |
--------------------------------------------------------------------------------
/.tmp/mocha-webpack/41b95b2827c5c444d6082d96fc35bf1d/41b95b2827c5c444d6082d96fc35bf1d-output.js:
--------------------------------------------------------------------------------
1 | /******/ (function(modules) { // webpackBootstrap
2 | /******/ // The module cache
3 | /******/ var installedModules = {};
4 | /******/
5 | /******/ // The require function
6 | /******/ function __webpack_require__(moduleId) {
7 | /******/
8 | /******/ // Check if module is in cache
9 | /******/ if(installedModules[moduleId]) {
10 | /******/ return installedModules[moduleId].exports;
11 | /******/ }
12 | /******/ // Create a new module (and put it into the cache)
13 | /******/ var module = installedModules[moduleId] = {
14 | /******/ i: moduleId,
15 | /******/ l: false,
16 | /******/ exports: {}
17 | /******/ };
18 | /******/
19 | /******/ // Execute the module function
20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21 | /******/
22 | /******/ // Flag the module as loaded
23 | /******/ module.l = true;
24 | /******/
25 | /******/ // Return the exports of the module
26 | /******/ return module.exports;
27 | /******/ }
28 | /******/
29 | /******/
30 | /******/ // expose the modules object (__webpack_modules__)
31 | /******/ __webpack_require__.m = modules;
32 | /******/
33 | /******/ // expose the module cache
34 | /******/ __webpack_require__.c = installedModules;
35 | /******/
36 | /******/ // identity function for calling harmony imports with the correct context
37 | /******/ __webpack_require__.i = function(value) { return value; };
38 | /******/
39 | /******/ // define getter function for harmony exports
40 | /******/ __webpack_require__.d = function(exports, name, getter) {
41 | /******/ if(!__webpack_require__.o(exports, name)) {
42 | /******/ Object.defineProperty(exports, name, {
43 | /******/ configurable: false,
44 | /******/ enumerable: true,
45 | /******/ get: getter
46 | /******/ });
47 | /******/ }
48 | /******/ };
49 | /******/
50 | /******/ // getDefaultExport function for compatibility with non-harmony modules
51 | /******/ __webpack_require__.n = function(module) {
52 | /******/ var getter = module && module.__esModule ?
53 | /******/ function getDefault() { return module['default']; } :
54 | /******/ function getModuleExports() { return module; };
55 | /******/ __webpack_require__.d(getter, 'a', getter);
56 | /******/ return getter;
57 | /******/ };
58 | /******/
59 | /******/ // Object.prototype.hasOwnProperty.call
60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
61 | /******/
62 | /******/ // __webpack_public_path__
63 | /******/ __webpack_require__.p = "/packs-test/";
64 | /******/
65 | /******/ // Load entry module and return exports
66 | /******/ return __webpack_require__(__webpack_require__.s = 0);
67 | /******/ })
68 | /************************************************************************/
69 | /******/ ([
70 | /* 0 */
71 | /***/ (function(module, exports, __webpack_require__) {
72 |
73 |
74 | var testsContext = !(function webpackMissingModule() { var e = new Error("Cannot find module \"../../spec/javascripts/components\""); e.code = 'MODULE_NOT_FOUND'; throw e; }());
75 |
76 | var runnable = testsContext.keys();
77 |
78 | runnable.forEach(testsContext);
79 |
80 | /***/ })
81 | /******/ ]);
--------------------------------------------------------------------------------
/.tmp/mocha-webpack/41b95b2827c5c444d6082d96fc35bf1d/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "main.js": "/packs-test/41b95b2827c5c444d6082d96fc35bf1d-output.js"
3 | }
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ruby:2.4.1
2 | RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
3 | RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
4 | RUN apt-get install -y nodejs
5 | RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
6 | RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
7 | RUN apt-get update && apt-get install yarn
8 | RUN mkdir /webpacker-example-app
9 | WORKDIR /webpacker-example-app
10 | ADD Gemfile /webpacker-example-app/Gemfile
11 | ADD package.json /webpacker-example-app/package.json
12 | ADD yarn.lock /webpacker-example-app/yarn.lock
13 | ADD Gemfile.lock /webpacker-example-app/Gemfile.lock
14 | RUN bundle install
15 | RUN yarn install
16 | ADD . /webpacker-example-app
17 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | ruby '2.4.1'
2 | source 'https://rubygems.org'
3 |
4 | git_source(:github) do |repo_name|
5 | repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
6 | "https://github.com/#{repo_name}.git"
7 | end
8 |
9 | gem 'rails', '~> 5.1.0'
10 | gem 'pg'
11 |
12 | gem 'coffee-rails'
13 | gem 'puma', '~> 3.0'
14 | gem 'sass-rails', github: 'rails/sass-rails'
15 | gem 'uglifier', '>= 1.3.0'
16 | gem 'webpacker'
17 | gem 'turbolinks', '~> 5'
18 | gem 'jbuilder'
19 | gem 'mini_racer'
20 | gem 'execjs'
21 | gem 'hypernova'
22 |
23 | group :development, :test do
24 | gem 'byebug', platform: :mri
25 | gem 'capybara'
26 | gem 'selenium-webdriver'
27 | end
28 |
29 | group :production do
30 | gem 'redis'
31 | # gem 'heroku-deflater', github: 'romanbsd/heroku-deflater'
32 | gem 'rack-cors'
33 | end
34 |
35 | group :development do
36 | gem 'foreman'
37 | gem 'web-console', github: 'rails/web-console'
38 | gem 'spring'
39 | gem 'listen', '>= 3.0.5', '< 3.2'
40 | end
41 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GIT
2 | remote: https://github.com/rails/sass-rails.git
3 | revision: dd04a6a6d19cbd7cfd2f9d304a445444e0b88a19
4 | specs:
5 | sass-rails (6.0.0.beta1)
6 | railties (>= 4.0.0, < 6)
7 | sass (~> 3.4)
8 | sprockets (~> 4.x)
9 | sprockets-rails (< 4.0)
10 |
11 | GIT
12 | remote: https://github.com/rails/web-console.git
13 | revision: bc07283e844558ef05c9324b5e4876612d0a000d
14 | specs:
15 | web-console (3.5.1)
16 | actionview (>= 5.0)
17 | activemodel (>= 5.0)
18 | bindex (>= 0.4.0)
19 | railties (>= 5.0)
20 |
21 | GEM
22 | remote: https://rubygems.org/
23 | specs:
24 | actioncable (5.1.4)
25 | actionpack (= 5.1.4)
26 | nio4r (~> 2.0)
27 | websocket-driver (~> 0.6.1)
28 | actionmailer (5.1.4)
29 | actionpack (= 5.1.4)
30 | actionview (= 5.1.4)
31 | activejob (= 5.1.4)
32 | mail (~> 2.5, >= 2.5.4)
33 | rails-dom-testing (~> 2.0)
34 | actionpack (5.1.4)
35 | actionview (= 5.1.4)
36 | activesupport (= 5.1.4)
37 | rack (~> 2.0)
38 | rack-test (>= 0.6.3)
39 | rails-dom-testing (~> 2.0)
40 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
41 | actionview (5.1.4)
42 | activesupport (= 5.1.4)
43 | builder (~> 3.1)
44 | erubi (~> 1.4)
45 | rails-dom-testing (~> 2.0)
46 | rails-html-sanitizer (~> 1.0, >= 1.0.3)
47 | activejob (5.1.4)
48 | activesupport (= 5.1.4)
49 | globalid (>= 0.3.6)
50 | activemodel (5.1.4)
51 | activesupport (= 5.1.4)
52 | activerecord (5.1.4)
53 | activemodel (= 5.1.4)
54 | activesupport (= 5.1.4)
55 | arel (~> 8.0)
56 | activesupport (5.1.4)
57 | concurrent-ruby (~> 1.0, >= 1.0.2)
58 | i18n (~> 0.7)
59 | minitest (~> 5.1)
60 | tzinfo (~> 1.1)
61 | addressable (2.5.2)
62 | public_suffix (>= 2.0.2, < 4.0)
63 | arel (8.0.0)
64 | bindex (0.5.0)
65 | builder (3.2.3)
66 | byebug (9.1.0)
67 | capybara (2.15.1)
68 | addressable
69 | mini_mime (>= 0.1.3)
70 | nokogiri (>= 1.3.3)
71 | rack (>= 1.0.0)
72 | rack-test (>= 0.5.4)
73 | xpath (~> 2.0)
74 | childprocess (0.7.1)
75 | ffi (~> 1.0, >= 1.0.11)
76 | coffee-rails (4.2.2)
77 | coffee-script (>= 2.2.0)
78 | railties (>= 4.0.0)
79 | coffee-script (2.4.1)
80 | coffee-script-source
81 | execjs
82 | coffee-script-source (1.12.2)
83 | concurrent-ruby (1.0.5)
84 | crass (1.0.3)
85 | erubi (1.7.0)
86 | execjs (2.7.0)
87 | faraday (0.13.1)
88 | multipart-post (>= 1.2, < 3)
89 | ffi (1.9.18)
90 | foreman (0.84.0)
91 | thor (~> 0.19.1)
92 | globalid (0.4.0)
93 | activesupport (>= 4.2.0)
94 | hypernova (1.3.0)
95 | faraday (~> 0.8)
96 | i18n (0.9.1)
97 | concurrent-ruby (~> 1.0)
98 | jbuilder (2.7.0)
99 | activesupport (>= 4.2.0)
100 | multi_json (>= 1.2)
101 | libv8 (5.9.211.38.1)
102 | listen (3.1.5)
103 | rb-fsevent (~> 0.9, >= 0.9.4)
104 | rb-inotify (~> 0.9, >= 0.9.7)
105 | ruby_dep (~> 1.2)
106 | loofah (2.1.1)
107 | crass (~> 1.0.2)
108 | nokogiri (>= 1.5.9)
109 | mail (2.6.6)
110 | mime-types (>= 1.16, < 4)
111 | method_source (0.9.0)
112 | mime-types (3.1)
113 | mime-types-data (~> 3.2015)
114 | mime-types-data (3.2016.0521)
115 | mini_mime (0.1.4)
116 | mini_portile2 (2.3.0)
117 | mini_racer (0.1.14)
118 | libv8 (~> 5.9)
119 | minitest (5.10.3)
120 | multi_json (1.12.2)
121 | multipart-post (2.0.0)
122 | nio4r (2.1.0)
123 | nokogiri (1.8.1)
124 | mini_portile2 (~> 2.3.0)
125 | pg (0.21.0)
126 | public_suffix (3.0.0)
127 | puma (3.10.0)
128 | rack (2.0.3)
129 | rack-cors (1.0.1)
130 | rack-proxy (0.6.3)
131 | rack
132 | rack-test (0.8.2)
133 | rack (>= 1.0, < 3)
134 | rails (5.1.4)
135 | actioncable (= 5.1.4)
136 | actionmailer (= 5.1.4)
137 | actionpack (= 5.1.4)
138 | actionview (= 5.1.4)
139 | activejob (= 5.1.4)
140 | activemodel (= 5.1.4)
141 | activerecord (= 5.1.4)
142 | activesupport (= 5.1.4)
143 | bundler (>= 1.3.0)
144 | railties (= 5.1.4)
145 | sprockets-rails (>= 2.0.0)
146 | rails-dom-testing (2.0.3)
147 | activesupport (>= 4.2.0)
148 | nokogiri (>= 1.6)
149 | rails-html-sanitizer (1.0.3)
150 | loofah (~> 2.0)
151 | railties (5.1.4)
152 | actionpack (= 5.1.4)
153 | activesupport (= 5.1.4)
154 | method_source
155 | rake (>= 0.8.7)
156 | thor (>= 0.18.1, < 2.0)
157 | rake (12.3.0)
158 | rb-fsevent (0.10.2)
159 | rb-inotify (0.9.10)
160 | ffi (>= 0.5.0, < 2)
161 | redis (4.0.0)
162 | ruby_dep (1.5.0)
163 | rubyzip (1.2.1)
164 | sass (3.5.1)
165 | sass-listen (~> 4.0.0)
166 | sass-listen (4.0.0)
167 | rb-fsevent (~> 0.9, >= 0.9.4)
168 | rb-inotify (~> 0.9, >= 0.9.7)
169 | selenium-webdriver (3.5.2)
170 | childprocess (~> 0.5)
171 | rubyzip (~> 1.0)
172 | spring (2.0.2)
173 | activesupport (>= 4.2)
174 | sprockets (4.0.0.beta5)
175 | concurrent-ruby (~> 1.0)
176 | rack (> 1, < 3)
177 | sprockets-rails (3.2.1)
178 | actionpack (>= 4.0)
179 | activesupport (>= 4.0)
180 | sprockets (>= 3.0.0)
181 | thor (0.19.4)
182 | thread_safe (0.3.6)
183 | turbolinks (5.0.1)
184 | turbolinks-source (~> 5)
185 | turbolinks-source (5.0.3)
186 | tzinfo (1.2.4)
187 | thread_safe (~> 0.1)
188 | uglifier (3.2.0)
189 | execjs (>= 0.3.0, < 3)
190 | webpacker (3.1.1)
191 | activesupport (>= 4.2)
192 | rack-proxy (>= 0.6.1)
193 | railties (>= 4.2)
194 | websocket-driver (0.6.5)
195 | websocket-extensions (>= 0.1.0)
196 | websocket-extensions (0.1.2)
197 | xpath (2.1.0)
198 | nokogiri (~> 1.3)
199 |
200 | PLATFORMS
201 | ruby
202 |
203 | DEPENDENCIES
204 | byebug
205 | capybara
206 | coffee-rails
207 | execjs
208 | foreman
209 | hypernova
210 | jbuilder
211 | listen (>= 3.0.5, < 3.2)
212 | mini_racer
213 | pg
214 | puma (~> 3.0)
215 | rack-cors
216 | rails (~> 5.1.0)
217 | redis
218 | sass-rails!
219 | selenium-webdriver
220 | spring
221 | turbolinks (~> 5)
222 | uglifier (>= 1.3.0)
223 | web-console!
224 | webpacker
225 |
226 | RUBY VERSION
227 | ruby 2.4.1p111
228 |
229 | BUNDLED WITH
230 | 1.15.4
231 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: bundle exec puma -p $PORT
2 |
--------------------------------------------------------------------------------
/Procfile.dev:
--------------------------------------------------------------------------------
1 | #web: bundle exec rails s -b 'ssl://127.0.0.1:5000?key=/Users/gaurav/webpacker-example-app/localhost.key&cert=/Users/gaurav/webpacker-example-app/localhost.crt'
2 | web: bundle exec rails s
3 | # watcher: ./bin/webpack --watch --colors --progress
4 | webpacker: ./bin/webpack-dev-server
5 | # express: node ./config/webpack/server.js
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Rails Webpacker Example App
2 |
3 | Demo app that showcases Rails on webpack and yarn using Webpacker gem (default setup in upcoming Rails 5.1)
4 |
5 | * [Webpacker](https://github.com/rails/webpacker)
6 | * [PR](https://github.com/rails/rails/pull/26836)
7 | * [Blog Post](https://medium.com/@gauravtiwari/introducing-webpacker-7136d66cddfb)
8 |
9 | # Alpha Features
10 |
11 | Supports bundling
12 | * Javascript
13 | * Stylesheets
14 | * Images
15 | * Fonts
16 | * Linking assets
17 | * CND - Cloudfront
18 |
19 |
20 | # Running in development
21 |
22 | The app is using [foreman](https://github.com/ddollar/foreman), famous process manager. Checkout the `Procfile.dev` in app root for more information.
23 |
24 | ```bash
25 | git clone git@github.com:gauravtiwari/webpacker-example-app.git
26 | cd webpacker-example-app
27 | bundle install
28 | brew install yarn # (if not installed)
29 | ./bin/yarn install
30 | ```
31 |
32 | Then, run the server using this binstub,
33 |
34 | ```bash
35 | ./bin/server
36 | ```
37 | (try `chmod 777 ./bin/server` incase it doesn't work)
38 |
39 | Visit [http://localhost:5000/](http://localhost:5000/)
40 |
41 |
42 | # Installing and using new node modules
43 |
44 | ```bash
45 | # Using Yarn
46 | ./bin/yarn add material-ui
47 | ```
48 |
49 | Then, import it in your component,
50 |
51 | ```js
52 | import { Card } from 'material-ui/Card';
53 | ```
54 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require_relative 'config/application'
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/app/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../javascripts .js
3 | //= link_directory ../stylesheets .css
4 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/images/.keep
--------------------------------------------------------------------------------
/app/assets/javascript/Main.elm:
--------------------------------------------------------------------------------
1 | module Main exposing (..)
2 |
3 | import Html exposing (Html, h1, text)
4 | import Html.Attributes exposing (style)
5 |
6 | -- MODEL
7 |
8 | type alias Model =
9 | {
10 | }
11 |
12 | -- INIT
13 |
14 | init : (Model, Cmd Message)
15 | init =
16 | (Model, Cmd.none)
17 |
18 | -- VIEW
19 |
20 | view : Model -> Html Message
21 | view model =
22 | -- The inline style is being used for example purposes in order to keep this example simple and
23 | -- avoid loading additional resources. Use a proper stylesheet when building your own app.
24 | h1 [style [("display", "flex"), ("justify-content", "center")]]
25 | [text "Hello Elm!"]
26 |
27 | -- MESSAGE
28 |
29 | type Message
30 | = None
31 |
32 | -- UPDATE
33 |
34 | update : Message -> Model -> (Model, Cmd Message)
35 | update message model =
36 | (model, Cmd.none)
37 |
38 | -- SUBSCRIPTIONS
39 |
40 | subscriptions : Model -> Sub Message
41 | subscriptions model =
42 | Sub.none
43 |
44 | -- MAIN
45 |
46 | main : Program Never Model Message
47 | main =
48 | Html.program
49 | {
50 | init = init,
51 | view = view,
52 | update = update,
53 | subscriptions = subscriptions
54 | }
55 |
--------------------------------------------------------------------------------
/app/assets/javascript/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
16 |
17 |
23 |
--------------------------------------------------------------------------------
/app/assets/javascript/counter.jsx:
--------------------------------------------------------------------------------
1 | // Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
2 | // like app/views/layouts/application.html.erb. All it does is render
Hello React
at the bottom
3 | // of the page.
4 |
5 | import React, { Component } from 'react'
6 |
7 | class Counter extends Component {
8 | state = {
9 | counter: 0
10 | }
11 |
12 | addCounter = () =>
13 | this.setState({ counter: this.state.counter + 1 })
14 |
15 | render () {
16 | return (
17 |
18 | {this.state.counter}
19 | Add
20 |
21 | )
22 | }
23 | }
24 |
25 | export default Counter
26 |
--------------------------------------------------------------------------------
/app/assets/javascript/counter/components/counter.js:
--------------------------------------------------------------------------------
1 | // A simple counter example
2 |
3 | const incrementNode = document.getElementById('increment');
4 | const decrementNode = document.getElementById('decrement');
5 | const inputNode = document.getElementById('counter');
6 |
7 | const counter = {
8 | initialize() {
9 | incrementNode.addEventListener('click', (event) => {
10 | event.preventDefault();
11 | const currentValue = inputNode.value;
12 | inputNode.value = parseInt(currentValue, 0) + 1;
13 | });
14 |
15 | decrementNode.addEventListener('click', (event) => {
16 | event.preventDefault();
17 | const currentValue = inputNode.value;
18 | if (currentValue > 0) {
19 | inputNode.value = parseInt(currentValue, 0) - 1;
20 | }
21 | });
22 | }
23 | };
24 |
25 | export default counter;
26 |
--------------------------------------------------------------------------------
/app/assets/javascript/counter/fonts/lacuna-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/counter/fonts/lacuna-webfont.eot
--------------------------------------------------------------------------------
/app/assets/javascript/counter/fonts/lacuna-webfont.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 |
953 |
954 |
955 |
956 |
957 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
981 |
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 |
996 |
997 |
998 |
999 |
1000 |
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
1012 |
1013 |
1014 |
1015 |
1016 |
1017 |
1018 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 |
1030 |
1031 |
1032 |
1033 |
1034 |
1035 |
1036 |
1037 |
1038 |
1039 |
1040 |
1041 |
1042 |
1043 |
1044 |
1045 |
1046 |
1047 |
1048 |
1049 |
1050 |
1051 |
1052 |
1053 |
1054 |
1055 |
1056 |
1057 |
1058 |
1059 |
1060 |
1061 |
1062 |
1063 |
1064 |
1065 |
1066 |
1067 |
1068 |
1069 |
1070 |
1071 |
1072 |
1073 |
1074 |
1075 |
1076 |
1077 |
1078 |
1079 |
1080 |
1081 |
1082 |
1083 |
1084 |
1085 |
1086 |
1087 |
1088 |
1089 |
1090 |
1091 |
1092 |
1093 |
1094 |
1095 |
1096 |
1097 |
1098 |
1099 |
1100 |
1101 |
1102 |
1103 |
1104 |
1105 |
1106 |
1107 |
1108 |
1109 |
1110 |
1111 |
1112 |
1113 |
1114 |
1115 |
1116 |
1117 |
1118 |
1119 |
1120 |
1121 |
1122 |
1123 |
1124 |
1125 |
1126 |
1127 |
1128 |
1129 |
1130 |
1131 |
1132 |
1133 |
1134 |
1135 |
1136 |
1137 |
1138 |
1139 |
1140 |
1141 |
1142 |
1143 |
1144 |
1145 |
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 |
1153 |
1154 |
1155 |
1156 |
1157 |
1158 |
1159 |
1160 |
1161 |
1162 |
1163 |
1164 |
1165 |
1166 |
1167 |
1168 |
1169 |
1170 |
1171 |
1172 |
1173 |
1174 |
1175 |
1176 |
1177 |
1178 |
1179 |
1180 |
1181 |
1182 |
1183 |
1184 |
1185 |
1186 |
1187 |
1188 |
1189 |
1190 |
1191 |
1192 |
1193 |
1194 |
1195 |
1196 |
1197 |
1198 |
1199 |
1200 |
1201 |
1202 |
1203 |
1204 |
1205 |
1206 |
1207 |
1208 |
1209 |
1210 |
1211 |
1212 |
1213 |
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 |
1221 |
1222 |
1223 |
1224 |
1225 |
1226 |
1227 |
1228 |
1229 |
1230 |
1231 |
1232 |
1233 |
1234 |
1235 |
1236 |
1237 |
1238 |
1239 |
1240 |
1241 |
1242 |
1243 |
1244 |
1245 |
1246 |
1247 |
1248 |
1249 |
1250 |
1251 |
1252 |
1253 |
1254 |
1255 |
1256 |
1257 |
1258 |
1259 |
1260 |
1261 |
1262 |
1263 |
1264 |
1265 |
1266 |
1267 |
1268 |
1269 |
1270 |
1271 |
1272 |
1273 |
1274 |
1275 |
1276 |
1277 |
1278 |
1279 |
1280 |
1281 |
1282 |
1283 |
1284 |
1285 |
1286 |
1287 |
1288 |
1289 |
1290 |
1291 |
1292 |
1293 |
1294 |
1295 |
1296 |
1297 |
1298 |
1299 |
1300 |
1301 |
1302 |
1303 |
1304 |
1305 |
1306 |
1307 |
1308 |
1309 |
1310 |
1311 |
1312 |
1313 |
1314 |
1315 |
1316 |
1317 |
1318 |
1319 |
1320 |
1321 |
1322 |
1323 |
1324 |
1325 |
1326 |
1327 |
1328 |
1329 |
1330 |
1331 |
1332 |
1333 |
1334 |
1335 |
1336 |
1337 |
1338 |
1339 |
1340 |
1341 |
1342 |
1343 |
1344 |
1345 |
1346 |
1347 |
1348 |
1349 |
1350 |
1351 |
1352 |
1353 |
1354 |
1355 |
1356 |
1357 |
1358 |
1359 |
1360 |
1361 |
1362 |
1363 |
1364 |
1365 |
1366 |
1367 |
1368 |
1369 |
1370 |
1371 |
1372 |
1373 |
1374 |
1375 |
1376 |
1377 |
1378 |
1379 |
1380 |
1381 |
1382 |
1383 |
1384 |
1385 |
1386 |
1387 |
1388 |
1389 |
1390 |
1391 |
1392 |
1393 |
1394 |
1395 |
1396 |
1397 |
1398 |
1399 |
1400 |
1401 |
1402 |
1403 |
1404 |
1405 |
1406 |
1407 |
1408 |
1409 |
1410 |
1411 |
1412 |
1413 |
1414 |
1415 |
1416 |
1417 |
1418 |
1419 |
1420 |
1421 |
1422 |
1423 |
1424 |
1425 |
1426 |
1427 |
1428 |
1429 |
1430 |
1431 |
1432 |
1433 |
1434 |
1435 |
1436 |
1437 |
1438 |
1439 |
1440 |
1441 |
1442 |
1443 |
1444 |
1445 |
1446 |
1447 |
1448 |
1449 |
1450 |
1451 |
1452 |
1453 |
1454 |
1455 |
1456 |
1457 |
1458 |
1459 |
1460 |
1461 |
1462 |
1463 |
1464 |
1465 |
1466 |
1467 |
1468 |
1469 |
1470 |
1471 |
1472 |
1473 |
1474 |
1475 |
1476 |
1477 |
1478 |
1479 |
1480 |
1481 |
1482 |
1483 |
1484 |
1485 |
1486 |
1487 |
1488 |
1489 |
1490 |
1491 |
1492 |
1493 |
1494 |
1495 |
1496 |
1497 |
1498 |
1499 |
1500 |
1501 |
1502 |
1503 |
1504 |
1505 |
1506 |
1507 |
1508 |
1509 |
1510 |
1511 |
1512 |
1513 |
1514 |
1515 |
1516 |
1517 |
1518 |
1519 |
1520 |
1521 |
1522 |
1523 |
1524 |
1525 |
1526 |
1527 |
1528 |
1529 |
1530 |
1531 |
1532 |
1533 |
1534 |
1535 |
1536 |
1537 |
1538 |
1539 |
1540 |
1541 |
1542 |
1543 |
1544 |
1545 |
1546 |
1547 |
1548 |
1549 |
1550 |
1551 |
1552 |
1553 |
1554 |
1555 |
1556 |
1557 |
1558 |
1559 |
1560 |
1561 |
1562 |
1563 |
1564 |
1565 |
1566 |
1567 |
1568 |
1569 |
1570 |
1571 |
1572 |
1573 |
1574 |
1575 |
1576 |
1577 |
1578 |
1579 |
1580 |
1581 |
1582 |
1583 |
1584 |
1585 |
1586 |
1587 |
1588 |
1589 |
1590 |
1591 |
1592 |
1593 |
1594 |
1595 |
1596 |
1597 |
1598 |
1599 |
1600 |
1601 |
1602 |
1603 |
1604 |
1605 |
1606 |
1607 |
1608 |
1609 |
1610 |
1611 |
1612 |
1613 |
1614 |
1615 |
1616 |
1617 |
1618 |
1619 |
1620 |
1621 |
1622 |
1623 |
1624 |
1625 |
1626 |
1627 |
1628 |
1629 |
1630 |
1631 |
1632 |
1633 |
1634 |
1635 |
1636 |
1637 |
1638 |
1639 |
1640 |
1641 |
1642 |
1643 |
1644 |
1645 |
1646 |
1647 |
1648 |
1649 |
1650 |
1651 |
1652 |
1653 |
1654 |
1655 |
1656 |
1657 |
1658 |
1659 |
1660 |
1661 |
1662 |
1663 |
1664 |
1665 |
1666 |
1667 |
1668 |
1669 |
1670 |
1671 |
1672 |
1673 |
1674 |
1675 |
1676 |
1677 |
1678 |
1679 |
1680 |
1681 |
1682 |
1683 |
1684 |
1685 |
1686 |
1687 |
1688 |
1689 |
1690 |
1691 |
1692 |
1693 |
1694 |
1695 |
1696 |
1697 |
1698 |
1699 |
1700 |
1701 |
1702 |
1703 |
1704 |
1705 |
1706 |
1707 |
1708 |
1709 |
1710 |
1711 |
1712 |
1713 |
1714 |
1715 |
1716 |
1717 |
1718 |
1719 |
1720 |
1721 |
1722 |
1723 |
1724 |
1725 |
1726 |
1727 |
1728 |
1729 |
1730 |
1731 |
1732 |
1733 |
1734 |
1735 |
1736 |
1737 |
1738 |
1739 |
--------------------------------------------------------------------------------
/app/assets/javascript/counter/fonts/lacuna-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/counter/fonts/lacuna-webfont.ttf
--------------------------------------------------------------------------------
/app/assets/javascript/counter/fonts/lacuna-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/counter/fonts/lacuna-webfont.woff
--------------------------------------------------------------------------------
/app/assets/javascript/counter/images/clock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/counter/images/clock.png
--------------------------------------------------------------------------------
/app/assets/javascript/counter/index.js:
--------------------------------------------------------------------------------
1 | // Initialize the counter code when DOM is ready
2 | import './styles/style.sass';
3 | import './styles/container.css';
4 | import counter from './components/counter';
5 |
6 | document.addEventListener('DOMContentLoaded', () => {
7 | counter.initialize();
8 | });
9 |
--------------------------------------------------------------------------------
/app/assets/javascript/counter/styles/container.css:
--------------------------------------------------------------------------------
1 | $color: #fafafa;
2 | $margin: 100px;
3 |
4 | .container {
5 | max-width: $margin * 5;
6 | margin: $margin auto;
7 | background: $color;
8 | }
9 |
--------------------------------------------------------------------------------
/app/assets/javascript/counter/styles/style.sass:
--------------------------------------------------------------------------------
1 | $grey: #f2f2f2
2 |
3 | @font-face
4 | font-family: 'Lacuna'
5 | src: url('../fonts/lacuna-webfont.eot')
6 | src: url('../fonts/lacuna-webfont.eot?#iefix') format('embedded-opentype'),
7 | url('../fonts/lacuna-webfont.woff') format('woff'),
8 | url('../fonts/lacuna-webfont.ttf') format('truetype'),
9 | url('../fonts/lacuna-webfont.svg#Darkenstone') format('svg')
10 | font-weight: normal
11 | font-style: normal
12 |
13 |
14 | .counter-wrapper
15 | padding: 10px
16 | border: 1px solid $grey
17 | font-family: 'Lacuna', sans-serif
18 | transition: all 1s
19 |
20 | form
21 |
22 | input
23 | display: block
24 | margin-bottom: 10px
25 |
26 | button
27 | display: inline-block
28 |
29 | .footer-image
30 | margin-top: 20px
31 |
32 | #css-bg-image
33 | width: 48px
34 | height: 48px
35 | background-image: url('../images/clock.png')
36 | background-repeat: no-repeat
37 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/application.js:
--------------------------------------------------------------------------------
1 | /* eslint no-console:0 */
2 | // This file is automatically compiled by Webpack, along with any other files
3 | // present in this directory. You're encouraged to place your actual application logic in
4 | // a relevant structure within app/javascript and only use these pack files to reference
5 | // that code so it'll be compiled.
6 | //
7 | // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8 | // layout file, like app/views/layouts/application.html.erb
9 |
10 | import { render } from 'react-dom'
11 | import React from 'react'
12 | import HelloReact from './hello_react'
13 |
14 |
15 | document.addEventListener('DOMContentLoaded', () => {
16 | render(
17 | ,
18 | document.getElementById('hello_react')
19 | )
20 |
21 |
22 | import(/* webpackChunkName: "counter" */ '../counter').then(({ default: Counter }) => {
23 | render(
24 | ,
25 | document.getElementById('counter')
26 | )
27 | })
28 | })
29 |
30 | console.log('hello there')
31 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/hello.coffee:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | number = 1
4 |
5 | export class Mathematics
6 | least: (x, y) -> if x < y then x else y
7 |
8 | maths = new Mathematics()
9 |
10 | console.log maths.least(4, 6)
11 |
12 | export default number
13 |
14 | console.log number
15 |
16 | renderStarRating = ({ title }) ->
17 |
20 |
21 | console.log(renderStarRating('hello there Gaurav'))
22 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/hello_angular.js:
--------------------------------------------------------------------------------
1 | // Run this Angular example by adding the following HTML markup to your view:
2 | //
3 | // Loading...
4 | //
5 | // <%= javascript_pack_tag 'hello_angular' %>
6 |
7 | require('../hello_angular')
8 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/hello_elm.js:
--------------------------------------------------------------------------------
1 | // Run this example by adding <%= javascript_pack_tag "hello_elm" %> to the
2 | // head of your layout file, like app/views/layouts/application.html.erb.
3 | // It will render "Hello Elm!" within the page.
4 |
5 | import Elm from '../Main'
6 |
7 | document.addEventListener('DOMContentLoaded', () => {
8 | const target = document.createElement('div')
9 |
10 | document.body.appendChild(target)
11 | Elm.Main.embed(target)
12 | })
13 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/hello_react.jsx:
--------------------------------------------------------------------------------
1 | // Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
2 | // like app/views/layouts/application.html.erb. All it does is render Hello React
at the bottom
3 | // of the page.
4 |
5 | import React, { Component } from 'react'
6 | import Hello from '../hello_react'
7 |
8 | export default Hello
9 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/hello_vue.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from '../hello_vue'
3 | import '../hello_vue/style.scss'
4 |
5 | document.addEventListener('DOMContentLoaded', () => {
6 | document.body.appendChild(document.createElement('hello'))
7 | const app = new Vue(App).$mount('hello')
8 | })
9 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/hello_world.js:
--------------------------------------------------------------------------------
1 | console.log('hello world message')
2 | console.log('more hellos')
3 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/hola.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/entries/hola.js
--------------------------------------------------------------------------------
/app/assets/javascript/entries/math.js:
--------------------------------------------------------------------------------
1 | import { square } from '../math'
2 |
3 | console.log(square(2))
4 |
--------------------------------------------------------------------------------
/app/assets/javascript/entries/puchi.js:
--------------------------------------------------------------------------------
1 | console.log('puchi')
2 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello.sass:
--------------------------------------------------------------------------------
1 | .container
2 | .react-app-wrapper
3 | max-width: 200px
4 | margin: 0 auto
5 |
6 | .hello-react
7 | font-size: 20px
8 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_angular/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'hello-angular',
5 | template: `Hello {{name}} `
6 | })
7 | export class AppComponent {
8 | name = 'there!';
9 | }
10 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_angular/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppComponent } from './app.component';
5 |
6 | @NgModule({
7 | declarations: [
8 | AppComponent
9 | ],
10 | imports: [
11 | BrowserModule
12 | ],
13 | providers: [],
14 | bootstrap: [AppComponent]
15 | })
16 | export class AppModule { }
17 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_angular/index.ts:
--------------------------------------------------------------------------------
1 | import './polyfills.ts';
2 |
3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
4 | import { AppModule } from './app/app.module';
5 |
6 | platformBrowserDynamic().bootstrapModule(AppModule);
7 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_angular/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
38 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
39 |
40 | /** Evergreen browsers require these. **/
41 | import 'core-js/es6/reflect';
42 | import 'core-js/es7/reflect';
43 |
44 |
45 | /**
46 | * Required to support Web Animations `@angular/animation`.
47 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
48 | **/
49 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
50 |
51 |
52 |
53 | /***************************************************************************************************
54 | * Zone JS is required by Angular itself.
55 | */
56 | import 'zone.js/dist/zone';
57 | // import 'zone.js/dist/long-stack-trace-zone' // async stack traces with zone.js
58 |
59 |
60 |
61 | /***************************************************************************************************
62 | * APPLICATION IMPORTS
63 | */
64 |
65 | /**
66 | * Date, currency, decimal and percent pipes.
67 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
68 | */
69 | // import 'intl'; // Run `npm install --save intl`.
70 | /**
71 | * Need to import at least one locale-data with intl.
72 | */
73 | // import 'intl/locale-data/jsonp/en';
74 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_elm/index.elm:
--------------------------------------------------------------------------------
1 | module Main exposing (..)
2 |
3 | import Html exposing (Html, h1, text)
4 | import Html.Attributes exposing (style)
5 |
6 | -- MODEL
7 |
8 | type alias Model =
9 | {
10 | }
11 |
12 | -- INIT
13 |
14 | init : (Model, Cmd Message)
15 | init =
16 | (Model, Cmd.none)
17 |
18 | -- VIEW
19 |
20 | view : Model -> Html Message
21 | view model =
22 | -- The inline style is being used for example purposes in order to keep this example simple and
23 | -- avoid loading additional resources. Use a proper stylesheet when building your own app.
24 | h1 [style [("display", "flex"), ("justify-content", "center")]]
25 | [text "Hello Elm!"]
26 |
27 | -- MESSAGE
28 |
29 | type Message
30 | = None
31 |
32 | -- UPDATE
33 |
34 | update : Message -> Model -> (Model, Cmd Message)
35 | update message model =
36 | (model, Cmd.none)
37 |
38 | -- SUBSCRIPTIONS
39 |
40 | subscriptions : Model -> Sub Message
41 | subscriptions model =
42 | Sub.none
43 |
44 | -- MAIN
45 |
46 | main : Program Never Model Message
47 | main =
48 | Html.program
49 | {
50 | init = init,
51 | view = view,
52 | update = update,
53 | subscriptions = subscriptions
54 | }
55 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_example.jsx:
--------------------------------------------------------------------------------
1 | // Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
2 | // like app/views/layouts/application.html.erb. All it does is render Hello React
at the bottom
3 | // of the page.
4 |
5 | import React from 'react'
6 | import ReactDOM from 'react-dom'
7 | import './hello.sass'
8 |
9 | const Hello = props => (
10 |
11 |
12 | Hello world! {props.name}!
13 |
14 |
15 | )
16 |
17 | Hello.defaultProps = {
18 | name: 'David'
19 | }
20 |
21 | Hello.propTypes = {
22 | name: React.PropTypes.string
23 | }
24 |
25 | export default Hello
26 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_react/forward-partners.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 | Forward Partners Logo
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_react/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react'
2 | import PropTypes from 'prop-types'
3 | import logo from './react.png'
4 | import Image2 from './forward-partners.svg';
5 |
6 | // and use it like any other React Component
7 | import style from './style.sass'
8 | import 'bootstrap/dist/css/bootstrap.css'
9 |
10 | class HelloReact extends Component {
11 | componentDidMount() {
12 | this._node.style.fontSize = '25px'
13 | }
14 |
15 | handleOnClick = () =>
16 | console.log('I Clicked')
17 |
18 | render () {
19 | return (
20 |
21 |
22 |
(this._node = node)}>Hello {this.props.name}!
23 |
24 |
25 | )
26 | }
27 | }
28 |
29 | HelloReact.defaultProps = {
30 | name: 'React'
31 | }
32 |
33 | HelloReact.propTypes = {
34 | name: PropTypes.string
35 | }
36 |
37 | export default HelloReact
38 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_react/react.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/hello_react/react.png
--------------------------------------------------------------------------------
/app/assets/javascript/hello_react/style.sass:
--------------------------------------------------------------------------------
1 | .hello-react
2 | text-align: center
3 | font-size: 2em
4 |
5 | .react-logo
6 | display: block
7 | margin: 0 auto
8 | max-width: 100px
9 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_vue/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{ message }}
5 |
6 |
7 |
8 |
9 |
10 |
19 |
20 |
36 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_vue/style.scss:
--------------------------------------------------------------------------------
1 | .content {
2 | text-align: center;
3 | }
4 |
5 | p {
6 | font-size: 2em;
7 | text-align: center;
8 | }
9 |
10 | .vue-logo {
11 | display: block;
12 | margin: 0 auto;
13 | max-width: 100px;
14 | }
15 |
--------------------------------------------------------------------------------
/app/assets/javascript/hello_vue/vue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/hello_vue/vue.png
--------------------------------------------------------------------------------
/app/assets/javascript/images/react.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/images/react.png
--------------------------------------------------------------------------------
/app/assets/javascript/images/vue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascript/images/vue.png
--------------------------------------------------------------------------------
/app/assets/javascript/math.js:
--------------------------------------------------------------------------------
1 | export function square(x) {
2 | return x * x;
3 | }
4 |
5 | export function cube(x) {
6 | return x * x * x;
7 | }
8 |
--------------------------------------------------------------------------------
/app/assets/javascript/packs/application.js:
--------------------------------------------------------------------------------
1 | /* eslint no-console:0 */
2 | // This file is automatically compiled by Webpack, along with any other files
3 | // present in this directory. You're encouraged to place your actual application logic in
4 | // a relevant structure within app/javascript and only use these pack files to reference
5 | // that code so it'll be compiled.
6 | //
7 | // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8 | // layout file, like app/views/layouts/application.html.erb
9 |
10 | console.log('Hello World from Webpacker')
11 |
--------------------------------------------------------------------------------
/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
5 | // vendor/assets/javascripts directory can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file. JavaScript code in this file should be added after the last require_* statement.
9 | //
10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require rails-ujs
14 |
--------------------------------------------------------------------------------
/app/assets/javascripts/cable.js:
--------------------------------------------------------------------------------
1 | // Action Cable provides the framework to deal with WebSockets in Rails.
2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3 | //
4 | //= require action_cable
5 | //= require_self
6 | //= require_tree ./channels
7 |
8 | (function() {
9 | this.App || (this.App = {});
10 |
11 | App.cable = ActionCable.createConsumer();
12 |
13 | }).call(this);
14 |
--------------------------------------------------------------------------------
/app/assets/javascripts/channels/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/assets/javascripts/channels/.keep
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6 | * vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10 | * files in this directory. Styles in this file should be added after the last require_* statement.
11 | * It is generally better to create a new file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Channel < ActionCable::Channel::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Connection < ActionCable::Connection::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | protect_from_forgery with: :exception
3 | end
4 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/app/controllers/pages_controller.rb:
--------------------------------------------------------------------------------
1 | class PagesController < ApplicationController
2 | around_action :hypernova_render_support
3 |
4 | def index
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | def react_component(name, props = {}, options = {}, &block)
3 | pack = Rails.root.join(File.join(Webpacker.config.public_path, Webpacker.manifest.lookup("#{name}.js"))).read
4 | renderer = ServerRender.new(code: pack)
5 | renderer.render(name.camelize, props)
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | class ApplicationJob < ActiveJob::Base
2 | end
3 |
--------------------------------------------------------------------------------
/app/lib/server_render.rb:
--------------------------------------------------------------------------------
1 | class ServerRender
2 | # @return [ExecJS::Runtime::Context] The JS context for this renderer
3 | attr_reader :context
4 |
5 | def initialize(options={})
6 | js_code = options[:code] || raise("Pass `code:` option to instantiate a JS context!")
7 | @context = ExecJS.compile(GLOBAL_WRAPPER + js_code)
8 | end
9 |
10 | def render(component_name, props)
11 | js_executed_before = before_render(component_name, props)
12 | js_executed_after = after_render(component_name, props)
13 | js_main_section = main_render(component_name, props)
14 | html = render_from_parts(js_executed_before, js_main_section, js_executed_after)
15 | rescue ExecJS::ProgramError => err
16 | Rails.logger.debug err.message
17 | end
18 |
19 | # Hooks for inserting JS before/after rendering
20 | def before_render(component_name, props); ""; end
21 | def after_render(component_name, props); ""; end
22 |
23 | # Handle Node.js & other ExecJS contexts
24 | GLOBAL_WRAPPER = <<-JS
25 | var global = global || this;
26 | var self = self || this;
27 | JS
28 |
29 | private
30 |
31 | def render_from_parts(before, main, after)
32 | js_code = compose_js(before, main, after)
33 | @context.eval(js_code).html_safe
34 | end
35 |
36 | def main_render(component_name, props)
37 | "
38 | ReactDOMServer.renderToString(React.createElement(eval(#{component_name}), #{props}))
39 | "
40 | end
41 |
42 | def compose_js(before, main, after)
43 | <<-JS
44 | (function () {
45 | #{before}
46 | var result = #{main};
47 | #{after}
48 | return result;
49 | })()
50 | JS
51 | end
52 | end
53 |
--------------------------------------------------------------------------------
/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | class ApplicationMailer < ActionMailer::Base
2 | default from: 'from@example.com'
3 | layout 'mailer'
4 | end
5 |
--------------------------------------------------------------------------------
/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | class ApplicationRecord < ActiveRecord::Base
2 | self.abstract_class = true
3 | end
4 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/app/models/concerns/.keep
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Webpacker
5 | <%= csrf_meta_tags %>
6 |
7 |
8 |
9 | <%= yield %>
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.text.erb:
--------------------------------------------------------------------------------
1 | <%= yield %>
2 |
--------------------------------------------------------------------------------
/app/views/pages/index.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 | <%= javascript_pack_tag('application') %>
4 | <%= javascript_pack_tag('hello_vue') %>
5 |
6 | <%= stylesheet_pack_tag('hello_react') %>
7 | <%= javascript_pack_tag('hello_elm') %>
8 | Loading
9 | <%= javascript_pack_tag('hello_angular') %>
10 |
--------------------------------------------------------------------------------
/benchmark.md:
--------------------------------------------------------------------------------
1 | ## ExecJS
2 |
3 | ```
4 | user system total real
5 | 0.010000 0.000000 0.010000 ( 0.014621)
6 | 0.010000 0.000000 0.010000 ( 0.011691)
7 | 0.010000 0.000000 0.010000 ( 0.012252)
8 | 0.020000 0.000000 0.020000 ( 0.018900)
9 | ```
10 |
11 | Browser: 120-130ms
12 |
13 |
14 | ## Hypernova
15 |
16 | ```
17 | user system total real
18 | 0.000000 0.000000 0.000000 ( 0.000698)
19 | 0.000000 0.000000 0.000000 ( 0.001027)
20 | 0.000000 0.000000 0.000000 ( 0.000531)
21 | 0.000000 0.000000 0.000000 ( 0.000527)
22 | ```
23 |
24 | Browser: 40-50ms
25 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/byebug:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'byebug' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("byebug", "byebug")
18 |
--------------------------------------------------------------------------------
/bin/foreman:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'foreman' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("foreman", "foreman")
18 |
--------------------------------------------------------------------------------
/bin/listen:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'listen' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("listen", "listen")
18 |
--------------------------------------------------------------------------------
/bin/nokogiri:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'nokogiri' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("nokogiri", "nokogiri")
18 |
--------------------------------------------------------------------------------
/bin/puma:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'puma' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("puma", "puma")
18 |
--------------------------------------------------------------------------------
/bin/pumactl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'pumactl' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("puma", "pumactl")
18 |
--------------------------------------------------------------------------------
/bin/rackup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'rackup' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("rack", "rackup")
18 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../config/application', __dir__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/bin/sass:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'sass' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sass", "sass")
18 |
--------------------------------------------------------------------------------
/bin/sass-convert:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'sass-convert' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sass", "sass-convert")
18 |
--------------------------------------------------------------------------------
/bin/scss:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'scss' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sass", "scss")
18 |
--------------------------------------------------------------------------------
/bin/server:
--------------------------------------------------------------------------------
1 | #!/bin/bash -i
2 | bundle install
3 | bundle exec foreman start -f Procfile.dev
4 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 | require 'fileutils'
4 | include FileUtils
5 |
6 | # path to your application root.
7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | chdir APP_ROOT do
14 | # This script is a starting point to setup your application.
15 | # Add necessary setup steps to this file.
16 |
17 | puts '== Installing dependencies =='
18 | system! 'gem install bundler --conservative'
19 | system('bundle check') || system!('bundle install')
20 |
21 | # Install JavaScript dependencies if using Yarn
22 | # system('bin/yarn')
23 |
24 |
25 | # puts "\n== Copying sample files =="
26 | # unless File.exist?('config/database.yml')
27 | # cp 'config/database.yml.sample', 'config/database.yml'
28 | # end
29 |
30 | puts "\n== Preparing database =="
31 | system! 'bin/rails db:setup'
32 |
33 | puts "\n== Removing old logs and tempfiles =="
34 | system! 'bin/rails log:clear tmp:clear'
35 |
36 | puts "\n== Restarting application server =="
37 | system! 'bin/rails restart'
38 | end
39 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'spring' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("spring", "spring")
18 |
--------------------------------------------------------------------------------
/bin/sprockets:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'sprockets' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sprockets", "sprockets")
18 |
--------------------------------------------------------------------------------
/bin/thor:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'thor' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("thor", "thor")
18 |
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 | require 'fileutils'
4 | include FileUtils
5 |
6 | # path to your application root.
7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | chdir APP_ROOT do
14 | # This script is a way to update your development environment automatically.
15 | # Add necessary update steps to this file.
16 |
17 | puts '== Installing dependencies =='
18 | system! 'gem install bundler --conservative'
19 | system('bundle check') || system!('bundle install')
20 |
21 | puts "\n== Updating database =="
22 | system! 'bin/rails db:migrate'
23 |
24 | puts "\n== Removing old logs and tempfiles =="
25 | system! 'bin/rails log:clear tmp:clear'
26 |
27 | puts "\n== Restarting application server =="
28 | system! 'bin/rails restart'
29 | end
30 |
--------------------------------------------------------------------------------
/bin/webpack:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'webpack' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("webpacker", "webpack")
18 |
--------------------------------------------------------------------------------
/bin/webpack-dev-server:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'webpack-dev-server' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("webpacker", "webpack-dev-server")
18 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | VENDOR_PATH = File.expand_path('..', __dir__)
3 | Dir.chdir(VENDOR_PATH) do
4 | begin
5 | exec "yarnpkg #{ARGV.join(" ")}"
6 | rescue Errno::ENOENT
7 | $stderr.puts "Yarn executable was not detected in the system."
8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 | exit 1
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require_relative 'config/environment'
4 |
5 | run Rails.application
6 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module WebpackerExampleApp
10 | class Application < Rails::Application
11 | if defined? Rack::Cors
12 | Rails.configuration.middleware.insert_before 0, Rack::Cors do
13 | allow do
14 | origins %w[
15 | https://webpacker-example-app.herokuapp.com
16 | ]
17 | resource '/entries/*'
18 | end
19 | end
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: async
6 |
7 | production:
8 | adapter: redis
9 | url: redis://localhost:6379/1
10 | channel_prefix: webpacker_production
11 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | default: &default
2 | adapter: postgresql
3 | encoding: unicode
4 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
5 |
6 | development:
7 | <<: *default
8 | database: webpacker_example_app
9 |
10 | test:
11 | <<: *default
12 | database: webpacker_example_app
13 |
14 | production:
15 | <<: *default
16 | url: <%= ENV['DATABASE_URL'] %>
17 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative 'application'
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Verifies that versions and hashed value of the package contents in the project's package.json
3 | config.webpacker.check_yarn_integrity = true
4 |
5 | # Make javascript_pack_tag load assets from webpack-dev-server.
6 | config.x.webpacker[:dev_server_host] = "http://localhost:8000"
7 |
8 | # Settings specified here will take precedence over those in config/application.rb.
9 |
10 | # In the development environment your application's code is reloaded on
11 | # every request. This slows down response time but is perfect for development
12 | # since you don't have to restart the web server when you make code changes.
13 | config.cache_classes = false
14 |
15 | # Do not eager load code on boot.
16 | config.eager_load = false
17 |
18 | # Show full error reports.
19 | config.consider_all_requests_local = true
20 |
21 | # Enable/disable caching. By default caching is disabled.
22 | if Rails.root.join('tmp/caching-dev.txt').exist?
23 | config.action_controller.perform_caching = true
24 |
25 | config.cache_store = :memory_store
26 | config.public_file_server.headers = {
27 | 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
28 | }
29 | else
30 | config.action_controller.perform_caching = false
31 |
32 | config.cache_store = :null_store
33 | end
34 |
35 | config.action_controller.asset_host = ENV['ASSET_HOST']
36 |
37 | # Don't care if the mailer can't send.
38 | config.action_mailer.raise_delivery_errors = false
39 |
40 | config.action_mailer.perform_caching = false
41 |
42 | # Print deprecation notices to the Rails logger.
43 | config.active_support.deprecation = :log
44 |
45 | # Raise an error on page load if there are pending migrations.
46 | config.active_record.migration_error = :page_load
47 |
48 | # Debug mode disables concatenation and preprocessing of assets.
49 | # This option may cause significant delays in view rendering with a large
50 | # number of complex assets.
51 | config.assets.debug = true
52 |
53 | # Suppress logger output for asset requests.
54 | config.assets.quiet = true
55 |
56 | # Raises error for missing translations
57 | # config.action_view.raise_on_missing_translations = true
58 |
59 | # Use an evented file watcher to asynchronously detect changes in source code,
60 | # routes, locales, etc. This feature depends on the listen gem.
61 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
62 | end
63 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Verifies that versions and hashed value of the package contents in the project's package.json
3 | config.webpacker.check_yarn_integrity = false
4 |
5 | # Code is not reloaded between requests.
6 | config.cache_classes = true
7 |
8 | # Eager load code on boot. This eager loads most of Rails and
9 | # your application in memory, allowing both threaded web servers
10 | # and those relying on copy on write to perform better.
11 | # Rake tasks automatically ignore this option for performance.
12 | config.eager_load = true
13 |
14 | # Full error reports are disabled and caching is turned on.
15 | config.consider_all_requests_local = false
16 | config.action_controller.perform_caching = true
17 |
18 | # Disable serving static files from the `/public` folder by default since
19 | # Apache or NGINX already handles this.
20 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
21 |
22 | # Compress JavaScripts and CSS.
23 | config.assets.js_compressor = :uglifier
24 | # config.assets.css_compressor = :sass
25 |
26 | # Do not fallback to assets pipeline if a precompiled asset is missed.
27 | config.assets.compile = false
28 |
29 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
30 |
31 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
32 | # config.action_controller.asset_host = 'http://assets.example.com'
33 | config.action_controller.asset_host = ENV['ASSET_HOST']
34 |
35 | # Specifies the header that your server uses for sending files.
36 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
37 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
38 |
39 | # Mount Action Cable outside main process or domain
40 | # config.action_cable.mount_path = nil
41 | # config.action_cable.url = 'wss://example.com/cable'
42 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
43 |
44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45 | # config.force_ssl = true
46 |
47 | # Use the lowest log level to ensure availability of diagnostic information
48 | # when problems arise.
49 | config.log_level = :info
50 |
51 | # Prepend all log lines with the following tags.
52 | config.log_tags = [ :request_id ]
53 |
54 | # Use a different cache store in production.
55 | # config.cache_store = :mem_cache_store
56 |
57 | # Use a real queuing backend for Active Job (and separate queues per environment)
58 | # config.active_job.queue_adapter = :resque
59 | # config.active_job.queue_name_prefix = "webpacker_#{Rails.env}"
60 | config.action_mailer.perform_caching = false
61 |
62 | # Ignore bad email addresses and do not raise email delivery errors.
63 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
64 | # config.action_mailer.raise_delivery_errors = false
65 |
66 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
67 | # the I18n.default_locale when a translation cannot be found).
68 | config.i18n.fallbacks = true
69 |
70 | # Send deprecation notices to registered listeners.
71 | config.active_support.deprecation = :notify
72 |
73 | # Use default logging formatter so that PID and timestamp are not suppressed.
74 | config.log_formatter = ::Logger::Formatter.new
75 |
76 | # Use a different logger for distributed setups.
77 | # require 'syslog/logger'
78 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
79 |
80 | if ENV["RAILS_LOG_TO_STDOUT"].present?
81 | logger = ActiveSupport::Logger.new(STDOUT)
82 | logger.formatter = config.log_formatter
83 | config.logger = ActiveSupport::TaggedLogging.new(logger)
84 | end
85 |
86 | # Do not dump schema after migrations.
87 | config.active_record.dump_schema_after_migration = false
88 | end
89 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 | config.action_mailer.perform_caching = false
31 |
32 | # Tell Action Mailer not to deliver emails to the real world.
33 | # The :test delivery method accumulates sent emails in the
34 | # ActionMailer::Base.deliveries array.
35 | config.action_mailer.delivery_method = :test
36 |
37 | # Print deprecation notices to the stderr.
38 | config.active_support.deprecation = :stderr
39 |
40 | # Raises error for missing translations
41 | # config.action_view.raise_on_missing_translations = true
42 | end
43 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ApplicationController.renderer.defaults.merge!(
4 | # http_host: 'example.org',
5 | # https: false
6 | # )
7 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 | # Add Yarn node_modules folder to the asset load path.
9 | Rails.application.config.assets.paths << Rails.root.join('vendor/node_modules')
10 |
11 | # Precompile additional assets.
12 | # application.js, application.css, and all non-JS/CSS in the app/assets
13 | # folder are already added.
14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
15 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Specify a serializer for the signed and encrypted cookie jars.
4 | # Valid options are :json, :marshal, and :hybrid.
5 | Rails.application.config.action_dispatch.cookies_serializer = :json
6 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/config/initializers/hypernova.rb:
--------------------------------------------------------------------------------
1 | require 'hypernova'
2 | require 'hypernova/plugins/development_mode_plugin'
3 |
4 | Hypernova.add_plugin!(DevelopmentModePlugin.new)
5 |
6 | Hypernova.configure do |config|
7 | config.host = 'localhost'
8 | config.port = 3030
9 | end
10 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/config/initializers/new_framework_defaults.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 | #
3 | # This file contains migration options to ease your Rails 5.0 upgrade.
4 | #
5 | # Read the Guide for Upgrading Ruby on Rails for more info on each option.
6 |
7 | # Enable per-form CSRF tokens. Previous versions had false.
8 | Rails.application.config.action_controller.per_form_csrf_tokens = true
9 |
10 | # Enable origin-checking CSRF mitigation. Previous versions had false.
11 | Rails.application.config.action_controller.forgery_protection_origin_check = true
12 |
13 | # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
14 | # Previous versions had false.
15 | ActiveSupport.to_time_preserves_timezone = true
16 |
17 | # Require `belongs_to` associations by default. Previous versions had false.
18 | Rails.application.config.active_record.belongs_to_required_by_default = true
19 |
20 | # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
21 | Rails.application.config.ssl_options = { hsts: { subdomains: true } }
22 |
23 | # Unknown asset fallback will return the path passed in when the given
24 | # asset is not present in the asset pipeline.
25 | Rails.application.config.assets.unknown_asset_fallback = false
26 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json]
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # 'true': 'foo'
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at http://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers: a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum; this matches the default thread size of Active Record.
6 | #
7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | threads threads_count, threads_count
9 |
10 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11 | #
12 | port ENV.fetch("PORT") { 3000 }
13 |
14 | # Specifies the `environment` that Puma will run in.
15 | #
16 | environment ENV.fetch("RAILS_ENV") { "development" }
17 |
18 | # Specifies the number of `workers` to boot in clustered mode.
19 | # Workers are forked webserver processes. If using threads and workers together
20 | # the concurrency of the application would be max `threads` * `workers`.
21 | # Workers do not work on JRuby or Windows (both of which do not support
22 | # processes).
23 | #
24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 |
26 | # Use the `preload_app!` method when specifying a `workers` number.
27 | # This directive tells Puma to first boot the application and load code
28 | # before forking the application. This takes advantage of Copy On Write
29 | # process behavior so workers use less memory. If you use this option
30 | # you need to make sure to reconnect any threads in the `on_worker_boot`
31 | # block.
32 | #
33 | # preload_app!
34 |
35 | # If you are preloading your application and using Active Record, it's
36 | # recommended that you close any connections to the database before workers
37 | # are forked to prevent connection leakage.
38 | #
39 | # before_fork do
40 | # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
41 | # end
42 |
43 | # The code in the `on_worker_boot` will be called if you are using
44 | # clustered mode by specifying a number of `workers`. After each worker
45 | # process is booted, this block will be run. If you are using the `preload_app!`
46 | # option, you will want to use this block to reconnect to any threads
47 | # or connections that may have been created at application boot, as Ruby
48 | # cannot share connections between processes.
49 | #
50 | # on_worker_boot do
51 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
52 | # end
53 | #
54 |
55 | # Allow puma to be restarted by `rails restart` command.
56 | plugin :tmp_restart
57 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'pages#index'
3 | end
4 |
--------------------------------------------------------------------------------
/config/secrets.yml:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rails secret` to generate a secure secret key.
9 |
10 | # Make sure the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | # Shared secrets are available across all environments.
14 |
15 | shared:
16 | api_key: 123
17 |
18 | # Environmental secrets are only available for that specific environment.
19 |
20 | development:
21 | secret_key_base: ed482e413191545448a2a183180688fc2095249df93d516dbe5feb2beb43465a360eb491b6fc1df84ecc63d23c1d30950e304b33b3ecaf50d50650273cddbc7e
22 |
23 | test:
24 | secret_key_base: 88fc3a598482f3786984abeae582132fa82efb37b68cd4b1743691c6ef2b77b593810e8db54f3afa0c0d87951187ebacae1c4d170e6be5f422ae2d3d072a1d5e
25 |
26 | # Do not keep production secrets in the repository,
27 | # instead read values from the environment.
28 |
29 | production:
30 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
31 |
--------------------------------------------------------------------------------
/config/spring.rb:
--------------------------------------------------------------------------------
1 | %w(
2 | .ruby-version
3 | .rbenv-vars
4 | tmp/restart.txt
5 | tmp/caching-dev.txt
6 | ).each { |path| Spring.watch(path) }
7 |
--------------------------------------------------------------------------------
/config/webpack/custom.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack')
2 |
3 | module.exports = {
4 | resolve: {
5 | extensions: [
6 | '.svg',
7 | '.tiff',
8 | '.png',
9 | '.hola'
10 | ]
11 | },
12 | module: {
13 | rules: [
14 | {
15 | test: /\.json$/,
16 | exclude: /node_modules/,
17 | loader: 'json-loader'
18 | }
19 | ]
20 | },
21 | plugins: [
22 | new webpack.optimize.CommonsChunkPlugin({
23 | name: 'manifest' // Runtime code
24 | }),
25 |
26 | new webpack.optimize.CommonsChunkPlugin({
27 | async: true,
28 | children: true,
29 | minChunks: 4
30 | })
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/config/webpack/development.js:
--------------------------------------------------------------------------------
1 | const environment = require('./environment')
2 | const path = require('path')
3 | const { config: webpackerConfig } = require('@rails/webpacker')
4 |
5 | environment.config.devtool = 'cheap-eval-source-map'
6 | environment.config.output.filename = '[name].js'
7 | module.exports = environment.toWebpackConfig()
8 |
--------------------------------------------------------------------------------
/config/webpack/dll.js:
--------------------------------------------------------------------------------
1 | const dll = require('@rails/webpacker/package/environments/dll')
2 |
3 | const dllContructor = new dll()
4 | const config = dllContructor.toWebpackConfig()
5 |
6 | config.entry = {
7 | vendor: [
8 | 'react',
9 | 'react-dom',
10 | 'prop-types',
11 | 'vue',
12 | 'hypernova-react'
13 | ]
14 | }
15 |
16 | module.exports = config
17 |
--------------------------------------------------------------------------------
/config/webpack/environment.js:
--------------------------------------------------------------------------------
1 | const { environment } = require('@rails/webpacker')
2 |
3 | const coffeeLoader = environment.loaders.get('coffee')
4 | const babelLoader = environment.loaders.get('babel')
5 | babelLoader.use.forEach(loader => coffeeLoader.use.unshift(loader))
6 |
7 | const sassLoader = environment.loaders.get('sass')
8 | const css = environment.loaders.get('css')
9 | const cssLoader = sassLoader.use.find(loader => loader.loader === 'css-loader')
10 |
11 | cssLoader.options = Object.assign(cssLoader.options, {
12 | modules: true,
13 | localIdentName: '[name]__[local]--[hash:base64:5]'
14 | })
15 |
16 | environment.loaders.prepend('svg', // In your webpack config
17 | {
18 | test: /\.svg$/,
19 | use: babelLoader.use.concat([
20 | {
21 | loader: "react-svg-loader",
22 | options: {
23 | jsx: true // true outputs JSX tags
24 | }
25 | }
26 | ])
27 | })
28 |
29 | module.exports = environment
30 |
--------------------------------------------------------------------------------
/config/webpack/production.js:
--------------------------------------------------------------------------------
1 | const environment = require('./environment')
2 |
3 | module.exports = environment.toWebpackConfig()
4 |
--------------------------------------------------------------------------------
/config/webpack/server.js:
--------------------------------------------------------------------------------
1 | process.env.NODE_ENV = 'development'
2 | process.env.WEBPACKER_ASSET_HOST = 'http://localhost:3035'
3 |
4 | const path = require('path');
5 | const webpack = require('webpack');
6 | const express = require('express');
7 | const WebpackDevServer = require('webpack-dev-server');
8 |
9 | const SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin');
10 |
11 | const config = require('./development.js');
12 | const devServer = config.devServer;
13 |
14 | /**
15 | * Takes a request "/dist/file1.bundle.js"
16 | * returns a key from config.entry "file1.bundle"
17 | */
18 | function convertReqPathToBundleName(reqPath) {
19 | return path.basename(reqPath).replace(path.extname(reqPath), '');
20 | }
21 |
22 | function createBuildOnRequestMiddleware(config) {
23 | // hold onto a reference to our original config.entry,
24 | // and clear out the entry on the config. We'll dynamically
25 | // re-add as needed.
26 | const allEntries = config.entry;
27 | config.entry = {};
28 |
29 | // Webpack validation will fail if you create a compiler with no entry
30 | // points, so we add the first one back in.
31 | const firstEntry = Object.keys(allEntries)[0];
32 | config.entry[firstEntry] = allEntries[firstEntry];
33 |
34 | delete config.devServer
35 |
36 | const compiler = webpack(config);
37 | const webpackDevServer = new WebpackDevServer(compiler, devServer);
38 |
39 | const devServerWrapper = express();
40 |
41 | /**
42 | * Before we hook up the webpackDevServer, we need to be sure we're
43 | * compiling everything needed.
44 | * This makes sure our compiler is in the correct state before letting
45 | * webpackDevServer handle all the requests.
46 | */
47 | devServerWrapper.use(function(req, res, next) {
48 | const entryKey = convertReqPathToBundleName(req.path);
49 | if(!config.entry[entryKey] && allEntries[entryKey]) {
50 | console.log(`Found a request for an unbuilt bundle "${entryKey}", adding to compiler: "${compiler.name}"`);
51 | config.entry[entryKey] = allEntries[entryKey];
52 |
53 | // This only works for entries that are composed of arrays.
54 | // { 'file1.bundle': ['...'] } vs { 'file1.bundle': '...' }
55 | compiler.apply(new SingleEntryPlugin(null, allEntries[entryKey], entryKey));
56 |
57 | // This is sort of hacky, but it was the easiest way to invalidate
58 | // webpack + watcher.
59 | webpackDevServer.middleware.invalidate();
60 | }
61 | next();
62 | });
63 |
64 | devServerWrapper.use(webpackDevServer.app);
65 |
66 | return devServerWrapper;
67 | }
68 |
69 | const app = express();
70 |
71 | /**
72 | * Load the webpackDevServer as middleware in our express server.
73 | */
74 | app.use(createBuildOnRequestMiddleware(config));
75 |
76 | app.listen(devServer.port, devServer.host, () => {
77 | console.log(`Listening: ${devServer.host}:${devServer.port}`);
78 | });
79 |
--------------------------------------------------------------------------------
/config/webpack/test.js:
--------------------------------------------------------------------------------
1 | const environment = require('./environment')
2 |
3 | module.exports = environment.toWebpackConfig()
4 |
--------------------------------------------------------------------------------
/config/webpacker.yml:
--------------------------------------------------------------------------------
1 | # Note: You must restart bin/webpack-dev-server for changes to take effect
2 |
3 | default: &default
4 | source_path: app/assets/javascript
5 | source_entry_path: entries
6 | public_output_path: entries
7 | cache_path: tmp/cache/webpacker
8 |
9 | # Additional paths webpack should lookup modules
10 | # ['app/assets', 'engine/foo/app/assets']
11 | resolved_paths: []
12 |
13 | # Reload manifest.json on all requests so we reload latest compiled packs
14 | cache_manifest: false
15 |
16 | extensions:
17 | - .elm
18 | - .coffee
19 | - .erb
20 | - .js
21 | - .jsx
22 | - .ts
23 | - .vue
24 | - .sass
25 | - .scss
26 | - .css
27 | - .png
28 | - .svg
29 | - .gif
30 | - .jpeg
31 | - .jpg
32 |
33 | development:
34 | <<: *default
35 | compile: true
36 |
37 | # Reference: https://webpack.js.org/configuration/dev-server/
38 | dev_server:
39 | https: false
40 | host: localhost
41 | port: 3035
42 | public: localhost:3035
43 | hmr: true
44 | # Inline should be set to true if using HMR
45 | inline: true
46 | overlay: true
47 | pretty: true
48 | disable_host_check: true
49 | use_local_ip: false
50 | quiet: false
51 |
52 | test:
53 | <<: *default
54 | compile: true
55 |
56 | # Compile test packs to a separate directory
57 | public_output_path: packs-test
58 |
59 | production:
60 | <<: *default
61 |
62 | # Production depends on precompilation of packs prior to booting for performance.
63 | compile: false
64 |
65 | # Cache manifest.json for performance
66 | cache_manifest: true
67 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 0) do
14 |
15 | # These are extensions that must be enabled in order to support this database
16 | enable_extension "plpgsql"
17 |
18 | end
19 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7 | # Character.create(name: 'Luke', movie: movies.first)
8 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | postgres:
4 | image: postgres:9.6-alpine
5 | webpacker:
6 | build: .
7 | env_file:
8 | - '.env.docker'
9 | command: bundle exec webpack-dev-server
10 | volumes:
11 | - .:/webpacker-example-app
12 | ports:
13 | - '3035:3035'
14 | web:
15 | build: .
16 | env_file:
17 | - '.env.docker'
18 | command: bundle exec rails s
19 | volumes:
20 | - .:/webpacker-example-app
21 | ports:
22 | - '3000:3000'
23 | depends_on:
24 | - postgres
25 |
--------------------------------------------------------------------------------
/elm-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "summary": "helpful summary of your project, less than 80 characters",
4 | "repository": "https://github.com/user/project.git",
5 | "license": "BSD3",
6 | "source-directories": [
7 | "app/assets/javascript/entries"
8 | ],
9 | "exposed-modules": [],
10 | "dependencies": {
11 | "elm-lang/core": "5.1.1 <= v < 6.0.0",
12 | "elm-lang/html": "2.0.0 <= v < 3.0.0"
13 | },
14 | "elm-version": "0.18.0 <= v < 0.19.0"
15 | }
16 |
--------------------------------------------------------------------------------
/hypernova.js:
--------------------------------------------------------------------------------
1 | const { join } = require('path')
2 | const hypernova = require('hypernova/server')
3 | const renderReact = require('hypernova-react').renderReact
4 | const { environment } = require('@rails/webpacker')
5 | const requireFromUrl = require('require-from-url/sync')
6 | const detect = require('detect-port')
7 |
8 | const config = environment.toWebpackConfig()
9 | const devServerUrl = `http://${config.devServer.host}:${config.devServer.port}`
10 |
11 | function camelize(text) {
12 | const separator = '_'
13 | const words = text.split(separator)
14 | if (words.length === 0) return text.charAt(0).toUpperCase() + word.slice(1)
15 | let result = ''
16 | let i = 0
17 |
18 | while (i < words.length) {
19 | const word = words[i]
20 | const capitalizedWord = word.charAt(0).toUpperCase() + word.slice(1)
21 | result += capitalizedWord
22 | i += 1
23 | }
24 |
25 | return result
26 | }
27 |
28 | const detectPort = new Promise((resolve, reject) =>
29 | detect(config.devServer.port, (err, _port) => {
30 | if (err) {
31 | resolve(false)
32 | }
33 |
34 | if (config.devServer.port == _port) {
35 | resolve(false)
36 | } else {
37 | resolve(true)
38 | }
39 | })
40 | )
41 |
42 | hypernova({
43 | devMode: true,
44 | port: 3030,
45 | async getComponent(name) {
46 | const manifest = require(join(config.output.path, 'manifest.json'))
47 | const packName = manifest[`${name}.js`]
48 | const isDevServerRunning = await detectPort
49 | let bundle
50 |
51 | if (isDevServerRunning) {
52 | requireFromUrl(`${devServerUrl}${packName}`)
53 | } else {
54 | require(join(config.output.path, '..', manifest[`${name}.js`]))
55 | }
56 |
57 | return renderReact(name, eval(camelize(name)))
58 | }
59 | })
60 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/lib/tasks/.keep
--------------------------------------------------------------------------------
/localhost.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIErTCCA5WgAwIBAgIJAOB1vxuz2H9+MA0GCSqGSIb3DQEBBQUAMIGVMQswCQYD
3 | VQQGEwJHQjETMBEGA1UECBMKTGFuY2FzaGlyZTETMBEGA1UEBxMKTWFuY2hlc3Rl
4 | cjESMBAGA1UEChMJV2VicGFja2VyMQ0wCwYDVQQLEwRUZWNoMQ8wDQYDVQQDEwZH
5 | YXVyYXYxKDAmBgkqhkiG9w0BCQEWGWdhdXJhdkBnYXVyYXZ0aXdhcmkuY28udWsw
6 | HhcNMTcwODEyMDczOTQxWhcNMTgwODEyMDczOTQxWjCBlTELMAkGA1UEBhMCR0Ix
7 | EzARBgNVBAgTCkxhbmNhc2hpcmUxEzARBgNVBAcTCk1hbmNoZXN0ZXIxEjAQBgNV
8 | BAoTCVdlYnBhY2tlcjENMAsGA1UECxMEVGVjaDEPMA0GA1UEAxMGR2F1cmF2MSgw
9 | JgYJKoZIhvcNAQkBFhlnYXVyYXZAZ2F1cmF2dGl3YXJpLmNvLnVrMIIBIjANBgkq
10 | hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq5NDzQkttvq+woqHeupoqZAyUzKvuI9c
11 | oQy23Mdry6sQRfpI5xJmpoAj0OP2Brpuf1hgHnKy5J12d8OyKvCuL2JUviDnnxva
12 | pmWbzuHTh4Arokc60o9r1c8v9PIy57V8WNj61JvGjfohDBNSkvwPD88YJurQ99Oh
13 | ivRK61VIXRJiHHGUxAEGlX/cEyn/+RdOPyT0I+uLq54fnRFqNjgWCeVOCqjfW/50
14 | bNgsnr8HDMiWyjZNJo2McBdnHIGkXT3z2HYpIXjMaKKfJazh8RRsblJQn/CA/B1E
15 | OnNUjU8l1Fs1BaFUsNYkVzJCDNK6wXsljjZImeC0r30l1aNulL3zjwIDAQABo4H9
16 | MIH6MB0GA1UdDgQWBBSSNpvjN5pKKCApHHl1P9khJ7HjHjCBygYDVR0jBIHCMIG/
17 | gBSSNpvjN5pKKCApHHl1P9khJ7HjHqGBm6SBmDCBlTELMAkGA1UEBhMCR0IxEzAR
18 | BgNVBAgTCkxhbmNhc2hpcmUxEzARBgNVBAcTCk1hbmNoZXN0ZXIxEjAQBgNVBAoT
19 | CVdlYnBhY2tlcjENMAsGA1UECxMEVGVjaDEPMA0GA1UEAxMGR2F1cmF2MSgwJgYJ
20 | KoZIhvcNAQkBFhlnYXVyYXZAZ2F1cmF2dGl3YXJpLmNvLnVrggkA4HW/G7PYf34w
21 | DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAcLcCsYe2wRi9hJ4J12fS
22 | D6t72RORJcLjrGY4JkVKTqvKlzpOSWOIM/XpdB07repE92Dau6r96qF2zL8EVZiz
23 | BUJoATji0X8bmtXlqjsMjR0cGzrZVEonDtPj8Bpr8By1vbdVaR4COAYhBcddGKy4
24 | hVNWvMiq+OYRo7549eWOaSnkNoTUrQxO+af1I/LodDaUQcE0S0SRGVG63ujDJDC3
25 | AOzWdzbuuzYGNl/xxWWtrpK2BhPsQHBNFPLcsz4h1zXmmXfqNzuCIc23B8uwP22q
26 | lg2aDXFj/UzddEY8aZSnUN5hfTX82fstq1X7pNUOzkl1iT3eYxTXcjgJ3gvVuLHU
27 | ZA==
28 | -----END CERTIFICATE-----
29 |
--------------------------------------------------------------------------------
/localhost.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIIEpQIBAAKCAQEAq5NDzQkttvq+woqHeupoqZAyUzKvuI9coQy23Mdry6sQRfpI
3 | 5xJmpoAj0OP2Brpuf1hgHnKy5J12d8OyKvCuL2JUviDnnxvapmWbzuHTh4Arokc6
4 | 0o9r1c8v9PIy57V8WNj61JvGjfohDBNSkvwPD88YJurQ99OhivRK61VIXRJiHHGU
5 | xAEGlX/cEyn/+RdOPyT0I+uLq54fnRFqNjgWCeVOCqjfW/50bNgsnr8HDMiWyjZN
6 | Jo2McBdnHIGkXT3z2HYpIXjMaKKfJazh8RRsblJQn/CA/B1EOnNUjU8l1Fs1BaFU
7 | sNYkVzJCDNK6wXsljjZImeC0r30l1aNulL3zjwIDAQABAoIBAQCEQMbRhFK1qgBj
8 | Cs81wvycP6dbFEX5GKDJD3jhI+MGojywBCYv37I6g6mX+jAJralBBglJTxZwPKQ1
9 | 2yY6DT3nDn/N8qU3swvOmaIJTW91EioQM6G27pCrxcHsqMjubKmF/vMR8WWSyQyy
10 | Ny6+WAbwI601Sml7rqjl6DrbvehCvIWOnkvNCwSXOkfZ39bUKNJNDm8HJ8kXcupQ
11 | hie3/ZQZVhKyhJ9/adPyBj5xzZoZ6fIByWRyuQEEv0epK7mOQC2xBe8ktE6HQ4qq
12 | 2heIJ5x5UsXweEgZjNrwhdpqNRuvgOVKP+KAV8XEZREakkhQAcfpYxTTLyxRB5s+
13 | zj2WfJphAoGBAOSHniueYaeDkqkTQyCqJIYDDXw/oNyVxHG315ShFAfu4jw0TVby
14 | spyOK6P3Cw7ElJBj0hNqcFjq+a5MVuBdnmq9RlQ1jlBhkMbeOSYtMZLXKo1rQEac
15 | 7+5s/xKk//aDjYKjH8CsHYaa7Tbu//4R07WGry9pjdyfApvNVYna0MIfAoGBAMAz
16 | BuU7A4jLn9eGCF2Wg8oLY2fpH0ImqNV4nV2m6VI26dAFesOv1esY2A/ncCATRub3
17 | jQiiXk0L9/DeYTVPafYQTGg2lGewPbclJ+Exd5swN0Se+FZLjO2LfX76EEQa2x83
18 | QiSquWf4706mMLyQJKsoRkxDhlajBiFDRLbLgACRAoGBAKgCQDmHHfoeU9MzUxWP
19 | oHxZgC+JQ8UH4j1MUBR3+5b9e5uRRA6ZLNDGALVxqNJ5mVMx377gcKoeTeNjQjd+
20 | /Dky36KHIRJdOCfMNi2n6hsvTpxbbgy70fTycvANGBTukDmrnWtz3d0Yxy6stMzf
21 | 5Eo/M0njCyVYTX2njqxjjzg3AoGAZ7GgAMCsEXu6iy73CHcSN0mZohA2Gxx8bl+a
22 | l1JcA005LFAogbc2NJa8yyfUaJm94RKh9oyTUAIrDLsNuxNTWbxFXNxFiQOe6FaV
23 | g3uKyiFjUBRsazJroCVn2b/UUsoiel73woyRZzT493fWR4WFIwqhkrfDnK5rujpu
24 | sihssOECgYEA02s2pmO8I0826E2u/EIsS1qTZvo043RgSgmD74VqYU5bSsdjittF
25 | Ybz2fS8tI8ZtcgJM/kE6TnI48xHLzA3NzgxTLhWqV4U0XwmBlk2V1dpp7MyziCv0
26 | XtrbSKhARNEiqVgGAiTFFpTqYoXPKvFKAi7ok4sMC7yTvfXz1I231vk=
27 | -----END RSA PRIVATE KEY-----
28 |
--------------------------------------------------------------------------------
/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/log/.keep
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "postinstall": "npm rebuild node-sass && npm rebuild elm",
4 | "build": "node_modules/.bin/webpacker build",
5 | "start": "node_modules/.bin/webpacker start",
6 | "test": "NODE_ENV=test mocha-webpack --webpack-config ./config/webpack/test.js spec/javascripts/components/*.spec.js --recursive"
7 | },
8 | "engines": {
9 | "npm": "4.2.0"
10 | },
11 | "dependencies": {
12 | "@angular/common": "^5.0.5",
13 | "@angular/compiler": "^5.0.5",
14 | "@angular/core": "^5.0.5",
15 | "@angular/platform-browser": "^5.0.5",
16 | "@angular/platform-browser-dynamic": "^5.0.5",
17 | "@rails/webpacker": "^3.0.2",
18 | "babel-polyfill": "^6.26.0",
19 | "babel-preset-react": "^6.24.1",
20 | "bootstrap": "^3.3.7",
21 | "coffeescript": "2.0.1",
22 | "core-js": "^2.5.1",
23 | "elm": "^0.18.0",
24 | "elm-webpack-loader": "^4.4.0",
25 | "es6-promise": "^4.1.1",
26 | "hypernova": "^2.1.3",
27 | "hypernova-react": "^2.0.0",
28 | "isomorphic-fetch": "^2.2.1",
29 | "object-assign": "^4.1.1",
30 | "prop-types": "^15.5.10",
31 | "react": "^15.6.1",
32 | "react-dom": "^15.6.1",
33 | "react-svg-loader": "^2.1.0",
34 | "require-from-url": "^3.1.2",
35 | "rxjs": "^5.5.3",
36 | "ts-loader": "^3.2.0",
37 | "typescript": "^2.6.2",
38 | "vue": "^2.4.2",
39 | "vue-loader": "^13.0.4",
40 | "vue-template-compiler": "^2.4.2",
41 | "webpack-node-externals": "^1.6.0",
42 | "zone.js": "^0.8.18"
43 | },
44 | "devDependencies": {
45 | "elm-hot-loader": "^0.5.4",
46 | "webpack-dev-server": "^2.9.4"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/public/apple-touch-icon-precomposed.png
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/public/favicon.ico
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 |
--------------------------------------------------------------------------------
/test/application_system_test_case.rb:
--------------------------------------------------------------------------------
1 | require "test_helper"
2 |
3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5 | end
6 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/test/controllers/.keep
--------------------------------------------------------------------------------
/test/fixtures/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/test/fixtures/.keep
--------------------------------------------------------------------------------
/test/fixtures/files/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/test/fixtures/files/.keep
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/test/helpers/.keep
--------------------------------------------------------------------------------
/test/integration/home_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class HomeTest < ActionDispatch::IntegrationTest
4 | test "can see the hello message" do
5 | get '/'
6 | assert_select "h5", text: "Hello! David"
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/test/mailers/.keep
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/test/models/.keep
--------------------------------------------------------------------------------
/test/system/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gauravtiwari/webpacker-example-app/bf55d9c6ecff07666b32552142b7de158cfbdb75/test/system/.keep
--------------------------------------------------------------------------------
/test/system/homes_test.rb:
--------------------------------------------------------------------------------
1 | require "application_system_test_case"
2 |
3 | class HomesTest < ApplicationSystemTestCase
4 | test "can see the hello message" do
5 | visit root_url
6 | assert_selector "h5", text: "Hello! David"
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../../config/environment', __FILE__)
2 | require 'rails/test_help'
3 |
4 | class ActiveSupport::TestCase
5 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
6 | fixtures :all
7 | # Add more helper methods to be used by all tests here...
8 | end
9 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "declaration": false,
4 | "emitDecoratorMetadata": true,
5 | "experimentalDecorators": true,
6 | "lib": ["es6", "dom"],
7 | "module": "es6",
8 | "moduleResolution": "node",
9 | "sourceMap": true,
10 | "target": "es5"
11 | },
12 | "exclude": [
13 | "**/*.spec.ts",
14 | "node_modules",
15 | "vendor",
16 | "public"
17 | ],
18 | "compileOnSave": false
19 | }
20 |
--------------------------------------------------------------------------------