Skip to content

Updating JOPS

How you update JOPS depends on where your page loads the library from.

  1. Install the new version into node_modules:

    Terminal window
    npm i jops-core@latest
  2. Copy it into your project, where the browser loads it from:

    Terminal window
    npx jops-core update
  3. Reload the page (a hard reload clears a cached copy of the old file).

Run both commands. npm i only updates node_modules, which the browser never loads. npx jops-core update copies the new lib/jops-core.min.js into your project. Running update without npm i first has no effect: it copies whatever version is already in node_modules.

In web, Cordova and Capacitor projects, the "postinstall": "jops-core update" script that init adds runs step 2 for you after every npm install. Projects created before 1.1.8 have "postinstall": "npx jops-core init", which shows the template question on every npm install (since 1.1.8 it uses 5, None, when nobody answers; before, npm install failed in CI). Change it to "postinstall": "jops-core update".

npx jops-core update knows the project types the CLI supports:

Project Library copied to
Web project lib/jops-core.min.js
Next.js project public/lib/jops-core.min.js
Electron project src/lib/jops-core.min.js
Cordova / Capacitor lib/ inside the web folder (www/ or your webDir)
WordPress also refreshes an installed JOPS plugin

After each command, the CLI checks npm for a newer jops-core and prints a notice when one is available:

[jops-core] Update available: 1.1.9 → 1.1.10
npm i jops-core@latest && npx jops-core update

The check takes at most 1.5 seconds and stays silent when you are offline. Turn it off with --no-update-check or the environment variable JOPS_NO_UPDATE_CHECK=1. It is skipped automatically when CI is set.

See the CLI reference for every command and flag.