@@ -7,12 +7,17 @@ import issueRegex from 'issue-regex';
7
7
import terminalLink from 'terminal-link' ;
8
8
import { execa } from 'execa' ;
9
9
import pMemoize from 'p-memoize' ;
10
- import ow from 'ow' ;
11
10
import chalk from 'chalk' ;
12
11
import Version from './version.js' ;
13
12
import * as git from './git-util.js' ;
14
13
import * as npm from './npm/util.js' ;
15
14
15
+ export const assert = ( condition , message ) => {
16
+ if ( ! condition ) {
17
+ throw new Error ( message ) ;
18
+ }
19
+ } ;
20
+
16
21
export const readPackage = async ( packagePath = process . cwd ( ) ) => {
17
22
const packageResult = await readPackageUp ( { cwd : packagePath } ) ;
18
23
@@ -62,7 +67,7 @@ export const linkifyCommitRange = (url, commitRange) => {
62
67
63
68
/** @type {(config: import('./package-manager/types.js').PackageManagerConfig) => Promise<string> } */
64
69
export const getTagVersionPrefix = pMemoize ( async config => {
65
- ow ( config , ow . object . hasKeys ( 'tagVersionPrefixCommand' ) ) ;
70
+ assert ( config && Object . hasOwn ( config , 'tagVersionPrefixCommand' ) , 'Config is missing key `tagVersionPrefixCommand`' ) ;
66
71
67
72
try {
68
73
const { stdout} = await execa ( ...config . tagVersionPrefixCommand ) ;
@@ -132,7 +137,7 @@ export const getNewDependencies = async (newPackage, rootDirectory) => {
132
137
133
138
/** @type {(config: import('./package-manager/types.js').PackageManagerConfig) => Promise<string> } */
134
139
export const getPreReleasePrefix = pMemoize ( async config => {
135
- ow ( config , ow . object . hasKeys ( 'cli' ) ) ;
140
+ assert ( config && Object . hasOwn ( config , 'cli' ) , 'Config is missing key `cli`' ) ;
136
141
137
142
try {
138
143
const { stdout} = await execa ( config . cli , [ 'config' , 'get' , 'preid' ] ) ;
0 commit comments