<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mxd-deck Archives | Clever Cloud</title>
	<atom:link href="https://www.clever.cloud/blog/tag/mxd-deck/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.clever.cloud/blog/tag/mxd-deck/</link>
	<description>From Code to Product</description>
	<lastBuildDate>Fri, 27 Oct 2023 12:48:39 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://cdn.clever-cloud.com/uploads/2023/03/cropped-cropped-favicon-32x32.png</url>
	<title>mxd-deck Archives | Clever Cloud</title>
	<link>https://www.clever.cloud/blog/tag/mxd-deck/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Deploy node projects as static &#8211; MDX-Deck demo</title>
		<link>https://www.clever.cloud/blog/engineering/2020/05/05/deploy-node-mxd-deck/</link>
		
		<dc:creator><![CDATA[Valeriane Venance]]></dc:creator>
		<pubDate>Tue, 05 May 2020 14:27:00 +0000</pubDate>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[mxd-deck]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[static deployment]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2020/05/05/deploy-node-mxd-deck/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="nodebanner 1" decoding="async" fetchpriority="high" srcset="https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1-1368x528.png 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p>As some of you may know, we love to present tech talks at Clever Cloud, and this often comes with visual presentations slides. There are numerous tools to help you do that, but one particularly caught my attention as it is also destined to developers first.<span id="more-2824"></span> <a href="https://github.com/jxnblk/mdx-deck">MDX-deck</a> allows you to write <a href="https://reactjs.org/">React</a> components and content in <a href="https://www.markdownguide.org/">Markdown</a> among other cool stuffs. Check out the official repo to find out more about the capabilities of the project.

Wether you&#39;re doing presentations or not, read carefully, we are about to deploy a static application made out of a React build and use the Clever Cloud hooks to do so. Ready? Let&#39;s go.
<h3 id="requirements">Requirements</h3>
<ul>
 	<li>you need to have <a href="https://www.npmjs.com/get-npm">npm</a> and <a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git">git</a> installed on your machine.</li>
 	<li>you need a <a href="https://api.clever-cloud.com/v2/sessions/signup">Clever Cloud account</a> with at least a validated email to benefit the free credits.</li>
</ul>
<h3 id="setting-up-our-mdx-deck">Setting up our MDX-Deck</h3>
Go to your console and type in
<pre><code class="language-bash">$ mkdir presentation //creating a new folder
$ cd presentation
$ git init // creating fresh git folder
$ npm init //creating new project
</code></pre>
Just type enter for eveything you&#39;re prompted of except for <code>description</code> if you would like to provide one, <code>author</code> that you must fill, <code>license</code> that you can edit to the licence you want your project to be under.

Now we will create our presentation file with <code>$ touch deck.mdx</code> and add the package to the project with <code>$ npm i -D mdx-deck</code>.

Open the project in your text editor and start with fine tuning <code>package.json</code> Here we want to remove the line
<pre><code class="language-json">&quot;main&quot;: &quot;index.js&quot;,
</code></pre>
and add a start and a build command using the mxd-deck CLI with the file we just created to our scripts
<pre><code class="language-json">&quot;scripts&quot;: {
    &quot;start&quot;: &quot;mdx-deck deck.mdx&quot;,
    &quot;build&quot;: &quot;mdx-deck build deck.mdx&quot;,
    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;
},
</code></pre>
We will only use <code>start</code> to test locally and use <code>build</code> to deploy. We are done with <code>package.json</code>, we can now move to <code>deck.mdx</code>. Add this in the file:
<pre><code class="language-markdown"># Congratulations!

---

## You&#39;re up and live on Clever Cloud!

---
</code></pre>
You can note that we have just created two slides, each one ending with <code>---</code> and that we are using the Markdown syntax. Let&#39;s see how it renders with <code>npm start</code>. Your browser will open at <code>http://localhost:8000</code> displaying our first slide. Use side arrows to navigate between pages.
<h2 id="deploy-to-clever-cloud-as-static-with-hooks">Deploy to clever cloud as static with hooks</h2>
Now we will create a static application in the <a href="https://console.clever-cloud.com/">Clever Cloud console</a>. Under the organization of our choice, we will click the <strong>Create</strong> button and select <strong>application</strong>, then <strong>Static</strong>. Follow the instructions, and just select <strong>git</strong> when you have the choice between it and FTP. A git remote will be provided to you. Add it to your local repository with the provided command and get back to the Clever Cloud console. Select <strong>Environment variables</strong> in the left menu of your application and add <code>CC_PRE_RUN_HOOK</code> with value <code>npm run build</code> and <code>CC_WEBROOT</code> with value <code>/public</code>. Do not forget to add each new variable and to update changes when you are done editing.

Now we can push our sources to the clever git remote we set previously by adding and committing them, then pushing with <code>$ git push clever master</code>. It is also possible to du it using the Clever Cloud CLI with <code>clever deploy</code>. Documentation <a href="https://www.clever.cloud/developers/clever-tools/getting_started/">here</a>

In the Clever Cloud console, the deployment logs will appear and after a little you will be able to navigate to your application by going to the <strong>overview</strong> page of your application and clicking the link icon on the top right. Use right arrow to navigate to slide two. But what did just happen?
<h2 id="explanation">Explanation</h2>
The <code>CC_PRE_RUN_HOOK</code> is a command run only if specified. This hook is run before the dependencies are fetched and has the specificity to make your deployment fail if it no successful. This is helpful as we do not want to try running a failed build result and have confusing errors harder to debug.
Here, we gave it the value of <code>npm run-script build</code>, this basically tells npm to run our build command specified in <code>package.json</code>. Build command which runs mdx-deck build cli. That leaves us with a new <code>/public</code> folder containing our website static web pages. The other environment variable we used is <code>CC_WEBROOT</code>. This variable tells the server to set the DocumentRoot to the  <code>/public</code> folder wich contains your web pages. This is where a visitor will end up when visiting your website.

You can, of course adapt, it to any other npm project static build.]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="nodebanner 1" decoding="async" srcset="https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/nodebanner-1-1368x528.png 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p>As some of you may know, we love to present tech talks at Clever Cloud, and this often comes with visual presentations slides. There are numerous tools to help you do that, but one particularly caught my attention as it is also destined to developers first.<span id="more-2824"></span> <a href="https://github.com/jxnblk/mdx-deck">MDX-deck</a> allows you to write <a href="https://reactjs.org/">React</a> components and content in <a href="https://www.markdownguide.org/">Markdown</a> among other cool stuffs. Check out the official repo to find out more about the capabilities of the project.

Wether you&#39;re doing presentations or not, read carefully, we are about to deploy a static application made out of a React build and use the Clever Cloud hooks to do so. Ready? Let&#39;s go.
<h3 id="requirements">Requirements</h3>
<ul>
 	<li>you need to have <a href="https://www.npmjs.com/get-npm">npm</a> and <a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git">git</a> installed on your machine.</li>
 	<li>you need a <a href="https://api.clever-cloud.com/v2/sessions/signup">Clever Cloud account</a> with at least a validated email to benefit the free credits.</li>
</ul>
<h3 id="setting-up-our-mdx-deck">Setting up our MDX-Deck</h3>
Go to your console and type in
<pre><code class="language-bash">$ mkdir presentation //creating a new folder
$ cd presentation
$ git init // creating fresh git folder
$ npm init //creating new project
</code></pre>
Just type enter for eveything you&#39;re prompted of except for <code>description</code> if you would like to provide one, <code>author</code> that you must fill, <code>license</code> that you can edit to the licence you want your project to be under.

Now we will create our presentation file with <code>$ touch deck.mdx</code> and add the package to the project with <code>$ npm i -D mdx-deck</code>.

Open the project in your text editor and start with fine tuning <code>package.json</code> Here we want to remove the line
<pre><code class="language-json">&quot;main&quot;: &quot;index.js&quot;,
</code></pre>
and add a start and a build command using the mxd-deck CLI with the file we just created to our scripts
<pre><code class="language-json">&quot;scripts&quot;: {
    &quot;start&quot;: &quot;mdx-deck deck.mdx&quot;,
    &quot;build&quot;: &quot;mdx-deck build deck.mdx&quot;,
    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;
},
</code></pre>
We will only use <code>start</code> to test locally and use <code>build</code> to deploy. We are done with <code>package.json</code>, we can now move to <code>deck.mdx</code>. Add this in the file:
<pre><code class="language-markdown"># Congratulations!

---

## You&#39;re up and live on Clever Cloud!

---
</code></pre>
You can note that we have just created two slides, each one ending with <code>---</code> and that we are using the Markdown syntax. Let&#39;s see how it renders with <code>npm start</code>. Your browser will open at <code>http://localhost:8000</code> displaying our first slide. Use side arrows to navigate between pages.
<h2 id="deploy-to-clever-cloud-as-static-with-hooks">Deploy to clever cloud as static with hooks</h2>
Now we will create a static application in the <a href="https://console.clever-cloud.com/">Clever Cloud console</a>. Under the organization of our choice, we will click the <strong>Create</strong> button and select <strong>application</strong>, then <strong>Static</strong>. Follow the instructions, and just select <strong>git</strong> when you have the choice between it and FTP. A git remote will be provided to you. Add it to your local repository with the provided command and get back to the Clever Cloud console. Select <strong>Environment variables</strong> in the left menu of your application and add <code>CC_PRE_RUN_HOOK</code> with value <code>npm run build</code> and <code>CC_WEBROOT</code> with value <code>/public</code>. Do not forget to add each new variable and to update changes when you are done editing.

Now we can push our sources to the clever git remote we set previously by adding and committing them, then pushing with <code>$ git push clever master</code>. It is also possible to du it using the Clever Cloud CLI with <code>clever deploy</code>. Documentation <a href="https://www.clever.cloud/developers/clever-tools/getting_started/">here</a>

In the Clever Cloud console, the deployment logs will appear and after a little you will be able to navigate to your application by going to the <strong>overview</strong> page of your application and clicking the link icon on the top right. Use right arrow to navigate to slide two. But what did just happen?
<h2 id="explanation">Explanation</h2>
The <code>CC_PRE_RUN_HOOK</code> is a command run only if specified. This hook is run before the dependencies are fetched and has the specificity to make your deployment fail if it no successful. This is helpful as we do not want to try running a failed build result and have confusing errors harder to debug.
Here, we gave it the value of <code>npm run-script build</code>, this basically tells npm to run our build command specified in <code>package.json</code>. Build command which runs mdx-deck build cli. That leaves us with a new <code>/public</code> folder containing our website static web pages. The other environment variable we used is <code>CC_WEBROOT</code>. This variable tells the server to set the DocumentRoot to the  <code>/public</code> folder wich contains your web pages. This is where a visitor will end up when visiting your website.

You can, of course adapt, it to any other npm project static build.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
