Skip to content

v2.0.0: Fix compatibility, simplify code, eliminate vulnerabilities#49

Merged
parvardegr merged 4 commits into
mainfrom
copilot/full-review-and-simplification
Jun 16, 2026
Merged

v2.0.0: Fix compatibility, simplify code, eliminate vulnerabilities#49
parvardegr merged 4 commits into
mainfrom
copilot/full-review-and-simplification

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Full review pass: fix bugs that break on modern Node, replace fragile dependencies, resolve all npm audit vulnerabilities, add tests and CI.

Bug fixes

  • new Buffer()Buffer.from() (removed since Node 10)
  • .mv().then(err => ...).then() receives resolved value, not error; split into .then()/.catch()
  • Undeclared usageMessage variable (implicit global)
  • SSL cert/key paths resolved relative to __dirname instead of process.cwd()
  • Upload destination resolved relative to __dirname instead of user-specified path
  • File path extraction via string slicing → path.dirname() / path.basename()
  • Malformed <a/> close tag in receive form HTML

Compatibility

  • require('node:os')require('os') (prefix requires Node 14.18+)
  • clipboardy@3 (ESM-only) → clipboardy@2 (CommonJS)
  • GitHub fork serve-handler → official serve-handler@6.1.6 with inline prefix strip
  • Added engines: { node: ">=14.0.0" }
  • Removed deprecated preferGlobal
  • Added missing -q/--receive-port CLI option (was in README but not in code)
  • Added type annotations to all yargs options

Security

  • Express 4.18.14.21.212 → 0 npm audit vulnerabilities
  • Escaped upload path in post-upload alert to prevent XSS

Tests

  • 11 tests (unit + integration) using only built-in assert — no framework dependency
  • Covers: utils, config defaults, directory serving, file download, receive form, upload rejection, CLI --help/--version

CI/CD

  • Updated publish workflow to run tests across Node 14/16/18/20/22 as a required test job before the publish job (needs: test)
  • Added new ci.yml workflow that runs the same test matrix on every push and PR to master/main
  • Updated actions/checkout and actions/setup-node from v2 to v4

Copilot AI added 3 commits June 16, 2026 11:24
- Fix deprecated new Buffer() → Buffer.from()
- Fix node:os prefix → os for broader Node compatibility
- Fix implicit global usageMessage variable
- Fix .mv() promise handling (use .then/.catch properly)
- Fix SSL cert path resolution (use cwd instead of __dirname)
- Fix upload path resolution to use user-specified path
- Simplify file path handling with path.dirname()
- Replace GitHub fork serve-handler with official package + inline prefix strip
- Update Express to latest v4 (fixes vulnerabilities)
- Replace ESM-only clipboardy v3 with CommonJS-compatible v2
- Remove deprecated preferGlobal from package.json
- Add engines field (node >= 10)
- Add missing -q/--receive-port option
- Fix HTML close tag in receive-form.html
- Add proper type annotations to yargs options
- Add 11 tests (unit + integration)
- Bump version to 2.0.0
Copilot AI changed the title v2.0.0: Simplify code, fix compatibility across Node versions, add tests v2.0.0: Fix compatibility, simplify code, eliminate vulnerabilities Jun 16, 2026
Copilot AI requested a review from parvardegr June 16, 2026 11:35
@parvardegr
parvardegr marked this pull request as ready for review June 16, 2026 12:21
@parvardegr

Copy link
Copy Markdown
Owner

@copilot add a step in ci/cd to run the tests also before publishing, maybe as the first step

- Run tests across Node 14/16/18/20/22 before npm publish
- Add separate CI workflow for push/PR to master/main
- Update actions/checkout and actions/setup-node to v4

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot add a step in ci/cd to run the tests also before publishing, maybe as the first step

Done. Updated the publish workflow to run tests across Node 14/16/18/20/22 as a test job that must pass before the publish job runs (needs: test). Also added a separate ci.yml workflow that runs the same test matrix on every push and PR to master/main. See commit ci: add test step before publish, add CI workflow for PRs.

Copilot AI requested a review from parvardegr June 16, 2026 12:25
@parvardegr
parvardegr merged commit 13e1621 into main Jun 16, 2026
5 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