Skip to content

Commit

Permalink
removed: useless join
Browse files Browse the repository at this point in the history
  • Loading branch information
binjospookie committed Dec 29, 2023
1 parent 180a05e commit 5ef4574
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pure-index",
"type": "module",
"version": "0.0.36",
"version": "0.0.37",
"description": "Utility for monorepos. It helps to find unused exports from packages or get a list of all unique uses of any package",
"main": "./src/index.js",
"bin": "./bin/index.js",
Expand Down
4 changes: 3 additions & 1 deletion src/baseFlow.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { join } from 'node:path'

import { getExports } from './getExports.js'
import { fileTraversal } from './fileTraversal/index.js'
import { createStatusAPI, readJSON } from './utils/index.js'
Expand All @@ -18,7 +20,7 @@ import { createStatusAPI, readJSON } from './utils/index.js'
*/
const baseFlow = async ({ config }) => {
const { name } = await readJSON('package.json')
const pkg = { name, path: process.cwd() }
const pkg = { name, path: config.entry }
const statusApi = createStatusAPI({
title: `Checking exports from the ${pkg.name} package`
})
Expand Down
4 changes: 1 addition & 3 deletions src/getExports.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { join } from 'node:path'
import parser from '@babel/parser'

import { readFile, ObservableSet } from './utils/index.js'
Expand All @@ -7,7 +6,6 @@ import { readFile, ObservableSet } from './utils/index.js'
* @param {{
* config: {
* babelPlugins: Array<string>
* entry: string
* }
* pkg: {
* path: string
Expand All @@ -17,7 +15,7 @@ import { readFile, ObservableSet } from './utils/index.js'
* @returns {Promise<Set.<string>>}
*/
const getExports = async ({ config, pkg }) => {
const code = await readFile(join(pkg.path, config.entry))
const code = await readFile(pkg.path)
const result = new ObservableSet()

const ast = parser.parse(code, {
Expand Down
4 changes: 1 addition & 3 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { join } from 'node:path'
import fs from 'node:fs/promises'
import { createSpinner } from 'nanospinner'
import pc from 'picocolors'
Expand All @@ -8,8 +7,7 @@ const { bgRed, bold } = pc
const readFile = async filePath =>
await fs.readFile(filePath, { encoding: 'utf-8' })

const readJSON = async filePath =>
JSON.parse(await readFile(join(process.cwd(), filePath)))
const readJSON = async filePath => JSON.parse(await readFile(filePath))

const printError = text =>
process.stdout.write(`\n${bold(bgRed(' Failed '))} ${text}\n\n`)
Expand Down

0 comments on commit 5ef4574

Please sign in to comment.