package
0.200.1
Repository: https://github.com/invopop/gobl.git
Documentation: pkg.go.dev

# README

GOBL.js (WASM)

This folder contains the files necessary to execute the GOBL client library in your web browser. The core library is written in Go, and compiled to WebAssembly. The file gobl.js provides a thin JavaScript wrapper around the compiled WebAssembly running in a web worker.

To execute a simple demo of the GOBL library in your browser, you will need to:

  1. Install Go (1.22 or newer)
  2. From this directory, execute the command ./build.sh which will compile the WASM target and start a bare web server.
  3. In your browser, navigate to http://localhost:9999/
  4. Open the JavaScript console in your browser to see the test output.

Running The GOBL.js Playground

Development

To start the local server via browser-sync, including hot reloading (no browser refresh required to see changes):

npm run dev

To start the interactive cyprus.io browser test runner. You must have a server running (npm run dev or npm run start for prod). This interactive UI runs tests against whichever server you have running. (Note: the Lighthouse performance tests will fail against the development server, because performance is much slower there.):

npm run test

To run the testing suite as it would run on a ci server, against the production build:

npm run ci

To run the code formatting checking tools eslint (and prettier):

npm run check-formatting

Production

For deployment, build the project and serve it on a simple http server.

npm start

Packages

MotivationPackage
development HTTP server, with hot reloadingbrowser-sync
production HTTP Serverhttp-server
Test runnerCypress (note: we're just using the free and open source runner, not the paid/hosted product)
Application performance toolLighthouse
Standardized Code Formatting (syntax gotchas, etc)ESLint
Standardized Code formatting (for cypress test code)eslint-plugin-cypress
Standardized Code Formatting (indentation, etc)Prettier
Getting eslint and prettier to play well together (avoiding conflicting rules)eslint-config-prettier
Running prettier rules as part of eslinteslint-plugin-prettier
For CI, wait for the server to start before running testswait-on
Keeping performance/accessibility in check via Lighthousecypress-audit which uses lighthouse-ci
CSS LibraryTailwind CSS

Recommended Text Editor Extensions

Notes

  • We're using tailwindcss via a CDN for now to try it out. If we decide to stick with it, we should add it in via a css build tool (like postcss) instead of using the CDN directly.
  • For now everything (dev, prod, testing) uses port 8080. If/when that gets in the way of anything, we can set it up to use a different port for dev/testing vs prod.

# Packages

Package main is used to launch a demo site for the wasm.