isomorfeus-installer 1.0.0.epsilon1 → 1.0.0.epsilon2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/isomorfeus +1 -1
- data/lib/isomorfeus/installer/cli.rb +13 -1
- data/lib/isomorfeus/installer/new_project.rb +7 -12
- data/lib/isomorfeus/installer/options_mangler.rb +2 -0
- data/lib/isomorfeus/installer/templates/Gemfile.erb +6 -6
- data/lib/isomorfeus/installer/templates/app.rb.erb +4 -4
- data/lib/isomorfeus/installer/templates/debug.js.erb +135 -0
- data/lib/isomorfeus/installer/templates/development.js.erb +116 -0
- data/lib/isomorfeus/installer/templates/isomorfeus_loader.rb.erb +3 -3
- data/lib/isomorfeus/installer/templates/package.json.erb +4 -1
- data/lib/isomorfeus/installer/templates/production.js.erb +84 -0
- data/lib/isomorfeus/installer/templates/spec_helper.rb.erb +0 -1
- data/lib/isomorfeus/installer/version.rb +1 -1
- data/lib/isomorfeus/installer.rb +35 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08896fbcd932ba150cd01138d9ed2c8e72aea9fa35b82eea8bf158a964dcc5d4'
|
4
|
+
data.tar.gz: 1f2d2b698199fc476937651d158c1587f145db2b35b684d1d311c540ed6deeb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d5d55a002f4f234465134748f531246c2012a8015d7a3a6bed0af9be14d0df4751b5c4d0cfb9d2d574b335ce555b975a2a3553d3f504e2c1ec39450725a6d46
|
7
|
+
data.tar.gz: 412c41e42c0fc3cbccdf4263021764b039e3f09288965d97d2b690461cd2d552451aece678f23a7bc14813074e8e34cf6c1f63298d496d0d54c5720a9f41413e
|
data/bin/isomorfeus
CHANGED
@@ -2,7 +2,7 @@ module Isomorfeus
|
|
2
2
|
module Installer
|
3
3
|
class CLI < Thor
|
4
4
|
|
5
|
-
desc "new project_name", "
|
5
|
+
desc "new project_name", "Create a new isomorfeus project with project_name."
|
6
6
|
option :rack_server, default: 'iodine', aliases: '-r',
|
7
7
|
desc: "Select rack server, one of: #{Isomorfeus::Installer.sorted_rack_servers.join(', ')}. (optional)"
|
8
8
|
option :yarn_and_bundle, default: true, required: false, type: :boolean, aliases: '-y', desc: "Execute yarn install and bundle install. (optional)"
|
@@ -11,6 +11,18 @@ module Isomorfeus
|
|
11
11
|
Isomorfeus::Installer.options = options
|
12
12
|
Isomorfeus::Installer::NewProject.execute(yarn_and_bundle: options[:yarn_and_bundle])
|
13
13
|
end
|
14
|
+
|
15
|
+
desc "test_app", "Create a test_app for internal framework tests."
|
16
|
+
option :module, required: true, type: :string, aliases: '-m', desc: "Isomorfeus module name for which to generate the test app, eg: 'i18n'. (required)"
|
17
|
+
option :source_dir, required: false, type: :string, aliases: '-s', desc: "Recursively copy files from source dir into app. (optional)"
|
18
|
+
option :rack_server, default: 'iodine', aliases: '-r',
|
19
|
+
desc: "Select rack server, one of: #{Isomorfeus::Installer.sorted_rack_servers.join(', ')}. (optional)"
|
20
|
+
option :yarn_and_bundle, default: true, required: false, type: :boolean, aliases: '-y', desc: "Execute yarn install and bundle install. (optional)"
|
21
|
+
def test_app
|
22
|
+
Isomorfeus::Installer.set_project_names('test_app')
|
23
|
+
Isomorfeus::Installer.options = options
|
24
|
+
Isomorfeus::Installer::NewProject.execute(yarn_and_bundle: options[:yarn_and_bundle])
|
25
|
+
end
|
14
26
|
end
|
15
27
|
end
|
16
28
|
end
|
@@ -4,28 +4,21 @@ require 'opal-webpack-loader/version'
|
|
4
4
|
module Isomorfeus
|
5
5
|
module Installer
|
6
6
|
class NewProject
|
7
|
-
attr_reader :installer
|
8
|
-
|
9
|
-
def self.installer
|
10
|
-
Isomorfeus::Installer
|
11
|
-
end
|
12
|
-
|
13
7
|
def self.execute(yarn_and_bundle: true)
|
14
8
|
begin
|
15
|
-
Dir.mkdir(
|
16
|
-
Dir.chdir(
|
9
|
+
Dir.mkdir(Isomorfeus::Installer.project_dir)
|
10
|
+
Dir.chdir(Isomorfeus::Installer.project_dir)
|
17
11
|
rescue
|
18
12
|
puts "Directory #{installer.project_dir} could not be created!"
|
19
13
|
exit 1
|
20
14
|
end
|
21
15
|
|
22
|
-
root = Dir.open('.')
|
23
|
-
|
24
16
|
begin
|
25
17
|
Isomorfeus::Installer.create_directories
|
26
18
|
Isomorfeus::Installer.install_framework
|
27
19
|
|
28
20
|
OpalWebpackLoader::Installer::CLI.start(['iso'])
|
21
|
+
Isomorfeus::Installer.install_webpack_config
|
29
22
|
|
30
23
|
Isomorfeus::Installer.install_styles
|
31
24
|
Isomorfeus::Installer.install_js_entries
|
@@ -38,11 +31,13 @@ module Isomorfeus
|
|
38
31
|
Isomorfeus::Installer.create_gemfile
|
39
32
|
Isomorfeus::Installer.create_procfile
|
40
33
|
|
34
|
+
Isomorfeus::Installer.copy_source_dir_files if Isomorfeus::Installer.source_dir
|
35
|
+
|
41
36
|
if yarn_and_bundle
|
42
37
|
puts 'Executing yarn install:'
|
43
|
-
system('yarn install')
|
38
|
+
system('env -i PATH=$PATH yarn install')
|
44
39
|
puts 'Executing bundle install:'
|
45
|
-
system('bundle install')
|
40
|
+
system('env -i PATH=$PATH bundle install')
|
46
41
|
end
|
47
42
|
|
48
43
|
Dir.chdir('..')
|
@@ -8,6 +8,8 @@ module Isomorfeus
|
|
8
8
|
else
|
9
9
|
Isomorfeus::Installer.rack_server = Isomorfeus::Installer.rack_servers['iodine']
|
10
10
|
end
|
11
|
+
Isomorfeus::Installer.source_dir = File.expand_path(options[:source_dir]) if options.key?(:source_dir)
|
12
|
+
Isomorfeus::Installer.isomorfeus_module = "isomorfeus-#{options[:module]}".to_sym if options.key?(:module)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -11,12 +11,12 @@ gem 'opal-activesupport', '~> 0.3.3'
|
|
11
11
|
gem 'opal-webpack-loader', '>= 0.9.2'
|
12
12
|
|
13
13
|
gem 'isomorfeus-redux', '~> 4.0.11'
|
14
|
-
gem 'isomorfeus-react', '>= 16.9.
|
15
|
-
gem 'isomorfeus-
|
16
|
-
gem 'isomorfeus-
|
17
|
-
gem 'isomorfeus-
|
18
|
-
gem 'isomorfeus-operation',
|
19
|
-
gem 'isomorfeus-
|
14
|
+
gem 'isomorfeus-react', '>= 16.9.4'
|
15
|
+
gem 'isomorfeus-policy', <%= isomorfeus_policy %>
|
16
|
+
gem 'isomorfeus-transport', <%= isomorfeus_transport %>
|
17
|
+
gem 'isomorfeus-data', <%= isomorfeus_data %>
|
18
|
+
gem 'isomorfeus-operation', <%= isomorfeus_operation %>
|
19
|
+
gem 'isomorfeus-i18n', <%= isomorfeus_i18n %>
|
20
20
|
|
21
21
|
group :development do
|
22
22
|
gem 'auto_reloader'
|
@@ -11,7 +11,7 @@ class <%= app_class %> < Roda
|
|
11
11
|
use_isomorfeus_middlewares
|
12
12
|
plugin :public, root: 'public'
|
13
13
|
|
14
|
-
def page_content(location)
|
14
|
+
def page_content(host, location)
|
15
15
|
<<~HTML
|
16
16
|
<html>
|
17
17
|
<head>
|
@@ -19,7 +19,7 @@ class <%= app_class %> < Roda
|
|
19
19
|
#{owl_script_tag 'application.js'}
|
20
20
|
</head>
|
21
21
|
<body>
|
22
|
-
#{mount_component('<%= app_class %>', location: location)}
|
22
|
+
#{mount_component('<%= app_class %>', location_host: host, location: location)}
|
23
23
|
</body>
|
24
24
|
</html>
|
25
25
|
HTML
|
@@ -27,7 +27,7 @@ class <%= app_class %> < Roda
|
|
27
27
|
|
28
28
|
route do |r|
|
29
29
|
r.root do
|
30
|
-
page_content('/')
|
30
|
+
page_content(env['HTTP_HOST'], '/')
|
31
31
|
end
|
32
32
|
|
33
33
|
r.public
|
@@ -37,7 +37,7 @@ class <%= app_class %> < Roda
|
|
37
37
|
end
|
38
38
|
|
39
39
|
r.get do
|
40
|
-
page_content(env['PATH_INFO'])
|
40
|
+
page_content(env['HTTP_HOST'], env['PATH_INFO'])
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const webpack = require('webpack');
|
3
|
+
const OwlResolver = require('opal-webpack-loader/resolver'); // to resolve ruby files
|
4
|
+
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin'); // to watch for added ruby files
|
5
|
+
|
6
|
+
const common_config = {
|
7
|
+
context: path.resolve(__dirname, '../isomorfeus'),
|
8
|
+
mode: "development",
|
9
|
+
optimization: {
|
10
|
+
removeAvailableModules: false,
|
11
|
+
removeEmptyChunks: false,
|
12
|
+
minimize: false // dont minimize for debugging
|
13
|
+
},
|
14
|
+
performance: {
|
15
|
+
maxAssetSize: 20000000,
|
16
|
+
maxEntrypointSize: 2000000
|
17
|
+
},
|
18
|
+
// use one of these below for source maps
|
19
|
+
devtool: 'source-map', // this works well, good compromise between accuracy and performance
|
20
|
+
// devtool: 'cheap-eval-source-map', // less accurate
|
21
|
+
// devtool: 'inline-source-map', // slowest
|
22
|
+
// devtool: 'inline-cheap-source-map',
|
23
|
+
output: {
|
24
|
+
filename: '[name].js',
|
25
|
+
path: path.resolve(__dirname, '../public/assets'),
|
26
|
+
publicPath: 'http://localhost:3035/assets/'
|
27
|
+
},
|
28
|
+
resolve: {
|
29
|
+
plugins: [new OwlResolver('resolve', 'resolved')], // this makes it possible for webpack to find ruby files
|
30
|
+
alias: {
|
31
|
+
'react-dom': 'react-dom/profiling',
|
32
|
+
'schedule/tracing': 'schedule/tracing-profiling',
|
33
|
+
}
|
34
|
+
},
|
35
|
+
plugins: [
|
36
|
+
// both for hot reloading
|
37
|
+
new webpack.NamedModulesPlugin(),
|
38
|
+
new webpack.HotModuleReplacementPlugin(),
|
39
|
+
// watch for added files in opal dir
|
40
|
+
new ExtraWatchWebpackPlugin({ dirs: [path.resolve(__dirname, '../isomorfeus')] })
|
41
|
+
],
|
42
|
+
module: {
|
43
|
+
rules: [
|
44
|
+
{
|
45
|
+
test: /.scss$/,
|
46
|
+
use: [ "cache-loader", "style-loader",
|
47
|
+
{
|
48
|
+
loader: "css-loader",
|
49
|
+
options: { sourceMap: true }
|
50
|
+
},
|
51
|
+
{
|
52
|
+
loader: "sass-loader",
|
53
|
+
options: {
|
54
|
+
includePaths: [path.resolve(__dirname, '../isomorfeus/styles')],
|
55
|
+
sourceMap: true // set to false to speed up hot reloads
|
56
|
+
}
|
57
|
+
}
|
58
|
+
]
|
59
|
+
},
|
60
|
+
{
|
61
|
+
test: /.css$/,
|
62
|
+
use: [ "cache-loader", "style-loader",
|
63
|
+
{
|
64
|
+
loader: "css-loader",
|
65
|
+
options: { sourceMap: true }
|
66
|
+
}
|
67
|
+
]
|
68
|
+
},
|
69
|
+
{
|
70
|
+
test: /.(png|svg|jpg|gif|woff|woff2|eot|ttf|otf)$/,
|
71
|
+
use: [ "cache-loader", "file-loader" ]
|
72
|
+
},
|
73
|
+
{
|
74
|
+
test: /.(rb|js.rb)$/,
|
75
|
+
use: [ "cache-loader",
|
76
|
+
{
|
77
|
+
loader: 'opal-webpack-loader', // opal-webpack-loader will compile and include ruby files in the pack
|
78
|
+
options: {
|
79
|
+
sourceMap: true,
|
80
|
+
hmr: true,
|
81
|
+
hmrHook: 'Opal.Isomorfeus.$force_render()'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
]
|
85
|
+
}
|
86
|
+
]
|
87
|
+
},
|
88
|
+
// configuration for webpack-dev-server
|
89
|
+
devServer: {
|
90
|
+
open: false,
|
91
|
+
lazy: false,
|
92
|
+
port: 3035,
|
93
|
+
hot: true,
|
94
|
+
// hotOnly: true,
|
95
|
+
inline: true,
|
96
|
+
https: false,
|
97
|
+
disableHostCheck: true,
|
98
|
+
headers: {
|
99
|
+
"Access-Control-Allow-Origin": "*",
|
100
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
101
|
+
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
|
102
|
+
},
|
103
|
+
watchOptions: {
|
104
|
+
// in case of problems with hot reloading uncomment the following two lines:
|
105
|
+
// aggregateTimeout: 250,
|
106
|
+
// poll: 50,
|
107
|
+
ignored: /\bnode_modules\b/
|
108
|
+
},
|
109
|
+
contentBase: path.resolve(__dirname, 'public'),
|
110
|
+
useLocalIp: false
|
111
|
+
}
|
112
|
+
};
|
113
|
+
|
114
|
+
const browser_config = {
|
115
|
+
target: 'web',
|
116
|
+
entry: { application: [path.resolve(__dirname, '../isomorfeus/imports/application.js')] },
|
117
|
+
externals: { crypto: 'Crypto' }
|
118
|
+
};
|
119
|
+
|
120
|
+
const ssr_config = {
|
121
|
+
target: 'node',
|
122
|
+
entry: { application_ssr: [path.resolve(__dirname, '../isomorfeus/imports/application_ssr.js')] }
|
123
|
+
};
|
124
|
+
|
125
|
+
const web_worker_config = {
|
126
|
+
target: 'webworker',
|
127
|
+
entry: { web_worker: [path.resolve(__dirname, '../isomorfeus/imports/application_web_worker.js')] },
|
128
|
+
externals: { crypto: 'Crypto' }
|
129
|
+
};
|
130
|
+
|
131
|
+
const browser = Object.assign({}, common_config, browser_config);
|
132
|
+
const ssr = Object.assign({}, common_config, ssr_config);
|
133
|
+
const web_worker = Object.assign({}, common_config, web_worker_config);
|
134
|
+
|
135
|
+
module.exports = [ browser, ssr ];
|
@@ -0,0 +1,116 @@
|
|
1
|
+
// require requirements used below
|
2
|
+
const path = require('path');
|
3
|
+
const webpack = require('webpack');
|
4
|
+
const OwlResolver = require('opal-webpack-loader/resolver'); // to resolve ruby files
|
5
|
+
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin'); // to watch for added ruby files
|
6
|
+
|
7
|
+
const common_config = {
|
8
|
+
context: path.resolve(__dirname, '../isomorfeus'),
|
9
|
+
mode: "development",
|
10
|
+
optimization: {
|
11
|
+
removeAvailableModules: false,
|
12
|
+
removeEmptyChunks: false,
|
13
|
+
minimize: false // dont minimize in development, to speed up hot reloads
|
14
|
+
},
|
15
|
+
performance: {
|
16
|
+
maxAssetSize: 20000000,
|
17
|
+
maxEntrypointSize: 2000000
|
18
|
+
},
|
19
|
+
output: {
|
20
|
+
filename: '[name].js',
|
21
|
+
path: path.resolve(__dirname, '../public/assets'),
|
22
|
+
publicPath: 'http://localhost:3035/assets/'
|
23
|
+
},
|
24
|
+
resolve: { plugins: [new OwlResolver('resolve', 'resolved')] }, // resolve ruby files
|
25
|
+
plugins: [
|
26
|
+
// both for hot reloading
|
27
|
+
new webpack.NamedModulesPlugin(),
|
28
|
+
new webpack.HotModuleReplacementPlugin(),
|
29
|
+
// watch for added files in opal dir
|
30
|
+
new ExtraWatchWebpackPlugin({ dirs: [ path.resolve(__dirname, '../isomorfeus') ] })
|
31
|
+
],
|
32
|
+
module: {
|
33
|
+
rules: [
|
34
|
+
{
|
35
|
+
test: /.scss$/,
|
36
|
+
use: [ "cache-loader", "style-loader" , "css-loader",
|
37
|
+
{
|
38
|
+
loader: "sass-loader",
|
39
|
+
options: {
|
40
|
+
includePaths: [path.resolve(__dirname, '../isomorfeus/styles')],
|
41
|
+
sourceMap: false
|
42
|
+
}
|
43
|
+
}
|
44
|
+
]
|
45
|
+
},
|
46
|
+
{
|
47
|
+
test: /.css$/,
|
48
|
+
use: ["cache-loader", "style-loader", "css-loader"]
|
49
|
+
},
|
50
|
+
{
|
51
|
+
test: /.(png|svg|jpg|gif|woff|woff2|eot|ttf|otf)$/,
|
52
|
+
use: ["cache-loader", "file-loader"]
|
53
|
+
},
|
54
|
+
{
|
55
|
+
test: /.(rb|js.rb)$/,
|
56
|
+
use: ["cache-loader",
|
57
|
+
{
|
58
|
+
loader: 'opal-webpack-loader', // opal-webpack-loader will compile and include ruby files in the pack
|
59
|
+
options: {
|
60
|
+
sourceMap: false,
|
61
|
+
hmr: true,
|
62
|
+
hmrHook: 'Opal.Isomorfeus.$force_render()'
|
63
|
+
}
|
64
|
+
}
|
65
|
+
]
|
66
|
+
}
|
67
|
+
]
|
68
|
+
},
|
69
|
+
// configuration for webpack-dev-server
|
70
|
+
devServer: {
|
71
|
+
open: false,
|
72
|
+
lazy: false,
|
73
|
+
port: 3035,
|
74
|
+
hot: true,
|
75
|
+
// hotOnly: true,
|
76
|
+
inline: true,
|
77
|
+
https: false,
|
78
|
+
disableHostCheck: true,
|
79
|
+
headers: {
|
80
|
+
"Access-Control-Allow-Origin": "*",
|
81
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
82
|
+
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
|
83
|
+
},
|
84
|
+
watchOptions: {
|
85
|
+
// in case of problems with hot reloading uncomment the following two lines:
|
86
|
+
// aggregateTimeout: 250,
|
87
|
+
// poll: 50,
|
88
|
+
ignored: /\bnode_modules\b/
|
89
|
+
},
|
90
|
+
contentBase: path.resolve(__dirname, 'public'),
|
91
|
+
useLocalIp: false
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
const browser_config = {
|
96
|
+
target: 'web',
|
97
|
+
entry: { application: [path.resolve(__dirname, '../isomorfeus/imports/application.js')] },
|
98
|
+
externals: { crypto: 'Crypto' }
|
99
|
+
};
|
100
|
+
|
101
|
+
const ssr_config = {
|
102
|
+
target: 'node',
|
103
|
+
entry: { application_ssr: [path.resolve(__dirname, '../isomorfeus/imports/application_ssr.js')] }
|
104
|
+
};
|
105
|
+
|
106
|
+
const web_worker_config = {
|
107
|
+
target: 'webworker',
|
108
|
+
entry: { web_worker: [path.resolve(__dirname, '../isomorfeus/imports/application_web_worker.js')] },
|
109
|
+
externals: { crypto: 'Crypto' }
|
110
|
+
};
|
111
|
+
|
112
|
+
const browser = Object.assign({}, common_config, browser_config);
|
113
|
+
const ssr = Object.assign({}, common_config, ssr_config);
|
114
|
+
const web_worker = Object.assign({}, common_config, web_worker_config);
|
115
|
+
|
116
|
+
module.exports = [ browser, ssr ];
|
@@ -2,16 +2,16 @@ require 'opal'
|
|
2
2
|
require 'opal-autoloader'
|
3
3
|
require 'isomorfeus-redux'
|
4
4
|
require 'isomorfeus-react'
|
5
|
+
require 'isomorfeus-policy'
|
5
6
|
require 'isomorfeus-transport'
|
6
7
|
require 'isomorfeus-data'
|
7
8
|
require 'isomorfeus-i18n'
|
8
9
|
require 'isomorfeus-operation'
|
9
|
-
require 'isomorfeus-policy'
|
10
10
|
|
11
|
+
require_tree 'policies'
|
11
12
|
require_tree 'channels'
|
12
13
|
require_tree 'data'
|
13
|
-
require_tree 'components'
|
14
14
|
require_tree 'operations'
|
15
|
-
require_tree '
|
15
|
+
require_tree 'components'
|
16
16
|
|
17
17
|
Isomorfeus.start_app!
|
@@ -17,7 +17,6 @@
|
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
19
|
"cache-loader": "^4.1.0",
|
20
|
-
"chokidar": "^3.0.2",
|
21
20
|
"compression-webpack-plugin": "^3.0.0",
|
22
21
|
"css-loader": "^3.2.0",
|
23
22
|
"extra-watch-webpack-plugin": "^1.0.3",
|
@@ -33,5 +32,9 @@
|
|
33
32
|
"webpack-assets-manifest": "^3.1.1",
|
34
33
|
"webpack-cli": "^3.3.6",
|
35
34
|
"webpack-dev-server": "^3.8.0"
|
35
|
+
},
|
36
|
+
"optionalDependencies": {
|
37
|
+
"bufferutil": "^4.0.1",
|
38
|
+
"utf-8-validate": "^5.0.2"
|
36
39
|
}
|
37
40
|
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const OwlResolver = require('opal-webpack-loader/resolver');
|
3
|
+
const CompressionPlugin = require("compression-webpack-plugin"); // for gzipping the packs
|
4
|
+
const TerserPlugin = require('terser-webpack-plugin'); // for minifying the packs
|
5
|
+
const WebpackAssetsManifest = require('webpack-assets-manifest');
|
6
|
+
|
7
|
+
const common_config = {
|
8
|
+
context: path.resolve(__dirname, '../isomorfeus'),
|
9
|
+
mode: "production",
|
10
|
+
optimization: {
|
11
|
+
minimize: true, // minimize
|
12
|
+
minimizer: [new TerserPlugin({ parallel: true, cache: true })]
|
13
|
+
},
|
14
|
+
performance: {
|
15
|
+
maxAssetSize: 20000000,
|
16
|
+
maxEntrypointSize: 2000000
|
17
|
+
},
|
18
|
+
output: {
|
19
|
+
filename: '[name]-[chunkhash].js', // include fingerprint in file name, so browsers get the latest
|
20
|
+
path: path.resolve(__dirname, '../public/assets'),
|
21
|
+
publicPath: '/assets/'
|
22
|
+
},
|
23
|
+
resolve: { plugins: [new OwlResolver('resolve', 'resolved')] }, // resolve ruby files
|
24
|
+
plugins: [
|
25
|
+
new CompressionPlugin({ test: /^((?!application_ssr).)*$/, cache: true }), // gzip compress, exclude application_ssr.js
|
26
|
+
new WebpackAssetsManifest({ publicPath: true, merge: true }) // generate manifest
|
27
|
+
],
|
28
|
+
module: {
|
29
|
+
rules: [
|
30
|
+
{
|
31
|
+
test: /.scss$/,
|
32
|
+
use: ["cache-loader", "style-loader", "css-loader",
|
33
|
+
{
|
34
|
+
loader: "sass-loader",
|
35
|
+
options: {
|
36
|
+
includePath: [path.resolve(__dirname, '../isomorfeus/styles')],
|
37
|
+
sourceMap: false
|
38
|
+
}
|
39
|
+
}
|
40
|
+
]
|
41
|
+
},
|
42
|
+
{
|
43
|
+
test: /.css$/,
|
44
|
+
use: ["cache-loader", "style-loader", "css-loader"]
|
45
|
+
},
|
46
|
+
{
|
47
|
+
test: /.(png|svg|jpg|gif|woff|woff2|eot|ttf|otf)$/,
|
48
|
+
use: ["cache-loader", "file-loader"]
|
49
|
+
},
|
50
|
+
{
|
51
|
+
test: /.(rb|js.rb)$/,
|
52
|
+
use: ["cache-loader",
|
53
|
+
{
|
54
|
+
loader: 'opal-webpack-loader', // opal-webpack-loader will compile and include ruby files in the pack
|
55
|
+
options: { sourceMap: false, hmr: false }
|
56
|
+
}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
]
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
const browser_config = {
|
64
|
+
target: 'web',
|
65
|
+
entry: { application: [path.resolve(__dirname, '../isomorfeus/imports/application.js')] },
|
66
|
+
externals: { crypto: 'Crypto' }
|
67
|
+
};
|
68
|
+
|
69
|
+
const ssr_config = {
|
70
|
+
target: 'node',
|
71
|
+
entry: { application_ssr: [path.resolve(__dirname, '../isomorfeus/imports/application_ssr.js')] }
|
72
|
+
};
|
73
|
+
|
74
|
+
const web_worker_config = {
|
75
|
+
target: 'webworker',
|
76
|
+
entry: { web_worker: [path.resolve(__dirname, '../isomorfeus/imports/application_web_worker.js')] },
|
77
|
+
externals: { crypto: 'Crypto' }
|
78
|
+
};
|
79
|
+
|
80
|
+
const browser = Object.assign({}, common_config, browser_config);
|
81
|
+
const ssr = Object.assign({}, common_config, ssr_config);
|
82
|
+
const web_worker = Object.assign({}, common_config, web_worker_config);
|
83
|
+
|
84
|
+
module.exports = [ browser, ssr ];
|
data/lib/isomorfeus/installer.rb
CHANGED
@@ -16,10 +16,12 @@ module Isomorfeus
|
|
16
16
|
attr_reader :app_require
|
17
17
|
attr_accessor :database
|
18
18
|
attr_accessor :framework
|
19
|
+
attr_accessor :isomorfeus_module
|
19
20
|
attr_reader :project_dir
|
20
21
|
attr_reader :project_name
|
21
22
|
attr_accessor :rack_server
|
22
23
|
attr_accessor :rack_server_name
|
24
|
+
attr_accessor :source_dir
|
23
25
|
|
24
26
|
# installer options
|
25
27
|
attr_reader :options
|
@@ -91,6 +93,10 @@ module Isomorfeus
|
|
91
93
|
'isomorfeus'
|
92
94
|
end
|
93
95
|
|
96
|
+
def self.webpack_config_path(config_file)
|
97
|
+
File.join( 'webpack', config_file)
|
98
|
+
end
|
99
|
+
|
94
100
|
def self.stylesheet_path(stylesheet)
|
95
101
|
File.join(isomorfeus_path, 'styles', stylesheet)
|
96
102
|
end
|
@@ -112,7 +118,7 @@ module Isomorfeus
|
|
112
118
|
create_directory(File.join(isomorfeus_path, 'channels'))
|
113
119
|
create_directory(File.join(isomorfeus_path, 'components'))
|
114
120
|
create_directory(File.join(isomorfeus_path, 'data'))
|
115
|
-
create_directory(File.join(isomorfeus_path, 'handlers'))
|
121
|
+
# create_directory(File.join(isomorfeus_path, 'handlers'))
|
116
122
|
create_directory(File.join(isomorfeus_path, 'locales'))
|
117
123
|
create_directory(File.join(isomorfeus_path, 'operations'))
|
118
124
|
create_directory(File.join(isomorfeus_path, 'policies'))
|
@@ -166,6 +172,14 @@ module Isomorfeus
|
|
166
172
|
create_file_from_template('application.css.erb', stylesheet_path('application.css'), {})
|
167
173
|
end
|
168
174
|
|
175
|
+
def self.install_webpack_config
|
176
|
+
File.unlink(webpack_config_path('production.js'), webpack_config_path('development.js'),
|
177
|
+
webpack_config_path('debug.js'))
|
178
|
+
create_file_from_template('production.js.erb', webpack_config_path('production.js'), {})
|
179
|
+
create_file_from_template('development.js.erb', webpack_config_path('development.js'), {})
|
180
|
+
create_file_from_template('debug.js.erb', webpack_config_path('debug.js'), {})
|
181
|
+
end
|
182
|
+
|
169
183
|
def self.create_gemfile
|
170
184
|
rack_server_gems = ''
|
171
185
|
Isomorfeus::Installer.rack_servers[options[:rack_server]]&.fetch(:gems)&.each do |gem|
|
@@ -176,8 +190,14 @@ module Isomorfeus
|
|
176
190
|
database_gems << generate_gem_line(gem)
|
177
191
|
end
|
178
192
|
data_hash = { database_gems: database_gems.chop,
|
179
|
-
rack_server_gems: rack_server_gems.chop
|
180
|
-
|
193
|
+
rack_server_gems: rack_server_gems.chop }
|
194
|
+
%i[isomorfeus_data isomorfeus_i18n isomorfeus_operation isomorfeus_policy isomorfeus_transport].each do |i_module|
|
195
|
+
if source_dir
|
196
|
+
data_hash[i_module] = i_module == isomorfeus_module ? "path: '..'" : "path: '../../#{i_module.to_s.tr('_', '-')}'"
|
197
|
+
else
|
198
|
+
data_hash[i_module] = "'~> #{Isomorfeus::Installer::VERSION}'"
|
199
|
+
end
|
200
|
+
end
|
181
201
|
create_file_from_template('Gemfile.erb', 'Gemfile', data_hash)
|
182
202
|
end
|
183
203
|
|
@@ -221,5 +241,17 @@ module Isomorfeus
|
|
221
241
|
def self.use_asset_bundler?
|
222
242
|
options.has_key?('asset_bundler')
|
223
243
|
end
|
244
|
+
|
245
|
+
def self.copy_source_dir_files
|
246
|
+
Dir.glob("#{source_dir}/**/*").each do |file|
|
247
|
+
if File.file?(file)
|
248
|
+
target_file = file[(source_dir.size+1)..-1]
|
249
|
+
target_dir = File.dirname(target_file)
|
250
|
+
Dir.mkdir(target_dir) unless Dir.exist?(target_dir)
|
251
|
+
puts "Copying #{file} to #{target_file}."
|
252
|
+
FileUtils.copy(file, target_file)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
224
256
|
end
|
225
257
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-installer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.epsilon2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -141,6 +141,8 @@ files:
|
|
141
141
|
- lib/isomorfeus/installer/templates/application_ssr.js.erb
|
142
142
|
- lib/isomorfeus/installer/templates/application_web_worker.js.erb
|
143
143
|
- lib/isomorfeus/installer/templates/config.ru.erb
|
144
|
+
- lib/isomorfeus/installer/templates/debug.js.erb
|
145
|
+
- lib/isomorfeus/installer/templates/development.js.erb
|
144
146
|
- lib/isomorfeus/installer/templates/hello_component.rb.erb
|
145
147
|
- lib/isomorfeus/installer/templates/iodine_config.rb.erb
|
146
148
|
- lib/isomorfeus/installer/templates/isomorfeus_loader.rb.erb
|
@@ -148,6 +150,7 @@ files:
|
|
148
150
|
- lib/isomorfeus/installer/templates/my_app.rb.erb
|
149
151
|
- lib/isomorfeus/installer/templates/navigation_links.rb.erb
|
150
152
|
- lib/isomorfeus/installer/templates/package.json.erb
|
153
|
+
- lib/isomorfeus/installer/templates/production.js.erb
|
151
154
|
- lib/isomorfeus/installer/templates/spec_helper.rb.erb
|
152
155
|
- lib/isomorfeus/installer/templates/test_spec.rb.erb
|
153
156
|
- lib/isomorfeus/installer/templates/welcome_component.rb.erb
|