From 0fcf48d5251a0944081c44ef94e87ee1613cc44f Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 8 Sep 2026 22:29:57 +1200 Subject: [PATCH] Adopt Web Packages Assisted-By: devx/7ef83274-928f-499d-b668-48449b1ff60e --- context/integrating-with-javascript.md | 16 ++++++++-------- guides/integrating-with-javascript/readme.md | 16 ++++++++-------- lib/utopia/import_map.rb | 6 +++--- releases.md | 6 ++++++ test/utopia/import_map.rb | 2 +- utopia.gemspec | 2 +- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/context/integrating-with-javascript.md b/context/integrating-with-javascript.md index 30add821..fc66e53e 100644 --- a/context/integrating-with-javascript.md +++ b/context/integrating-with-javascript.md @@ -8,7 +8,7 @@ Import maps provide a modern way to manage JavaScript module dependencies. Utopi ### Installing JavaScript Libraries -Declare browser libraries as production dependencies in `package.json`. The `bake-node.packages` section selects the files that should be served and assigns their browser import names: +Declare browser libraries as production dependencies in `package.json`. The `web-packages.packages` section selects the files that should be served and assigns their browser import names: ```json { @@ -16,7 +16,7 @@ Declare browser libraries as production dependencies in `package.json`. The `bak "dependencies": { "@socketry/syntax": "^0.6.1" }, - "bake-node": { + "web-packages": { "packages": { "@socketry/syntax": { "include": [ @@ -34,8 +34,8 @@ Declare browser libraries as production dependencies in `package.json`. The `bak Install the dependencies using the configured package manager, then generate the browser-facing package projection: ```bash -$ bundle exec bake node:install -$ bundle exec bake node:packages:static +$ bundle exec bake web:packages:install +$ bundle exec bake web:packages:update ``` This installs dependencies into `node_modules/` and copies only the selected browser files into `public/_components/`. Treat both directories as generated projections rather than authored source. @@ -43,8 +43,8 @@ This installs dependencies into `node_modules/` and copies only the selected bro Use an immutable installation and verify the checked-in projection in CI: ```bash -$ bundle exec bake node:install frozen=true -$ bundle exec bake node:packages:check +$ bundle exec bake web:packages:install frozen=true +$ bundle exec bake web:packages:check ``` ### Creating the Import Map @@ -96,9 +96,9 @@ Once the import map is set up, you can import and use the library in your script ``` -Inspect the generated import map with `bundle exec bake node:importmap:show` when debugging package resolution. +Inspect the generated import map with `bundle exec bake web:packages:import_map:show` when debugging package resolution. -See the [Bake Node documentation](https://socketry.github.io/bake-node/) for workspace packages, package selection, and alternative package managers. +See the [Web Packages documentation](https://socketry.github.io/web-packages/) for workspace packages, package selection, and alternative package managers. ### Advanced Import Map Features diff --git a/guides/integrating-with-javascript/readme.md b/guides/integrating-with-javascript/readme.md index 30add821..fc66e53e 100644 --- a/guides/integrating-with-javascript/readme.md +++ b/guides/integrating-with-javascript/readme.md @@ -8,7 +8,7 @@ Import maps provide a modern way to manage JavaScript module dependencies. Utopi ### Installing JavaScript Libraries -Declare browser libraries as production dependencies in `package.json`. The `bake-node.packages` section selects the files that should be served and assigns their browser import names: +Declare browser libraries as production dependencies in `package.json`. The `web-packages.packages` section selects the files that should be served and assigns their browser import names: ```json { @@ -16,7 +16,7 @@ Declare browser libraries as production dependencies in `package.json`. The `bak "dependencies": { "@socketry/syntax": "^0.6.1" }, - "bake-node": { + "web-packages": { "packages": { "@socketry/syntax": { "include": [ @@ -34,8 +34,8 @@ Declare browser libraries as production dependencies in `package.json`. The `bak Install the dependencies using the configured package manager, then generate the browser-facing package projection: ```bash -$ bundle exec bake node:install -$ bundle exec bake node:packages:static +$ bundle exec bake web:packages:install +$ bundle exec bake web:packages:update ``` This installs dependencies into `node_modules/` and copies only the selected browser files into `public/_components/`. Treat both directories as generated projections rather than authored source. @@ -43,8 +43,8 @@ This installs dependencies into `node_modules/` and copies only the selected bro Use an immutable installation and verify the checked-in projection in CI: ```bash -$ bundle exec bake node:install frozen=true -$ bundle exec bake node:packages:check +$ bundle exec bake web:packages:install frozen=true +$ bundle exec bake web:packages:check ``` ### Creating the Import Map @@ -96,9 +96,9 @@ Once the import map is set up, you can import and use the library in your script ``` -Inspect the generated import map with `bundle exec bake node:importmap:show` when debugging package resolution. +Inspect the generated import map with `bundle exec bake web:packages:import_map:show` when debugging package resolution. -See the [Bake Node documentation](https://socketry.github.io/bake-node/) for workspace packages, package selection, and alternative package managers. +See the [Web Packages documentation](https://socketry.github.io/web-packages/) for workspace packages, package selection, and alternative package managers. ### Advanced Import Map Features diff --git a/lib/utopia/import_map.rb b/lib/utopia/import_map.rb index b6e5bc8d..97b5c7b7 100644 --- a/lib/utopia/import_map.rb +++ b/lib/utopia/import_map.rb @@ -6,7 +6,7 @@ require "json" require "xrb" require "protocol/url" -require "bake/node/manifest" +require "web/packages/manifest" module Utopia # Represents an import map for JavaScript modules with support for URI and relative path resolution. @@ -56,11 +56,11 @@ module Utopia # # puts page_map.to_html class ImportMap - # Load the import mappings from a Bake Node static package manifest. + # Load the import mappings from a Web Packages static projection manifest. # @parameter root [String | Pathname] The static package output directory. # @returns [ImportMap] A frozen import map using the manifest's public base URL. def self.load_manifest(root) - manifest = Bake::Node::Manifest.load(root) + manifest = Web::Packages::Manifest.load(root) base = Protocol::URL[manifest.data.fetch("base")] imports = manifest.import_map.fetch("imports").transform_values do |value| Protocol::URL[value].relative_to(base).to_s diff --git a/releases.md b/releases.md index d7e47efe..0e3b6a08 100644 --- a/releases.md +++ b/releases.md @@ -1,5 +1,11 @@ # Releases +## Unreleased + +### Web Packages + +Utopia now uses `web-packages` v0.2 after the project was renamed from `bake-node`. Applications should use the `web-packages` key in `package.json` and invoke package management through the `web:packages` Bake namespace. The generated `.manifest.json` format remains compatible. + ## v3.0.6 ### JavaScript Packages diff --git a/test/utopia/import_map.rb b/test/utopia/import_map.rb index a48021bd..65b1968e 100644 --- a/test/utopia/import_map.rb +++ b/test/utopia/import_map.rb @@ -11,7 +11,7 @@ with ".load_manifest" do it "loads generated imports while preserving relative rendering" do Dir.mktmpdir do |root| - Bake::Node::Manifest.build( + Web::Packages::Manifest.build( base: "/_components/", imports: { "example" => "/_components/example/example.js", diff --git a/utopia.gemspec b/utopia.gemspec index e44aff41..3ba97b81 100644 --- a/utopia.gemspec +++ b/utopia.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 3.3" spec.add_dependency "bake", "~> 0.20" - spec.add_dependency "bake-node" + spec.add_dependency "web-packages", "~> 0.2" spec.add_dependency "concurrent-ruby", "~> 1.2" spec.add_dependency "console", "~> 1.24" spec.add_dependency "irb"