fix: add parens around the null coalescing operator to fix issues when npm_config_user_agent exists (#1519)

This commit is contained in:
dexmlee
2024-09-12 00:11:38 +02:00
committed by GitHub
parent b4dd6aa4cc
commit e3de9043b7
+2 -2
View File
@@ -15,7 +15,7 @@ if (a == 'init') {
w(n, JSON.stringify(o, 0, /\t/.test(s) ? '\t' : 2) + '\n')
p.stdout.write(i())
try { f.mkdirSync('.husky') } catch {}
w('.husky/pre-commit', p.env.npm_config_user_agent?.split('/')[0] ?? 'npm' + ' test\n')
w('.husky/pre-commit', (p.env.npm_config_user_agent?.split('/')[0] ?? 'npm') + ' test\n')
p.exit()
}
@@ -23,4 +23,4 @@ d = c => console.error(`${c} command is DEPRECATED`)
if (['add', 'set', 'uninstall'].includes(a)) { d(a); p.exit(1) }
if (a == 'install') d(a)
p.stdout.write(i(a == 'install' ? undefined : a))
p.stdout.write(i(a == 'install' ? undefined : a))