@@ -7,12 +7,17 @@ import issueRegex from 'issue-regex';
77import terminalLink from 'terminal-link' ;
88import { execa } from 'execa' ;
99import pMemoize from 'p-memoize' ;
10- import ow from 'ow' ;
1110import chalk from 'chalk' ;
1211import Version from './version.js' ;
1312import * as git from './git-util.js' ;
1413import * as npm from './npm/util.js' ;
1514
15+ export const assert = ( condition , message ) => {
16+ if ( ! condition ) {
17+ throw new Error ( message ) ;
18+ }
19+ } ;
20+
1621export const readPackage = async ( packagePath = process . cwd ( ) ) => {
1722 const packageResult = await readPackageUp ( { cwd : packagePath } ) ;
1823
@@ -62,7 +67,7 @@ export const linkifyCommitRange = (url, commitRange) => {
6267
6368/** @type {(config: import('./package-manager/types.js').PackageManagerConfig) => Promise<string> } */
6469export const getTagVersionPrefix = pMemoize ( async config => {
65- ow ( config , ow . object . hasKeys ( 'tagVersionPrefixCommand' ) ) ;
70+ assert ( config && Object . hasOwn ( config , 'tagVersionPrefixCommand' ) , 'Config is missing key `tagVersionPrefixCommand`' ) ;
6671
6772 try {
6873 const { stdout} = await execa ( ...config . tagVersionPrefixCommand ) ;
@@ -132,7 +137,7 @@ export const getNewDependencies = async (newPackage, rootDirectory) => {
132137
133138/** @type {(config: import('./package-manager/types.js').PackageManagerConfig) => Promise<string> } */
134139export const getPreReleasePrefix = pMemoize ( async config => {
135- ow ( config , ow . object . hasKeys ( 'cli' ) ) ;
140+ assert ( config && Object . hasOwn ( config , 'cli' ) , 'Config is missing key `cli`' ) ;
136141
137142 try {
138143 const { stdout} = await execa ( config . cli , [ 'config' , 'get' , 'preid' ] ) ;
0 commit comments