Skip to content

Migrate to domstack-sync#259

Merged
bcomnes merged 1 commit into
masterfrom
domstack-sync
Jun 29, 2026
Merged

Migrate to domstack-sync#259
bcomnes merged 1 commit into
masterfrom
domstack-sync

Conversation

@bcomnes

@bcomnes bcomnes commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Migrate to a modernized domstack sync from browsersync.

Copilot AI review requested due to automatic review settings June 2, 2026 04:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Replaces the legacy browser-sync integration with @domstack/sync for the dev server and routes build/watch logs through a structured logger created via createLogger. The watch() API gains an onInitialBuild hook so the CLI can render its build tree after watchers are ready and before the dev server starts.

Changes:

  • Swap browser-sync for @domstack/sync in production deps (and remove @types/browser-sync); start the dev server via createServer and shut it down via await syncServer.exit().
  • Replace console.log/error calls in DomStack with a pino-style logger, exposed/initialized through a new createLogger helper and a logger build option.
  • Refactor watch() to register cpx event listeners up front, await Promise.all of watcher readiness, invoke a new onInitialBuild(report) callback, and only then spin up the sync server; update example package.jsons to drop browser-sync/npm-run-all2 in favor of domstack --watch.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
package.json Adds @domstack/sync@^0.0.4, drops browser-sync and @types/browser-sync.
index.js Imports @domstack/sync, adds createLogger/wrapPinoLogger exports, swaps console logs for the structured logger, restructures watch() cpx setup, adds onInitialBuild, and replaces browserSyncServer with #syncServer.
lib/builder.js Documents new optional logger BuildOpts property typed against @domstack/sync.
bin.js Creates a CLI logger, passes it via opts, moves post-initial-build tree/warning output into the new onInitialBuild callback, and routes quit messages through the logger.
examples/string-layouts/package.json Replaces split watch:serve/watch:domstack scripts with domstack --watch; removes browser-sync and npm-run-all2 devDeps.
examples/default-layout/package.json Same example simplification as string-layouts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls

coveralls commented Jun 2, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 28344270455

Coverage increased (+0.4%) to 92.302%

Details

  • Coverage increased (+0.4%) from the base build.
  • Patch coverage: 67 uncovered changes across 2 files (130 of 197 lines covered, 65.99%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
lib/logger.js 80 43 53.75%
index.js 115 85 73.91%
Total (3 files) 197 130 65.99%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
index.js 1 82.17%

Coverage Stats

Coverage Status
Relevant Lines: 4292
Covered Lines: 4041
Line Coverage: 94.15%
Relevant Branches: 709
Covered Branches: 575
Branch Coverage: 81.1%
Branches in Coverage %: Yes
Coverage Strength: 73.98 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@socket-security

socket-security Bot commented Jun 27, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm @fastify/middie is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?npm/@domstack/sync@0.0.5npm/@fastify/middie@9.3.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@fastify/middie@9.3.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@bcomnes bcomnes left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Spotted some issues.

Comment thread index.js
Comment thread index.js Outdated
Comment thread index.js Outdated
Comment thread index.js Outdated
Comment thread lib/builder.js Outdated
Comment thread test-cases/watch/index.test.js Outdated
@bcomnes bcomnes force-pushed the domstack-sync branch 3 times, most recently from 8a19fd6 to f73a59e Compare June 29, 2026 00:14
@socket-security

socket-security Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​domstack/​sync@​0.0.57710010091100
Addednpm/​pino-pretty@​13.1.39910010086100
Addednpm/​pino@​9.14.09910010090100

View full report

Comment thread bin.js Outdated
Comment thread index.js Outdated
@bcomnes bcomnes force-pushed the domstack-sync branch 2 times, most recently from 5d5721e to 4f6a153 Compare June 29, 2026 01:20
@bcomnes

bcomnes commented Jun 29, 2026

Copy link
Copy Markdown
Owner Author

Follow-up: simplified lib/logger.js so the production logger no longer accepts or wraps custom streams. createDomStackLogger() now just creates the app logger and lets pino-pretty handle stdout. The watch test uses its own local logger double instead of adding stream plumbing to production code.

@bcomnes bcomnes force-pushed the domstack-sync branch 3 times, most recently from 855955c to db68533 Compare June 29, 2026 01:55
@bcomnes

bcomnes commented Jun 29, 2026

Copy link
Copy Markdown
Owner Author

OK code actually looks okay! This just needs one more round interactive testing.

@bcomnes

bcomnes commented Jun 29, 2026

Copy link
Copy Markdown
Owner Author

Looks good.

@bcomnes bcomnes merged commit a76e342 into master Jun 29, 2026
10 checks passed
@bcomnes bcomnes deleted the domstack-sync branch June 29, 2026 02:10
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.

3 participants