Skip to content

Commit

Permalink
Require Node.js 18 and move to ESM
Browse files Browse the repository at this point in the history
Fixes #34
  • Loading branch information
sindresorhus committed Oct 27, 2023
1 parent edf8387 commit 7e41f27
Show file tree
Hide file tree
Showing 10 changed files with 385 additions and 408 deletions.
7 changes: 5 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
- push
- pull_request
jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 20
- 18
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

34 changes: 14 additions & 20 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
#!/usr/bin/env node
'use strict';
const pkg = require('./package.json');
const yosay = require('.');
import meow from 'meow';
import yosay from './index.js';

require('taketalk')({
init(input, options) {
console.log(yosay(input, options));
},
help() {
console.log(`
${pkg.description}
const cli = meow(`
Usage
$ yosay <string>
$ yosay <string> --maxLength 8
$ echo <string> | yosay
Usage
$ yosay <string>
$ yosay <string> --maxLength 8
$ echo <string> | yosay
Example
$ yosay 'Sindre is a horse'
${yosay('Sindre is a horse')}`);
},
version: pkg.version
Example
$ yosay 'Sindre is a horse'
${yosay('Sindre is a horse')}
`, {
importMeta: import.meta,
});

console.log(yosay(cli.input[0], cli.flags));

0 comments on commit 7e41f27

Please sign in to comment.