Skip to content

Commit 7e41f27

Browse files
committed
Require Node.js 18 and move to ESM
Fixes #34
1 parent edf8387 commit 7e41f27

File tree

10 files changed

+385
-408
lines changed

10 files changed

+385
-408
lines changed

.editorconfig

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
root = true
22

33
[*]
4-
indent_style = space
5-
indent_size = 2
4+
indent_style = tab
65
end_of_line = lf
76
charset = utf-8
87
trim_trailing_whitespace = true
98
insert_final_newline = true
9+
10+
[*.yml]
11+
indent_style = space
12+
indent_size = 2

.gitattributes

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf

.github/workflows/main.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
test:
7+
name: Node.js ${{ matrix.node-version }}
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
node-version:
13+
- 20
14+
- 18
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- run: npm install
21+
- run: npm test

.travis.yml

-5
This file was deleted.

cli.js

+14-20
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
#!/usr/bin/env node
2-
'use strict';
3-
const pkg = require('./package.json');
4-
const yosay = require('.');
2+
import meow from 'meow';
3+
import yosay from './index.js';
54

6-
require('taketalk')({
7-
init(input, options) {
8-
console.log(yosay(input, options));
9-
},
10-
help() {
11-
console.log(`
12-
${pkg.description}
5+
const cli = meow(`
6+
Usage
7+
$ yosay <string>
8+
$ yosay <string> --maxLength 8
9+
$ echo <string> | yosay
1310
14-
Usage
15-
$ yosay <string>
16-
$ yosay <string> --maxLength 8
17-
$ echo <string> | yosay
18-
19-
Example
20-
$ yosay 'Sindre is a horse'
21-
${yosay('Sindre is a horse')}`);
22-
},
23-
version: pkg.version
11+
Example
12+
$ yosay 'Sindre is a horse'
13+
${yosay('Sindre is a horse')}
14+
`, {
15+
importMeta: import.meta,
2416
});
17+
18+
console.log(yosay(cli.input[0], cli.flags));

0 commit comments

Comments
 (0)