From 4e2803602b9e57c16f8fe93c6e413cc3f88eb026 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 14 Oct 2023 23:40:08 +0700 Subject: [PATCH] Fix the check hanging Fixes sindresorhus/np#592 Fixes sindresorhus/npm-name-cli#30 --- index.js | 11 ++++++----- test.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 6bfc399..0c66a75 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ import zip from 'lodash.zip'; import validate from 'validate-npm-package-name'; import orgRegex from 'org-regex'; import pMap from 'p-map'; -import {isTaken} from 'is-name-taken'; +/// import {isTaken} from 'is-name-taken'; const configuredRegistryUrl = registryUrl(); const organizationRegex = orgRegex({exact: true}); @@ -60,10 +60,11 @@ const request = async (name, options) => { const {statusCode} = error.response || {}; if (statusCode === 404) { - if (!isOrganization) { - const conflict = await isTaken(name.toLowerCase(), {maxAge: 60000}); - return !conflict; - } + // Disabled as it's often way too slow: https://github.com/sindresorhus/npm-name-cli/issues/30 + // if (!isOrganization) { + // const conflict = await isTaken(name.toLowerCase(), {maxAge: 60000}); + // return !conflict; + // } return true; } diff --git a/test.js b/test.js index 1dd6d7c..5462801 100644 --- a/test.js +++ b/test.js @@ -27,7 +27,7 @@ test('returns false when package name is taken', async t => { t.false(await npmName('np', options)); }); -test('returns false when package name is taken, regardless of punctuation', async t => { +test.failing('returns false when package name is taken, regardless of punctuation', async t => { t.false(await npmName('ch-alk')); t.false(await npmName('recursivereaddir')); });