Skip to content

Commit

Permalink
Move cli to bin/cli.js
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed May 22, 2023
1 parent d510dc5 commit 265fe12
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions cli.js → bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
const fs = require('fs');
const process = require('process');
const minimist = require('minimist');
const {description, version} = require('./package.json');
const oust = require('./index.js');
const {description, version} = require('../package.json');
const oust = require('../index.js');

const argv = minimist(process.argv.slice(2));

Expand Down Expand Up @@ -34,7 +34,10 @@ if (argv.h || argv.help || argv._.length === 0) {
const [file, type] = argv._;

fs.promises.readFile(file, 'utf8')
.then(data => console.log(oust(data, type).join('\n')))
.then(data => {
const srcs = oust(data, type).join('\n');
console.log(srcs);
})
.catch(error => {
console.error(`Error opening file: ${error.message}`);
process.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"homepage": "https://github.com/addyosmani/oust",
"main": "index.js",
"bin": {
"oust": "cli.js"
"oust": "bin/cli.js"
},
"files": [
"index.js",
"cli.js"
"bin/cli.js",
"index.js"
],
"scripts": {
"lint": "xo",
Expand Down

0 comments on commit 265fe12

Please sign in to comment.