In your package.json
file, just add an extra command to the script say, "start" that starts your server chaining the yarn install --check-files
command (reinstall all packages that have changed) and the start command using &&
like this:
"scripts": {
"start": "yarn install --check-files && someStartCommand someFile.xyz",
"someOtherScript": "someOtherCommand someOtherFile.xyz",
}
Alternatively, you can use the yarn upgrade
command if you want to update your packages to their latest version based on the version range specified in the package.json
file by adding an extra command to the script say, "start" that starts your server chaining the yarn upgrade
command and the start command using &&
like this:
"scripts": {
"start": "yarn upgrade && someStartCommand someFile.xyz",
"someOtherScript": "someOtherCommand someOtherFile.xyz",
}
You can also add the --latest
flag to your yarn upgrade
command if you want to ignore the version range specified in package.json
and instead install the version specified by the latest tag (potentially upgrading the packages across major versions).