refactor: decouple deployer widget into @nsite/deployer package#42
Open
dskvr wants to merge 2 commits into
Open
refactor: decouple deployer widget into @nsite/deployer package#42dskvr wants to merge 2 commits into
dskvr wants to merge 2 commits into
Conversation
Extract the deploy/manage/auth component tree from apps/spa into a standalone
@nsite/deployer package so it can be consumed as an embeddable widget. The SPA
becomes a thin shell that mounts DeployerWidget and renders Navbar with
session props received via events.
Package layout:
- packages/deployer/src/components: 12 Svelte components (DeployerWidget,
ManageSite, SuccessPanel, LoginModal, NIP46Dialog, AdvancedConfig,
DeployZone, FileTree, ActivityRings, ProgressIndicator, LogoutConfirmModal,
OperationBanner)
- packages/deployer/src/lib: upload, publish, nostr, scanner, crypto, files,
base36, store (converted to createDeployerStores factory)
- packages/deployer/src/widget: NsiteDeployerElement HTMLElement wrapper and
CSS string constant for the custom element
- packages/deployer/{vite.widget.config.js,vitest.config.js,svelte.config.js}
Workspace:
- Root package.json with npm workspaces (apps/spa, packages/deployer)
- .npmrc for @jsr registry
- deno.json nodeModulesDir: "none" for deno+npm workspace compat
- apps/spa/package.json depends on @nsite/deployer via workspace protocol
- CI installs deno workspace before build
Main fixes preserved by manual port into decoupled files (bypassing rebase
conflicts from PR #18 squash-merge divergence):
- DeployerWidget.svelte: merge kind-10063 blossoms into serverConfig.extraBlossoms
so AdvancedConfig shows them; dTag regex allows interior hyphens; deploy
blossom URL union no longer re-adds userBlossoms (already in extraBlossoms)
- packages/deployer/src/lib/upload.js: uploadBlobs and deleteBlobs batch auth
signing (50 hashes per event) per BUD-11
- packages/deployer/src/lib/files.js: inferMimeType uses @std/media-types
contentType() instead of inline MIME_TYPES map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bundle Size Report
|
Bump AUTH_BATCH_SIZE in uploadBlobs and deleteBlobs from 50 to 350 so a single BUD-11 auth event can cover up to 350 hashes instead of requiring a sign() round-trip every 50 files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apps/spainto a standalone@nsite/deployerpackage consumable as an embeddable widget (12 Svelte components + 8 lib modules + Svelte/ESM/IIFE build targets +<nsite-deployer>custom element).apps/spa+packages/deployer) with.npmrcfor JSR,deno.jsonnodeModulesDir: "none"for deno+npm coexistence, and CIdeno installstep.apps/spa/src/App.svelteinto a thin shell that mountsDeployerWidgetand refactorsNavbar.svelteto receive session state via props/events instead of reading the store directly.Context
This replaces the original
enhance/decouple-deployerbranch, which forked fromd36ac10and accumulated ~40 commits that conflicted badly with main's PR #18 (Enhance/action guards) squash-merge. Rather than rebase through the squash, the decoupled package was ported onto a fresh branch from main and main's divergent fixes were manually applied to the new file locations.Ported fixes (applied into decoupled files)
DeployerWidget.svelteserverConfig.extraBlossoms(both fetch paths) soAdvancedConfigshows them and users can remove themdTagValidregex allows interior hyphens (^[a-z0-9](?:[a-z0-9-]{0,11}[a-z0-9])?$) with matching error messageblossomUrlsunion no longer re-addsuserBlossoms(now comes throughcfg.extraBlossoms)-packages/deployer/src/lib/upload.js—uploadBlobsanddeleteBlobsboth batch auth signing (350 hashes per event) per BUD-11packages/deployer/src/lib/files.js—inferMimeTypeusescontentType()from@std/media-typesinstead of an inline MIME_TYPES map (+ runtime dep added topackages/deployer/package.json)Intentionally kept at main's version (not overwritten from old branch)
apps/blossom/src/auth/nostr.ts— main's BUD-11 multi-x-tag validationapps/gateway/src/hostname.{ts,test.ts}— main's hyphenated-dTag support + testsapps/gateway/src/security-headers.ts— main's tighter CSPapps/spa/src/lib/tools-resources.yaml— main's updated URLs/versionspackages/stealthis/*— main-only package, untouchedTest plan
packages/deployervitest — 114/114 passapps/spavitest — 6/6 passvite build(SPA) — oknpm run build:widget(packages/deployer) — ok (dist/deployer.js+dist/deployer.mjs)deno task build— ok (relay/blossom/gateway bundles)deno task check— okpackages/deployer/test/test-widget.htmlafter build