hyper-be-roda 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -0
- data/LICENSE +21 -0
- data/README.md +11 -0
- data/bin/roda-hyper-it-make +135 -0
- data/config/Procfile +2 -0
- data/config/entry/app.js +48 -0
- data/config/entry/cordova.js +56 -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-be-roda.gemspec +19 -0
- data/lib/hyper-be-roda/version.rb +3 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 671095fe79f3d44eaf267a443711ded029229f8a54d951401c33f36333f515d8
|
4
|
+
data.tar.gz: a1830537b591254ee3a4aa9c15fe31fd6ecc0742b9d129426536eeaf3bb08df2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: afce2d2d95c80de80886845f3113dc1351a5c632e1089823169966c459efb22df1934a41062c044805c1c503f4cc19a1265146aff2af77e2f41ad49cafa221fc
|
7
|
+
data.tar.gz: beeeecedf5a4f3f9ec2bed4a6eaa5d035cd9c2b86ece85d4ba2dac46288ac9688d0bfddf28eae31943cbb1cd40f14215ace16702a713b5c018b42c49810e60f6
|
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,11 @@
|
|
1
|
+
# roda-be-hyper
|
2
|
+
|
3
|
+
Server side configuration and helpers for using hyper-stack with roda
|
4
|
+
|
5
|
+
## usage
|
6
|
+
`roda-hyper-it-make` - will setup a roda project with the necessary configuration
|
7
|
+
|
8
|
+
options:
|
9
|
+
|
10
|
+
`roda-hyper-it-make cordova` in addition to the web setup, install config for cordova
|
11
|
+
`roda-hyper-it-make react-native` in addition to the web setup, install config for react-native (not implemented yet)
|
@@ -0,0 +1,135 @@
|
|
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
|
+
owcs = "\ngem 'opal-webpack-compile-server', '0.1.7', require: false"
|
58
|
+
store = "\ngem 'hyper-store', github: 'janbiedermann/hyper-store', branch: 'ulysses'"
|
59
|
+
component = "\ngem 'hyper-component', github: 'janbiedermann/hyper-react', branch: 'ulysses'"
|
60
|
+
|
61
|
+
if File.exist?('Gemfile')
|
62
|
+
content = File.read('Gemfile')
|
63
|
+
|
64
|
+
content << c_lexer unless defined?(CLexer)
|
65
|
+
unless defined?(Opal)
|
66
|
+
content << opal
|
67
|
+
content << owcs
|
68
|
+
else
|
69
|
+
puts es6
|
70
|
+
end
|
71
|
+
unless defined?(HyperStore)
|
72
|
+
content << store
|
73
|
+
else
|
74
|
+
puts
|
75
|
+
end
|
76
|
+
unless defined?(Hyperloop::Component)
|
77
|
+
content << component
|
78
|
+
else
|
79
|
+
puts ulysses
|
80
|
+
end
|
81
|
+
content << "\n"
|
82
|
+
File.write('Gemfile', content)
|
83
|
+
else
|
84
|
+
require 'bundler/cli'
|
85
|
+
require 'bundler/cli/init'
|
86
|
+
Bundler::CLI::Init.new({}).run
|
87
|
+
content = File.read('Gemfile')
|
88
|
+
content << "\ngem 'roda'"
|
89
|
+
content << "\ngem 'rake'"
|
90
|
+
content << "\ngem 'puma'"
|
91
|
+
content << c_lexer
|
92
|
+
content << opal
|
93
|
+
content << owcs
|
94
|
+
content << store
|
95
|
+
content << component
|
96
|
+
content << "\n"
|
97
|
+
File.write('Gemfile', content)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# create directories for configuration and code
|
102
|
+
mkdir('assets')
|
103
|
+
mkdir('public')
|
104
|
+
mkdir('webpack')
|
105
|
+
mkdir('hyperloop')
|
106
|
+
puts
|
107
|
+
puts 'Webpack config:'
|
108
|
+
copy('production.js', 'config/webpack', 'webpack')
|
109
|
+
copy('development.js', 'config/webpack', 'webpack')
|
110
|
+
copy('test.js', 'config/webpack', 'webpack')
|
111
|
+
copy('cordova.js', 'config/webpack', 'webpack') if cordova
|
112
|
+
# copy('react-native.js', 'config/webpack', 'webpack') if react_native
|
113
|
+
puts
|
114
|
+
puts 'Application entry points:'
|
115
|
+
copy('app.js', 'config/entry', 'assets')
|
116
|
+
copy('cordova.js', 'config/entry', 'assets') if cordova
|
117
|
+
# copy('react-native.js', 'config/entry', 'assets') if react_native
|
118
|
+
puts
|
119
|
+
puts 'Procfile:'
|
120
|
+
copy('Procfile', 'config', '.')
|
121
|
+
puts
|
122
|
+
puts 'package.json:'
|
123
|
+
package_json
|
124
|
+
puts
|
125
|
+
puts 'Gemfile:'
|
126
|
+
gemfile
|
127
|
+
puts
|
128
|
+
puts 'Things to do:'
|
129
|
+
puts 'Please run:'
|
130
|
+
puts '1. yarn install'
|
131
|
+
puts '2. bundle install'
|
132
|
+
puts '3. Check Procfile if it starts the server you want'
|
133
|
+
puts '4. Add necessary requires to the server entry, e.g. config.ru:'
|
134
|
+
puts " require 'bundler'"
|
135
|
+
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
|
+
}
|
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-be-roda/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'hyper-be-roda'
|
5
|
+
s.version = HyperBeRoda::VERSION
|
6
|
+
s.author = 'Jan Biedermann'
|
7
|
+
s.email = 'jan@kursator.de'
|
8
|
+
s.homepage = 'https://github.com/janbiedermann/hyper-be-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,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hyper-be-roda
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan Biedermann
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-20 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/package.json
|
49
|
+
- config/webpack/cordova.js
|
50
|
+
- config/webpack/development.js
|
51
|
+
- config/webpack/production.js
|
52
|
+
- config/webpack/test.js
|
53
|
+
- hyper-be-roda.gemspec
|
54
|
+
- lib/hyper-be-roda/version.rb
|
55
|
+
homepage: https://github.com/janbiedermann/hyper-be-roda
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.7.6
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Backend support for using hyper-stack with roda
|
79
|
+
test_files: []
|