Skip to content

Commit

Permalink
Fix the check hanging
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 14, 2023
1 parent 7aef07b commit 4e28036
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions index.js
Expand Up @@ -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});
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion test.js
Expand Up @@ -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'));
});
Expand Down

0 comments on commit 4e28036

Please sign in to comment.