We'll learn about migration generators and use them to jump to a specific lab in the workshop.
- Understand the
nx migrate
command - Install the
@nrwl/nx-workshop
package - Migrate to a specific version
- Modify the migrations.json file
-
Install an old version of the
@nrwl/nx-workshop
npm package:yarn add -D @nrwl/[email protected]
-
Make sure you've committed all your changes to this point:
git commit -am "lab 3"
-
Migrate to the latest version of
@nrwl/nx-workshop
🐳 Hint
nx migrate @nrwl/nx-workshop@latest
-
Look at the
migrations.json
file. It contains the generators to complete every lab in the workshop. We don't want to run everything, so let's delete every migration entry except for labs 1 through 3. -
The
migrations.json
file should now only contain generators for the first 3 labs. Let's run those migrations:nx migrate --run-migrations
. -
There's also a generator that comes with
@nrwl/nx-workshop
to help you set up themigrations.json
file to complete a specific lab or to complete a range of labs in option 1 or option 2. Experiment with thecomplete-labs
generator so that later on you can catch up if you get stuck on a lab.nx g @nrwl/nx-workshop:complete-labs --help