๐ Lab 3.1 - Migrations
March 19, 2023 ยท View on GitHub
โฐ Estimated time: 5-15 minutes
We'll learn about migration generators and use them to jump to a specific lab in the workshop.
๐ Learning outcomes:
- Understand the
nx migratecommand - Install the
@nrwl/nx-workshoppackage - Migrate to a specific version
- Modify the migrations.json file
๐ฒ After this workshop, you should have:
App Screenshot
File structure
๐๏ธโโ๏ธ Steps:
-
Install an old version of the
@nrwl/nx-workshopnpm package:nx-workshop@0.0.1 -
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.jsonfile. 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.jsonfile 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-workshopto help you set up themigrations.jsonfile to complete a specific lab or to complete a range of labs in option 1 or option 2. Experiment with thecomplete-labsgenerator so that later on you can catch up if you get stuck on a lab.nx g @nrwl/nx-workshop:complete-labs --help