Yarn creates a yarn.lock file after you perform a yarn install.
yarn.lock
yarn install
Should this be committed to the repository or ignored? What is it for?
Yes, You should commit it. For more about yarn.lock file, refer the official docs here