Skip to content

Replace Q with native promises - #64

Merged
ashirman merged 2 commits into
mainfrom
feature/rev-134
Oct 15, 2026
Merged

ashirman merged 2 commits into
mainfrom
feature/rev-134

Conversation

@revopushbot

@revopushbot revopushbot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Step 3 of 4 of the dependency cleanup (REV-134). Removes q and @types/q. Q is internal only: the package exposes the CLI, not the SDK.

Changes

  • Q deferreds and Q.Promise(...): new Promise(...) in hash-utils, binary-utils, commands/debug, management-sdk and command-executor.
  • Q(x) and Q.all: Promise.resolve and Promise.all.
  • .spread in deployment history: array destructuring.
  • .done() in cli.ts: removed. Node exits on an unhandled rejection the same way Q's .done() crashed.
  • Q workarounds: globalThis.Promise annotations become plain Promise, and the redundant Q wrapper around packageFileFromPath is gone.
  • Async functions: release(), packageFileFromPath and generatePackageManifestFromDirectory are now async, with no change to what they send or return.
  • Version detection order: release-react and release-expo now wait for the app version before preparing the source map folder. Q handled a detection failure during that step, but with native promises it could crash Node with a stack trace instead of printing [Error] ….
  • Dead code: the unused ReleaseHook type is removed.

Error output

Q silently drops rejected promises nobody handles, while native promises crash Node. I ran the no-floating-promises lint rule to find spots where switching would change behaviour. Errors on these paths now reach the CLI's normal [Error] … output:

Case Before Now
Release folder that can't be read exit 0, nothing uploaded, no message [Error] EACCES: permission denied, scandir …, exit 1
Release folder containing a symlink to a folder crashes with a stack trace, exit 1 [Error] not a file: …, exit 1
Signing an empty folder [Error] undefined [Error] Can't sign the release because no files were found.

Everything else behaves as before.

Verification

  • Build and lint: tsc and npm run lint are clean.
  • Tests: all 155 pass on macOS and on Linux (Docker, Node 20.19.0).
  • End to end: the real CLI binary from main and from this branch, run against a local fake server.
    • Commands: whoami, app ls, deployment ls, deployment history (including a 404), and release of a folder, an unreadable folder and a missing path.
    • Output and exit codes match, except the unreadable-folder row above.
    • The server received identical requests: same zip entries, file hashes and packageInfo.
  • Version detection: release-react with an invalid Android versionName prints the same [Error] … as main.
  • Code signing: sign() gives the same content hash as main for a folder with nested files, a non-ASCII file name and an ignored .DS_Store. Signing a single file also works.

#65, stacked on this PR, moves the remaining .then chains to async/await without behaviour changes.

🤖 Generated with Claude Code

revopushbot and others added 2 commits October 15, 2026 13:43
- Q deferreds and Q.Promise(...) calls become new Promise(...)
- Q(x), Q.all and .spread become Promise.resolve, Promise.all and
  array destructuring
- Drop .done() in cli.ts; Node exits on unhandled rejections the same way
- Remove the unused ReleaseHook type
- Report errors that Q used to drop: an unreadable release folder no longer
  exits 0 silently, and yazl input errors no longer crash the process
- Reject with an Error when signing an empty folder

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
releaseReact and releaseExpo started version detection, awaited the source
map folder, then returned the detection promise. A detection failure in
between was an unhandled rejection and crashed Node instead of printing
the CLI error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ashirman
ashirman merged commit 8c97639 into main Oct 15, 2026
2 checks passed
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.

2 participants