{"id":7048,"date":"2019-06-08T20:17:18","date_gmt":"2019-06-08T20:17:18","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=7048"},"modified":"2019-06-08T20:17:18","modified_gmt":"2019-06-08T20:17:18","slug":"yarn-and-what-not-to-commit-to-your-source-repos","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/yarn-and-what-not-to-commit-to-your-source-repos\/","title":{"rendered":"Yarn and what not to commit to your source repos"},"content":{"rendered":"<p>When working with yarn you&#8217;ll find your source code folder includes the following files and folder (amongst others)<\/p>\n<ul>\n<li>packages.json<\/li>\n<li>yarn.lock<\/li>\n<li>node_modules<\/li>\n<\/ul>\n<p>If using TypeScript you may also have <em>tsconfig.json<\/em>.<\/p>\n<p>The <em>node_modules<\/em> folder is basically everything downloaded via yarn that are either included within the <em>packages.json<\/em> or dependencies of those packages. So unless you&#8217;re fearful of versions of mdoules\/dependencies becoming unavailable, this folder can be left out of source control, plus it can get big quickly.<\/p>\n<p>The <em>packages.json<\/em> file should be committed as it obviously includes all the information regarding the packages used and their versions, but is also used for scripts etc.<\/p>\n<p>Interestingly, I thought that <em>yarn.lock<\/em> should also be excluded as it&#8217;s generated by yarn, but according to <a href=\"https:\/\/yarnpkg.com\/blog\/2016\/11\/24\/lockfiles-for-all\/\" rel=\"noopener noreferrer\" target=\"_blank\">Lockfiles should be committed on all projects<\/a>.<\/p>\n<p>If you have <em>tsconfig.json<\/em>, this file is a TypeScript configuration file. Hence this should be committed to ensure other team members are using the same configuration.<\/p>\n<p><strong>What about .vscode<\/strong><\/p>\n<p>If you&#8217;re using VSCode as your editor\/development tool then you&#8217;ll notice that a .vscode folder is created in some cases with settings.json etc. within it. <\/p>\n<p>Obviously whether you commit .vscode (or individual files within it) depends on whether you&#8217;re also aiming to commit shared settings etc. To my mind this would be a good thing as I use multiple machines for development and it&#8217;s an easy way for me to share settings between machines. This said if you&#8217;re a larger team it also might be useful to ensure everyone uses the same settings.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When working with yarn you&#8217;ll find your source code folder includes the following files and folder (amongst others) packages.json yarn.lock node_modules If using TypeScript you may also have tsconfig.json. The node_modules folder is basically everything downloaded via yarn that are either included within the packages.json or dependencies of those packages. So unless you&#8217;re fearful of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[242],"tags":[],"class_list":["post-7048","post","type-post","status-publish","format-standard","hentry","category-yarn"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=7048"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7048\/revisions"}],"predecessor-version":[{"id":7152,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7048\/revisions\/7152"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=7048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=7048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=7048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}