webpacked 0.1.0 → 0.1.2
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/README.md +11 -8
- data/lib/capistrano/tasks/webpacked.rake +8 -3
- data/lib/webpacked/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a831df23a305a0f70f2a8dbf00b823267212491f
|
4
|
+
data.tar.gz: 0c2846787f6de4d1c101da0831a55612fe8e5a2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32485b777d6fa441fbd41b4ccf2782ec36736632238ed0823563fea4b345d624765253539421ff8f64786f8fcd180aa1defd98c53e9fb7858c21f99217297fcc
|
7
|
+
data.tar.gz: 0c6e740686f93e77a0a54097334c80f1658c333a8c3b73062057c26a1fef61845c3c0c0879852348fe42753db1395974b85353e920cafc56580d605d72908725
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ Webpack configs are divided into on three files:
|
|
33
33
|
1. `frontend/development.config.js` contains setup specific for development
|
34
34
|
1. `frontend/production.config.js` includes production optimizations
|
35
35
|
|
36
|
-
Follow comments in these files and webpack official docs to conclude what meets
|
36
|
+
Follow the comments in these files and webpack official docs to conclude what meets your requirements.
|
37
37
|
|
38
38
|
Environment is defined via `NODE_ENV` variable and initialized in`frontend/main.config.js`. Normally you don't need to manual set up `NODE_ENV` unless you want to add another environment for your frontend application.
|
39
39
|
|
@@ -61,9 +61,9 @@ To add webpacked assets in to your application, use following helpers:
|
|
61
61
|
</html>
|
62
62
|
```
|
63
63
|
|
64
|
-
Where `
|
64
|
+
Where `application` is a one of the your entry points in webpack config.
|
65
65
|
|
66
|
-
NOTE
|
66
|
+
**NOTE**: if you using [common chunks optimization](https://webpack.github.io/docs/code-splitting.html#split-app-and-vendor-code) (it is so indeed in production most likely), these helpers may produce additional CSS/Javascript include tag for that common bundle.
|
67
67
|
|
68
68
|
You should not concern about including any extra scripts to get hot module reloading works: it integrates transparently through a same webpack manifest file.
|
69
69
|
|
@@ -109,7 +109,7 @@ Gem exposes a few configuration options:
|
|
109
109
|
* `webpacked.enabled` default to `true`; you probably want to disable webpacked in test environment, so helpers will not fail if manifest does not exist
|
110
110
|
* `webpacked.manifest_path` default to `webpack-assets.json`
|
111
111
|
* `webpacked.load_manifest_on_initialize` default to `false`; if `true` then parse manifest on application bootstrap
|
112
|
-
* `webpacked.common_entry_name` default to `common` (if you've
|
112
|
+
* `webpacked.common_entry_name` default to `common` (if you've changed this, you need to update it in the webpack config as well)
|
113
113
|
* `webpacked.bin` default to `node_modules/.bin/webpack`
|
114
114
|
* `webpacked.config` default to `frontend/main.config.js`
|
115
115
|
* `webpacked.dev_server` enabled only in development mode
|
@@ -120,13 +120,16 @@ Gem exposes a few configuration options:
|
|
120
120
|
|
121
121
|
### Installation and usage
|
122
122
|
|
123
|
-
To deploy generated assets add `require "capistrano/webpacked"` to your `Capfile`.
|
123
|
+
To deploy generated assets add `require "capistrano/webpacked"` to your `Capfile`.
|
124
124
|
|
125
|
-
Also you need to
|
125
|
+
Also you need to add some code in to `deploy.rb`:
|
126
126
|
|
127
|
-
|
127
|
+
* set up the `:assets_roles` so **webpacked** could run its tasks
|
128
|
+
* define a hook when the task should be run: `after 'deploy:updated', 'deploy:webpacked:build'` or (if you use sprockets) `before 'deploy:compile_assets', 'deploy:webpacked:build'` are good variants
|
128
129
|
|
129
|
-
|
130
|
+
What under the hood? The task makes diff of files and folders (specified in `:webpacked_dependencies` option) in current release against previous release and decides whether to run production webpack build. If there is no diff then simply a manifest copied from previous release path. If some of dependencies were changed then production build starts *locally* and assets synchronized via `rsync` over SSH.
|
131
|
+
|
132
|
+
**NOTE**: scince webpack build runs locally, you should pay an extra attention to your working copy condition: current branch, not published commits, not commited changes, etc.
|
130
133
|
|
131
134
|
Additionally there are some extra tasks exposed (they are used by `deploy:webpacked:build` internally):
|
132
135
|
|
@@ -36,6 +36,12 @@ namespace :deploy do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
latest_manifest_path = latest_release_path.join(OPTIONS.(:manifest_path))
|
40
|
+
unless test("[[ -f #{latest_manifest_path} ]]")
|
41
|
+
info "Latest webpack manifest not found: #{latest_manifest_path}. Need rebuild"
|
42
|
+
raise WebpackedBuildRequired
|
43
|
+
end
|
44
|
+
|
39
45
|
info 'Skipping webpack build, no diff found'
|
40
46
|
|
41
47
|
execute(
|
@@ -49,7 +55,6 @@ namespace :deploy do
|
|
49
55
|
end
|
50
56
|
end
|
51
57
|
end
|
52
|
-
after 'deploy:updated', 'deploy:webpacked:build'
|
53
58
|
|
54
59
|
task :build_force do
|
55
60
|
run_locally do
|
@@ -63,7 +68,6 @@ namespace :deploy do
|
|
63
68
|
|
64
69
|
task :sync do
|
65
70
|
on roles(fetch(:assets_roles)) do
|
66
|
-
info 'Sync assets...'
|
67
71
|
upload!(
|
68
72
|
OPTIONS.(:deploy_manifest_path),
|
69
73
|
release_path.join(OPTIONS.(:manifest_path))
|
@@ -72,7 +76,8 @@ namespace :deploy do
|
|
72
76
|
end
|
73
77
|
roles(fetch(:assets_roles)).each do |host|
|
74
78
|
run_locally do
|
75
|
-
|
79
|
+
info 'Sync assets...'
|
80
|
+
local_output_path = OPTIONS.(:local_output_path)
|
76
81
|
release_output_path = shared_path.join(OPTIONS.(:release_output_path))
|
77
82
|
`rsync -avzr --delete #{local_output_path} #{host.user}@#{host.hostname}:#{release_output_path.parent}`
|
78
83
|
end
|
data/lib/webpacked/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpacked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Garbuz
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.6.
|
90
|
+
rubygems_version: 2.6.4
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: Easy webpack and Rails integration
|