Skip to content

Commit

Permalink
chore: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Apr 29, 2024
1 parent a530ea8 commit 8154f64
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/monorepo-release/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import { execSync as nodeExecSync } from "node:child_process"
import { Readable } from "node:stream"
import { Config, defaultConfig } from "./config.js"

type PackageJsonRelease = PackageJson & { release: Partial<Config> }

async function read(directory: string): Promise<PackageJsonRelease>
async function read(directory: string, raw: true): Promise<string>
async function read(
directory: string,
raw?: boolean
): Promise<Required<PackageJson & { release?: Partial<Config> }> | string> {
raw?: boolean,
): Promise<PackageJsonRelease | string> {
const content = await fs.readFile(
path.join(process.cwd(), directory, "package.json"),
"utf8",
Expand All @@ -21,7 +25,7 @@ async function update(
directory: string,
data: Partial<PackageJson>,
): Promise<void> {
const original = await pkgJson.read(directory, true) as string
const original = await pkgJson.read(directory, true)
let content = JSON.stringify({ ...JSON.parse(original), ...data }, null, 2)
content += original.endsWith("\r\n") ? "\r\n" : "\n"
await fs.writeFile(
Expand Down Expand Up @@ -70,8 +74,8 @@ export function pluralize(
typeof count === "number"
? count
: count instanceof Set || count instanceof Map
? count.size
: count.length
? count.size
: count.length

const pluralForm = pluralRules.select(count)
switch (pluralForm) {
Expand Down

0 comments on commit 8154f64

Please sign in to comment.