Skip to content

Commit

Permalink
fix(install): use current path to get configuration
Browse files Browse the repository at this point in the history
release-npm
  • Loading branch information
tobua committed Apr 27, 2024
1 parent 5412c0e commit 70b509e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ async function configureProject() {
}

for (const workspace of await getWorkspaces()) {
const packageJson = await Bun.file(root('./package.json')).json()
reset(workspace, packageJson)
await reset(workspace)
await configureProject()
}
12 changes: 8 additions & 4 deletions state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { join } from 'node:path'
import type { PackageJson, State } from './types'
import Bun from 'bun'
import type { State } from './types'

export const state: State = {
options: {},
Expand All @@ -14,10 +15,13 @@ export const fileExtension = () => (state.language === 'javascript' ? 'js' : 'ts
export const root = (file: string) =>
process.cwd().includes('node_modules') ? join(process.cwd(), '../..', state.directory, file) : join(process.cwd(), state.directory, file)

export const reset = ({ path, root }: { path: string; root: boolean }, packageJson: PackageJson) => {
export async function reset({ path, root: isRoot }: { path: string; root: boolean }) {
state.options = {}
state.language = 'json'
state.packageJson = packageJson
state.directory = path
state.root = root
state.root = isRoot

const packageJson = await Bun.file(root('./package.json')).json()

state.packageJson = packageJson
}

0 comments on commit 70b509e

Please sign in to comment.