Updating JOPS
How you update JOPS depends on where your page loads the library from.
-
Install the new version into
node_modules:Terminal window npm i jops-core@latest -
Copy it into your project, where the browser loads it from:
Terminal window npx jops-core update -
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".
Change the version in the URL, in both the import map and the script tag:
<script type="importmap">{ "imports": { "jops-core": "https://cdn.jsdelivr.net/npm/jops-core@1.1.10/lib/jops-core.min.js" }}</script><script type="module" src="https://cdn.jsdelivr.net/npm/jops-core@1.1.10/lib/jops-core.min.js" data-app="./src/App.js"></script>With @latest you get new releases automatically, once the CDN refreshes its cache.
Where update copies the library
Section titled “Where update copies the library”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 |
Update notices
Section titled “Update notices”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 updateThe 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.