markdowndocs 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70a3fffbcd50ae1f278895fe3bd5a1834916cc0f538218bf4b39c6901d4314ae
4
- data.tar.gz: 120d2bb20c1b1ea471cdd68af794d2887c6817be63433d162ce93a06b652f880
3
+ metadata.gz: cebbfbc9bd8562902775c6661f2241c7c5556b1ccecdc4cc6b993804d4c58e02
4
+ data.tar.gz: af7ab61db222e6dbd9dbecb557cc713068809fdd26604ed629c7b6a49c122e42
5
5
  SHA512:
6
- metadata.gz: 526153fb60c2781e578c417000d3fec8048d9c955b9c652e67f2c39e9e3b1d6ba36efcd412bed60d714fe0f714e101fca6861c8932226fcc8589033baca1c519
7
- data.tar.gz: c3ce1ff0c86b6bcd12763268069fe6f766ac64793e327000228316cc50c9a59ea42310f15599846a47533866ff35082ae573fac927425c05f997abd3000b3807
6
+ metadata.gz: 5389780ce9d8ad500df799b93bc5790cbca71651f2d320249be1d77cccb85124a484fc519c889e3fd2d8a8d1ec4458d9b65ba0925e706af2835261468e65bbdf
7
+ data.tar.gz: 9ccbdda3525cc1bd2268214dd684643d5c200da356495cdeeb8f99fa364bee4615910ad20334ee943dd95b75502bc20afb8a5888ab95ed7f45cb0baa0b92804e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.1] - 2026-02-21
9
+
10
+ ### Fixed
11
+
12
+ - Stimulus controllers and vendored minisearch now auto-register with the host app's importmap. Previously, host apps had to manually add pins to `config/importmap.rb`.
13
+ - Engine now registers `app/assets/javascripts` in the asset pipeline paths so Propshaft/Sprockets can serve the JS files.
14
+ - Install generator now injects importmap pins into the host app's `config/importmap.rb` during installation.
15
+ - Both asset and importmap initializers gracefully skip when the host app doesn't use the relevant gems.
16
+
8
17
  ## [0.2.0] - 2026-02-21
9
18
 
10
19
  ### Added
@@ -67,6 +76,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
67
76
  - i18n support for all UI strings
68
77
  - Install generator (`rails generate markdowndocs:install`)
69
78
 
79
+ [0.2.1]: https://github.com/dschmura/markdowndocs/releases/tag/v0.2.1
70
80
  [0.2.0]: https://github.com/dschmura/markdowndocs/releases/tag/v0.2.0
71
81
  [0.1.5]: https://github.com/dschmura/markdowndocs/releases/tag/v0.1.5
72
82
  [0.1.4]: https://github.com/dschmura/markdowndocs/releases/tag/v0.1.4
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Importmap pins for Markdowndocs engine.
4
+ # These are automatically registered with the host app when importmap-rails is present.
5
+
6
+ pin "markdowndocs/controllers/docs_search_controller", to: "markdowndocs/controllers/docs_search_controller.js"
7
+ pin "markdowndocs/controllers/docs_mode_controller", to: "markdowndocs/controllers/docs_mode_controller.js"
8
+ pin "minisearch", to: "markdowndocs/vendor/minisearch.min.js"
@@ -20,6 +20,28 @@ module Markdowndocs
20
20
  route 'mount Markdowndocs::Engine, at: "/docs"'
21
21
  end
22
22
 
23
+ def pin_importmap_assets
24
+ importmap_file = Rails.root.join("config/importmap.rb").to_s
25
+ return unless File.exist?(importmap_file)
26
+
27
+ importmap_content = File.read(importmap_file)
28
+
29
+ pins = {
30
+ 'pin "markdowndocs/controllers/docs_search_controller", to: "markdowndocs/controllers/docs_search_controller.js"' => "docs_search_controller",
31
+ 'pin "markdowndocs/controllers/docs_mode_controller", to: "markdowndocs/controllers/docs_mode_controller.js"' => "docs_mode_controller",
32
+ 'pin "minisearch", to: "markdowndocs/vendor/minisearch.min.js"' => "minisearch"
33
+ }
34
+
35
+ pins.each do |pin_line, name|
36
+ if importmap_content.include?(pin_line)
37
+ say_status :skip, "importmap pin for #{name} already present", :yellow
38
+ else
39
+ append_to_file importmap_file, "\n#{pin_line}\n"
40
+ say_status :pin, name, :green
41
+ end
42
+ end
43
+ end
44
+
23
45
  def inject_tailwind_source
24
46
  css_file = find_tailwind_css_file
25
47
  return unless css_file
@@ -54,6 +76,11 @@ module Markdowndocs
54
76
  say " @source \"#{Markdowndocs::Engine.root.join("app", "views")}/**/*.erb\";"
55
77
  say ""
56
78
  end
79
+ say " Stimulus controllers are auto-registered via importmap.", :green
80
+ say " If you use a custom Stimulus setup, register these controllers:"
81
+ say " - markdowndocs/controllers/docs_mode_controller"
82
+ say " - markdowndocs/controllers/docs_search_controller (when search is enabled)"
83
+ say ""
57
84
  end
58
85
 
59
86
  private
@@ -7,5 +7,17 @@ module Markdowndocs
7
7
  initializer "markdowndocs.i18n" do
8
8
  config.i18n.load_path += Dir[root.join("config/locales/**/*.yml")]
9
9
  end
10
+
11
+ initializer "markdowndocs.assets" do |app|
12
+ if app.config.respond_to?(:assets)
13
+ app.config.assets.paths << root.join("app/assets/javascripts")
14
+ end
15
+ end
16
+
17
+ initializer "markdowndocs.importmap", before: "importmap" do |app|
18
+ if app.config.respond_to?(:importmap)
19
+ app.config.importmap.paths << root.join("config/importmap.rb")
20
+ end
21
+ end
10
22
  end
11
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Markdowndocs
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdowndocs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Chmura
@@ -93,6 +93,7 @@ files:
93
93
  - app/views/markdowndocs/docs/_navigation.html.erb
94
94
  - app/views/markdowndocs/docs/index.html.erb
95
95
  - app/views/markdowndocs/docs/show.html.erb
96
+ - config/importmap.rb
96
97
  - config/locales/en.yml
97
98
  - config/routes.rb
98
99
  - lib/generators/markdowndocs/install/install_generator.rb