Updating MemberJunction to a new version
As new versions are published to NPM, you can update your installation to take advantage of new features. The latest distribution zip will always contain template projects for MJAPI and MJExplorer that use the latest MemberJunction library versions. However, we try to keep those templates stable so that new features can be used just by updating your dependency versions.
To update the dependency versions for your installation, start by confirming you have the latest CLI version installed globally
mj version
If necessary, install
npm install --global @memberjunction/cli
or update it
npm update --global @memberjunction/cli
Finally, run the bump
command to update the package.json in the current directory
mj bump
The command can also update all subdirectories by using the -r
flag. Additionally, in environments that support it, you can also use the -q
flag to limit the output to just the paths for the package.json files that were updated. This allows piping the output to an npm install
command to update node_modules
locally and the package-lock.json
file for each package.
mj bump -rq | xargs -n1 -I{} npm install --prefix {}
Minor versions
MemberJunction follows a Semver-style versioning scheme in which minor versions are used to indicate that a database migration is required. To update the minor version of your installation (e.g. from 2.12.0 to 2.13.3) be sure to run the migration tool using the latest CLI
mj migrate
The migration tool will use your mj.config.cjs
to connect to the database and run the latest migrations. By default, it will read migrations from the ./migrations
directory (and subdirectories), however, a specific version can be targeted by using the -t
flag
mj migrate -t v2.13.0
This will use migrations from the GitHub ref tagged as v2.13.0
. It is also possible to use the latest migrations with the tag main
for the latest release or next
for the currently available upcoming release (be careful with this one).
After updating, run CodeGen
Because updates (especially minor updates) often affect generated code, it's important to run CodeGen as the final step in your update process.
mj codegen
This will ensure that your apps are completely up to date with the latest features and fixes.
Updated 14 days ago