importmap-jets 0.1.0 → 0.1.1
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/install/bin/importmap +5 -0
- data/install/config/importmap.rb +6 -0
- data/install/install.rb +36 -0
- data/lib/importmap_jets/version.rb +1 -1
- 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: 96f67b3f25375fc7a5a4660f33acf20a2519aed51d0db84cd25e718c072d66de
|
|
4
|
+
data.tar.gz: cffdc835f426566fc2e43e055bb77acca54ffae3f78e8444cefd9fc50df2fc13
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e08f9d8af599de5f2afa74ea73a5dd79b42854d8cc7be0572f67281daaa34be74236f61ef82911bab98fd3a0b8a51b20a55e0f539a3f7129586f552fd9f3b12
|
|
7
|
+
data.tar.gz: 74a28b78855ddbc5db11196887ed9694bceb6091c715ad329f2cc77b1e0efedf675f9cebd917ebe9d7285b58f16b271e0c2f3125fceae9af4e30720b01520d4c
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Pin npm packages by running bin/importmap
|
|
2
|
+
|
|
3
|
+
pin "application", preload: true
|
|
4
|
+
pin "jquery", to: "https://ga.jspm.io/npm:jquery@3.7.0/dist/jquery.js", preload: true
|
|
5
|
+
pin "@rubyonjets/ujs-compat", to: "https://ga.jspm.io/npm:@rubyonjets/ujs-compat@1.1.0/index.js", preload: true
|
|
6
|
+
pin_all_from "app/javascript/controllers", under: "controllers"
|
data/install/install.rb
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
APPLICATION_LAYOUT_PATH = Jets.root.join("app/views/layouts/application.html.erb")
|
|
2
|
+
|
|
3
|
+
if APPLICATION_LAYOUT_PATH.exist?
|
|
4
|
+
say "Add Importmap include tags in application layout"
|
|
5
|
+
insert_into_file APPLICATION_LAYOUT_PATH.to_s, "\n <%= javascript_importmap_tags %>", before: /\s*<\/head>/
|
|
6
|
+
else
|
|
7
|
+
say "Default application.html.erb is missing!", :red
|
|
8
|
+
say " Add <%= javascript_importmap_tags %> within the <head> tag in your custom layout."
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
say "Create application.js module as entrypoint"
|
|
12
|
+
create_file Jets.root.join("app/javascript/application.js") do <<-JS
|
|
13
|
+
// Configure your import map in config/importmap.rb. Read more: https://github.com/boltops-tools/importmap-jets
|
|
14
|
+
import jquery from 'jquery'
|
|
15
|
+
window.$ = jquery
|
|
16
|
+
import Jets from "@rubyonjets/ujs-compat"
|
|
17
|
+
Jets.start()
|
|
18
|
+
JS
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
say "Use vendor/javascript for downloaded pins"
|
|
22
|
+
empty_directory "vendor/javascript"
|
|
23
|
+
keep_file "vendor/javascript"
|
|
24
|
+
|
|
25
|
+
if (sprockets_manifest_path = Jets.root.join("app/assets/config/manifest.js")).exist?
|
|
26
|
+
say "Ensure JavaScript files are in the Sprocket manifest"
|
|
27
|
+
append_to_file sprockets_manifest_path,
|
|
28
|
+
%(//= link_tree ../../javascript .js\n//= link_tree ../../../vendor/javascript .js\n)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
say "Configure importmap paths in config/importmap.rb"
|
|
32
|
+
copy_file "#{__dir__}/config/importmap.rb", "config/importmap.rb"
|
|
33
|
+
|
|
34
|
+
say "Copying binstub"
|
|
35
|
+
copy_file "#{__dir__}/bin/importmap", "bin/importmap"
|
|
36
|
+
chmod "bin", 0755 & ~File.umask, verbose: false
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: importmap-jets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tung Nguyen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-12-
|
|
11
|
+
date: 2023-12-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: importmap
|
|
@@ -38,6 +38,9 @@ files:
|
|
|
38
38
|
- app/assets/javascripts/es-module-shims.js.map
|
|
39
39
|
- app/assets/javascripts/es-module-shims.min.js
|
|
40
40
|
- app/helpers/importmap/importmap_tags_helper.rb
|
|
41
|
+
- install/bin/importmap
|
|
42
|
+
- install/config/importmap.rb
|
|
43
|
+
- install/install.rb
|
|
41
44
|
- lib/importmap-jets.rb
|
|
42
45
|
- lib/importmap_jets.rb
|
|
43
46
|
- lib/importmap_jets/autoloader.rb
|