Skip to content

Commit 6bfe004

Browse files
committed
Merge remote-tracking branch 'upstream/main' into config-accept
2 parents e25a358 + 4d02a20 commit 6bfe004

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

MIT-LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2021 Basecamp
1+
Copyright (c) 2022 Basecamp
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ There's [native support for import maps in Chrome/Edge 89+](https://caniuse.com/
1111

1212
Importmap for Rails is automatically included in Rails 7+ for new applications, but you can also install it manually in existing applications:
1313

14-
1. Add `importmap-rails` to your Gemfile with `gem 'importmap-rails'`
15-
2. Run `./bin/bundle install`
16-
3. Run `./bin/rails importmap:install`
14+
1. Run `./bin/bundle add importmap-rails`
15+
2. Run `./bin/rails importmap:install`
1716

1817
Note: In order to use JavaScript from Rails frameworks like Action Cable, Action Text, and Active Storage, you must be running Rails 7.0+. This was the first version that shipped with ESM compatible builds of these libraries.
1918

@@ -251,7 +250,7 @@ Import your module on the specific page. Note: you'll likely want to use a `cont
251250
<% end %>
252251
```
253252

254-
**Important**: The `javacript_import_module_tag` should come after your `javascript_importmap_tags`
253+
**Important**: The `javascript_import_module_tag` should come after your `javascript_importmap_tags`
255254

256255
```erb
257256
<%= javascript_importmap_tags %>

test/packager_test.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ def code() "200" end
3535
end
3636

3737
test "failed request with mock" do
38-
response = Class.new do
39-
def code() "500" end
40-
end.new
41-
4238
Net::HTTP.stub(:post, proc { raise "Unexpected Error" }) do
4339
assert_raises(Importmap::Packager::HTTPError) do
4440
@packager.import("[email protected]")
@@ -54,4 +50,9 @@ def code() "500" end
5450
test "pin_for" do
5551
assert_equal %(pin "react", to: "https://cdn/react"), @packager.pin_for("react", "https://cdn/react")
5652
end
53+
54+
test "vendored_pin_for" do
55+
assert_equal %(pin "react" # @17.0.2), @packager.vendored_pin_for("react", "https://cdn/[email protected]")
56+
assert_equal %(pin "javascript/react", to: "javascript--react.js" # @17.0.2), @packager.vendored_pin_for("javascript/react", "https://cdn/[email protected]")
57+
end
5758
end

0 commit comments

Comments
 (0)