railspacker 0.1.1 → 0.2.0
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 +4 -4
- data/lib/generators/templates/config/initializers/railspacker.rb +5 -2
- data/lib/generators/templates/webpack.config.js +26 -5
- data/lib/railspacker.rb +1 -0
- data/lib/railspacker/helper.rb +2 -2
- data/lib/railspacker/manifest/build.rb +0 -4
- data/lib/railspacker/manifest/dev_server.rb +0 -4
- data/lib/railspacker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bed5e14cdffea7ec2d8425d59c64578c1c4625d803c3d9a08c7a01fe56ae8c7e
|
|
4
|
+
data.tar.gz: 28856f38d1300804d55f8b9eeca10a8507a8dd9edf48853f26f99a179e776fb9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 38cbd0eabb7a6568098a1cd94f040a506ccf199ba8e55ff01a0fba41eb7c051501cbb3f8eb551d9368199150206767ca99853162059333fb12b6eb72da1f2a73
|
|
7
|
+
data.tar.gz: 6b5cc2f3e10f999da798ecd2fae0e2eebb16f88659d233c1473e7ae6c9e458c3c338bc2948f66b364c014072e64b93f3ff2ca510e5c785e3fe3a98e2843afdb8
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Script that will run run before the `assets:precompile` task
|
|
2
2
|
# Railspacker.before_assets_precompile_script = 'build'
|
|
3
3
|
|
|
4
|
+
# Change this if you need change output path returned by manifest.json
|
|
5
|
+
# Railspacker.source = ->(filename) { filename }
|
|
6
|
+
|
|
4
7
|
Railspacker.manifest = case Rails.env
|
|
5
8
|
when 'development'
|
|
6
9
|
Railspacker::Manifest::DevServer.new(url: 'http://localhost:3001')
|
|
@@ -8,4 +11,4 @@ when 'test'
|
|
|
8
11
|
Railspacker::Manifest::Build.new(public_path: 'packs-test')
|
|
9
12
|
when 'production'
|
|
10
13
|
Railspacker::Manifest::Build.new(public_path: 'packs')
|
|
11
|
-
end
|
|
14
|
+
end
|
|
@@ -14,33 +14,54 @@ module.exports = (env) => {
|
|
|
14
14
|
config.entry = {
|
|
15
15
|
app: './app/webpack/index.js'
|
|
16
16
|
};
|
|
17
|
+
|
|
17
18
|
config.plugins = [
|
|
18
19
|
// Generate a manifest.json to output. Is requred to Railspacker.
|
|
19
20
|
new ManifestPlugin(),
|
|
20
21
|
|
|
21
22
|
// Clean output directory before builds
|
|
22
23
|
new CleanWebpackPlugin([outputPath]),
|
|
23
|
-
|
|
24
|
-
// Enables Hot Module Replacement, otherwise known as HMR.
|
|
25
|
-
new webpack.HotModuleReplacementPlugin()
|
|
26
24
|
];
|
|
25
|
+
|
|
27
26
|
config.output = {
|
|
28
27
|
filename: '[name].js',
|
|
29
28
|
path: path.resolve(__dirname, outputPath)
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
// development environment
|
|
32
|
+
if (env == 'development') {
|
|
33
33
|
config.mode = 'development'
|
|
34
34
|
config.devtool = 'inline-source-map'
|
|
35
|
+
|
|
36
|
+
// This set of options is picked up by webpack-dev-server
|
|
35
37
|
config.devServer = {
|
|
36
38
|
contentBase: path.resolve(__dirname, 'app/webpack'),
|
|
37
39
|
port: 3001,
|
|
38
|
-
hot: true
|
|
40
|
+
hot: true,
|
|
41
|
+
headers: {
|
|
42
|
+
"Access-Control-Allow-Origin": "*"
|
|
43
|
+
}
|
|
39
44
|
}
|
|
45
|
+
|
|
46
|
+
config.plugins = config.plugins.concat([
|
|
47
|
+
// Enables Hot Module Replacement, otherwise known as HMR.
|
|
48
|
+
new webpack.HotModuleReplacementPlugin()
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
config.output.publicPath = 'http://localhost:3001/'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// test environment
|
|
55
|
+
if (env === 'test') {
|
|
56
|
+
config.mode = 'development'
|
|
57
|
+
config.devtool = 'inline-source-map'
|
|
58
|
+
config.output.publicPath = 'packs-test/'
|
|
40
59
|
};
|
|
41
60
|
|
|
61
|
+
// production environment
|
|
42
62
|
if (env === 'production') {
|
|
43
63
|
config.mode = 'production'
|
|
64
|
+
config.output.publicPath = 'packs/'
|
|
44
65
|
};
|
|
45
66
|
|
|
46
67
|
return config;
|
data/lib/railspacker.rb
CHANGED
|
@@ -5,6 +5,7 @@ require "railspacker/manifest/dev_server"
|
|
|
5
5
|
module Railspacker
|
|
6
6
|
mattr_accessor :manifest
|
|
7
7
|
mattr_accessor :before_assets_precompile_script, default: 'build'
|
|
8
|
+
mattr_accessor :source, default: ->(filename) { filename }
|
|
8
9
|
|
|
9
10
|
def self.run(name)
|
|
10
11
|
system("yarn run #{name}")
|
data/lib/railspacker/helper.rb
CHANGED
data/lib/railspacker/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railspacker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexandre Magro
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-02-
|
|
11
|
+
date: 2019-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|