Skip to content

Commit

Permalink
refactor(cli): removes fileURLToPath call
Browse files Browse the repository at this point in the history
removes not needed call to fileURLToPath, replacing with the URL object itself
  • Loading branch information
aarondill committed Jan 22, 2023
1 parent dd747f5 commit a365d4f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env node
import { globbySync } from 'globby'
import fs from 'node:fs'
import { fileURLToPath } from 'url'
import sortPackageJson from './index.js'

const isCheckFlag = (argument) => argument === '--check' || argument === '-c'
Expand Down Expand Up @@ -31,7 +30,7 @@ Strings passed as files are parsed as globs.
if (isVersion) {
try {
const cliParentDir = new URL('package.json', import.meta.url)
const packageJsonBuffer = fs.readFileSync(fileURLToPath(cliParentDir))
const packageJsonBuffer = fs.readFileSync(cliParentDir)
const { version } = JSON.parse(packageJsonBuffer)

console.log(`sort-package-json ${version}`)
Expand Down

0 comments on commit a365d4f

Please sign in to comment.