Skip to content

Commit

Permalink
refactor: avoid exists-file
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Oct 7, 2023
1 parent 7727df2 commit ff16f06
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# - name: Report
# run: mkdir -p coverage && npx nyc report --reporter=text-lcov > coverage/lcov.info
# - name: Coverage
# uses: coverallsapp/github-action@master
# uses: coverallsapp/github-action@main
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Release
Expand Down
7 changes: 3 additions & 4 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
'use strict'

const emailRegex = require('email-regex')
const existsFile = require('exists-file')
const jsonFuture = require('json-future')
const colors = require('picocolors')
const execa = require('execa')
const path = require('path')
const mri = require('mri')
const fs = require('fs')

const BOT_NAMES = ['ImgBotApp', 'greenkeeper', 'noreply', '\\bbot\\b', 'Travis CI']

Expand Down Expand Up @@ -81,16 +81,15 @@ const extractContributors = stdout => {
}

const getContributors = async () => {
if (!(await existsFile('.git'))) {
if (!fs.existsSync('.git')) {
return processError({
message: 'Ops, not git directory detected!'
})
}

const { print, cwd, save, ignorePattern } = flags
const pkgPath = path.join(cwd, 'package.json')
const cmd = 'git shortlog -sne HEAD'
const { stdout, stderr } = await execa.command(cmd, {
const { stdout, stderr } = await execa.command('git shortlog -sne HEAD', {
cwd,
shell: true,
stdio: ['ignore', 'pipe', 'pipe']
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,21 @@
],
"dependencies": {
"email-regex": "~4.0.0",
"execa": "~5.1.0",
"exists-file": "~3.0.2",
"execa": "~5.1.1",
"json-future": "~2.2.18",
"mri": "~1.2.0",
"picocolors": "~1.0.0"
},
"devDependencies": {
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@ksmithut/prettier-standard": "latest",
"c8": "latest",
"ci-publish": "latest",
"conventional-github-releaser": "latest",
"finepack": "latest",
"nano-staged": "latest",
"npm-check-updates": "latest",
"prettier-standard": "latest",
"simple-git-hooks": "latest",
"standard": "latest",
"standard-markdown": "latest",
Expand Down Expand Up @@ -101,8 +100,9 @@
]
},
"nano-staged": {
"*.js,!*.min.js,": [
"prettier-standard"
"*.js": [
"prettier-standard",
"standard --fix"
],
"*.md": [
"standard-markdown"
Expand Down

0 comments on commit ff16f06

Please sign in to comment.