@loopback/docs
Version:
Documentation for LoopBack 4
76 lines (64 loc) • 2.99 kB
Markdown
---
lang: en
title: 'Update generator'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/Update-generator.html
---
{% include content/generator-create-app.html lang=page.lang %}
### Synopsis
The `lb4 update` command runs against a LoopBack 4 project and checks
dependencies against the installed `/cli`. By default, it checks for
exact match. Use `--semver` option to check compatibility using semver
semantics.
```sh
lb4 update [options]
```
The key benefit of `lb4 update` over `npm update` is that `lb4 update` honors
the collection of compatible LoopBack packages (and their dependencies) that are
released with the current lb4 command from `/cli`.
If the command is run without a LoopBack 4 project, it prints the version of the
current CLI and versions of LoopBack packages that are released with the
`/cli`. This is the same as `lb4 -v`.
### Options
`--semver` : _(Optional)_ Use semver semantics to check version compatibility
for project dependencies of LoopBack modules. Without this option, `lb4 update`
performs exact version match between the project dependency and the one from
running CLI template, for example, `"@loopback/core": "^1.2.1"` is considered
different from `"@loopback/core":"^1.2.2"`. The `--semver` flag relaxes the
check to allow `"@loopback/core": "^1.2.1"` to be compatible with
`"@loopback/core": "^1.2.2"` (a new patch version), but not
`"@loopback/core": "^2.0.0"` (a new major version).
### Output
Assuming you have a project `my-app` scaffolded with version `1.0.1` of
`/cli` and you install a newer version (`1.24.0`) of `/cli`,
running `lb4 update` against `my-app` will produce the following output:
```
The project was originally generated by /cli@1.0.1.
The following dependencies are incompatible with /cli@1.24.0:
- /node: ^10.14.6 (cli ^10.17.3)
- /boot: ^1.2.7 (cli ^1.5.10)
- /build: ^1.5.4 (cli ^2.0.15)
- /context: ^1.15.0 (cli ^1.23.4)
- /core: ^1.7.0 (cli ^1.10.6)
- /openapi-v3: ^1.3.11 (cli ^1.10.0)
- /repository: ^1.5.5 (cli ^1.15.3)
- /rest: ^1.11.2 (cli ^1.22.0)
- /testlab: ^1.2.9 (cli ^1.9.3)
- /service-proxy: ^1.1.10 (cli ^1.3.10)
? How do you want to proceed? Upgrade project dependencies
- Dependency /boot: ^1.2.7 => ^1.5.10
- Dependency /context: ^1.15.0 => ^1.23.4
- Dependency /core: ^1.7.0 => ^1.10.6
- Dependency /openapi-v3: ^1.3.11 => ^1.10.0
- Dependency /repository: ^1.5.5 => ^1.15.3
- Dependency /rest: ^1.11.2 => ^1.22.0
- Dependency /service-proxy: ^1.1.10 => ^1.3.10
- DevDependency /build: ^1.5.4 => ^2.0.15
- DevDependency /testlab: ^1.2.9 => ^1.9.3
- DevDependency /node: ^10.14.6 => ^10.17.3
Upgrading dependencies may break the current project.
conflict package.json
? Overwrite package.json? overwrite
force package.json
```