snowpacker 0.0.4.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +3 -0
  3. data/.dockerignore +22 -0
  4. data/.github/workflows/build.yml +20 -0
  5. data/.gitignore +65 -0
  6. data/CHANGELOG.md +28 -0
  7. data/Dockerfile +38 -0
  8. data/Gemfile +8 -0
  9. data/Gemfile.lock +199 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +156 -0
  12. data/Rakefile +32 -0
  13. data/bin/console +15 -0
  14. data/bin/setup +8 -0
  15. data/docker-compose.yml +17 -0
  16. data/docker.env +8 -0
  17. data/examples/rails-without-webpack/.gitignore +34 -0
  18. data/examples/rails-without-webpack/.ruby-version +1 -0
  19. data/examples/rails-without-webpack/Gemfile +33 -0
  20. data/examples/rails-without-webpack/Gemfile.lock +225 -0
  21. data/examples/rails-without-webpack/README.md +24 -0
  22. data/examples/rails-without-webpack/Rakefile +6 -0
  23. data/examples/rails-without-webpack/app/assets/config/manifest.js +2 -0
  24. data/examples/rails-without-webpack/app/assets/images/.keep +0 -0
  25. data/examples/rails-without-webpack/app/assets/stylesheets/application.css +15 -0
  26. data/examples/rails-without-webpack/app/assets/stylesheets/static_pages.scss +3 -0
  27. data/examples/rails-without-webpack/app/channels/application_cable/channel.rb +4 -0
  28. data/examples/rails-without-webpack/app/channels/application_cable/connection.rb +4 -0
  29. data/examples/rails-without-webpack/app/controllers/application_controller.rb +2 -0
  30. data/examples/rails-without-webpack/app/controllers/concerns/.keep +0 -0
  31. data/examples/rails-without-webpack/app/controllers/static_pages_controller.rb +4 -0
  32. data/examples/rails-without-webpack/app/helpers/application_helper.rb +2 -0
  33. data/examples/rails-without-webpack/app/helpers/static_pages_helper.rb +2 -0
  34. data/examples/rails-without-webpack/app/javascript/channels/consumer.js +6 -0
  35. data/examples/rails-without-webpack/app/javascript/channels/index.js +6 -0
  36. data/examples/rails-without-webpack/app/javascript/packs/application.js +17 -0
  37. data/examples/rails-without-webpack/app/javascript/stylesheets/index.css +3 -0
  38. data/examples/rails-without-webpack/app/jobs/application_job.rb +7 -0
  39. data/examples/rails-without-webpack/app/mailers/application_mailer.rb +4 -0
  40. data/examples/rails-without-webpack/app/models/application_record.rb +3 -0
  41. data/examples/rails-without-webpack/app/models/concerns/.keep +0 -0
  42. data/examples/rails-without-webpack/app/views/layouts/application.html.erb +16 -0
  43. data/examples/rails-without-webpack/app/views/layouts/mailer.html.erb +13 -0
  44. data/examples/rails-without-webpack/app/views/layouts/mailer.text.erb +1 -0
  45. data/examples/rails-without-webpack/app/views/static_pages/index.html.erb +2 -0
  46. data/examples/rails-without-webpack/bin/bundle +114 -0
  47. data/examples/rails-without-webpack/bin/rails +9 -0
  48. data/examples/rails-without-webpack/bin/rake +9 -0
  49. data/examples/rails-without-webpack/bin/setup +36 -0
  50. data/examples/rails-without-webpack/bin/spring +17 -0
  51. data/examples/rails-without-webpack/bin/yarn +9 -0
  52. data/examples/rails-without-webpack/config.ru +5 -0
  53. data/examples/rails-without-webpack/config/application.rb +20 -0
  54. data/examples/rails-without-webpack/config/boot.rb +4 -0
  55. data/examples/rails-without-webpack/config/cable.yml +10 -0
  56. data/examples/rails-without-webpack/config/credentials.yml.enc +1 -0
  57. data/examples/rails-without-webpack/config/database.yml +25 -0
  58. data/examples/rails-without-webpack/config/environment.rb +5 -0
  59. data/examples/rails-without-webpack/config/environments/development.rb +62 -0
  60. data/examples/rails-without-webpack/config/environments/production.rb +112 -0
  61. data/examples/rails-without-webpack/config/environments/test.rb +49 -0
  62. data/examples/rails-without-webpack/config/initializers/application_controller_renderer.rb +8 -0
  63. data/examples/rails-without-webpack/config/initializers/assets.rb +14 -0
  64. data/examples/rails-without-webpack/config/initializers/backtrace_silencers.rb +7 -0
  65. data/examples/rails-without-webpack/config/initializers/content_security_policy.rb +31 -0
  66. data/examples/rails-without-webpack/config/initializers/cookies_serializer.rb +5 -0
  67. data/examples/rails-without-webpack/config/initializers/filter_parameter_logging.rb +4 -0
  68. data/examples/rails-without-webpack/config/initializers/inflections.rb +16 -0
  69. data/examples/rails-without-webpack/config/initializers/mime_types.rb +4 -0
  70. data/examples/rails-without-webpack/config/initializers/snowpacker.rb +19 -0
  71. data/examples/rails-without-webpack/config/initializers/wrap_parameters.rb +14 -0
  72. data/examples/rails-without-webpack/config/locales/en.yml +33 -0
  73. data/examples/rails-without-webpack/config/puma.rb +38 -0
  74. data/examples/rails-without-webpack/config/routes.rb +4 -0
  75. data/examples/rails-without-webpack/config/snowpacker/.browserslistrc +1 -0
  76. data/examples/rails-without-webpack/config/snowpacker/babel.config.js +76 -0
  77. data/examples/rails-without-webpack/config/snowpacker/postcss.config.js +12 -0
  78. data/examples/rails-without-webpack/config/snowpacker/snowpack.config.js +42 -0
  79. data/examples/rails-without-webpack/config/spring.rb +6 -0
  80. data/examples/rails-without-webpack/config/storage.yml +34 -0
  81. data/examples/rails-without-webpack/db/seeds.rb +7 -0
  82. data/examples/rails-without-webpack/lib/assets/.keep +0 -0
  83. data/examples/rails-without-webpack/lib/tasks/.keep +0 -0
  84. data/examples/rails-without-webpack/package.json +33 -0
  85. data/examples/rails-without-webpack/storage/.keep +0 -0
  86. data/examples/rails-without-webpack/test/application_system_test_case.rb +5 -0
  87. data/examples/rails-without-webpack/test/channels/application_cable/connection_test.rb +11 -0
  88. data/examples/rails-without-webpack/test/controllers/.keep +0 -0
  89. data/examples/rails-without-webpack/test/controllers/static_pages_controller_test.rb +8 -0
  90. data/examples/rails-without-webpack/test/fixtures/.keep +0 -0
  91. data/examples/rails-without-webpack/test/fixtures/files/.keep +0 -0
  92. data/examples/rails-without-webpack/test/helpers/.keep +0 -0
  93. data/examples/rails-without-webpack/test/integration/.keep +0 -0
  94. data/examples/rails-without-webpack/test/mailers/.keep +0 -0
  95. data/examples/rails-without-webpack/test/models/.keep +0 -0
  96. data/examples/rails-without-webpack/test/system/.keep +0 -0
  97. data/examples/rails-without-webpack/test/test_helper.rb +13 -0
  98. data/examples/rails-without-webpack/tmp/.keep +0 -0
  99. data/examples/rails-without-webpack/tmp/pids/.keep +0 -0
  100. data/examples/rails-without-webpack/vendor/.keep +0 -0
  101. data/examples/rails-without-webpack/yarn.lock +4254 -0
  102. data/lib/snowpacker.rb +24 -0
  103. data/lib/snowpacker/configuration.rb +19 -0
  104. data/lib/snowpacker/engine.rb +9 -0
  105. data/lib/snowpacker/env.rb +23 -0
  106. data/lib/snowpacker/runner.rb +51 -0
  107. data/lib/snowpacker/snowpacker_generator.rb +58 -0
  108. data/lib/snowpacker/snowpacker_proxy.rb +48 -0
  109. data/lib/snowpacker/templates/babel.config.js +76 -0
  110. data/lib/snowpacker/templates/postcss.config.js +12 -0
  111. data/lib/snowpacker/templates/snowpack.config.js +42 -0
  112. data/lib/snowpacker/templates/snowpacker.rb +19 -0
  113. data/lib/snowpacker/version.rb +5 -0
  114. data/lib/tasks/snowpacker_tasks.rake +30 -0
  115. data/snowpacker.gemspec +45 -0
  116. data/yarn.lock +6211 -0
  117. metadata +299 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7421458a983b96881cc1a1e1c5897faa2dc9e45525f98fc8a7b221ac508c0f2b
4
+ data.tar.gz: 63825a9988c73a052c8473d3faaf5b6a5c94d1b2d2fdf93dc7aa5e930b7036f5
5
+ SHA512:
6
+ metadata.gz: 31acb49ccdaa05c9fb530bc5b6146eb80fa1e9b789bcd548077e4c0ac68110dbde33cc69164a546467e57a6e08c982e6c8f70689ba16ff66ff888e10bd72b358
7
+ data.tar.gz: ec162ec7488a1fa0e9e2049a2901e4ddc72c7a3b25c683d3252b1401199a1042de61c39e103bb102a684c8fb4103595ff8caeb3e5d91eccad47e3f424750b656
@@ -0,0 +1,3 @@
1
+ exclude_patterns:
2
+ - "examples/"
3
+ - "lib/snowpacker/templates/babel.config.js"
@@ -0,0 +1,22 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ public/
14
+ .cache/
15
+
16
+ log/
17
+
18
+ node_modules/
19
+
20
+ .vscode/
21
+ /tags
22
+ .gitignore
@@ -0,0 +1,20 @@
1
+ name: Run tests and linter
2
+
3
+ on:
4
+ push:
5
+ branches: [ $default-branch ]
6
+ pull_request:
7
+ branches: [ $default-branch ]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Build the Docker image
16
+ run: |
17
+ source docker.env
18
+ docker-compose up --build --exit-code-from web
19
+ - name: Run StandardRB
20
+ run: docker-compose run --rm web bundle exec standardrb --format progress
@@ -0,0 +1,65 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ public/
14
+ .cache/
15
+
16
+ log/
17
+
18
+ *node_modules*
19
+
20
+ .vscode/
21
+ tags
22
+
23
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
24
+ #
25
+ # If you find yourself ignoring temporary files generated by your text editor
26
+ # or operating system, you probably want to add a global ignore instead:
27
+ # git config --global core.excludesfile '~/.gitignore_global'
28
+
29
+ # Ignore bundler config.
30
+ .bundle
31
+
32
+ # Ignore the default SQLite database.
33
+ examples/*/db/*.sqlite3
34
+ examples/*/db/*.sqlite3-journal
35
+ examples/*/db/*.sqlite3-*
36
+
37
+ # Ignore all logfiles and tempfiles.
38
+ examples/*/log/*
39
+ examples/*/tmp/*
40
+ !examples/*/log/.keep
41
+ !examples/*/tmp/.keep
42
+
43
+ # Ignore pidfiles, but keep the directory.
44
+ examples/*/tmp/pids/*
45
+ !examples/*/tmp/pids/
46
+ !examples/*/tmp/pids/.keep
47
+
48
+ # Ignore uploaded files in development.
49
+ examples/*/storage/*
50
+ !examples/*/storage/.keep
51
+
52
+ examples/*/public/assets
53
+ examples/*/.byebug_history
54
+
55
+ # Ignore master key for decrypting credentials and more.
56
+ examples/*/config/master.key
57
+
58
+ examples/*/public/packs
59
+ examples/*/public/snowpacks
60
+ examples/*/public/packs-test
61
+ examples/*/node_modules
62
+ examples/*/yarn-error.log
63
+ examples/*/yarn-debug.log*
64
+ examples/*/.yarn-integrity
65
+ examples/*/snowpacks
@@ -0,0 +1,28 @@
1
+ <a name="2020-07-24"></a>
2
+ ### 2020-07-24
3
+
4
+
5
+ #### Features
6
+
7
+ * add an example of using stylesheet link tags ([889f241](/../../commit/889f241))
8
+ * add a mount directory configuration ([c8556d7](/../../commit/c8556d7))
9
+ * add a compile rake task ([607ef29](/../../commit/607ef29))
10
+ * updating templates ([e126948](/../../commit/e126948))
11
+ * rewrite snowpack.config to js format ([e6f89aa](/../../commit/e6f89aa))
12
+ * allow users to define a hostname and port ([95ff03b](/../../commit/95ff03b))
13
+ * add rack-proxy for proxy requests ([8635324](/../../commit/8635324))
14
+ * add snowpacks to example directory ([bb3f1e9](/../../commit/bb3f1e9))
15
+ * have the runner specify a node_env ([5f97e9a](/../../commit/5f97e9a))
16
+ * modify generators and update readme ([a305177](/../../commit/a305177))
17
+ * Add a prior-to-install directory ([fbca36d](/../../commit/fbca36d))
18
+ * add docker ([945d27b](/../../commit/945d27b))
19
+
20
+ #### Bug Fixes
21
+
22
+ * gitignore to ignore node_modules ([e1ee78d](/../../commit/e1ee78d))
23
+ * remove parcel-bundler, remove .travis.yml ([08ecb2a](/../../commit/08ecb2a))
24
+
25
+ * **gitignore**
26
+ * ignore tags ([890ce35](/../../commit/890ce35))
27
+
28
+
@@ -0,0 +1,38 @@
1
+ FROM ruby:2.6-alpine3.11 as builder
2
+
3
+ # Install system dependencies & clean them up
4
+ RUN apk add --no-cache --virtual \
5
+ nodejs-dev yarn bash \
6
+ tzdata build-base libffi-dev \
7
+ curl git vim \
8
+ libnotify-dev
9
+
10
+ FROM builder as bridgetownrb-app
11
+
12
+ # This is to fix an issue on Linux with permissions issues
13
+ ARG USER_ID=${USER_ID:-1000}
14
+ ARG GROUP_ID=${GROUP_ID:-1000}
15
+ ARG DOCKER_USER=${DOCKER_USER:-user}
16
+ ARG APP_DIR=${APP_DIR:-/home/user/snowpacker}
17
+
18
+ # Create a non-root user
19
+ RUN addgroup -g $GROUP_ID -S $GROUP_ID
20
+ RUN adduser --disabled-password -G $GROUP_ID --uid $USER_ID -S $DOCKER_USER
21
+
22
+ # Create and then own the directory to fix permissions issues
23
+ RUN mkdir -p $APP_DIR
24
+ RUN chown -R $USER_ID:$GROUP_ID $APP_DIR
25
+
26
+ # Define the user running the container
27
+ USER $USER_ID:$GROUP_ID
28
+
29
+ # . now == $APP_DIR
30
+ WORKDIR $APP_DIR
31
+
32
+ # COPY is run as a root user, not as the USER defined above, so we must chown it
33
+ COPY --chown=$USER_ID:$GROUP_ID Gemfile* $APP_DIR/
34
+ COPY --chown=$USER_ID:$GROUP_ID *.gemspec $APP_DIR/
35
+ RUN gem install bundler
36
+ RUN bundle install
37
+
38
+ CMD ["bundle", "exec", "rake", "test"]
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in snowpacker.gemspec
8
+ gemspec
@@ -0,0 +1,199 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ snowpacker (0.0.4.alpha1)
5
+ rack-proxy (~> 0.6.4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.0.3.2)
11
+ actionpack (= 6.0.3.2)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (6.0.3.2)
15
+ actionpack (= 6.0.3.2)
16
+ activejob (= 6.0.3.2)
17
+ activerecord (= 6.0.3.2)
18
+ activestorage (= 6.0.3.2)
19
+ activesupport (= 6.0.3.2)
20
+ mail (>= 2.7.1)
21
+ actionmailer (6.0.3.2)
22
+ actionpack (= 6.0.3.2)
23
+ actionview (= 6.0.3.2)
24
+ activejob (= 6.0.3.2)
25
+ mail (~> 2.5, >= 2.5.4)
26
+ rails-dom-testing (~> 2.0)
27
+ actionpack (6.0.3.2)
28
+ actionview (= 6.0.3.2)
29
+ activesupport (= 6.0.3.2)
30
+ rack (~> 2.0, >= 2.0.8)
31
+ rack-test (>= 0.6.3)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
+ actiontext (6.0.3.2)
35
+ actionpack (= 6.0.3.2)
36
+ activerecord (= 6.0.3.2)
37
+ activestorage (= 6.0.3.2)
38
+ activesupport (= 6.0.3.2)
39
+ nokogiri (>= 1.8.5)
40
+ actionview (6.0.3.2)
41
+ activesupport (= 6.0.3.2)
42
+ builder (~> 3.1)
43
+ erubi (~> 1.4)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
+ activejob (6.0.3.2)
47
+ activesupport (= 6.0.3.2)
48
+ globalid (>= 0.3.6)
49
+ activemodel (6.0.3.2)
50
+ activesupport (= 6.0.3.2)
51
+ activerecord (6.0.3.2)
52
+ activemodel (= 6.0.3.2)
53
+ activesupport (= 6.0.3.2)
54
+ activestorage (6.0.3.2)
55
+ actionpack (= 6.0.3.2)
56
+ activejob (= 6.0.3.2)
57
+ activerecord (= 6.0.3.2)
58
+ marcel (~> 0.3.1)
59
+ activesupport (6.0.3.2)
60
+ concurrent-ruby (~> 1.0, >= 1.0.2)
61
+ i18n (>= 0.7, < 2)
62
+ minitest (~> 5.1)
63
+ tzinfo (~> 1.1)
64
+ zeitwerk (~> 2.2, >= 2.2.2)
65
+ ast (2.4.1)
66
+ builder (3.2.4)
67
+ coderay (1.1.3)
68
+ concurrent-ruby (1.1.6)
69
+ conventional-changelog (1.3.0)
70
+ crass (1.0.6)
71
+ diff-lcs (1.4.4)
72
+ erubi (1.9.0)
73
+ globalid (0.4.2)
74
+ activesupport (>= 4.2.0)
75
+ i18n (1.8.5)
76
+ concurrent-ruby (~> 1.0)
77
+ loofah (2.6.0)
78
+ crass (~> 1.0.2)
79
+ nokogiri (>= 1.5.9)
80
+ mail (2.7.1)
81
+ mini_mime (>= 0.1.1)
82
+ marcel (0.3.3)
83
+ mimemagic (~> 0.3.2)
84
+ method_source (1.0.0)
85
+ mimemagic (0.3.5)
86
+ mini_mime (1.0.2)
87
+ mini_portile2 (2.4.0)
88
+ minitest (5.14.1)
89
+ nio4r (2.5.2)
90
+ nokogiri (1.10.10)
91
+ mini_portile2 (~> 2.4.0)
92
+ parallel (1.19.2)
93
+ parser (2.7.1.4)
94
+ ast (~> 2.4.1)
95
+ pry (0.13.1)
96
+ coderay (~> 1.1)
97
+ method_source (~> 1.0)
98
+ rack (2.2.3)
99
+ rack-proxy (0.6.5)
100
+ rack
101
+ rack-test (1.1.0)
102
+ rack (>= 1.0, < 3)
103
+ rails (6.0.3.2)
104
+ actioncable (= 6.0.3.2)
105
+ actionmailbox (= 6.0.3.2)
106
+ actionmailer (= 6.0.3.2)
107
+ actionpack (= 6.0.3.2)
108
+ actiontext (= 6.0.3.2)
109
+ actionview (= 6.0.3.2)
110
+ activejob (= 6.0.3.2)
111
+ activemodel (= 6.0.3.2)
112
+ activerecord (= 6.0.3.2)
113
+ activestorage (= 6.0.3.2)
114
+ activesupport (= 6.0.3.2)
115
+ bundler (>= 1.3.0)
116
+ railties (= 6.0.3.2)
117
+ sprockets-rails (>= 2.0.0)
118
+ rails-dom-testing (2.0.3)
119
+ activesupport (>= 4.2.0)
120
+ nokogiri (>= 1.6)
121
+ rails-html-sanitizer (1.3.0)
122
+ loofah (~> 2.3)
123
+ railties (6.0.3.2)
124
+ actionpack (= 6.0.3.2)
125
+ activesupport (= 6.0.3.2)
126
+ method_source
127
+ rake (>= 0.8.7)
128
+ thor (>= 0.20.3, < 2.0)
129
+ rainbow (3.0.0)
130
+ rake (13.0.1)
131
+ regexp_parser (1.7.1)
132
+ rexml (3.2.4)
133
+ rspec (3.9.0)
134
+ rspec-core (~> 3.9.0)
135
+ rspec-expectations (~> 3.9.0)
136
+ rspec-mocks (~> 3.9.0)
137
+ rspec-core (3.9.2)
138
+ rspec-support (~> 3.9.3)
139
+ rspec-expectations (3.9.2)
140
+ diff-lcs (>= 1.2.0, < 2.0)
141
+ rspec-support (~> 3.9.0)
142
+ rspec-mocks (3.9.1)
143
+ diff-lcs (>= 1.2.0, < 2.0)
144
+ rspec-support (~> 3.9.0)
145
+ rspec-support (3.9.3)
146
+ rubocop (0.85.1)
147
+ parallel (~> 1.10)
148
+ parser (>= 2.7.0.1)
149
+ rainbow (>= 2.2.2, < 4.0)
150
+ regexp_parser (>= 1.7)
151
+ rexml
152
+ rubocop-ast (>= 0.0.3)
153
+ ruby-progressbar (~> 1.7)
154
+ unicode-display_width (>= 1.4.0, < 2.0)
155
+ rubocop-ast (0.2.0)
156
+ parser (>= 2.7.0.1)
157
+ rubocop-performance (1.6.1)
158
+ rubocop (>= 0.71.0)
159
+ ruby-progressbar (1.10.1)
160
+ sprockets (4.0.2)
161
+ concurrent-ruby (~> 1.0)
162
+ rack (> 1, < 3)
163
+ sprockets-rails (3.2.1)
164
+ actionpack (>= 4.0)
165
+ activesupport (>= 4.0)
166
+ sprockets (>= 3.0.0)
167
+ standard (0.4.7)
168
+ rubocop (~> 0.85.0)
169
+ rubocop-performance (~> 1.6.0)
170
+ standardrb (1.0.0)
171
+ standard
172
+ thor (1.0.1)
173
+ thread_safe (0.3.6)
174
+ tzinfo (1.2.7)
175
+ thread_safe (~> 0.1)
176
+ unicode-display_width (1.7.0)
177
+ websocket-driver (0.7.3)
178
+ websocket-extensions (>= 0.1.0)
179
+ websocket-extensions (0.1.5)
180
+ yard (0.9.25)
181
+ zeitwerk (2.4.0)
182
+
183
+ PLATFORMS
184
+ ruby
185
+
186
+ DEPENDENCIES
187
+ bundler (~> 2)
188
+ conventional-changelog (~> 1.2)
189
+ minitest (~> 5.14)
190
+ pry (~> 0.12)
191
+ rails (~> 6)
192
+ rake (~> 13.0)
193
+ rspec (~> 3.0)
194
+ snowpacker!
195
+ standardrb
196
+ yard
197
+
198
+ BUNDLED WITH
199
+ 2.1.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Michał Darda
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,156 @@
1
+ # Snowpacker
2
+
3
+ ## WORK IN PROGRESS
4
+
5
+ Progress can be seen on the `development` branch.
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/snowpacker.svg)](https://badge.fury.io/rb/snowpacker)
8
+
9
+ [![Maintainability](https://api.codeclimate.com/v1/badges/b88ac1a56d868d4f23d5/maintainability)](https://codeclimate.com/github/ParamagicDev/snowpacker/maintainability)
10
+
11
+ This gem integrates the [snowpack](https://snowpack.dev/) JS module bundler into
12
+ your Rails application. It is inspired by gems such as
13
+ [breakfast](https://github.com/devlocker/breakfast) /
14
+ [webpacker](https://github.com/rails/webpacker) started as a fork of
15
+ [parcel-rails](https://github.com/michaldarda/parcel-rails)
16
+
17
+ This is not meant to be a 1:1 replacement of Webpacker.
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem 'snowpacker'
25
+ ```
26
+
27
+ Then run
28
+
29
+ ```bash
30
+ bin/rails g snowpacker
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ### Tasks
36
+
37
+ ```bash
38
+ rails snowpacker:dev # starts a dev server
39
+ rails snowpacker:build # builds for production
40
+
41
+ rails assets:precompile # will build snowpacker and asset pipeline
42
+ ```
43
+
44
+ ### Caveats
45
+
46
+ Currently `snowpacker` is not integrated with `rails s` so you need a process manager like [foreman](https://github.com/ddollar/foreman) to run both `rails s` and `snowpack`.
47
+
48
+ Create `Procfile.dev`, with the following content:
49
+
50
+ ```bash
51
+ web: bin/rails s
52
+ snowpacker: bin/rails snowpacker:dev
53
+ ```
54
+
55
+ Then run `foreman start -f Procfile.dev`
56
+
57
+ Alternatively, you can run:
58
+
59
+ ```
60
+ rails server
61
+ rails snowpacker:dev
62
+ ```
63
+
64
+ in 2 different terminals.
65
+
66
+ ## File Structure
67
+
68
+ Given the below file structure and a default configuration:
69
+
70
+ ```yaml
71
+ app:
72
+ ├── javascript:
73
+ │   ├── channels:
74
+ │   ├── packs:
75
+ │   └── stylesheets:
76
+ ```
77
+
78
+ It will output to the following location:
79
+
80
+ ```yaml
81
+ ├── public:
82
+ │   └── snowpacks:
83
+ │   ├── channels:
84
+ │   ├── packs:
85
+ │   ├── __snowpack__:
86
+ │   ├── stylesheets:
87
+ │   └── web_modules:
88
+ ```
89
+
90
+ ## Including in views
91
+
92
+ Use Rails generic helpers to include assets in your views
93
+
94
+ ```ruby
95
+ <%= stylesheet_link_tag '/snowpacks/stylesheets/index', media: 'all',
96
+ 'data-turbolinks-track': 'reload' %>
97
+
98
+ <%= javascript_include_tag '/snowpacks/packs/application',
99
+ 'data-turbolinks-track': 'reload', type: "module" %>
100
+ ```
101
+
102
+ This assumes you are using the default configuration.
103
+
104
+ Make sure to use `type: "module"` for all javascript scripts, otherwise,
105
+ snowpack will not work properly.
106
+
107
+ ## Configuration
108
+
109
+ After running generator, the configuration file can be found in
110
+ `config/initializers/snowpacker.rb`
111
+
112
+ In addition, all related `snowpack.config.js`, `babel.config.js`, and `postcss.config.js` can all be found in the
113
+ `config/snowpacker` directory.
114
+
115
+ ## Production
116
+
117
+ Gem hooks up to the `rails assets:precompile` and `rails
118
+ assets:clobber`, so no special setup is required.
119
+
120
+ You can start snowpacker's compilation process manually by running
121
+
122
+ ```bash
123
+ rails snowpacker:compile
124
+
125
+ # OR
126
+
127
+ rails snowpacker:build
128
+ ```
129
+
130
+
131
+ ## Examples
132
+
133
+ Examples can be found in the [/examples](/examples) directory.
134
+
135
+ ## Converting from Webpack to Snowpack
136
+
137
+ - Snowpack (as far as I'm aware) does not support the `require.context()`
138
+ so you will have to manually `register` your Stimulus Controllers and
139
+ your Websocket Channels.
140
+
141
+ - Any require statements should be rewritten to import statements.
142
+ Alternatively, you could add a polyfill-plugin to snowpack to fix this
143
+ issue as well.
144
+
145
+
146
+ ## Changelog
147
+
148
+ See [CHANGELOG.md](https://github.com/ParamagicDev/snowpacker/blob/master/CHANGELOG.md)
149
+
150
+ ## Contributing
151
+
152
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ParamagicDev/snowpacker.
153
+
154
+ ## License
155
+
156
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).