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 versionIf necessary, install
npm install --global @memberjunction/clior update it
npm update --global @memberjunction/cliFinally, run the bump command to update the package.json in the current directory
mj bumpThe 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 migrateThe 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.0This 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 codegenThis will ensure that your apps are completely up to date with the latest features and fixes.
TL;DR:
npm update --global @memberjunction/cli- Monorepo?
mj bump -r && npm install- otherwise,
mj bump -rq | xargs -n1 -I{} npm install --prefix {}
mj migrate -t mainmj codegen
Updated 4 months ago
