1
0
mirror of https://github.com/lancedikson/bowser synced 2026-09-23 12:34:58 +00:00
Commit Graph

27 Commits

Author SHA1 Message Date
naorpeled
876f2b81ca ci: restrict the pull-request workflow GITHUB_TOKEN to contents: read 2026-08-29 23:50:17 +03:00
naorpeled
11a78f50b2 fix(ci): create the tarball directory before npm pack
npm pack --pack-destination does not create the target directory, so the
Pack step failed with ENOENT.
2026-08-01 21:28:56 +03:00
naorpeled
a78d9d35a2 fix: make dual packaging non-breaking for existing consumers
Keeps the published surface of bowser@2.14.1 intact while adding a real
ESM build, and rewrites CI so it can actually run the new toolchain.

Packaging

- Restore the flat artifact layout. es5.js and bundled.js stay at the
  tarball root next to src/, so unpkg.com/bowser/es5.js and
  require('bowser/bundled') keep working. bowser.mjs is added alongside.
- Build the UMD bundles from dedicated single-default-export entries in
  build/entries/. src/bowser.js gained named exports (parse, getParser)
  to fix #511, but a UMD bundle with named exports makes require('bowser')
  a namespace object instead of the class: typeof flips from 'function' to
  'object' and BROWSER_MAP / ENGINE_MAP / OS_MAP / PLATFORMS_MAP disappear,
  since they are static getters rather than exports.
- globalName back to lowercase 'bowser', matching the shipped es5.js.
  Renaming it to 'Bowser' would break every script-tag consumer.
- Enumerate every legacy subpath in the exports map. Conditional exports
  are honoured from Node 12.16.0 onward, so a "."-only map turns paths
  that resolve today into ERR_PACKAGE_PATH_NOT_EXPORTED. Subpath patterns
  ("./src/*") need Node 12.20.0+ and the trailing-slash folder form was
  removed in Node 17, so explicit per-file keys are the only spelling that
  works across the whole supported range. Extension-less aliases included:
  the README documents require('bowser/bundled').
- main, browser and module keep their existing values. No engines field
  (npm warns EBADENGINE, pnpm fails under engine-strict) and no type
  field (it would reclassify es5.js as ESM).

Build

- Minify the UMD bundles with terser instead of rolldown's built-in oxc
  minifier. oxc prints every string literal as a template literal and
  rejects any compress.target below es2015, so it cannot emit ES5 and was
  silently undoing babel's lowering. terser is what webpack 4 used.
- Wire up the copyright banner, which was declared but never passed to a
  config, and restore bundled.js as the polyfilled build via core-js/stable.
- Add index.d.mts so the import condition has ESM types. Reusing the
  export = declarations for both conditions describes an ES module with
  CommonJS types.

CI

- Replace npm ci with pnpm across all workflows. This is what was failing:
  the lockfile was swapped for pnpm-lock.yaml but the workflows still ran
  npm ci, pinned to Node 12.16.3 and 16. Build now runs on Node 24, which
  tsdown requires.
- Add a pack-smoke job that installs the packed tarball on Node 12.16.3,
  14, 18, 20 and 24 and exercises every documented entry point, plus
  publint and attw on the tarball. This is what makes "non-breaking" a
  tested claim rather than an argument; it catches all of the above.
- Restore test-list-of-ua.js to asserting src against the built es5.js.
  It had been collapsed to comparing Bowser.parse with itself.
2026-08-01 14:40:56 +03:00
naorpeled
507b205791 chore: remove github copilot instructions file 2026-02-13 22:31:33 +02:00
naorpeled
f11700291a Replace .github/copilot-instructions.md with AGENTS.md 2026-02-13 22:30:26 +02:00
Denis Demchenko
740d6c4844 Update npm to latest version before publishing to npm registry (#603)
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-08 23:37:11 +02:00
naorpeled
382bc22397 chore: update publish flow 2026-02-07 19:43:20 +02:00
naorpeled
e2318ef12d fix: attemp to resolve NPM publish issues 2026-02-07 19:12:34 +02:00
naorpeled
8f9badd27f chore: update publish flow 2026-02-07 19:05:32 +02:00
naorpeled
fbccc9616a docs: add naorpeled to Funding.yml 2026-01-31 19:07:46 +02:00
Copilot
a4d0b828e4 chore: add Copilot instructions for repository (#574)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: naorpeled <6171622+naorpeled@users.noreply.github.com>
2025-11-22 13:31:12 +02:00
Naor Peled
3c25806efe ci(publish): add manual trigger and retry logic for npm publish 2025-08-09 21:27:38 +03:00
Naor Peled
8ac2f6a1ec chore(deps): change nyc version to 15 for Node 12 to work (#565) 2025-08-09 21:05:17 +03:00
Naor Peled
20fc037785 fix: resolve CI failures (#560) 2025-08-09 20:51:00 +03:00
Naor Peled
afc0fbf131 ci(release): bump all deps 2025-07-06 19:24:07 +03:00
Naor Peled
e0ee0e7baf ci: bump cache action to v4 2025-07-06 19:21:23 +03:00
Naor Peled
16c9f22546 ci: attempt to resolve merge to master errors (#546) 2024-04-20 14:54:03 +03:00
Naor Peled
327e6f5e51 ci: add release drafter (#545) 2024-04-20 14:35:56 +03:00
Naor Peled
69bc6c2dbf revert(workflows): rollback to Node 12.16.3 (#537) 2023-11-17 20:45:54 +02:00
Naor Peled
9c1588a43e chore: add CodeQL config 2023-11-13 11:56:25 +02:00
Naor Peled
efb8e612a5 ci: move to Github Actions (#530) 2023-11-13 11:11:28 +02:00
Denis Demchenko
41c30ec722 fix(chore): bug with babel/helper-compilation on build
No "exports" main resolved in /home/runner/work/bowser/bowser/node_modules/@babel/helper-compilation-targets/package.json
2020-07-09 21:27:15 +03:00
Denis Demchenko
ea8d9c5427 npm i → npm ci 2019-10-02 21:50:47 +03:00
Denis Demchenko
8fb6e3a080 Update nodejs.yml 2019-08-27 20:17:55 +03:00
Denis Demchenko
40c6be6654 Activate github actions 2019-08-27 20:13:33 +03:00
Denis Demchenko
71d4904d20 chore(.github): move github related files 2019-08-04 23:51:07 +03:00
Denis Demchenko
976518e524 Add FUNDING.yml 2019-07-16 21:39:38 +03:00