Skip to content

Commit c4cf64a

Browse files
author
Benjamin E. Coe
authored
feat(launches): blog post for v16 (#52)
1 parent bcb9d61 commit c4cf64a

File tree

7 files changed

+215
-116
lines changed

7 files changed

+215
-116
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
name: ci
7+
jobs:
8+
build:
9+
runs-on: ubuntu-16.04
10+
strategy:
11+
matrix:
12+
ruby: [ '2.6' ]
13+
name: Ruby ${{ matrix.ruby }} test
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-ruby@v1
17+
with:
18+
ruby-version: ${{ matrix.ruby }}
19+
- name: Build and test
20+
run: |
21+
gem install bundler
22+
bundle install
23+
bundle exec jekyll build
24+
bundle exec htmlproofer ./_site --only-4xx --check-favicon --check-html

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ _site
22
.sass-cache
33
node_modules/
44
tmp
5+
.jekyll-cache
6+

.travis.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source "http://rubygems.org"
22

33
gem 'json', github: 'flori/json', branch: 'v1.8'
4-
gem 'jekyll', '2.5.3'
4+
gem 'jekyll', '4.0.1'
55
gem 'jekyll-redirect-from'
66
gem 'html-proofer'

Gemfile.lock

Lines changed: 72 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -8,112 +8,92 @@ GIT
88
GEM
99
remote: http://rubygems.org/
1010
specs:
11-
activesupport (4.2.5.1)
12-
i18n (~> 0.7)
13-
json (~> 1.7, >= 1.7.7)
14-
minitest (~> 5.1)
15-
thread_safe (~> 0.3, >= 0.3.4)
16-
tzinfo (~> 1.1)
17-
addressable (2.3.8)
18-
blankslate (2.1.2.4)
19-
classifier-reborn (2.0.4)
20-
fast-stemmer (~> 1.0)
21-
coffee-script (2.4.1)
22-
coffee-script-source
23-
execjs
24-
coffee-script-source (1.10.0)
25-
colorator (0.1)
26-
colored (1.2)
27-
ethon (0.8.1)
11+
addressable (2.7.0)
12+
public_suffix (>= 2.0.2, < 5.0)
13+
colorator (1.1.0)
14+
concurrent-ruby (1.1.7)
15+
em-websocket (0.5.1)
16+
eventmachine (>= 0.12.9)
17+
http_parser.rb (~> 0.6.0)
18+
ethon (0.12.0)
2819
ffi (>= 1.3.0)
29-
execjs (2.6.0)
30-
faraday (0.9.2)
31-
multipart-post (>= 1.2, < 3)
32-
fast-stemmer (1.0.2)
33-
ffi (1.9.10)
34-
html-proofer (2.6.4)
35-
activesupport (~> 4.2)
20+
eventmachine (1.2.7)
21+
ffi (1.13.1)
22+
forwardable-extended (2.6.0)
23+
html-proofer (3.15.3)
3624
addressable (~> 2.3)
37-
colored (~> 1.2)
38-
mercenary (~> 0.3.2)
39-
nokogiri (~> 1.5)
25+
mercenary (~> 0.3)
26+
nokogumbo (~> 2.0)
4027
parallel (~> 1.3)
41-
typhoeus (~> 0.7)
28+
rainbow (~> 3.0)
29+
typhoeus (~> 1.3)
4230
yell (~> 2.0)
43-
i18n (0.7.0)
44-
jekyll (2.5.3)
45-
classifier-reborn (~> 2.0)
46-
colorator (~> 0.1)
47-
jekyll-coffeescript (~> 1.0)
48-
jekyll-gist (~> 1.0)
49-
jekyll-paginate (~> 1.0)
50-
jekyll-sass-converter (~> 1.0)
51-
jekyll-watch (~> 1.1)
52-
kramdown (~> 1.3)
53-
liquid (~> 2.6.1)
31+
http_parser.rb (0.6.0)
32+
i18n (1.8.5)
33+
concurrent-ruby (~> 1.0)
34+
jekyll (4.0.1)
35+
addressable (~> 2.4)
36+
colorator (~> 1.0)
37+
em-websocket (~> 0.5)
38+
i18n (>= 0.9.5, < 2)
39+
jekyll-sass-converter (~> 2.0)
40+
jekyll-watch (~> 2.0)
41+
kramdown (~> 2.1)
42+
kramdown-parser-gfm (~> 1.0)
43+
liquid (~> 4.0)
5444
mercenary (~> 0.3.3)
55-
pygments.rb (~> 0.6.0)
56-
redcarpet (~> 3.1)
45+
pathutil (~> 0.9)
46+
rouge (~> 3.0)
5747
safe_yaml (~> 1.0)
58-
toml (~> 0.1.0)
59-
jekyll-coffeescript (1.0.1)
60-
coffee-script (~> 2.2)
61-
jekyll-gist (1.4.0)
62-
octokit (~> 4.2)
63-
jekyll-paginate (1.1.0)
64-
jekyll-redirect-from (0.9.1)
65-
jekyll (>= 2.0)
66-
jekyll-sass-converter (1.4.0)
67-
sass (~> 3.4)
68-
jekyll-watch (1.3.0)
48+
terminal-table (~> 1.8)
49+
jekyll-redirect-from (0.16.0)
50+
jekyll (>= 3.3, < 5.0)
51+
jekyll-sass-converter (2.1.0)
52+
sassc (> 2.0.1, < 3.0)
53+
jekyll-watch (2.2.1)
6954
listen (~> 3.0)
70-
kramdown (1.9.0)
71-
liquid (2.6.3)
72-
listen (3.0.5)
73-
rb-fsevent (>= 0.9.3)
74-
rb-inotify (>= 0.9)
75-
mercenary (0.3.5)
76-
mini_portile2 (2.0.0)
77-
minitest (5.8.4)
78-
multipart-post (2.0.0)
79-
nokogiri (1.6.7.2)
80-
mini_portile2 (~> 2.0.0.rc2)
81-
octokit (4.2.0)
82-
sawyer (~> 0.6.0, >= 0.5.3)
83-
parallel (1.6.1)
84-
parslet (1.5.0)
85-
blankslate (~> 2.0)
86-
posix-spawn (0.3.11)
87-
pygments.rb (0.6.3)
88-
posix-spawn (~> 0.3.6)
89-
yajl-ruby (~> 1.2.0)
90-
rb-fsevent (0.9.7)
91-
rb-inotify (0.9.5)
92-
ffi (>= 0.5.0)
93-
redcarpet (3.3.4)
94-
safe_yaml (1.0.4)
95-
sass (3.4.20)
96-
sawyer (0.6.0)
97-
addressable (~> 2.3.5)
98-
faraday (~> 0.8, < 0.10)
99-
thread_safe (0.3.5)
100-
toml (0.1.2)
101-
parslet (~> 1.5.0)
102-
typhoeus (0.8.0)
103-
ethon (>= 0.8.0)
104-
tzinfo (1.2.2)
105-
thread_safe (~> 0.1)
106-
yajl-ruby (1.2.2)
107-
yell (2.0.5)
55+
kramdown (2.3.0)
56+
rexml
57+
kramdown-parser-gfm (1.1.0)
58+
kramdown (~> 2.0)
59+
liquid (4.0.3)
60+
listen (3.2.1)
61+
rb-fsevent (~> 0.10, >= 0.10.3)
62+
rb-inotify (~> 0.9, >= 0.9.10)
63+
mercenary (0.3.6)
64+
mini_portile2 (2.4.0)
65+
nokogiri (1.10.10)
66+
mini_portile2 (~> 2.4.0)
67+
nokogumbo (2.0.2)
68+
nokogiri (~> 1.8, >= 1.8.4)
69+
parallel (1.19.2)
70+
pathutil (0.16.2)
71+
forwardable-extended (~> 2.6)
72+
public_suffix (4.0.6)
73+
rainbow (3.0.0)
74+
rb-fsevent (0.10.4)
75+
rb-inotify (0.10.1)
76+
ffi (~> 1.0)
77+
rexml (3.2.4)
78+
rouge (3.22.0)
79+
safe_yaml (1.0.5)
80+
sassc (2.4.0)
81+
ffi (~> 1.9)
82+
terminal-table (1.8.0)
83+
unicode-display_width (~> 1.1, >= 1.1.1)
84+
typhoeus (1.4.0)
85+
ethon (>= 0.9.0)
86+
unicode-display_width (1.7.0)
87+
yell (2.2.2)
10888

10989
PLATFORMS
11090
ruby
11191

11292
DEPENDENCIES
11393
html-proofer
114-
jekyll (= 2.5.3)
94+
jekyll (= 4.0.1)
11595
jekyll-redirect-from
11696
json!
11797

11898
BUNDLED WITH
119-
1.14.6
99+
1.17.2

_posts/2017-10-20-yargs-10.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,5 @@ I hope you like what `yargs@10` has to offer,
117117
-- [Ben](https://github.com/bcoe).
118118

119119
</div>
120-
121120
{::options parse_block_html="true" /}
122-
<div class="page-box right">
123-
## Support Yargs Development
124-
125-
<br />
126-
127-
Yargs is developed on evenings and weekends by
128-
volunteers. Why not grab them dinner or a drink?
129-
130-
<br />
131-
132-
[![Support via Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.svg)](https://gratipay.com/yargs/)
133-
134-
</div>
135121
</div>

_posts/2020-09-07-yargs-16.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
layout: blog
3+
title: yargs 16 Released
4+
excerpt: yargs 16 released
5+
---
6+
7+
{::options parse_block_html="true" /}
8+
<div class="page-content align-items">
9+
<div class="page-box-full left">
10+
# yargs 16 Released
11+
12+
About 5 months ago, [Mael Le Guen](https://github.com/mleguen) proposed converting the yargs codebase to TypeScript. I was a bit skeptical at first...
13+
14+
I saw benefits TypeScript could offer the project:
15+
16+
* yargs has a large API surface with many implicit contracts, e.g., how calling a method like `.option()` eventually feeds into [yargs-parser](https://github.com/yargs/yargs-parser).
17+
* some parts of the codebase are quite messy, and type safety would give additional confidence to future refactors.
18+
19+
A few concerns were motivating my skepticism:
20+
21+
* I knew this would be a large project, and was worried we'd deliver something that was only _halfway there._
22+
* The existing [@types/yargs](https://www.npmjs.com/package/@types/yargs) TypeScript definitions have **>12,000,000** downloads/week, I didn't want to disrupt this community.
23+
* I didn't want to significantly bloat the size of yargs.
24+
25+
Thanks to the hard work of Mael, who lead the conversion project (_with help from others like [QmarkC](https://github.com/QmarkC)_), and thanks to a few compromises, I'm happy to say that the TypeScript conversion project was successful.
26+
27+
Beyond the benefits I expected (_ease of refactoring, and explicit interfaces_), TypeScript made two additional improvements to yargs easier, which I'm excited to announce in **v16**:
28+
29+
* yargs now supports both ESM and CommonJS (_you can even use [yargs directly in the browser](https://jsfiddle.net/bencoe/m9fv2oet/), without bundling_).
30+
* yargs now has experimental support for Deno.
31+
32+
## yargs is now written in TypeScript, but...
33+
34+
As the TypeScript project approached completion, it became clear that it would be significant amount of work to match the type definitions exposed in **@types/yargs**...
35+
36+
We've made the decision to not ship yargs with [Type declaration files](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html). As a TypeScript user of yargs, usage [instructions](https://github.com/yargs/yargs/blob/master/docs/typescript.md) shouldn't change, and you will still `npm i @types/yargs --save-dev`.
37+
38+
Developers working on the yargs project now benefit from type safety, and the project benefits from the build steps we've introduced (_more on this in a moment_), but the existing TypeScript community should be able to upgrade with minimal disruption.
39+
40+
## ESM and CJS support
41+
42+
**yargs@v16** is **~26%** larger than past version of yargs. This is because, using Node.js' [conditional exports](https://nodejs.org/api/esm.html#esm_conditional_exports), yargs now provides an interface for both CommonJS and ESM:
43+
44+
**CommonJS example:**
45+
46+
```js
47+
const {argv} = require('yargs')
48+
49+
if (argv.ships > 3 && argv.distance < 53.5) {
50+
console.log('Plunder more riffiwobbles!')
51+
} else {
52+
console.log('Retreat from the xupptumblers!')
53+
}
54+
```
55+
56+
**ESM example:**
57+
58+
```js
59+
import yargs from 'yargs'
60+
import { hideBin } from 'yargs/helpers'
61+
62+
yargs(hideBin(process.argv))
63+
.command('curl <url>', 'fetch the contents of the URL', () => {}, (argv) => {
64+
console.info(argv)
65+
})
66+
.demandCommand(1)
67+
.argv
68+
```
69+
70+
To facilitate this, we target ESM with the TypeScript compilation step, then have an additional compile step with [Rollup](https://github.com/rollup/rollup) which creates a CommonJS bundle of the library.
71+
72+
It's my hope that taking this approach of shipping a dual mode library will help smooth the process for folks experimenting with ESM (_and that the additional bloat in the library will be forgiven 😊_)
73+
74+
## Deno Support
75+
76+
> Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.
77+
78+
Taking on the work to make yargs and its dependencies fully support ESM, combined with converting the codebase to TypeScript, made it a short addition step towards supporting the Deno runtime.
79+
80+
**Deno example:**
81+
82+
```typescript
83+
import yargs from 'https://deno.land/x/yargs/deno.ts'
84+
import { Arguments, YargsType } from 'https://deno.land/x/yargs/types.ts'
85+
86+
yargs()
87+
.command('download <files...>', 'download a list of files', (yargs: YargsType) => {
88+
return yargs.positional('files', {
89+
describe: 'a list of files to do something with'
90+
})
91+
}, (argv: Arguments) => {
92+
console.info(argv)
93+
})
94+
.strictCommands()
95+
.demandCommand(1)
96+
.parse(Deno.args)
97+
```
98+
99+
I am a Deno novice, and would characterize yargs' support of the platform as _experimental_. However, I'm excited to see folks adopt the functionality, and will happily fix bugs for the platform as they arise.
100+
101+
## Significant Breaking Changes
102+
103+
* the use of Conditional exports makes yargs' exported files explicit. Folks who were requiring deep files, e.g., `lib/utils/obj-filter.js`, will not be able to do so. The helpers yargs exposes have been [defined explicitly](https://github.com/yargs/yargs/pull/1733).
104+
* the `rebase` helper method has been removed from yargs (this was just wrapping `path.relative`).
105+
* Node 8 support has been dropped.
106+
107+
_Other changes are listed in the [CHANGELOG](https://github.com/yargs/yargs/blob/master/CHANGELOG.md)_.
108+
109+
-- [Ben](https://github.com/bcoe).
110+
111+
Related:
112+
113+
* ["Maintainers Should Consider Following Node.js’ Release Schedule"](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
114+
* ["How my team releases libraries"](https://dev.to/bcoe/how-my-team-releases-libraries-23el).
115+
</div>
116+
</div>

0 commit comments

Comments
 (0)