hyper-backend-roda 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +1 -0
- data/LICENSE +21 -0
- data/README.md +18 -0
- data/bin/roda-hyper-it-make +144 -0
- data/config/Procfile +2 -0
- data/config/entry/app.js +48 -0
- data/config/entry/cordova.js +56 -0
- data/config/hyperloop/hyperloop_webpack_loader.rb +14 -0
- data/config/package.json +37 -0
- data/config/webpack/cordova.js +78 -0
- data/config/webpack/development.js +163 -0
- data/config/webpack/production.js +86 -0
- data/config/webpack/test.js +70 -0
- data/hyper-backend-roda.gemspec +19 -0
- data/lib/hyper-backend-roda/version.rb +3 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0cd9bc52929209476172104bb8601e5409eca8856ee856e7170293357ed5f97c
|
4
|
+
data.tar.gz: 4038401652c1c8d949ab8a6ceb4a011a5647753b86a95472a44077809156cce2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 255d3ab9bb86ec75dbdc1ec992b02dc97ec4915fb97221c4bc744c377c32308a5fc3c6e9d67ce4e9ad4cd8134be91cef0af1fcd4f54e089fd5d050200bb9de55
|
7
|
+
data.tar.gz: b274f36b728933cac3f91a70ef0fc4d2ee16154c8f9d4827f16038dcd85655e770fa1257e08d4aef827f84c47f855caebab11d983ecdc672c7c3c72079a37358
|
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gemspec
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Jan Biedermann
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# hyper-be-roda
|
2
|
+
|
3
|
+
Server side configuration and helpers for using hyper-stack with roda
|
4
|
+
|
5
|
+
## usage
|
6
|
+
`gem install hyper-backend-roda` - install the gem
|
7
|
+
|
8
|
+
`roda-hyper-it-make` - will setup a roda project with the necessary configuration
|
9
|
+
|
10
|
+
options:
|
11
|
+
|
12
|
+
`roda-hyper-it-make cordova` in addition to the web setup, install config for cordova
|
13
|
+
|
14
|
+
`roda-hyper-it-make react-native` in addition to the web setup, install config for react-native (not implemented yet)
|
15
|
+
|
16
|
+
## community
|
17
|
+
|
18
|
+
Lets meet in the ruby-hyperloop gitter channel.
|
@@ -0,0 +1,144 @@
|
|
1
|
+
#!/usr/bin/env ruby_executable_hooks
|
2
|
+
#
|
3
|
+
# http://roda.jeremyevans.net/rdoc/files/doc/conventions_rdoc.html
|
4
|
+
|
5
|
+
# this helps to find out which gems and versions are already there
|
6
|
+
require 'fileutils'
|
7
|
+
require 'json'
|
8
|
+
require 'bundler'
|
9
|
+
Bundler.require if File.exist?('Gemfile')
|
10
|
+
|
11
|
+
cordova = ARGV[1] == 'cordova'
|
12
|
+
# react_native = ARGV[1] == 'react-native'
|
13
|
+
|
14
|
+
# helper methods
|
15
|
+
def mkdir(dir_name)
|
16
|
+
if Dir.exist?(dir_name)
|
17
|
+
puts "Directory #{dir_name} exists, very nice."
|
18
|
+
else
|
19
|
+
puts "Creating directory: #{dir_name}"
|
20
|
+
Dir.mkdir(dir_name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def copy(filename, source_dir, target_dir)
|
25
|
+
target_path = File.join(target_dir, filename)
|
26
|
+
source_path = File.join(File.dirname(__FILE__),'..', source_dir, filename)
|
27
|
+
if File.exist?(target_path)
|
28
|
+
puts "File #{target_path} exists, not overwriting, you may check #{source_path} for necessary adjustments."
|
29
|
+
else
|
30
|
+
puts "Creating file: #{target_path}"
|
31
|
+
FileUtils.cp(source_path, target_path)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def package_json
|
36
|
+
if File.exist?('package.json')
|
37
|
+
# read existing package.json
|
38
|
+
target = JSON.parse(File.read('package.json'))
|
39
|
+
# read wanted config
|
40
|
+
source = JSON.parse(File.read(File.join(File.dirname(__FILE__),'..', 'config', 'package.json')))
|
41
|
+
# merge
|
42
|
+
target.merge!(source)
|
43
|
+
# write
|
44
|
+
File.write('package.json', JSON.pretty_generate(target, indent: ' ', object_nl: "\n", array_nl: "\n"))
|
45
|
+
else
|
46
|
+
copy('package.json', 'config', '.')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def gemfile
|
51
|
+
#
|
52
|
+
es6 = "Please make sure the 'es6_import_export' branch is used for opal"
|
53
|
+
ulysses = "Please make sure the 'ulysses' branch is used for hyper-* gems"
|
54
|
+
# gem lines
|
55
|
+
c_lexer = "\ngem 'c_lexer'"
|
56
|
+
opal = "\ngem 'opal', github: 'janbiedermann/opal', branch: 'es6_import_export'"
|
57
|
+
auto = "\ngem 'opal-autoloader'"
|
58
|
+
owcs = "\ngem 'opal-webpack-compile-server', '~> 0.1.8', require: false"
|
59
|
+
store = "\ngem 'hyper-store', github: 'janbiedermann/hyper-store', branch: 'ulysses'"
|
60
|
+
component = "\ngem 'hyper-react', github: 'janbiedermann/hyper-react', branch: 'ulysses'"
|
61
|
+
|
62
|
+
if File.exist?('Gemfile')
|
63
|
+
content = File.read('Gemfile')
|
64
|
+
|
65
|
+
content << c_lexer unless defined?(CLexer)
|
66
|
+
unless defined?(Opal)
|
67
|
+
content << opal
|
68
|
+
content << owcs
|
69
|
+
else
|
70
|
+
puts es6
|
71
|
+
end
|
72
|
+
unless defined?(HyperStore)
|
73
|
+
content << store
|
74
|
+
else
|
75
|
+
puts
|
76
|
+
end
|
77
|
+
unless defined?(Hyperloop::Component)
|
78
|
+
content << component
|
79
|
+
else
|
80
|
+
puts ulysses
|
81
|
+
end
|
82
|
+
content << "\n"
|
83
|
+
File.write('Gemfile', content)
|
84
|
+
else
|
85
|
+
require 'bundler/cli'
|
86
|
+
require 'bundler/cli/init'
|
87
|
+
Bundler::CLI::Init.new({}).run
|
88
|
+
content = File.read('Gemfile')
|
89
|
+
content << "\ngem 'roda'"
|
90
|
+
content << "\ngem 'rake'"
|
91
|
+
content << "\ngem 'puma'"
|
92
|
+
content << c_lexer
|
93
|
+
content << opal
|
94
|
+
content << auto
|
95
|
+
content << owcs
|
96
|
+
content << store
|
97
|
+
content << component
|
98
|
+
content << "\n"
|
99
|
+
File.write('Gemfile', content)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# create directories for configuration and code
|
104
|
+
mkdir('assets')
|
105
|
+
mkdir('assets/stylesheets')
|
106
|
+
mkdir('public')
|
107
|
+
mkdir('webpack')
|
108
|
+
mkdir('hyperloop')
|
109
|
+
mkdir('hyperloop/components')
|
110
|
+
mkdir('hyperloop/models')
|
111
|
+
mkdir('hyperloop/stores')
|
112
|
+
puts
|
113
|
+
puts 'Webpack config:'
|
114
|
+
copy('production.js', 'config/webpack', 'webpack')
|
115
|
+
copy('development.js', 'config/webpack', 'webpack')
|
116
|
+
copy('test.js', 'config/webpack', 'webpack')
|
117
|
+
copy('cordova.js', 'config/webpack', 'webpack') if cordova
|
118
|
+
# copy('react-native.js', 'config/webpack', 'webpack') if react_native
|
119
|
+
puts
|
120
|
+
puts 'Application entry points:'
|
121
|
+
copy('app.js', 'config/entry', 'assets')
|
122
|
+
copy('cordova.js', 'config/entry', 'assets') if cordova
|
123
|
+
# copy('react-native.js', 'config/entry', 'assets') if react_native
|
124
|
+
puts
|
125
|
+
puts 'Procfile:'
|
126
|
+
copy('Procfile', 'config', '.')
|
127
|
+
puts
|
128
|
+
puts 'package.json:'
|
129
|
+
package_json
|
130
|
+
puts
|
131
|
+
puts 'Gemfile:'
|
132
|
+
gemfile
|
133
|
+
puts
|
134
|
+
puts 'Hyperloop loader:'
|
135
|
+
copy('hyperloop_webpack_loader.rb', 'config/hyperloop', 'hyperloop')
|
136
|
+
puts
|
137
|
+
puts 'Things to do:'
|
138
|
+
puts 'Please run:'
|
139
|
+
puts '1. yarn install'
|
140
|
+
puts '2. bundle install'
|
141
|
+
puts '3. Check Procfile if it starts the server you want'
|
142
|
+
puts '4. Add necessary requires to the server entry, e.g. config.ru:'
|
143
|
+
puts " require 'bundler'"
|
144
|
+
puts ' Bundler.require'
|
data/config/Procfile
ADDED
data/config/entry/app.js
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
// import stylesheets
|
2
|
+
// import '../assets/stylesheets/app.scss';
|
3
|
+
|
4
|
+
// basics for hyperloop
|
5
|
+
import React from 'react';
|
6
|
+
import ReactDOM from 'react-dom';
|
7
|
+
import * as History from 'history';
|
8
|
+
import * as ReactRouter from 'react-router';
|
9
|
+
import * as ReactRouterDOM from 'react-router-dom';
|
10
|
+
|
11
|
+
// for opal/hyperloop modules to find React and others they must explicitly be saved
|
12
|
+
// to the global space, otherwise webpack will encapsulate them locally here
|
13
|
+
global.React = React;
|
14
|
+
global.ReactDOM = ReactDOM;
|
15
|
+
global.History = History;
|
16
|
+
global.ReactRouter = ReactRouter;
|
17
|
+
global.ReactRouterDOM = ReactRouterDOM;
|
18
|
+
|
19
|
+
// for lazy loading
|
20
|
+
// import ReactLoadable from 'react-loadable';
|
21
|
+
// global.ReactLoadable = ReactLoadable;
|
22
|
+
|
23
|
+
// example for importing a component framework
|
24
|
+
// import * as Sem from 'semantic-ui-react';
|
25
|
+
// global.Sem = Sem;
|
26
|
+
|
27
|
+
// sometime accessing the .default is necessary
|
28
|
+
// import * as React_TimeAgo from 'react-timeago';
|
29
|
+
// global.ReactTimeAgo = React_TimeAgo.default;
|
30
|
+
|
31
|
+
// example for pusher
|
32
|
+
// import Pusher from 'pusher-js';
|
33
|
+
// global.Pusher = Pusher;
|
34
|
+
|
35
|
+
// all the hyperloop requires go in this file
|
36
|
+
// it needs to be imported first
|
37
|
+
import init_app from 'hyperloop_webpack_loader.rb';
|
38
|
+
// then it needs to initalized, this will register the available opal ruby modules
|
39
|
+
init_app();
|
40
|
+
// then it needs to be loaded, this will actually run the code and start the application
|
41
|
+
Opal.require('hyperloop_webpack_loader');
|
42
|
+
|
43
|
+
// this is required for hot reloading to work
|
44
|
+
if (module.hot) {
|
45
|
+
module.hot.accept('./app.js', function() {
|
46
|
+
console.log('Accepting the updated app_packs module!');
|
47
|
+
})
|
48
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
// import stylesheets
|
2
|
+
import '../assets/stylesheets/app.scss';
|
3
|
+
|
4
|
+
// basics for hyperloop
|
5
|
+
import React from 'react';
|
6
|
+
import ReactDOM from 'react-dom';
|
7
|
+
import * as History from 'history';
|
8
|
+
import * as ReactRouter from 'react-router';
|
9
|
+
import * as ReactRouterDOM from 'react-router-dom';
|
10
|
+
|
11
|
+
// for opal/hyperloop modules to find React and others they must explicitly be saved
|
12
|
+
// to the global space, otherwise webpack will encapsulate them locally here
|
13
|
+
global.React = React;
|
14
|
+
global.ReactDOM = ReactDOM;
|
15
|
+
global.History = History;
|
16
|
+
global.ReactRouter = ReactRouter;
|
17
|
+
global.ReactRouterDOM = ReactRouterDOM;
|
18
|
+
|
19
|
+
// for lazy laoding
|
20
|
+
// import * as ReactRailsUJS from 'react_ujs';
|
21
|
+
// global.ReactLoadable = ReactLoadable;
|
22
|
+
|
23
|
+
// example for importing a component framework
|
24
|
+
// import * as Sem from 'semantic-ui-react';
|
25
|
+
// global.Sem = Sem;
|
26
|
+
|
27
|
+
// sometime accessing the .default is necessary
|
28
|
+
// import * as React_TimeAgo from 'react-timeago';
|
29
|
+
// global.ReactTimeAgo = React_TimeAgo.default;
|
30
|
+
|
31
|
+
// example for pusher
|
32
|
+
// import Pusher from 'pusher-js';
|
33
|
+
// global.Pusher = Pusher;
|
34
|
+
|
35
|
+
// set global Cordova, this allows for:
|
36
|
+
// if `Cordova == true`
|
37
|
+
// # ON CORDOVA APP
|
38
|
+
// else
|
39
|
+
// # ON WEBSITE
|
40
|
+
// end
|
41
|
+
global.Cordova = true;
|
42
|
+
|
43
|
+
// all the hyperloop requires go in this file
|
44
|
+
// it needs to be imported first
|
45
|
+
import init_app from 'hyperloop_webpack_loader.rb';
|
46
|
+
// then it needs to initalized, this will register the available opal ruby modules
|
47
|
+
init_app();
|
48
|
+
// then it needs to be loaded, this will actually run the code and start the application
|
49
|
+
Opal.require('hyperloop_webpack_loader');
|
50
|
+
|
51
|
+
// this is required for hot reloading to work
|
52
|
+
if (module.hot) {
|
53
|
+
module.hot.accept('./app.js', function() {
|
54
|
+
console.log('Accepting the updated app_packs module!');
|
55
|
+
})
|
56
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'opal'
|
2
|
+
require 'browser' # CLIENT ONLY
|
3
|
+
require 'browser/delay' # CLIENT ONLY
|
4
|
+
require 'opal-autoloader'
|
5
|
+
require 'hyper-store'
|
6
|
+
require 'hyper-react'
|
7
|
+
require 'react/auto-import'
|
8
|
+
|
9
|
+
require_tree 'stores'
|
10
|
+
require_tree 'models'
|
11
|
+
require_tree 'components'
|
12
|
+
|
13
|
+
# mount your top level component
|
14
|
+
# Hyperloop::TopLevel.on_ready_mount(App)
|
data/config/package.json
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"engines": {
|
3
|
+
"node": "^10.4.0",
|
4
|
+
"yarn": "^1.7.0"
|
5
|
+
},
|
6
|
+
"dependencies": {
|
7
|
+
"history": "^4.7.2",
|
8
|
+
"react": "^16.3.2",
|
9
|
+
"react-dom": "^16.3.2",
|
10
|
+
"react-loadable": "^5.4.0",
|
11
|
+
"react-router": "^4.2.0",
|
12
|
+
"react-router-dom": "^4.2.2"
|
13
|
+
},
|
14
|
+
"scripts": {
|
15
|
+
"test": "bundle exec opal-webpack-compile-server kill; bundle exec opal-webpack-compile-server && webpack --config=webpack/test.js; bundle exec opal-webpack-compile-server kill",
|
16
|
+
"watch": "bundle exec opal-webpack-compile-server kill; bundle exec opal-webpack-compile-server && webpack --watch; bundle exec opal-webpack-compile-server kill",
|
17
|
+
"start": "bundle exec opal-webpack-compile-server kill; bundle exec opal-webpack-compile-server && bundle exec webpack-serve --config ./webpack/development.js; bundle exec opal-webpack-compile-server kill",
|
18
|
+
"build": "bundle exec opal-webpack-compile-server kill; bundle exec opal-webpack-compile-server && webpack --config=webpack/production.js; bundle exec opal-webpack-compile-server kill",
|
19
|
+
"cordova": "bundle exec opal-webpack-compile-server kill; bundle exec opal-webpack-compile-server && webpack --config=webpack/cordova.js; bundle exec opal-webpack-compile-server kill"
|
20
|
+
},
|
21
|
+
"devDependencies": {
|
22
|
+
"chokidar": "^2.0.3",
|
23
|
+
"compression-webpack-plugin": "^1.1.11",
|
24
|
+
"css-loader": "^0.28.11",
|
25
|
+
"file-loader": "^1.1.11",
|
26
|
+
"json-stringify-safe": "^5.0.1",
|
27
|
+
"node-sass": "^4.9.0",
|
28
|
+
"opal-webpack-loader": "^0.2.0",
|
29
|
+
"opal-webpack-resolver-plugin": "^0.1.0",
|
30
|
+
"sass-loader": "^7.0.3",
|
31
|
+
"style-loader": "^0.21.0",
|
32
|
+
"webpack": "^4.11.1",
|
33
|
+
"webpack-cli": "^3.0.2",
|
34
|
+
"webpack-manifest-plugin": "^2.0.3",
|
35
|
+
"webpack-serve": "^1.0.2"
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const OpalWebpackResolverPlugin = require('opal-webpack-resolver-plugin');
|
3
|
+
|
4
|
+
module.exports = {
|
5
|
+
context: path.resolve(__dirname, '../..'),
|
6
|
+
mode: "production",
|
7
|
+
optimization: {
|
8
|
+
minimize: false
|
9
|
+
},
|
10
|
+
performance: {
|
11
|
+
maxAssetSize: 20000000,
|
12
|
+
maxEntrypointSize: 20000000
|
13
|
+
},
|
14
|
+
entry: {
|
15
|
+
cordova: './assets/cordova.js'
|
16
|
+
},
|
17
|
+
output: {
|
18
|
+
filename: 'app.js',
|
19
|
+
path: path.resolve(__dirname, '../cordova/www/js/app'),
|
20
|
+
publicPath: '/js/app/'
|
21
|
+
},
|
22
|
+
resolve: {
|
23
|
+
plugins: [
|
24
|
+
new OpalWebpackResolverPlugin('resolve', 'resolved')
|
25
|
+
]
|
26
|
+
},
|
27
|
+
module: {
|
28
|
+
rules: [
|
29
|
+
{
|
30
|
+
test: /\.scss$/,
|
31
|
+
use: [
|
32
|
+
{
|
33
|
+
loader: "style-loader",
|
34
|
+
options: {
|
35
|
+
hmr: false
|
36
|
+
}
|
37
|
+
},
|
38
|
+
{
|
39
|
+
loader: "css-loader"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
loader: "sass-loader",
|
43
|
+
options: {
|
44
|
+
includePath: [
|
45
|
+
path.resolve(__dirname, './assets')
|
46
|
+
]
|
47
|
+
}
|
48
|
+
}
|
49
|
+
]
|
50
|
+
},
|
51
|
+
{
|
52
|
+
test: /\.css$/,
|
53
|
+
use: [
|
54
|
+
'style-loader',
|
55
|
+
'css-loader'
|
56
|
+
]
|
57
|
+
},
|
58
|
+
{
|
59
|
+
test: /\.(png|svg|jpg|gif)$/,
|
60
|
+
use: [
|
61
|
+
'file-loader'
|
62
|
+
]
|
63
|
+
},
|
64
|
+
{
|
65
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/,
|
66
|
+
use: [
|
67
|
+
'file-loader'
|
68
|
+
]
|
69
|
+
},
|
70
|
+
{
|
71
|
+
test: /\.(rb|js.rb)$/,
|
72
|
+
use: [
|
73
|
+
'opal-webpack-loader'
|
74
|
+
]
|
75
|
+
}
|
76
|
+
]
|
77
|
+
}
|
78
|
+
};
|
@@ -0,0 +1,163 @@
|
|
1
|
+
// require requirements used below
|
2
|
+
const path = require('path');
|
3
|
+
const webpack = require('webpack');
|
4
|
+
const chokidar = require('chokidar'); // for watching app/view
|
5
|
+
const stringify = require('json-stringify-safe');
|
6
|
+
const WebSocket = require('ws');
|
7
|
+
const OpalWebpackResolverPlugin = require('opal-webpack-resolver-plugin'); // to resolve ruby files
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
context: path.resolve(__dirname, '..'),
|
11
|
+
mode: "development",
|
12
|
+
optimization: {
|
13
|
+
minimize: false // dont minimize in development, to speed up hot reloads
|
14
|
+
},
|
15
|
+
performance: {
|
16
|
+
maxAssetSize: 20000000, // hyperloop is a lot of code
|
17
|
+
maxEntrypointSize: 20000000
|
18
|
+
},
|
19
|
+
// use this or others below, disable for faster hot reloads
|
20
|
+
devtool: 'source-map', // this works well, good compromise between accuracy and performance
|
21
|
+
// devtool: 'cheap-eval-source-map', // less accurate
|
22
|
+
// devtool: 'inline-source-map', // slowest
|
23
|
+
// devtool: 'inline-cheap-source-map',
|
24
|
+
entry: {
|
25
|
+
app: ['./assets/app.js'], // entrypoint for hyperloop
|
26
|
+
// have to add 'webpack-hot-client/client' for each additional entry point for hot reloading to work
|
27
|
+
// website: ['webpack-hot-client/client', './assets/website.js'] // entrypoint for website
|
28
|
+
},
|
29
|
+
output: {
|
30
|
+
// webpack-serve keeps the output in memory
|
31
|
+
filename: '[name]_development.js',
|
32
|
+
path: path.resolve(__dirname, '../public/'),
|
33
|
+
publicPath: 'http://localhost:3035/'
|
34
|
+
},
|
35
|
+
resolve: {
|
36
|
+
plugins: [
|
37
|
+
// this makes it possible for webpack to find ruby files
|
38
|
+
new OpalWebpackResolverPlugin('resolve', 'resolved')
|
39
|
+
]
|
40
|
+
},
|
41
|
+
plugins: [
|
42
|
+
// both for hot reloading
|
43
|
+
new webpack.NamedModulesPlugin(),
|
44
|
+
new webpack.HotModuleReplacementPlugin()
|
45
|
+
],
|
46
|
+
module: {
|
47
|
+
rules: [
|
48
|
+
{
|
49
|
+
// loader for .scss files
|
50
|
+
// test means "test for for file endings"
|
51
|
+
test: /\.scss$/,
|
52
|
+
use: [
|
53
|
+
{
|
54
|
+
loader: "style-loader",
|
55
|
+
options: {
|
56
|
+
hmr: true
|
57
|
+
}
|
58
|
+
},
|
59
|
+
{
|
60
|
+
loader: "css-loader",
|
61
|
+
options: {
|
62
|
+
sourceMap: true, // set to false to speed up hot reloads
|
63
|
+
minimize: false // set to false to speed up hot reloads
|
64
|
+
}
|
65
|
+
},
|
66
|
+
{
|
67
|
+
loader: "sass-loader",
|
68
|
+
options: {
|
69
|
+
includePaths: [path.resolve(__dirname, '../assets')],
|
70
|
+
sourceMap: true // set to false to speed up hot reloads
|
71
|
+
}
|
72
|
+
}
|
73
|
+
]
|
74
|
+
},
|
75
|
+
{
|
76
|
+
// loader for .css files
|
77
|
+
test: /\.css$/,
|
78
|
+
use: [
|
79
|
+
{
|
80
|
+
loader: "style-loader",
|
81
|
+
options: {
|
82
|
+
hmr: true
|
83
|
+
}
|
84
|
+
},
|
85
|
+
{
|
86
|
+
loader: "css-loader",
|
87
|
+
options: {
|
88
|
+
sourceMap: true, // set to false to speed up hot reloads
|
89
|
+
minimize: false // set to false to speed up hot reloads
|
90
|
+
}
|
91
|
+
}
|
92
|
+
]
|
93
|
+
},
|
94
|
+
{
|
95
|
+
test: /\.(png|svg|jpg|gif)$/,
|
96
|
+
use: [
|
97
|
+
'file-loader'
|
98
|
+
]
|
99
|
+
},
|
100
|
+
{
|
101
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/,
|
102
|
+
use: [
|
103
|
+
'file-loader'
|
104
|
+
]
|
105
|
+
},
|
106
|
+
{
|
107
|
+
// opal-webpack-loader will compile and include ruby files in the pack
|
108
|
+
test: /\.(rb|js.rb)$/,
|
109
|
+
use: [
|
110
|
+
'opal-webpack-loader'
|
111
|
+
]
|
112
|
+
}
|
113
|
+
]
|
114
|
+
},
|
115
|
+
// configuration for webpack serve
|
116
|
+
serve: {
|
117
|
+
dev: {
|
118
|
+
publicPath: '/',
|
119
|
+
headers: {
|
120
|
+
'Access-Control-Allow-Origin': '*'
|
121
|
+
},
|
122
|
+
watchOptions: {
|
123
|
+
|
124
|
+
}
|
125
|
+
},
|
126
|
+
hot: {
|
127
|
+
host: 'localhost',
|
128
|
+
port: '8081',
|
129
|
+
allEntries: true, // this doesn't seem to work
|
130
|
+
hmr: true
|
131
|
+
},
|
132
|
+
host: "localhost",
|
133
|
+
port: 3035,
|
134
|
+
content: path.resolve(__dirname, '../public'),
|
135
|
+
clipboard: false, // dont copy url to clipboard
|
136
|
+
open: false, // dont open browser
|
137
|
+
on: {
|
138
|
+
// this configuration is for triggering a hot reload for views
|
139
|
+
"listening": function (server) {
|
140
|
+
const socket = new WebSocket('ws://localhost:8081');
|
141
|
+
const watchPath = path.resolve(__dirname, '../views'); // adjust path here if needed
|
142
|
+
const options = {};
|
143
|
+
const watcher = chokidar.watch(watchPath, options);
|
144
|
+
|
145
|
+
watcher.on('change', () => {
|
146
|
+
const data = {
|
147
|
+
type: 'broadcast',
|
148
|
+
data: {
|
149
|
+
type: 'window-reload',
|
150
|
+
data: {},
|
151
|
+
},
|
152
|
+
};
|
153
|
+
|
154
|
+
socket.send(stringify(data));
|
155
|
+
});
|
156
|
+
|
157
|
+
server.server.on('close', () => {
|
158
|
+
watcher.close();
|
159
|
+
});
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
};
|
@@ -0,0 +1,86 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const OpalWebpackResolverPlugin = require('opal-webpack-resolver-plugin');
|
3
|
+
const CompressionPlugin = require("compression-webpack-plugin"); // for gzipping the packs
|
4
|
+
const ManifestPlugin = require('webpack-manifest-plugin'); // for generating the manifest
|
5
|
+
|
6
|
+
module.exports = {
|
7
|
+
context: path.resolve(__dirname, '..'),
|
8
|
+
mode: "production",
|
9
|
+
optimization: {
|
10
|
+
minimize: true // minimize
|
11
|
+
},
|
12
|
+
performance: {
|
13
|
+
maxAssetSize: 20000000, // hyperloop generates a lot of code
|
14
|
+
maxEntrypointSize: 20000000
|
15
|
+
},
|
16
|
+
entry: {
|
17
|
+
app: './assets/app.js',
|
18
|
+
},
|
19
|
+
plugins: [
|
20
|
+
new CompressionPlugin({ test: /\.js/ }), // gzip compress
|
21
|
+
new ManifestPlugin() // generate manifest
|
22
|
+
],
|
23
|
+
output: {
|
24
|
+
filename: '[name]-[chunkhash].js', // include fingerprint in file name, so browsers get the latest
|
25
|
+
path: path.resolve(__dirname, '../public'),
|
26
|
+
publicPath: '/'
|
27
|
+
},
|
28
|
+
resolve: {
|
29
|
+
plugins: [
|
30
|
+
// resolve ruby files
|
31
|
+
new OpalWebpackResolverPlugin('resolve', 'resolved')
|
32
|
+
]
|
33
|
+
},
|
34
|
+
module: {
|
35
|
+
rules: [
|
36
|
+
{
|
37
|
+
test: /\.scss$/,
|
38
|
+
use: [
|
39
|
+
{
|
40
|
+
loader: "style-loader",
|
41
|
+
options: {
|
42
|
+
hmr: false
|
43
|
+
}
|
44
|
+
},
|
45
|
+
{
|
46
|
+
loader: "css-loader"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
loader: "sass-loader",
|
50
|
+
options: {
|
51
|
+
includePath: [
|
52
|
+
path.resolve(__dirname, '../assets')
|
53
|
+
]
|
54
|
+
}
|
55
|
+
}
|
56
|
+
]
|
57
|
+
},
|
58
|
+
{
|
59
|
+
test: /\.css$/,
|
60
|
+
use: [
|
61
|
+
'style-loader',
|
62
|
+
'css-loader'
|
63
|
+
]
|
64
|
+
},
|
65
|
+
{
|
66
|
+
test: /\.(png|svg|jpg|gif)$/,
|
67
|
+
use: [
|
68
|
+
'file-loader'
|
69
|
+
]
|
70
|
+
},
|
71
|
+
{
|
72
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/,
|
73
|
+
use: [
|
74
|
+
'file-loader'
|
75
|
+
]
|
76
|
+
},
|
77
|
+
{
|
78
|
+
// compile and load ruby files
|
79
|
+
test: /\.(rb|js.rb)$/,
|
80
|
+
use: [
|
81
|
+
'opal-webpack-loader'
|
82
|
+
]
|
83
|
+
}
|
84
|
+
]
|
85
|
+
}
|
86
|
+
};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const OpalWebpackResolverPlugin = require('opal-webpack-resolver-plugin');
|
3
|
+
|
4
|
+
module.exports = {
|
5
|
+
context: path.resolve(__dirname, '..'),
|
6
|
+
mode: "test",
|
7
|
+
optimization: {
|
8
|
+
minimize: false
|
9
|
+
},
|
10
|
+
performance: {
|
11
|
+
maxAssetSize: 20000000,
|
12
|
+
maxEntrypointSize: 20000000
|
13
|
+
},
|
14
|
+
entry: {
|
15
|
+
app: './assets/app.js',
|
16
|
+
},
|
17
|
+
output: {
|
18
|
+
filename: '[name]_test.js',
|
19
|
+
path: path.resolve(__dirname, '../public'),
|
20
|
+
publicPath: '/'
|
21
|
+
},
|
22
|
+
resolve: {
|
23
|
+
plugins: [
|
24
|
+
new OpalWebpackResolverPlugin('resolve', 'resolved')
|
25
|
+
]
|
26
|
+
},
|
27
|
+
module: {
|
28
|
+
rules: [
|
29
|
+
{
|
30
|
+
test: /\.scss$/,
|
31
|
+
use: [
|
32
|
+
{ loader: "style-loader" },
|
33
|
+
{ loader: "css-loader" },
|
34
|
+
{
|
35
|
+
loader: "sass-loader",
|
36
|
+
options: {
|
37
|
+
includePaths: [path.resolve(__dirname, '../assets')]
|
38
|
+
}
|
39
|
+
}
|
40
|
+
]
|
41
|
+
},
|
42
|
+
{
|
43
|
+
test: /\.css$/,
|
44
|
+
use: [
|
45
|
+
'style-loader',
|
46
|
+
'css-loader'
|
47
|
+
]
|
48
|
+
},
|
49
|
+
{
|
50
|
+
test: /\.(png|svg|jpg|gif)$/,
|
51
|
+
use: [
|
52
|
+
'file-loader'
|
53
|
+
]
|
54
|
+
},
|
55
|
+
{
|
56
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/,
|
57
|
+
use: [
|
58
|
+
'file-loader'
|
59
|
+
]
|
60
|
+
},
|
61
|
+
{
|
62
|
+
test: /\.(rb|js.rb)$/,
|
63
|
+
use: [
|
64
|
+
'opal-webpack-loader'
|
65
|
+
]
|
66
|
+
}
|
67
|
+
]
|
68
|
+
}
|
69
|
+
};
|
70
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'lib/hyper-backend-roda/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'hyper-backend-roda'
|
5
|
+
s.version = HyperBackendRoda::VERSION
|
6
|
+
s.author = 'Jan Biedermann'
|
7
|
+
s.email = 'jan@kursator.de'
|
8
|
+
s.homepage = 'https://github.com/hyperstack-org/hyper-backend-roda'
|
9
|
+
s.summary = 'Backend support for using hyper-stack with roda'
|
10
|
+
s.description = "Write Browser Apps that transparently access server side resources like 'MyModel.first_name', with ease"
|
11
|
+
s.license = 'MIT'
|
12
|
+
|
13
|
+
s.executables << 'roda-hyper-it-make'
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
|
18
|
+
s.add_runtime_dependency 'bundler', '~> 1.16', '>= 1.16.0'
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hyper-backend-roda
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan Biedermann
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.16.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.16'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.16.0
|
33
|
+
description: Write Browser Apps that transparently access server side resources like
|
34
|
+
'MyModel.first_name', with ease
|
35
|
+
email: jan@kursator.de
|
36
|
+
executables:
|
37
|
+
- roda-hyper-it-make
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- Gemfile
|
42
|
+
- LICENSE
|
43
|
+
- README.md
|
44
|
+
- bin/roda-hyper-it-make
|
45
|
+
- config/Procfile
|
46
|
+
- config/entry/app.js
|
47
|
+
- config/entry/cordova.js
|
48
|
+
- config/hyperloop/hyperloop_webpack_loader.rb
|
49
|
+
- config/package.json
|
50
|
+
- config/webpack/cordova.js
|
51
|
+
- config/webpack/development.js
|
52
|
+
- config/webpack/production.js
|
53
|
+
- config/webpack/test.js
|
54
|
+
- hyper-backend-roda.gemspec
|
55
|
+
- lib/hyper-backend-roda/version.rb
|
56
|
+
homepage: https://github.com/hyperstack-org/hyper-backend-roda
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.7.6
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Backend support for using hyper-stack with roda
|
80
|
+
test_files: []
|