Comparing version 1.0.6 to 1.0.7
{ | ||
"name": "jqkill", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A linter to help locate and eliminate jQuery", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,8 +0,5 @@ | ||
import { stat, readFile } from 'fs'; | ||
import { promisify } from 'util'; | ||
const fileStatAsync = promisify(stat); | ||
const readFileAsync = promisify(readFile); | ||
import { promises as fs } from 'fs'; | ||
export async function readContents (path) { | ||
if (!await fileStatAsync(path)) { | ||
if (!await fs.stat(path)) { | ||
throw Error(`${path} not found, is this a package?`); | ||
@@ -12,3 +9,3 @@ } | ||
try { | ||
return await readFileAsync(path, 'utf-8'); | ||
return await fs.readFile(path, 'utf-8'); | ||
} catch { | ||
@@ -15,0 +12,0 @@ throw Error(`Failed to read ${path}`); |
@@ -1,8 +0,7 @@ | ||
import { stat, readFile } from 'fs'; | ||
import { promisify } from 'util'; | ||
const fileStatAsync = promisify(stat); | ||
const readFileAsync = promisify(readFile); | ||
import { promises as fs } from 'fs'; | ||
import { join } from 'path'; | ||
export async function readPkg (path) { | ||
if (!await fileStatAsync(path)) { | ||
export async function readPkg () { | ||
const PKG_PATH = join(new URL(import.meta.url).pathname, '../../../package.json'); | ||
if (!await fs.stat(PKG_PATH)) { | ||
throw Error('package.json not found, is this a package?'); | ||
@@ -12,3 +11,3 @@ } | ||
try { | ||
return JSON.parse(await readFileAsync(path, 'utf-8')); | ||
return JSON.parse(await fs.readFile(PKG_PATH, 'utf-8')); | ||
} catch { | ||
@@ -15,0 +14,0 @@ throw Error('Failed to read package.json'); |
Sorry, the diff of this file is not supported yet
15292
345