Skip to content

wcpos/web-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

140 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WooCommerce POS Web Bundle

The pre-built JavaScript bundle of the WCPOS web app — distributed via the jsDelivr CDN.

Latest version jsDelivr hits License: MIT Discord Chat

About  —  How it's consumed  —  How it's built  —  Local testing

💡 About

This repository holds the pre-built web export of the WooCommerce POS app (the React Native + Expo / Metro web build), versioned with git tags and served straight from the jsDelivr CDN. The WCPOS WordPress plugin loads this bundle to render the POS inside WordPress.

This is a distribution repository, not app source. The application source lives in the WCPOS monorepo under apps/main; the contents of build/ are generated from there and committed here. Don't hand-edit build/.

📦 How it's consumed

jsDelivr serves any tagged path in this repo. The consumer first fetches build/metadata.json to discover the content-hashed entry bundle and CSS filenames, then loads them:

https://cdn.jsdelivr.net/gh/wcpos/web-bundle@<version>/build/metadata.json
https://cdn.jsdelivr.net/gh/wcpos/web-bundle@<version>/build/_expo/static/js/web/entry-<hash>.js

Pinning to a git tag (e.g. @v1.9.0) gives a stable, immutable URL.

The bundle is path-portable: every internal asset and chunk URL resolves against a runtime global rather than a baked-in origin, so the same build works from jsDelivr, a local dev server, or inside Electron. The consumer sets:

  • window.cdnBaseUrl — the base every /_expo/… and /assets/… URL is prefixed with.
  • window.baseUrl — the app's base URL.

🗂 Contents

build/                 # the distributed bundle (committed)
  index.html           #   Expo app shell
  metadata.json        #   manifest: hashed entry-bundle + CSS filenames (read by the WP plugin)
  opfs.worker.js       #   OPFS storage worker (web)
  _expo/static/        #   content-hashed JS chunks + CSS
  assets/              #   fonts and images
scripts/
  build.js             # the build pipeline (run from the monorepo — see below)
  dev-server.js        # zero-dependency static server for local testing (port 4567)
  serve-colors.js      # serves color-palette.html (port 3001)
tests/                 # node:test unit tests for the build pipeline
color-palette.html     # standalone design-system / colour-token reference page

The legacy build/indexeddb.worker.js is intentionally git-ignored but preserved on disk across rebuilds (the build script carries it forward), so older clients mid-migration keep working.

🏗 How it's built

scripts/build.js is the producer, and it runs from the monorepo's apps/web directory (it resolves the app at ../main). In outline it:

  1. runs expo export --platform web against apps/main with a unique base-URL placeholder,
  2. prepends Metro's runtime + common chunks into the single entry-*.js (so the plugin only has to load one file),
  3. rewrites the placeholder paths to the window.cdnBaseUrl / window.baseUrl runtime globals, and
  4. regenerates metadata.json from the freshly-hashed filenames.

In practice you don't run this by hand: the monorepo's publish-web-bundle workflow builds apps/web and publishes the result to this repo for jsDelivr.

🧪 Local testing

To serve the committed bundle locally and point the app at it:

pnpm dev        # serves build/ at http://localhost:4567/build (CORS-enabled, no-cache)

Then set window.cdnBaseUrl = "http://localhost:4567/build" in the app.

pnpm colors     # opens the colour-palette reference at http://localhost:3001
node --test tests/*.test.js   # run the build-pipeline unit tests

🌿 Branches

This repo follows a two-trunk model (see AGENTS.md):

  • main — the stable, released line (patch releases ship from here).
  • next — the in-development line for the next minor/major.

Feature work targets next; patches target main.

🔗 Links

📄 License

MIT © Paul Kilmurray

About

JS bundle for the WooCommerce POS web application - distributed by jsDelivr

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors