Skip to content

refactor: stop bundling frontman-core into framework wrappers#707

Open
BlueHotDog wants to merge 13 commits intomainfrom
issue-419-refactor-stop-bundling-frontmancore
Open

refactor: stop bundling frontman-core into framework wrappers#707
BlueHotDog wants to merge 13 commits intomainfrom
issue-419-refactor-stop-bundling-frontmancore

Conversation

@BlueHotDog
Copy link
Copy Markdown
Collaborator

@BlueHotDog BlueHotDog commented Mar 25, 2026

Summary

  • Externalize @frontman-ai/frontman-core from tsup bundles in all framework wrappers (nextjs, astro, vite) — moved from noExternal to external
  • Move @frontman-ai/frontman-core from devDependencies to dependencies so npm/yarn installs it (and all transitive deps) automatically for consumers
  • Remove re-declared transitive deps (lighthouse, chrome-launcher) from each wrapper's package.json — they propagate via frontman-core
  • Make @frontman/bindings publishable — removed "private": true, added publish metadata, prepublishOnly build script, and Makefile
  • Add publish targets for frontman-protocol, @frontman/bindings, and frontman-core in both lib and root Makefiles

Publish order

These packages must be published to npm before releasing new wrapper versions. The root Makefile now handles this via make publish-deps (or make publish for everything):

  1. @frontman-ai/frontman-protocol — no workspace deps
  2. @frontman/bindings — no workspace deps
  3. @frontman-ai/frontman-core — depends on (1) and (2)
  4. Wrappers (nextjs, astro, vite) — depend on (3)
# Publish just the core deps
make publish-deps OTP=<code>

# Publish everything (deps first, then wrappers)
make publish OTP=<code>

Test plan

  • All three wrappers (frontman-nextjs, frontman-astro, frontman-vite) build successfully with yarn build:bundle
  • Bundle output contains bare import statements for @frontman-ai/frontman-core, @rescript/runtime, sury (not inlined)
  • Verify a clean npm install of each published wrapper pulls in frontman-core and its transitive deps
  • Smoke-test each framework integration in a sample app
  • Run make publish-deps to publish protocol, bindings, and core before releasing wrappers

Closes #419

🤖 Generated with Claude Code

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

BlueHotDog and others added 3 commits April 9, 2026 15:34
Move @frontman-ai/frontman-core from devDependencies to dependencies
in all framework wrappers (nextjs, astro, vite) and externalize it
from tsup bundles. This lets npm/yarn install frontman-core and all
its transitive deps (lighthouse, chrome-launcher, bindings, protocol,
sury, @rescript/runtime) automatically for consumers.

- Remove noExternal for workspace deps in all tsup configs
- Remove re-declared transitive deps (lighthouse, chrome-launcher)
  from wrapper package.json dependencies
- Make @frontman/bindings publishable (remove private: true)
- Deduplicate repeated external lists into shared constants

Closes #419

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add prepublishOnly and build scripts matching the pattern used by
frontman-core and frontman-protocol, so npm publish compiles the
ReScript sources before shipping.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add publish targets to bindings, frontman-core, and frontman-protocol
Makefiles, and wire them into the root Makefile with a publish-deps
target that runs them in dependency order (protocol → bindings → core)
before publishing the framework wrappers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@BlueHotDog BlueHotDog force-pushed the issue-419-refactor-stop-bundling-frontmancore branch from 2849fa3 to dd33512 Compare April 9, 2026 13:42
devin-ai-integration[bot]

This comment was marked as resolved.

BlueHotDog and others added 2 commits April 9, 2026 15:53
…packages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 10 additional findings in Devin Review.

Open in Devin Review

Comment on lines 73 to 78
outDir: 'dist',
clean: false,
define: { '__PACKAGE_VERSION__': JSON.stringify(pkg.version) },
noExternal: sharedNoExternal,
external: sharedExternal,
platform: 'browser',
target: 'es2020',
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Astro toolbar build missing noExternal — workspace deps won't be bundled for the browser

The toolbar entry point runs in the browser (platform: 'browser'), so all workspace dependencies must be bundled into the output. The PR moved workspace deps (@frontman-ai/frontman-core, @frontman/bindings, @rescript/runtime, sury, etc.) from devDependencies to dependencies in libs/frontman-astro/package.json:55-60 and simultaneously removed the noExternal list that previously forced bundling. tsup v8 auto-externalizes all packages listed in dependencies for ESM builds, so these deps will now produce bare import statements (e.g. import ... from '@frontman-ai/frontman-core') in the toolbar bundle — which will fail at runtime in the browser where there is no node_modules resolution.

The comment on line 69 even acknowledges the intent: "workspace deps must be bundled, not externalized" — but the config doesn't accomplish this. The old config (libs/frontman-astro/tsup.config.ts at base) had noExternal: sharedNoExternal on the toolbar entry to force bundling. The fix is to add noExternal back for the toolbar build to override tsup's auto-externalization of dependencies.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The premise here is incorrect. tsup does not auto-externalize packages listed in dependencies. It uses esbuild under the hood and only externalizes what's explicitly in the external array.

The toolbar config at line 76 has external: ['astro', 'astro/toolbar'] — the workspace deps (@frontman-ai/frontman-core, @frontman/bindings, @rescript/runtime, sury, etc.) are intentionally absent from that list, so esbuild will bundle them into dist/toolbar.js. The comment on line 69 even documents this intent: "workspace deps must be bundled, not externalized".

No change needed here.

BlueHotDog and others added 8 commits April 9, 2026 18:19
Add @frontman-ai/frontman-protocol, @frontman/bindings, @rescript/runtime,
sury, and dom-element-to-component-source to runtime dependencies of astro,
nextjs, and vite packages. These were marked external in tsup but undeclared,
causing ERR_MODULE_NOT_FOUND in strict package managers (pnpm, Yarn PnP).

Fix browser toolbar entry in frontman-astro tsup config to only externalize
astro and astro/toolbar. Previously all workspace deps were externalized via
sharedExternal, but the browser has no node_modules resolution — they must
be bundled into dist/toolbar.js.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ckages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Refactor: stop bundling frontman-core into framework wrappers so transitive deps propagate

1 participant