Skip to content

Commit 08fbc3e

Browse files
committed
Minor improvements in last article and in blog article template
1 parent 0f6905b commit 08fbc3e

7 files changed

Lines changed: 22 additions & 4 deletions

File tree

_11ty/copyStaticFiles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = function copyStaticFiles (config) {
44
// Pass-through files
55
config.addPassthroughCopy('src/CNAME')
66
config.addPassthroughCopy({ 'src/_includes/assets': 'assets' })
7+
config.addPassthroughCopy({ 'src/_includes/static': 'static' })
78
config.addPassthroughCopy({ 'src/node-js-design-patterns.jpg': 'img/node-js-design-patterns.jpg' })
89
// favicons
910
const favicons = [

_11ty/nunjucksFilters.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ module.exports = function nunjucksFilters (config) {
1414
return format(date, dateFormat)
1515
})
1616

17+
config.addFilter('dateToUTC', function (date) {
18+
const d = new Date(date)
19+
return d.toUTCString()
20+
})
21+
1722
// Add markdown filter
1823
config.addFilter('markdown', function (value) {
1924
const markdown = markdownIt({

src/_includes/layout.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ eleventyComputed:
5050
<meta name="author" content="{{ site.author }}">
5151
<meta name="copyright" content="{{ site.copyright }}">
5252
<meta name="generator" content="{{ site.generator }}">
53-
<meta http-equiv="last-modified" content="{{ page.date.toUTCString() }}">
53+
<meta http-equiv="last-modified" content="{% if updatedAt %}{{ updatedAt | dateToUTC }}{% else %}{{ page.date.toUTCString() }}{% endif %}">
5454
<meta name="date" content="{{ page.date.toUTCString() }}">
5555
<link rel="alternate" type="application/rss+xml" title="RSS Feed for {{ site.domain }}" href="/blog/rss.xml"/>
5656
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
2.7 KB
Loading
8.06 KB
Loading

src/blog/articles/installing-node-js/index.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
date: 2020-12-24T18:30:00
3+
updatedAt: 2020-12-30T16:00:00
34
title: 5 Ways to install Node.js
45
permalink: /blog/5-ways-to-install-node-js/
56
description: Learn what are the most common ways to install Node.js in your development machine
67
layout: article
78
author: Luciano Mammino
8-
author_profile_pic: https://api.microlink.io/?url=https://twitter.com/loige&embed=image.url
9+
author_profile_pic: /static/luciano-mammino-avatar-small.jpg
910
author_link: https://loige.co
1011
tags: ["blog"]
1112
---
@@ -88,6 +89,8 @@ Alternatively, you can use the custom install script:
8889
curl -L https://git.io/n-install | bash
8990
```
9091

92+
**Note:** if you are concerned about running a script downloaded from the web (as you should because [`curl | bash` might be dangerous](https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-bash-server-side/)), you can always download the script first, READ IT, and then run it locally...
93+
9194
If all goes well, you should now be able to use the `n` executable from your shell.
9295

9396
These are some of the commands you can run:
@@ -129,7 +132,7 @@ In summary, this is where `n` shines or falls short:
129132

130133
With more than 45 thousand stars on GitHub, [`nvm`](https://github.com/nvm-sh/nvm), which stands for "Node.js Version Manager" (no surprises!), is probably the most famous Node.js version manager currently available.
131134

132-
`nvm` works on any POSIX-compliant shell (`sh`, `dash`, `ksh`, `zsh`, `bash`, etc.) and it has been strongly tested against the following systems: unix, macOS, and windows WSL.
135+
`nvm` works on any POSIX-compliant shell (`sh`, `dash`, `ksh`, `zsh`, `bash`, etc.) and it has been strongly tested against the following systems: unix, macOS, and windows WSL (if you are on Windows, you can also check out [`nvm-windows`](https://github.com/coreybutler/nvm-windows)).
133136

134137
The easiest way to install `nvm` on your system is to use the official installer script:
135138

@@ -201,6 +204,8 @@ Finally, here are some pros and cons of `nvm`:
201204
- 👍 You can run once off commands on a given version of Node.js without having to switch the entire system to that version.
202205
- 👎 You might have to take a bit of time to go through the documentation and make sure you install it and use it correctly.
203206

207+
**Note**: if you like to use version managers like `n` or `nvm`, you can also check out [`volta.sh`](https://volta.sh/), another interesting alternative in this space, which defines itself as _"The Hassle-Free JavaScript Tool Manager"_.
208+
204209

205210
## Install Node.js using the official installer
206211

@@ -332,6 +337,8 @@ This way you can install third-party modules using `npm`, create your own script
332337

333338
This is the perfect environment for quick and dirty experiments.
334339

340+
Note, that you can also use Doccker as a full environment for development and not just for quick tests. Docker is actually great for keeping different Node.js version and other dependencies isolated on a per-project basis. Exploring this opportunity goes beyond the scope of this article, but there is ton of reference on the web on how you might use Docker for this.
341+
335342

336343
## Node.js online
337344

@@ -357,4 +364,9 @@ This concludes our list of ways to install Node.js. At this point, I hope you fe
357364

358365
If you enjoyed this article please consider sharing it and don't hesitate to reach out to me [on Twitter](https://twitter.com/loige). I am quite curious to find out what is your favourite way to install Node.js and why!
359366

360-
Until next time!
367+
Until next time!
368+
369+
370+
### Credits
371+
372+
This article was possible only thanks to the great support and feedback of some amazing engineers. Here are some of the names that helped me (and sorry if I am forgetting someone): [@\_Don\_Quijote\_](https://twitter.com/_Don_Quijote_), [@GiuseppeMorelli](https://twitter.com/giuseppemorelli), [@oliverturner](https://twitter.com/oliverturner), [@aetheon](https://twitter.com/aetheon), [@dottorblaster](https://twitter.com/dottorblaster), [@bcomnes](https://twitter.com/bcomnes) & [@wa7son](https://twitter.com/wa7son).
77 KB
Loading

0 commit comments

Comments
 (0)