<?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[Stories by Berkan Sezer on Medium]]></title>
        <description><![CDATA[Stories by Berkan Sezer on Medium]]></description>
        <link>https://medium.com/@kberkansezer?source=rss-68f417119bf1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*X_1rQeAXtXVrWcWu</url>
            <title>Stories by Berkan Sezer on Medium</title>
            <link>https://medium.com/@kberkansezer?source=rss-68f417119bf1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 16:41:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kberkansezer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Visual Testing That Doesn’t Suck: Playwright + GitHub Actions = Chef’s Kiss ]]></title>
            <link>https://medium.com/insiderengineering/visual-testing-that-doesnt-suck-playwright-github-actions-chef-s-kiss-efc27e0e8d83?source=rss-68f417119bf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/efc27e0e8d83</guid>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[visual-testing]]></category>
            <dc:creator><![CDATA[Berkan Sezer]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 07:02:51 GMT</pubDate>
            <atom:updated>2026-01-12T07:02:51.129Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uVBeHpG1rDOMlm3X5IYiAQ.png" /></figure><p>Modern teams rely on visual regression testing to keep UI changes intentional. In this guide, I’ll show how to run Playwright visual tests on every pull request, publish rich HTML reports to AWS S3, comment the results back to the PR, and provide a manual workflow to safely update snapshots when changes are expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dp9WZFlk5IMtL1to56XVtA.png" /><figcaption>CI Flow of playwright.yml</figcaption></figure><h4>What you will get from this article.</h4><ul><li><strong>Visual diffs</strong>: Compare screenshots to detect regressions.</li><li><strong>Rich reporting</strong>: Upload the HTML report and logs to S3, link them in the PR.</li><li><strong>Snapshot management</strong>: Manually trigger a second workflow to update snapshots and commit them back to the same PR.</li><li><strong>Traceability</strong>: GitHub App token for safe commits; S3 path keyed by branch and short SHA.</li></ul><h3>Prerequisites</h3><ul><li>A working <a href="https://playwright.dev/"><em>Playwright</em></a> test suite, including visual snapshot tests.</li><li>AWS S3 bucket access (programmatic credentials for CI).</li><li>GitHub App credentials (App ID, private key) for making commits from CI.</li><li>A self‑hosted runner(optional but strongly recommended) or GitHub‑hosted runner with Chromium dependencies. The examples below run on self-hosted.</li><li>Project secrets configured in your repo settings:</li></ul><pre>CI_GITHUB_APP_ID<br>CI_GITHUB_APP_PRIVATE_KEY<br>AWS_ACCESS_KEY_ID<br>AWS_SECRET_ACCESS_KEY<br>AWS_REGION<br>AWS_S3_BUCKET</pre><ul><li>Any app‑specific runtime envs (example: APP_PLUGIN_ID, APP_SECRET_KEY, APP_ROLE).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*fFKQNBri6KDZ84L1YLb0Vw.png" /><figcaption><a href="https://github.com/useinsider/guido/settings/secrets/actions">https://github.com/{company}/{repository}/settings/secrets/actions</a></figcaption></figure><h3>Workflow 1: Run Playwright on every PR and publish reports 📷</h3><p>Create a file like .github/workflows/playwright.yml to run on pull_request to develop. Key responsibilities:</p><ul><li>Install dependencies and Playwright browsers</li><li>Start your web app under test</li><li>Execute Playwright</li><li>Upload HTML report and logs to S3 (scoped by branch/commit for preventing cache and rerun issues)</li><li>Comment on the PR with a friendly summary and deep links</li></ul><p>Here’s the essential structure:</p><pre>name: Playwright Tests<br>on:<br>  pull_request:<br>    branches:<br>      - develop<br>jobs:<br>  test:<br>    timeout-minutes: 60<br>    runs-on: self-hosted #change it with your runner name.</pre><p>And you need to add your Playwright job here, step by step.</p><p>Add your GitHub App token generator:</p><pre>    steps:<br>      - name: Create GitHub App token<br>        id: github-app-token<br>        uses: actions/create-github-app-token@v2<br>        with:<br>          app-id: ${{ secrets.GITHUB_APP_ID }}<br>          private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}<br><br>      - uses: actions/checkout@v4<br>      - uses: actions/setup-node@v4<br>        with:<br>          node-version: lts/*</pre><p>Install dependencies &amp; Playwright Browsers:</p><pre>      - name: Install dependencies<br>        run: npm ci --legacy-peer-deps<br><br>      - name: Install Playwright Browsers<br>        run: npx playwright install --with-deps chromium # We just need chromium</pre><p>Start your web app with nohup:<br><em>Nohup keeps your project open in the background, and you can continue to use the terminal.</em></p><pre>      - name: Start web server<br>        run: |<br>          nohup npm start &gt; web.log 2&gt;&amp;1 &amp;<br>          sleep 10<br>        env:<br>          APP_PLUGIN_ID: ${{ secrets.APP_PLUGIN_ID }}<br>          APP_SECRET_KEY: ${{ secrets.APP_SECRET_KEY }}<br>          APP_ROLE: ${{ secrets.APP_ROLE }}</pre><p>Start running Playwright Tests:</p><p><em>Use </em><em>--reporter=dot,html to generate both concise CI output and a browsable HTML report.</em></p><pre>      - name: Run Playwright tests<br>        id: playwright-tests<br>        run: |<br>          npx playwright test --reporter=dot,html<br>          echo &quot;exit_code=$?&quot; &gt;&gt; $GITHUB_OUTPUT #we need this later<br>        env:<br>          APP_PLUGIN_ID: ${{ secrets.APP_PLUGIN_ID }}<br>          APP_SECRET_KEY: ${{ secrets.APP_SECRET_KEY }}<br>          APP_ROLE: ${{ secrets.APP_ROLE }}</pre><p>Configure AWS Credentials:</p><pre>      - name: Configure AWS Credential for S3<br>        if: always()<br>        uses: aws-actions/configure-aws-credentials@v4<br>        with:<br>          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}<br>          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>          aws-region: ${{ secrets.AWS_REGION_EU_WEST }}</pre><p>Upload to AWS S3:<br><em>Here, it creates a unique path for your test results like </em><em>playwright/TASK-ID/SHA</em></p><pre>      - name: Upload test report to S3<br>        if: always()<br>        run: |<br>          # Create short sha for unique folder names<br>          COMMIT_SHA=${GITHUB_SHA:0:7}<br>          BRANCH_NAME=$(echo &quot;${{ github.head_ref }}&quot; | cut -d&#39;/&#39; -f2)<br>          PROJECT_NAME=playwright<br><br>          # Determine test status<br>          if [ -f &quot;playwright-report/index.html&quot; ]; then<br>            TEST_STATUS=&quot;completed&quot;<br>          else<br>            TEST_STATUS=&quot;failed&quot;<br>          fi<br><br>          # Upload HTML report<br>          if [ -d &quot;playwright-report&quot; ]; then<br>            aws s3 sync playwright-report/ s3://${{ secrets.AWS_S3_BUCKET }}/$PROJECT_NAME/$BRANCH_NAME/$COMMIT_SHA/ --delete<br>            echo &quot;Report uploaded to: s3://${{ secrets.AWS_S3_BUCKET }}/$PROJECT_NAME/$BRANCH_NAME/$COMMIT_SHA/&quot;<br>          fi<br><br>          # Upload server logs if they exist<br>          if [ -f &quot;web.log&quot; ]; then<br>            aws s3 cp web.log s3://${{ secrets.AWS_S3_BUCKET }}/$PROJECT_NAME/$BRANCH_NAME/$COMMIT_SHA/web.log<br>          fi<br><br>          if [ -f &quot;test.log&quot; ]; then<br>            aws s3 cp test.log s3://${{ secrets.AWS_S3_BUCKET }}/$PROJECT_NAME/$BRANCH_NAME/$COMMIT_SHA/test.log<br>          fi<br><br>          # Create a summary file with metadata<br>          cat &gt; report-metadata.json &lt;&lt; EOF<br>          {<br>            &quot;repository&quot;: &quot;$GITHUB_REPOSITORY&quot;,<br>            &quot;branch&quot;: &quot;$BRANCH_NAME&quot;,<br>            &quot;commit&quot;: &quot;$GITHUB_SHA&quot;,<br>            &quot;workflow_run_id&quot;: &quot;$GITHUB_RUN_ID&quot;,<br>            &quot;test_status&quot;: &quot;$TEST_STATUS&quot;,<br>            &quot;report_url&quot;: &quot;s3://${{ secrets.AWS_S3_BUCKET }}/$PROJECT_NAME/$BRANCH_NAME/$COMMIT_SHA/&quot;<br>          }<br>          EOF<br><br>          aws s3 cp report-metadata.json s3://${{ secrets.AWS_S3_BUCKET }}/$PROJECT_NAME/$BRANCH_NAME/$COMMIT_SHA/metadata.json<br><br>          # Output the S3 URL for easy access<br>          echo &quot;::notice::Playwright report uploaded to S3: s3://${{ secrets.AWS_S3_BUCKET }}/$PROJECT_NAME/$BRANCH_NAME/$COMMIT_SHA/&quot;<br><br>          # Save S3 URL to a file for the comment step<br>          echo &quot;https://${{ secrets.AWS_S3_BUCKET }}.s3.eu-west-1.amazonaws.com/$PROJECT_NAME/$BRANCH_NAME/$COMMIT_SHA&quot; &gt; s3_report_url.txt</pre><p>Prepare a comment message for sending to the Pull Request</p><blockquote>Since links in Github Comment’s not opening on new tab, i added a <strong>💡 Tip</strong> message for developers</blockquote><pre>      - name: Comment PR with S3 URL<br>        if: always() &amp;&amp; github.event_name == &#39;pull_request&#39;<br>        uses: actions/github-script@v7<br>        with:<br>          script: |<br>            const fs = require(&#39;fs&#39;);<br>            const s3Url = fs.readFileSync(&#39;s3_report_url.txt&#39;, &#39;utf8&#39;).trim();<br>            const testStatus = &#39;${{ steps.upload-test-report.outputs.test_status }}&#39; || &#39;unknown&#39;;<br>            const statusIcon = testStatus === &#39;completed&#39; ? &#39;✅&#39; : &#39;❌&#39;;<br><br>            const comment = `## Playwright Test Results ${statusIcon}<br><br>            **Status:** ${testStatus === &#39;completed&#39; ? &#39;All tests passed&#39; : &#39;Some tests failed&#39;}<br><br>            **📊 Test Report:** [View Report](${s3Url}/index.html)<br><br>            **🔍 Logs:**<br>            - [Web Server Log](${s3Url}/web.log) (if available)<br>            - [Test Server Log](${s3Url}/test.log) (if available)<br>            - [Metadata](${s3Url}/metadata.json)<br><br>            ---<br>            *💡 Tip: Right-click links and select &quot;Open in new tab&quot; or use Cmd+Click*<br>            *Report generated at: ${new Date().toLocaleString(&#39;tr-TR&#39;, { <br>              day: &#39;2-digit&#39;, <br>              month: &#39;2-digit&#39;, <br>              year: &#39;numeric&#39;, <br>              hour: &#39;2-digit&#39;, <br>              minute: &#39;2-digit&#39;, <br>              second: &#39;2-digit&#39;,<br>              hour12: false <br>            }).replace(/\//g, &#39;.&#39;)}*<br>            *Workflow Run: [#${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})*`;<br><br>            github.rest.issues.createComment({<br>              issue_number: context.issue.number,<br>              owner: context.repo.owner,<br>              repo: context.repo.repo,<br>              body: comment<br>            });```</pre><p>Add some scenario if it fails</p><pre>      - name: Fail if tests failed<br>        if: steps.playwright-tests.outputs.exit_code != &#39;0&#39;<br>        run: exit 1</pre><blockquote>⚠️ <strong>Before running this on your branch, you have to push to develop. Otherwise it will not trigger.</strong></blockquote><p>Now, you have a CI for playwright testing. Now, you can open a pull request to <em>develop </em>branch, and you will be able to see the action under your PR.</p><p>It will send a message when it is done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*XmoAmYcRkAyNM6rFaKIqwg.png" /><figcaption>Example for failing cases.</figcaption></figure><h3>Workflow 2: Manually update visual snapshots 📸</h3><p>When a change is intentional (new UI, redesign), you can update snapshots safely via a separate, manual workflow. This keeps the validation workflow strict and only updates snapshots on demand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oq1uZT57kNLRNCDM_3oCLQ.png" /><figcaption>CI Flow of playwright-update-snapshots.yml</figcaption></figure><p>Create a file to .github/workflows/playwright-update-snapshots.yml like this</p><p><em>It triggers manually because of </em><em>workflow_dispatch</em></p><pre>name: Update Playwright Snapshots<br>on:<br>  workflow_dispatch:<br><br>jobs:<br>  update-snapshots:<br>    timeout-minutes: 60<br>    runs-on: self-hosted #change it with your runner name</pre><p>Create a GitHub token and checkout:</p><pre>    steps:<br>      - name: Create GitHub App token<br>        id: github-app-token<br>        uses: actions/create-github-app-token@v2<br>        with:<br>          app-id: ${{ secrets.GITHUB_APP_ID }}<br>          private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}<br><br>      - name: Checkout code<br>        uses: actions/checkout@v4<br><br>      - name: Setup Node.js<br>        uses: actions/setup-node@v4<br>        with:<br>          node-version: lts/*</pre><p>Install Dependencies &amp; Start Web Server:</p><pre><br>      - name: Install dependencies<br>        run: npm ci --legacy-peer-deps<br><br>      - name: Install Playwright Browsers<br>        run: npx playwright install --with-deps chromium # We just need chromium<br><br>      - name: Start web server<br>        run: |<br>          nohup npm start &gt; web.log 2&gt;&amp;1 &amp;<br>          sleep 10<br>        env:<br>          APP_PLUGIN_ID: ${{ secrets.APP_PLUGIN_ID }}<br>          APP_SECRET_KEY: ${{ secrets.APP_SECRET_KEY }}<br>          APP_ROLE: ${{ secrets.APP_ROLE }}</pre><p>Let the fight begin: Run the update command for Playwright:</p><pre>- name: Update Playwright snapshots<br>        id: update-snapshots<br>        run: |<br>          npx playwright test --update-snapshots --reporter html<br>          echo &quot;exit_code=$?&quot; &gt;&gt; $GITHUB_OUTPUT</pre><p>(Optional) You can save results as a GitHub artifact for debugging:</p><pre>      - name: Upload Playwright Report as Artifact<br>        uses: actions/upload-artifact@v4<br>        if: ${{ !cancelled() }}<br>        with:<br>          name: playwright-report<br>          path: playwright-report/<br>          retention-days: 10</pre><p>Now, Screenshots updated 🎉 Let’s commit them to the PR.</p><pre><br>      - name: Commit updated snapshots<br>        id: commit-snapshots<br>        run: |<br>          git config --local user.email &quot;github-actions[bot]@users.noreply.github.com&quot;<br>          git config --local user.name &quot;Visual Snapshot Updater [bot]&quot;<br>          git add __tests__/visual #give your test path here<br>          git diff --staged --quiet || git commit -m &quot;Update Playwright snapshots [skip ci]&quot;<br>          git push<br>          echo &quot;snapshots_updated=true&quot; &gt;&gt; $GITHUB_OUTPUT</pre><p>Also developer should know the result of this runner. So, let&#39;s send a message to PR.</p><p><em>Also, I added the username of who triggered the job.</em></p><pre><br>      - name: Comment on PR with results<br>        if: always()<br>        uses: actions/github-script@v7<br>        with:<br>          script: |<br>            const updateExitCode = &#39;${{ steps.update-snapshots.outputs.exit_code }}&#39;;<br>            const snapshotsUpdated = &#39;${{ steps.commit-snapshots.outputs.snapshots_updated }}&#39;;<br><br>            let statusIcon, statusMessage, detailsMessage;<br>            if (updateExitCode === &#39;0&#39;) {<br>              if (snapshotsUpdated === &#39;true&#39;) {<br>                statusIcon = &#39;✅&#39;;<br>                statusMessage = &#39;Visual tests passed and snapshots updated successfully!&#39;;<br>                detailsMessage = &#39;The visual regression tests have been completed and any necessary snapshot updates have been committed to your branch.&#39;;<br>              } else {<br>                statusIcon = &#39;✅&#39;;<br>                statusMessage = &#39;Visual tests passed - no snapshot updates needed&#39;;<br>                detailsMessage = &#39;All visual tests passed and your existing snapshots are up to date. No changes were committed.&#39;;<br>              }<br>            } else {<br>              statusIcon = &#39;❌&#39;;<br>              statusMessage = &#39;Visual tests failed - check the logs for details&#39;;<br>              detailsMessage = &#39;The visual regression tests encountered failures. Please review the test output and logs to identify the issues.&#39;;<br>            }<br><br>            const comment = `## 🎨 Visual Test Results ${statusIcon}\n\n` +<br>              `**Status:** ${statusMessage}\n\n` +<br>              `**Details:** ${detailsMessage}\n\n` +<br>              `---\n` +<br>              `*This workflow was manually triggered to update Playwright visual test snapshots.*`;<br><br>            const { data: pulls } = await github.rest.pulls.list({<br>              owner: context.repo.owner,<br>              repo: context.repo.repo,<br>              head: context.repo.owner + &#39;:&#39; + context.ref.replace(&#39;refs/heads/&#39;, &#39;&#39;),<br>              state: &#39;open&#39;<br>            });<br><br>            if (pulls.length &gt; 0) {<br>              await github.rest.issues.createComment({<br>                issue_number: pulls[0].number,<br>                owner: context.repo.owner,<br>                repo: context.repo.repo,<br>                body: comment<br>              });<br>            } else {<br>              console.log(&#39;No open PR found for this branch, skipping comment&#39;);<br>            }</pre><p>If Fails unexpectedly, let us upload the results to the artifact for debugging:</p><pre>      - name: Upload logs (if failed)<br>        if: failure()<br>        uses: actions/upload-artifact@v4<br>        with:<br>          name: server-logs<br>          path: |<br>            web.log<br>            test.log</pre><blockquote>⚠️ <strong>Before running this on your branch, you have to push to develop. Otherwise it will not trigger.</strong></blockquote><p>Now we can test 🎉</p><ul><li>You can reach this action in this path REPO_URL/actions/workflows/playwright-update-snapshots.yml</li><li><em>Click to </em><em>Run Workflow , choose your branch and Run.</em></li><li>You will see it succeed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3E_5O-4oE3jC6sXJ4oYwEQ.png" /><figcaption>Success page of playwright-update-snapshots.yml</figcaption></figure><p>Also success message has already been sent to the PR</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aYXlRj4qnywtOltCgedeQA.png" /><figcaption>Commit and Success Message for playwright-update-snapshots.yml</figcaption></figure><h3>Why a separate workflow ❓</h3><ul><li>Keeps the PR check deterministic: it must pass against current snapshots.</li><li>Snapshot updates are an intentional, auditable action.</li><li>Teams can review diffs before accepting new baselines.</li></ul><h3>Improvement Suggestions ⚡</h3><ul><li>You can add a CODEOWNER check for the second runner. It provides updates to screenshots by inexperienced developers.</li><li>Do not forget to configure your TTL(time to live) for S3 buckets and GitHub Artifacts to prevent extra charges.</li><li>Create your custom runner for better performance.</li></ul><h3>Conclusion 🗞️</h3><p>With two small workflows, you get robust PR‑level visual validation and a safe, auditable path for updating snapshots. Developers get fast feedback and rich diagnostics; reviewers get confidence that UI changes are intentional.</p><p>Drop these YAMLs into .github/workflows, wire up the secrets, and you’ll have a production‑grade visual testing pipeline that scales with your team.</p><p>If you are interested in more performance tricks, you can check <a href="https://medium.com/insiderengineering/size-matters-a-practical-guide-to-a-98-reduction-in-package-size-with-day-js-8853a44d3546">my other article</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efc27e0e8d83" width="1" height="1" alt=""><hr><p><a href="https://medium.com/insiderengineering/visual-testing-that-doesnt-suck-playwright-github-actions-chef-s-kiss-efc27e0e8d83">Visual Testing That Doesn’t Suck: Playwright + GitHub Actions = Chef’s Kiss 👌</a> was originally published in <a href="https://medium.com/insiderengineering">Insider One Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Size Matters: A Practical Guide to a 98% Reduction in Package Size with Day.js]]></title>
            <link>https://medium.com/insiderengineering/size-matters-a-practical-guide-to-a-98-reduction-in-package-size-with-day-js-8853a44d3546?source=rss-68f417119bf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8853a44d3546</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[package-management]]></category>
            <category><![CDATA[momentjs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Berkan Sezer]]></dc:creator>
            <pubDate>Tue, 23 Jan 2024 11:01:40 GMT</pubDate>
            <atom:updated>2024-01-23T11:01:40.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ta3krufWHD822qsGtPTpRA.png" /></figure><h3>Episode 1: Quick Preview</h3><h4>What is MomentJS &amp; Why do we need it?</h4><p>Moment is an external package for managing dates and times in your project, allowing you to format your date-time data. Another external package, moment-timezone, enables the manipulation of date-time data between timezones.</p><p>As a global company with numerous partners in different countries, we must provide our date-time data with timezone formatting.</p><h4>Why Do We Want to Get Rid of MomentJS?</h4><p>Firstly, as many of you may know, Moment is deprecated, but it is still usable on package managers such as NPM. However, using only Moment does not satisfy all of our needs; we also have to use moment-timezone. Let’s take a look at the chart to understand our concerns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2kDovKHnGRz9W_JX3N9VUg.png" /><figcaption>Source: <a href="https://bundlephobia.com/">bundlephobia.com</a></figcaption></figure><p>As you can see above, the Moment &amp; moment-timezone couple is quite large for the client side. Let’s continue and find an alternative library.</p><h4>An Alternative Library Selection</h4><p>We began our research on Moment’s official website and found documentation explaining why Moment is deprecated, along with alternatives and their pros and cons. You can check the documentation here: <a href="https://momentjs.com/docs/#/-project-status/">Moment Project Status</a>.</p><p>After extensive research, we narrowed down our selections to two alternatives: <em>date-fns</em>, popular and widely used, and <em>dayjs</em>, known for its small size and an API almost 100% compatible with Moment. Now, let’s check the performance and size comparison chart to see which one we chose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TgLa8o9cBNNF83Ijjk3fcg.png" /><figcaption>Size comparison between <em>moment</em>, <em>date-fns</em> and dayjs</figcaption></figure><p>Of course! We selected <strong>dayjs</strong> because of its small size, pluggability, and moment-like writing style. If you have your coffee ready, let’s dive in deeper! ☕</p><h3>Episode 2: Migration</h3><h4>How Did We Start to Migrate?</h4><p>With our complex codebase, some clever developers created a helper file for dedicated date-time functions called <em>DateHelper.js</em>. We quickly scanned the remaining files using Moment and replaced these functions with <em>DateHelper</em> functions. Now, our code structure looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5LUjrzNZk8cp3ha2zFNGPg.png" /><figcaption>Basic Codebase structure</figcaption></figure><p>We copied DateHelper.js and created a repository for it. We completed unit tests for each function, achieving 100% coverage. With the power of unit tests, we could be sure what function will return what value with what parameters.</p><p>Here is a small part of how DateHelper.js looks and its unit tests:</p><p><strong>DateHelper.js:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c50b777148c2a635a1b297306dc506c9/href">https://medium.com/media/c50b777148c2a635a1b297306dc506c9/href</a></iframe><p><strong>DateHelper.test.js:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c58cc10d44a0859c4f9e6f80be95cbc/href">https://medium.com/media/1c58cc10d44a0859c4f9e6f80be95cbc/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*haVC5WFF7A5Five-loVnGQ.png" /><figcaption>Unit test results after tests covered</figcaption></figure><p>After that, we installed <strong>dayjs</strong> instead of <em>moment</em> &amp; <em>moment-timezone</em> and started replacing them. Just a few changes were required: only import lines and <em>moment</em> functions calls changed.</p><p>Here is the diff:</p><p><a href="https://www.diffchecker.com/PKUyqcEA/">DateHelper.diff.js - Diff Checker</a></p><p><strong>And the final version of DateHelper is also available:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0facb1b3f790ddfe0af3a4026fd53d45/href">https://medium.com/media/0facb1b3f790ddfe0af3a4026fd53d45/href</a></iframe><p>No unit test changes were required, and they confirmed our migration was working correctly.</p><p>Here is the final result of <em>DateHelper.test.js</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QRrPbNfOyxll7vzUUhEslg.png" /><figcaption>Unit test results after dayjs integration</figcaption></figure><p>When we follow the same steps for the remaining parts, we will completely get rid of <em>moment &amp; moment-timezone</em> forever.</p><p>The article explains how to reduce client-side load size while migrating <em>momentjs</em> functions to <em>dayjs</em>. Also, it includes some practices, such as using another <em>layer </em>for managing external packages for maintainability.</p><p>I hope you enjoyed what you read along with your coffee ☕️</p><p>If you are interested in more performance tricks, you can check <a href="https://medium.com/insiderengineering/javascript-performance-optimization-with-vite-rollupjs-587d2cbf1979">this article</a> by <a href="https://medium.com/u/1f19a6d18af2">Ali Osman Menekse</a>, Senior Frontend Developer at Insider.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8853a44d3546" width="1" height="1" alt=""><hr><p><a href="https://medium.com/insiderengineering/size-matters-a-practical-guide-to-a-98-reduction-in-package-size-with-day-js-8853a44d3546">Size Matters: A Practical Guide to a 98% Reduction in Package Size with Day.js</a> was originally published in <a href="https://medium.com/insiderengineering">Insider One Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rastalının Gözünden Rastalarla Yasamak…]]></title>
            <link>https://medium.com/@kberkansezer/rastal%C4%B1n%C4%B1n-g%C3%B6z%C3%BCnden-rastalarla-yasamak-14c91a5f834c?source=rss-68f417119bf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/14c91a5f834c</guid>
            <category><![CDATA[saçtasarım]]></category>
            <category><![CDATA[dreadlocks]]></category>
            <category><![CDATA[rastayla-yaşamak]]></category>
            <category><![CDATA[rasta]]></category>
            <category><![CDATA[rastafari]]></category>
            <dc:creator><![CDATA[Berkan Sezer]]></dc:creator>
            <pubDate>Thu, 10 Jan 2019 22:58:12 GMT</pubDate>
            <atom:updated>2019-01-10T23:24:15.279Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J927Y67O-f57OY_SUN9Dpg.png" /></figure><p>Öncelikle rasta nedir diyelim. Rasta, gerek bal mumu gerekse tığ kullanarak saçı tutamlar halinde birbirine random olarak düğümleme şeklidir. Kaynaklara göre 2000 yıldan daha eskilere dayandığı da söz konusu… Size bahsedeceğim ve benim rastalarım tığ kullanılarak elle yapılan rasta olacak.</p><p>Rasta yaptırmayı son 4 senedir çok istiyordum lakin yaşadığım çevre ve bazı akrabalarımdan daha erkeğin saç uzatmasına alışamamış, “erkek adam saç mı uzatır?“ ya da “anan gibi saç uzatacağına baban gibi sakal uzat!” şeklindeki lafları hala duyduğum için rasta yaptırmayı hep ertelemiştim.</p><blockquote><strong>Rastayla Nasıl Tanıştım?</strong></blockquote><p>Lise sınavına gireceğim sene kuzenimin yanına İzmir’e gitmiştim. Üniversite yakınlarında dolaşırken bir kadın gördüm ve evet, saçları Rastalıydı. Gidip biraz konuştum, bugün benim aldığım bütün soruları ben de ona sordum. Ardından sürekli araştırma yapmaya başladım. Fiyatını öğrenince oldukça hayal kırıklığı yaşamıştım.</p><blockquote><strong>Ne Zamandır Rastalıyım?</strong></blockquote><p>2018 yılında artık saçlarım 50cm’i geçmiş ve neredeyse 5 yılını tamamlamak üzereydi. Bilen bilir, uzun ve dalgalı saçların bakımı çok çok zordur. Saçlarımı çok seviyordum ama yoğun okul ve iş hayatı her gün duş almama imkan vermiyordu. Ben de “<em>ya keserim bu saçları ya da Rasta yaparım” </em>dedim ve 2018 Haziran ayında Instagram’dan tanıştığım bir arkadaşa rastalarımı yaptırmaya karar verdim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*PT4f5Rkpyz8STphz1vm9AQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*QVSxTSuoG5zzmSBVYzqTRg.png" /></figure><blockquote><strong>Bakımı Zor Mu Ya Bunların? Nasıl Yıkıyorsun?</strong></blockquote><p>Öncelikle söyleyeyim bakımı biraz zor evet fakat her gün bakım yapmaktansa, 10–15 günde bir yıkamak (rastaları) oldukça pratik. Zira tam kuruması 4 - 6 saat kadar sürüyor. Bakımına gelince ise; ben biraz pimpirikli bir insanım ve en geç 2 ayda bir bakıma gidiyorum. Bakımını da rastacı kız yapıyor ve ücreti ise 100 TL civarında. Nasıl yıkıyorsun olayına da değinecek olursak; sadece kalıp sabunla sacları çok fazla üzmeden, köklerine masaj yapar gibi parmak uçlarıyla yıkamak yeterli oluyor. Rastanın gövdelerini de sabunlayıp ve bol su ile dikkatli bir şekilde duruluyorum. Banyodan sonra ise saçımı havluyla sarıp 4 saat ulufesi yeni yatmış yeniçeri gibi dolaşıyorum.</p><blockquote><strong>Hepsi Senin Mi Yavrum?</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_XApXMUQV9X-rGE2mI-SZQ.jpeg" /><figcaption>Ek yapildiktan sonraki hali II</figcaption></figure><p>Hayır. Rastalarımın tamamı benim değil. %70&#39;i benim o 50+cm’lik saçımdan yapıldı ama tahminimden daha kısa olduğu için(28-30 cm) 2 ay sonra ek yaptırdım. Ek saç için ister suni ister doğal saç kullanabilirsiniz.</p><p>Ben suni kullandım çünkü çok daha ucuz. Uçlarına ~15cm kadar ek yaptık ve bazılarına boncuk bazılarına renkli ipler takarak bugünkü görünümüne ulaştık.</p><p>Ek yapılacak saclarda bir risk alıp kızıl tonlarını sectim ve kesinlikle çok beğendim. Simdi ise bir tanesini sarıya cevirdik ve çok da güzel bir görünüme kavuştu.</p><blockquote><strong>Bunlarla Yaşaması Zor Mu?</strong></blockquote><p>Bu sorunun cevabı aslında evet. Size sürekli soru soran insanlar ve bir yere gittiğinizde dik dik bakan gözler sizi biraz hayattan soğutuyor. Bunun aksine ise saçınızı merak edip kampüste yemek yerken yanınıza oturan bir kadın da görmemek içten bile değil(yaşandı). Son zamanlarda kafama takılan şey ise giyim tarzı konusunda değişiklik yapmak istemem ve rastaların buna müsaade etmemesi. Klasik / Smart-casual tarzına geçmek istiyorum ama rastalarla düz gömlek bile giymek çok absürd kaçıyor. Bundan dolayı nadiren de olsa keşke rastalarım olmasaydı diyorum ama renkli ve hippi tarz gömlekler zaten sizi yeterince mutlu ve havalı yapıyor.</p><blockquote><strong>Geri Dönüşü Var Mı?</strong></blockquote><p>Evet, rastacım geri dönüşü olduğunu söyledi. Hatta bir tane rastamı açıp iki rastaya bile çevirdik. Yalnız bir tane rastanın bile açılması çok acı verdi. Ayrıca o sırada saçlarınızın bir kısmı hasar alıyor ve kopuyor. Eski saçlarınıza kavuşmayı asla beklemeyin. Eğer açtıracak olursanız da keratin beslemesi yapmanız ve uzun bir süre yağlarla beslemeniz gerekecektir.</p><p>Ben açtırmayı düşünmüyorum. Kestirip bir kavanozda ya da duvarımda hatıra olarak yıllarca saklamayı planlıyorum. Belki 10 sene sonra saçlarımı yeniden uzatıp rastaları ek yapmak için kullanabilirim.</p><blockquote><strong>Pişman Mısın?</strong></blockquote><p>Çok çok nadiren de gelen evet deme hissi oluyor. Bazen pişman olduğumu söyleyebilirim. Kız arkadaşlarımın bile kıskandığı saçlarım vardı ve saçlarımla oynamayı çok seviyordum. Bakımını yapabilecek zamanım olsaydı kesinlikle uzatmaya devam ederdim. Siz de rasta yaptırmak istiyorsanız kestirmeye alternatif olarak düşünün ve “<em>rasta bana yakışmazsa keser atarım</em>” deyin. Onu kesip atmanız çok da kolay olmuyor zaten. O kadar para veriyorsunuz çünkü. :)</p><blockquote><strong>Son Olarak…</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gUDlf-frWBSVlAXrxd4pJw.png" /><figcaption>Rastalarin Son Hali II</figcaption></figure><p>Olumsuz konulara değinmiş olsam da kesinlikle rasta yaptırmanızı öneririm. Hayatta bunu da denemeden ölmeyin derim. Bırakın size dik dik bakan insanların sayısı 4 katına çıksın. Siz keyfinize bakın... Bir de;<br>Rasta sahibi olmak icin illa ot içmeniz <strong>gerekmiyor</strong>. :)</p><p>Bana sormak istediklerinizi de içeriğin hemen altında sorabilirsiniz.</p><p>Okuduğunuz için teşekkür ederim. Yeni içeriklerde görüşmek üzere.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14c91a5f834c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>