Skip to content

Commit 9f84d2c

Browse files
committed
The task 6.
1 parent ee573e0 commit 9f84d2c

File tree

10 files changed

+4904
-3400
lines changed

10 files changed

+4904
-3400
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Webpack Budget CI
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: code checkout
8+
uses: actions/checkout@v2
9+
- name: run sitespeedio test
10+
run: docker run -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:latest https://f3c5-93-79-0-255.eu.ngrok.io/ --budget.configPath homeBudget.json -n 1

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ vendor/bundle
1818
.torus.json
1919
coverage
2020
/tags
21+
sitespeed-result/**/*
2122

2223
# Ignore public uploads
2324
/public/uploads/*
@@ -52,4 +53,4 @@ package-lock.json
5253
.idea/
5354

5455
#sitemap
55-
/public/sitemap.xml.gz
56+
/public/sitemap.xml.gz

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/dubnium
1+
v14.19.3

.ruby-gemset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rails-optimization-task6

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ end
1616
gem "actionpack-action_caching", "~> 1.2"
1717
gem "active_record_union", "~> 1.3"
1818
gem "acts-as-taggable-on", "~> 5.0"
19-
gem "acts_as_follower", github: "thepracticaldev/acts_as_follower", branch: "master"
19+
gem "acts_as_follower", github: "forem/acts_as_follower", branch: "master"
2020
gem "addressable", "~> 2.5", ">= 2.5.2"
2121
gem "administrate", "~> 0.11"
2222
gem "ahoy_email", "~> 0.5"
@@ -122,7 +122,7 @@ group :development, :test do
122122
gem "derailed", "~> 0.1"
123123
gem "erb_lint", "~> 0.0", require: false
124124
gem "faker", git: "https://github.com/stympy/faker.git", branch: "master"
125-
gem "fix-db-schema-conflicts", github: "thepracticaldev/fix-db-schema-conflicts", branch: "master"
125+
gem "fix-db-schema-conflicts", github: "jakeonrails/fix-db-schema-conflicts", branch: "master"
126126
gem "memory_profiler", "~> 0.9"
127127
gem "parallel_tests", "~> 2.27"
128128
gem "pry-byebug", "~> 3.7"

Gemfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
GIT
2-
remote: https://github.com/stympy/faker.git
3-
revision: 9910aa58d92c018abab25d491191576fcc1a7707
2+
remote: https://github.com/forem/acts_as_follower.git
3+
revision: 06393d3693a1a3d4b390aec4976c8b8f3a81cf01
44
branch: master
55
specs:
6-
faker (1.9.1)
7-
i18n (>= 0.7)
6+
acts_as_follower (0.2.1)
7+
activerecord (>= 4.0)
88

99
GIT
10-
remote: https://github.com/thepracticaldev/acts_as_follower.git
11-
revision: 288690cd99bc470eaee493fce5bfa9fe23157692
10+
remote: https://github.com/jakeonrails/fix-db-schema-conflicts.git
11+
revision: 1e94f518503f1d1addd6ed052454efcbec0b3c6a
1212
branch: master
1313
specs:
14-
acts_as_follower (0.2.1)
15-
activerecord (>= 4.0)
14+
fix-db-schema-conflicts (3.1.0)
15+
rubocop (>= 0.38.0)
1616

1717
GIT
18-
remote: https://github.com/thepracticaldev/fix-db-schema-conflicts.git
19-
revision: 4172392392e1a8d907f7ab673cb5ddd9a4a31940
18+
remote: https://github.com/stympy/faker.git
19+
revision: 9910aa58d92c018abab25d491191576fcc1a7707
2020
branch: master
2121
specs:
22-
fix-db-schema-conflicts (3.0.2)
23-
rubocop (>= 0.38.0)
22+
faker (1.9.1)
23+
i18n (>= 0.7)
2424

2525
GEM
2626
remote: https://rubygems.org/

config/webpack/environment.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// module.exports = environment;
1010

11-
11+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
1212
const { environment } = require('@rails/webpacker')
1313
const webpack = require('webpack')
1414

@@ -18,11 +18,24 @@ environment.plugins.append(
1818
name: 'vendor',
1919
minChunks: (module) => {
2020
// this assumes your vendor imports exist in the node_modules directory
21-
return module.context && module.context.indexOf('node_modules') !== -1
21+
return (
22+
module.context &&
23+
module.context.indexOf('node_modules') !== -1 &&
24+
module.context.indexOf('moment') === -1 &&
25+
module.context.indexOf('chart.js') === -1 &&
26+
module.context.indexOf('marked') === -1
27+
)
2228
}
2329
})
2430
)
2531

32+
environment.plugins.append('BundleAnalyzer', new BundleAnalyzerPlugin())
33+
34+
environment.plugins.append(
35+
'ContextReplacementPlugin',
36+
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/)
37+
)
38+
2639
environment.plugins.append(
2740
'CommonsChunkManifest',
2841
new webpack.optimize.CommonsChunkPlugin({

homeBudget.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"budget": {
3+
"transferSize": {
4+
"javascript": 460000
5+
}
6+
}
7+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@
9999
"prop-types": "^15.7.2",
100100
"pusher-js": "^4.4.0",
101101
"twilio-video": "^1.15.2",
102-
"web-share-wrapper": "^0.2.1"
102+
"web-share-wrapper": "^0.2.1",
103+
"webpack-bundle-analyzer": "^4.5.0"
103104
},
104105
"jest": {
105106
"setupFiles": [

0 commit comments

Comments
 (0)