<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Pavesoft - Medium]]></title>
        <description><![CDATA[A community of passionate designers &amp; engineers building delightful digital experiences, one at a time. - Medium]]></description>
        <link>https://medium.com/pavesoft?source=rss----7403e91e373d---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Pavesoft - Medium</title>
            <link>https://medium.com/pavesoft?source=rss----7403e91e373d---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:43:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/pavesoft" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[package-lock.json: The Complete Guide]]></title>
            <link>https://medium.com/pavesoft/package-lock-json-the-complete-guide-2ae40175ebdd?source=rss----7403e91e373d---4</link>
            <guid isPermaLink="false">https://medium.com/p/2ae40175ebdd</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Atharva Kulkarni]]></dc:creator>
            <pubDate>Wed, 21 Feb 2024 12:31:33 GMT</pubDate>
            <atom:updated>2023-04-11T03:05:29.553Z</atom:updated>
            <content:encoded><![CDATA[<h4>What is package-lock.json? And why should you care?</h4><h3>What is package.json?</h3><p><strong>package.json</strong> is a versioning file that primarily contains the list of dependencies (libraries) your node.js project needs to run.</p><p>It also includes other meta information like scripts, author &amp; license information, description, project properties etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*AJYiVa1Y_6YNitxIOIlNvw.png" /><figcaption>package.json</figcaption></figure><h3>An Inherent Problem</h3><p>In the above package.json, you can see that the “dependencies” object maps <strong>package-name to the version range.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*6iKNqQJFCLyqCPlXg-GY6g.png" /><figcaption>The dependencies object contains the package name mapped to the version range</figcaption></figure><blockquote>Dependencies and/or peer dependencies generally have a version range specified in the package.json file, not the exact version range.</blockquote><p>This makes <strong>npm</strong> <strong>install </strong>non-deterministic. So, when you run npm install today, and then you run it again after 3 months, you may not end up with the same node_modules tree.</p><p>Moreover, if another developer clones your project, and runs npm install on it a few days later, they may have a different node_modules dependency tree. When multiple developers are working on the same repository (which is most likely the case in every organization), this might pose a big problem and lead to inconsistencies in the dependencies installed, or worse, breaking changes.</p><p>So, what’s the solution? First, let’s understand what the <strong><em>version range</em></strong> signifies. The <em>version range</em> is a string that contains one or more space-separated numbers. These numbers also contain some special symbols like ^ ~ &lt; ||, e.g. ^1.0.4, ~2.3, 4.4.x, &gt;=2.3.4, &lt;1.0.9 ||</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*v7lIyWEsNDVheixfzazh_A.png" /><figcaption>Different symbols denote different version updating strategies</figcaption></figure><p>These symbols tell npm different things:</p><p>Let&#39;s say I want to install a package “foo”. After I run npm i foo, my <strong><em>package.json</em></strong> file would mostly have an entry like this:</p><pre>{<br>  &quot;dependencies&quot;:{<br>     &quot;foo&quot;: &quot;^2.3.0&quot;,<br>     ...<br>     ...<br>    }<br>}</pre><p>Here, foo is installed with version <strong>2.3.0</strong> [major minor patch]. The caret symbol tells something more:</p><p>^2.3.0 — [Caret Symbol] This tells npm to upgrade to minor and patch versions, but not major versions. So, basically 2.3.4, 2.3.9, 2.4.5, 2.8 but not 3.0.0 onwards. (Upgrade to minor and patch, but not major)</p><p>~2.3.0 — [Tilde Symbol] This tells npm to upgrade to patch versions, but not minor and major versions. So 2.3.4, 2.3.9 but not 2.4.0 onwards. (Upgrade to patch, but not minor and major)</p><p>There are a lot of other symbols that denote different npm version updating strategies. The official <a href="https://docs.npmjs.com/cli/v8/configuring-npm/package-json#dependencies">npm website</a> is a good reference.</p><p>So for &quot;foo&quot;: &quot;^2.3.0&quot;, running npm install a few days later might automatically upgrade the minor/patch version. <strong><em>This is undesirable…</em></strong></p><blockquote>But don&#39;t worry, we have package-lock.json to the rescue…</blockquote><h3>What is package-lock.json?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*fxotZ2ReBeL8Ss5-6Oe_dw.png" /><figcaption>The lockfile is generated and re-generated when node_modules or package.json is changed</figcaption></figure><p><strong>package-lock.json </strong>is a <strong>lockfile</strong> that contains information about the dependencies/packages with their <strong><em>exact version numbers (*important)</em></strong> that were installed for a node.js project.</p><ul><li>It helps different developers working on the same repo to install the exact package versions installed previously, even if the packages have released new versions. This ensures the same node_modules tree across different machines/environments.</li><li>package-lock.json file is essentially used to <strong>lock</strong> dependencies to a specific version number.</li><li>This file is automatically generated (or re-generated) when there is a change in either the node_modules tree or package.json file.</li><li>Whenever we clone a repo and run npm i on a new machine, npm will first look to see if a <strong>package-lock.json</strong> file is present. If yes, it will proceed by installing the packages given in that file. Otherwise, it will look into the package.json file and start installing the required dependency packages. (📦 A caveat to this is explained later in the article)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MvUJgJYlLWAYelTGK5TFA.png" /><figcaption>package-lock.json file ensures the same node_modules tree across</figcaption></figure><h3>Should you commit your package-lock.json?</h3><p>Yes, this file should be committed to the source repository so that when developers clone your repo, they can install dependencies that exactly match the ones installed on your machine/environment. This is basically to replicate node.js environments as it is on different machines.</p><blockquote>As of npm v7, the lockfile includes enough information about the entire package tree thus reducing the need to read package.json files, and thereby increasing performance as well</blockquote><h3>JFYI</h3><p>I’ve just started on youtube, creating videos of beautiful javascript experiences. (<em>PS. its not a coding tutorial channel…</em>) Do check out its videos:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FqTzuf9pCu14%3Fstart%3D86%26feature%3Doembed%26start%3D86&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqTzuf9pCu14&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FqTzuf9pCu14%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0cc2bb06f11b36200b390b7f358e1b3e/href">https://medium.com/media/0cc2bb06f11b36200b390b7f358e1b3e/href</a></iframe><h3>Why / When does npm install rewrite package-lock.json?</h3><ul><li>📦 Caveat: npm install considers <strong>package-lock.json</strong> only if the package(s) to be installed are within the version range of package.json.</li><li>If the package version given in the lockfile is not in the version range of the package.json file, packages are updated &amp; package-lock.json is overwritten.</li><li>If you want the installation to fail instead of overwriting package-lock.json, use npm ci.</li></ul><p><strong>For example,</strong></p><p>You declare a dependency in package.json like:</p><pre>&quot;foo&quot;: &quot;^2.3.0&quot;</pre><p>Then you do, npm install which will generate a package-lock.json with:</p><pre>&quot;foo&quot;: &quot;2.3.0&quot;</pre><p><em>Few days later, a newer minor version of “foo” is released, say “2.4.0”, then this happens:</em></p><p><strong>npm install </strong>— package-lock version is within the range (i.e. ^2.3.0) so 2.3.0 is installed<br><strong>npm ci </strong>— This anyway only looks at the package-lock.json so 2.3.0 is installed</p><p><em>Next, you </em><strong><em>manually</em></strong><em> update your package.json to:</em></p><pre>&quot;foo&quot;: &quot;^2.4.0&quot;</pre><p><em>Then rerun:</em></p><p><strong>npm install </strong>— package-lock version is not within the range (i.e. ^2.4.0) so 2.4.0 is installed and the package-lock.json is re-written to now show: <br>&quot;foo&quot;: &quot;2.4.0&quot;</p><p><strong>npm ci </strong>— This anyway only looks at the package-lock.json, but since the version is not within the range, it throws an error.</p><p><strong><em>npm ci</em></strong> command is similar to npm install, except it’s meant to be used in automated environments such as test platforms, continuous integration, and deployment — or any situation where you want to make sure you’re doing a clean installation of your dependencies. (Source: <a href="https://docs.npmjs.com/cli/v8/commands/npm-ci">npm docs</a>)</p><h3>So in a nutshell:</h3><ol><li>npm install is not deterministic, which poses a problem when you’re working on a repo (with multiple devs) containing thousands of dependencies.</li><li>The package-lock.json file ensures that the same node_modules tree is generated every time npm install is run.</li><li>A newer command npm ci ensures that it ALWAYS creates the same node_modules tree, otherwise throws an error.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ae40175ebdd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pavesoft/package-lock-json-the-complete-guide-2ae40175ebdd">package-lock.json: The Complete Guide</a> was originally published in <a href="https://medium.com/pavesoft">Pavesoft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dark Mode UI: the definitive guide]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/pavesoft/dark-mode-ui-design-the-definitive-guide-part-1-color-53dcfaea5129?source=rss----7403e91e373d---4"><img src="https://cdn-images-1.medium.com/max/2600/1*3U5Md2C2Ni1s-ckj1LgM_w.jpeg" width="7680"></a></p><p class="medium-feed-snippet">Dark mode is finding more appeal by the day. This article series gives you the insight to build a well-crafted dark UI for your next&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/pavesoft/dark-mode-ui-design-the-definitive-guide-part-1-color-53dcfaea5129?source=rss----7403e91e373d---4">Continue reading on Pavesoft »</a></p></div>]]></description>
            <link>https://medium.com/pavesoft/dark-mode-ui-design-the-definitive-guide-part-1-color-53dcfaea5129?source=rss----7403e91e373d---4</link>
            <guid isPermaLink="false">https://medium.com/p/53dcfaea5129</guid>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[visual-design]]></category>
            <category><![CDATA[dark-mode]]></category>
            <category><![CDATA[color-palette]]></category>
            <category><![CDATA[guides-and-tutorials]]></category>
            <dc:creator><![CDATA[Atharva Kulkarni]]></dc:creator>
            <pubDate>Wed, 21 Feb 2024 12:30:22 GMT</pubDate>
            <atom:updated>2024-02-06T11:28:12.154Z</atom:updated>
        </item>
    </channel>
</rss>