Pull activetext.js into dummy app with webpacker

This commit is contained in:
Javan Makhmali 2018-02-12 10:34:29 -05:00
parent 63add5acc4
commit 2f13b3c9fe
24 changed files with 6247 additions and 33 deletions

1
.gitignore vendored

@ -6,6 +6,7 @@ test/dummy/db/*.sqlite3
test/dummy/db/*.sqlite3-journal test/dummy/db/*.sqlite3-journal
test/dummy/log/*.log test/dummy/log/*.log
test/dummy/node_modules/ test/dummy/node_modules/
test/dummy/public/
test/dummy/yarn-error.log test/dummy/yarn-error.log
test/dummy/storage/ test/dummy/storage/
test/dummy/tmp/ test/dummy/tmp/

@ -74,6 +74,8 @@ GEM
nokogiri (1.8.2) nokogiri (1.8.2)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
rack (2.0.4) rack (2.0.4)
rack-proxy (0.6.3)
rack
rack-test (0.8.2) rack-test (0.8.2)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.2.0.rc1) rails (5.2.0.rc1)
@ -113,6 +115,10 @@ GEM
thread_safe (0.3.6) thread_safe (0.3.6)
tzinfo (1.2.5) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
webpacker (3.2.2)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
websocket-driver (0.7.0) websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3) websocket-extensions (0.1.3)
@ -124,6 +130,7 @@ DEPENDENCIES
activetext! activetext!
bundler (~> 1.15) bundler (~> 1.15)
sqlite3 sqlite3
webpacker (~> 3.2.2)
BUNDLED WITH BUNDLED WITH
1.16.1 1.16.1

@ -20,6 +20,7 @@
s.add_development_dependency "bundler", "~> 1.15" s.add_development_dependency "bundler", "~> 1.15"
s.add_development_dependency "sqlite3" s.add_development_dependency "sqlite3"
s.add_development_dependency "webpacker", "~> 3.2.2"
s.files = `git ls-files`.split("\n") s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- test/*`.split("\n") s.test_files = `git ls-files -- test/*`.split("\n")

29
bin/webpack Executable file

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'webpack' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("webpacker", "webpack")

29
bin/webpack-dev-server Executable file

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'webpack-dev-server' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("webpacker", "webpack-dev-server")

18
test/dummy/.babelrc Normal file

@ -0,0 +1,18 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}]
],
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
["transform-class-properties", { "spec": true }]
]
}

@ -0,0 +1,3 @@
plugins:
postcss-import: {}
postcss-cssnext: {}

@ -1,14 +0,0 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require activestorage
//= require_tree .

@ -1,13 +0,0 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
//
//= require action_cable
//= require_self
//= require_tree ./channels
(function() {
this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
}).call(this);

@ -1,2 +0,0 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

@ -10,6 +10,7 @@
* files in this directory. Styles in this file should be added after the last require_* statement. * files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope. * It is generally better to create a new file per style scope.
* *
*= require trix/dist/trix.css
*= require_tree . *= require_tree .
*= require_self *= require_self
*/ */

@ -0,0 +1 @@
import "activetext"

@ -4,8 +4,8 @@
<title>Dummy</title> <title>Dummy</title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all' %> <%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %> <%= javascript_pack_tag 'application' %>
</head> </head>
<body> <body>

@ -7,7 +7,7 @@
<p> <p>
<strong>Content:</strong> <strong>Content:</strong>
<%= @message.content %> <%= raw @message.content %>
</p> </p>
<%= link_to 'Edit', edit_message_path(@message) %> | <%= link_to 'Edit', edit_message_path(@message) %> |

@ -1,4 +1,6 @@
Rails.application.configure do Rails.application.configure do
# Verifies that versions and hashed value of the package contents in the project's package.json
config.webpacker.check_yarn_integrity = true
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on

@ -1,4 +1,6 @@
Rails.application.configure do Rails.application.configure do
# Verifies that versions and hashed value of the package contents in the project's package.json
config.webpacker.check_yarn_integrity = false
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests. # Code is not reloaded between requests.

@ -0,0 +1,3 @@
const environment = require('./environment')
module.exports = environment.toWebpackConfig()

@ -0,0 +1,3 @@
const { environment } = require('@rails/webpacker')
module.exports = environment

@ -0,0 +1,3 @@
const environment = require('./environment')
module.exports = environment.toWebpackConfig()

@ -0,0 +1,3 @@
const environment = require('./environment')
module.exports = environment.toWebpackConfig()

@ -0,0 +1,65 @@
# Note: You must restart bin/webpack-dev-server for changes to take effect
default: &default
source_path: app/javascript
source_entry_path: packs
public_output_path: packs
cache_path: tmp/cache/webpacker
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
extensions:
- .js
- .sass
- .scss
- .css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
compile: true
# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
host: localhost
port: 3035
public: localhost:3035
hmr: false
# Inline should be set to true if using HMR
inline: true
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
headers:
'Access-Control-Allow-Origin': '*'
watch_options:
ignored: /node_modules/
test:
<<: *default
compile: true
# Compile test packs to a separate directory
public_output_path: packs-test
production:
<<: *default
# Production depends on precompilation of packs prior to booting for performance.
compile: false
# Cache manifest.json for performance
cache_manifest: true

@ -1,5 +1,11 @@
{ {
"name": "dummy", "name": "dummy",
"private": true, "private": true,
"dependencies": {} "dependencies": {
"@rails/webpacker": "^3.2.2",
"activetext": "file:../.."
},
"devDependencies": {
"webpack-dev-server": "^2.11.1"
}
} }

6066
test/dummy/yarn.lock Normal file

File diff suppressed because it is too large Load Diff