Skip to content

Match bridgetown-quick-search plugin conventions - #12

Merged
AbuMareBear merged 3 commits into
mainfrom
ah/enable-npm-add
May 22, 2026
Merged

AbuMareBear merged 3 commits into
mainfrom
ah/enable-npm-add

Conversation

@AbuMareBear

@AbuMareBear AbuMareBear commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Enables auto-installation of the bridgetown-stoa npm companion in host Bridgetown sites via gemspec metadata. Safe now that bridgetown-stoa@0.2.0 is published (was held back in Add Tailwind v4 styling foundation #10 because the init-time registry lookup 404'd during tests until first publish).
  • Excludes frontend/ from the gem's files glob — the CSS partial belongs in the npm package only, not double-shipped via the gem.
  • Adds require_gem: false to the test fixture's init :"bridgetown-stoa" so Bridgetown's plugin manager doesn't run install_npm_dependencies during tests (which would inject a self-referencing bridgetown-stoa dep into the gem's own package.json on every cibuild).

Background

The first commit (Enable npm_add gemspec metadata) just uncommented the gemspec template's npm_add block. Running cibuild against that revealed two problems:

  • The auto-install fired during tests and wrote "bridgetown-stoa": "^0.2.0" into our own package.json — a permanent footgun if accidentally committed.
  • The gem was also shipping frontend/styles/bridgetown-stoa.css, double-distributing with the npm companion.

The second commit (Match bridgetown-quick-search plugin conventions) studies the canonical example and adopts its conventions:

  • yarn-add instead of npm_add (synonyms in Bridgetown's source; yarn-add is the ecosystem-standardized name — the gemspec template's npm_add is the older form).
  • frontend/ excluded from the gem's files glob.
  • require_gem: false in the fixture's initializer. The gem is already loaded by test/helper.rb, so the re-require (which is what triggers install_npm_dependencies) is redundant. This is an API-supported escape hatch — init's signature is init(name, require_gem: true, require_initializer: true, ...).

Test plan

  • script/cibuild passes in ~30ms with zero npm noise — no install commands, no 404s, no package.json mutation.
  • git status is clean after cibuild finishes.

🤖 Generated with Claude Code

@AbuMareBear AbuMareBear changed the title Enable npm_add gemspec metadata Match bridgetown-quick-search plugin conventions May 22, 2026
@AbuMareBear
AbuMareBear merged commit 0920add into main May 22, 2026
3 checks passed
@AbuMareBear
AbuMareBear deleted the ah/enable-npm-add branch May 22, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant