<?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 Joshua Tjhin on Medium]]></title>
        <description><![CDATA[Stories by Joshua Tjhin on Medium]]></description>
        <link>https://medium.com/@xueeey?source=rss-34905afd76f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WVikO5ovCnG2Vb3tGuzxcw.jpeg</url>
            <title>Stories by Joshua Tjhin on Medium</title>
            <link>https://medium.com/@xueeey?source=rss-34905afd76f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 20:54:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@xueeey/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[Build and automatically deploy a React site]]></title>
            <link>https://medium.com/@xueeey/build-and-automatically-deploy-a-react-site-4d5d6f07e4e8?source=rss-34905afd76f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d5d6f07e4e8</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[surge]]></category>
            <category><![CDATA[bitbucket]]></category>
            <dc:creator><![CDATA[Joshua Tjhin]]></dc:creator>
            <pubDate>Sun, 18 Jun 2017 14:40:47 GMT</pubDate>
            <atom:updated>2017-07-04T09:48:49.928Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ceRx7ShAibf1EpGIV301Ow.png" /></figure><p>Building, deploying and hosting a website has never been easier especially with the extensive range of free tools and services available. As a developer, building websites in familiar technologies like React is preferable to building it in Wordpress or plain HTML. I’ll show you how you can get from 0 lines of code to production in 5 mins. As a bonus, your repo will be set up to deploy automatically, on every commit to master!</p><h3>Zero configuration setup with create-react-app</h3><p><em>Time: 1 min</em></p><p>No-one wants to spend their first few hours agonising over the basic setup of a React application. How does a developer navigate the sea of setup configuration that includes Webpack/Babel/NPM/Lint etc.. required to start building a React app. The answer is the superb <a href="https://github.com/facebookincubator/create-react-app">create-react-app</a>, maintained by the creators of React/Redux, which simplifies setup to a few seconds. Not only will the basics be set up, it’ll also come with the latest React development tooling.</p><pre>npm install -g create-react-app</pre><pre>create-react-app react-site<br>cd react-site/<br>npm start</pre><p>💥 That’s it, your React application should be running locally on <a href="http://localhost:3000/">http://localhost:3000</a> powered by an excellent React tech and tool stack.</p><h3>Host your site on Surge</h3><p><em>Time: 1 min</em></p><p>For free static site hosting, I like <a href="http://surge.sh/">Surge.sh</a>. Surge offers a nice free plan which includes using a custom domain.</p><p>Use the surge cli to create and deploy your site. You’ll need to run a `npm run build` to produce the production-ready static site.</p><pre>npm install --global surge<br>npm run build   # Creates production build in build/<br>surge build     # Publishes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3-wRRgm0dGrCrW-ST2dVoQ.png" /></figure><p>💥 Your React site should now be live!</p><h3>Continuously deploy changes</h3><p><em>Time: 3 mins</em></p><p>Instead of manually deploying my site each time, I prefer setting up a automated workflow where changes pushed are live in under a minute.</p><p>Since I usually keep my code in Bitbucket (free unlimited private repos!), I can use <a href="https://bitbucket.org/product/features/pipelines">Bitbucket Pipelines</a> (disclosure: I work on it) to build and deploy my site. Bitbucket comes with 50 free pipeline minutes/month, enough for ~50+ deployments per month.</p><p>Pipelines can be found in your Bitbucket repository’s navigation menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OiEutqqYwTaBdGMjizZm2Q.png" /></figure><p>To configure it to deploy to Surge, you will need to add 2 environment variables in your Pipeline settings:</p><ul><li>SURGE_LOGIN (your Surge email)</li><li>SURGE_TOKEN (obtained by running `surge token`)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7e_QPJUywOLhhgSXs8TXVw.png" /></figure><p>Here’s the bitbucket-pipelines.yml configuration I use. The global surge dependency can be replaced by adding surge as a dev dependency and using an npm script.</p><pre>image: node:6.9.4<br><br>pipelines:<br>  branches:<br>    master:<br>      - step:<br>          script:<br>            - npm install -g surge<br>            - npm install<br>            - npm run build<br>            - surge build &lt;your-project&gt;.surge.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ceRx7ShAibf1EpGIV301Ow.png" /></figure><p>💥 Now every new commit on master will be automatically deployed to Surge.</p><p>Bonus tip: <a href="https://confluence.atlassian.com/bitbucket/notifications-for-bitbucket-pipelines-857053284.html">Configure HipChat or Slack notifications</a> to alert your team whenever your site has been successfully deployed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GfUWZTTk9WMhJehi6b2xyA.png" /></figure><h3>Go build your sites!</h3><p>This is the simple and awesome setup we use for <a href="http://reactaudit.com/">reactaudit.com</a> where changes are live within seconds of pushing. Try it out with your next React project whether it’s starting your own blog, website or just getting better at React.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d5d6f07e4e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>