diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 18531b3..3b8aa86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,13 +10,12 @@ jobs: fail-fast: false matrix: node-version: + - 16 - 14 - 12 - - 10 - - 8 steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install diff --git a/cli.js b/cli.js index 2e28559..7f49ad0 100755 --- a/cli.js +++ b/cli.js @@ -1,8 +1,8 @@ #!/usr/bin/env node -'use strict'; -const meow = require('meow'); -const sparkly = require('sparkly'); -const getStdin = require('get-stdin'); +import process from 'node:process'; +import meow from 'meow'; +import sparkly from 'sparkly'; +import getStdin from 'get-stdin'; const cli = meow(` Usage @@ -24,20 +24,21 @@ const cli = meow(` $ echo 0 3 5 8 4 3 | sparkly ▁▂▃▅▃▂ `, { + importMeta: import.meta, input: { - type: 'number' + type: 'number', }, flags: { min: { - type: 'number' + type: 'number', }, max: { - type: 'number' + type: 'number', }, style: { - type: 'string' - } - } + type: 'string', + }, + }, }); const {input} = cli; @@ -51,7 +52,7 @@ if (input.length > 0) { console.log(sparkly(input, cli.flags)); } else { (async () => { - const data = (await getStdin()).match(/\d/g).map(x => parseInt(x, 10)); + const data = (await getStdin()).match(/\d/g).map(x => Number.parseInt(x, 10)); console.log(sparkly(data, cli.flags)); })(); } diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/package.json b/package.json index 9678e0a..3a0488f 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,18 @@ "description": "Generate sparklines `▁▂▃▅▂▇`", "license": "MIT", "repository": "sindresorhus/sparkly-cli", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, + "type": "module", "bin": { - "sparkly": "cli.js" + "sparkly": "./cli.js" }, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "scripts": { "test": "xo && ava" @@ -36,13 +38,13 @@ "ascii" ], "dependencies": { - "get-stdin": "^6.0.0", - "meow": "^5.0.0", - "sparkly": "^4.0.0" + "get-stdin": "^9.0.0", + "meow": "^10.1.2", + "sparkly": "^6.0.0" }, "devDependencies": { - "ava": "*", - "execa": "^0.10.0", - "xo": "*" + "ava": "^3.15.0", + "execa": "^6.0.0", + "xo": "^0.46.4" } } diff --git a/readme.md b/readme.md index cbe761c..ab088b3 100644 --- a/readme.md +++ b/readme.md @@ -8,8 +8,8 @@ ## Install -``` -$ npm install --global sparkly-cli +```sh +npm install --global sparkly-cli ``` ## Usage diff --git a/test.js b/test.js index 45a053d..87e0329 100644 --- a/test.js +++ b/test.js @@ -1,5 +1,5 @@ import test from 'ava'; -import execa from 'execa'; +import {execa} from 'execa'; test('main', async t => { const {stdout} = await execa('./cli.js', [1, 2, 3]);