<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Narendra Sisodiya ⚛️ 🇮🇳</title>
    <description>The latest articles on DEV Community by Narendra Sisodiya ⚛️ 🇮🇳 (@nsisodiya).</description>
    <link>https://dev.to/nsisodiya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F380880%2Fd5c1ab8c-f7b5-400f-a6c1-83c4d4f66542.jpg</url>
      <title>DEV Community: Narendra Sisodiya ⚛️ 🇮🇳</title>
      <link>https://dev.to/nsisodiya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nsisodiya"/>
    <language>en</language>
    <item>
      <title>How to fix node version in a Web-App</title>
      <dc:creator>Narendra Sisodiya ⚛️ 🇮🇳</dc:creator>
      <pubDate>Wed, 30 Sep 2020 06:34:52 +0000</pubDate>
      <link>https://dev.to/nsisodiya/how-to-fix-node-version-in-a-web-app-59n5</link>
      <guid>https://dev.to/nsisodiya/how-to-fix-node-version-in-a-web-app-59n5</guid>
      <description>&lt;p&gt;How we can fix not version so that developer, CI/CD, production, everybody uses the same node version?&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 1 — Add nodeVersionLock in package.json
&lt;/h1&gt;

&lt;p&gt;We need to add preinstall and prestart scripts too.&lt;br&gt;
package.json will look like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "metaindex-frontend",
  "nodeVersionLock": "14.13.0",
  "scripts": {
    "preinstall": "node ./system/npm/preinstall.js",
    "prestart": "node ./system/npm/preinstall.js",
    "start": "run-p build:tailwindcss start:watchtailwindcss start:cra",
    "start:cra": "react-scripts start",
   }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 2 — Throw errors when undesired node-version found.
&lt;/h1&gt;

&lt;p&gt;Content of &lt;code&gt;./system/npm/preinstall.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const pkgJson = require('../../package.json');

const nodeVersion = process.versions.node;
let err = false;

if (pkgJson.nodeVersionLock !== nodeVersion) {
  console.error(`Please use node ${pkgJson.nodeVersionLock}. Try
    nvm install v${pkgJson.nodeVersionLock}
    nvm reinstall-packages v${nodeVersion}
    nvm uninstall v${nodeVersion}
  `);
  err = true;
} else {
  console.error(`Thanks for using Latest Node version ${pkgJson.nodeVersionLock}.\n`);
}

if (err) {
  console.error('');
  process.exit(1);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 3— AutoUpdate of Dockerfile &amp;amp; GitbHub YML
&lt;/h1&gt;

&lt;p&gt;This step is optional and custom. it depends on your setup.&lt;/p&gt;

&lt;p&gt;Content of &lt;code&gt;./system/npm/fix-node-versions.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fs = require('fs');
const YAML = require('yamljs');
const replaceFirstLineOfFile = require('file-firstline-replace');
const pkgJson = require('../../package.json');

var filename = 'Dockerfile';
var newHeader = `FROM node:${pkgJson.nodeVersionLock} as builder\n`;
replaceFirstLineOfFile(filename, newHeader, function (error) {
  if (error) {
    throw error;
  }
  console.warn('Dockerfile updated');
});

// Replace in gitlab ci file.

var gitlabCiYml = fs.readFileSync('.github/workflows/node.js.yml', 'utf8');

// parse YAML string
var gitlabCiJSON = YAML.parse(gitlabCiYml);
gitlabCiJSON.jobs.build.strategy.matrix['node-version'][0] = pkgJson.nodeVersionLock;
var spaces = 4;
var gitlabCiYmlUpdated = YAML.stringify(gitlabCiJSON, spaces);

fs.writeFileSync('.github/workflows/node.js.yml', gitlabCiYmlUpdated, 'utf8');
console.warn('github CI file updated');
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>node</category>
      <category>javascript</category>
      <category>react</category>
      <category>npm</category>
    </item>
    <item>
      <title>Internationalization of React App using Google Sheet and react-i18n</title>
      <dc:creator>Narendra Sisodiya ⚛️ 🇮🇳</dc:creator>
      <pubDate>Wed, 06 May 2020 16:51:35 +0000</pubDate>
      <link>https://dev.to/nsisodiya/internationalization-of-react-app-using-google-sheet-and-react-i18n-2009</link>
      <guid>https://dev.to/nsisodiya/internationalization-of-react-app-using-google-sheet-and-react-i18n-2009</guid>
      <description>&lt;p&gt;Internationalization of React App using Google Sheet and react-i18n&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@nsisodiya/internationalization-of-react-app-using-google-sheet-and-react-i18n-c1be9febcca8"&gt;https://medium.com/@nsisodiya/internationalization-of-react-app-using-google-sheet-and-react-i18n-c1be9febcca8&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
    </item>
  </channel>
</rss>
