-
-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check package name availability in custom registry #429
Check package name availability in custom registry #429
Conversation
@seognil Can you test this? |
Thanks for the patch, BUT it still won't work as what issue ticket described. maybe the process should be like // Pseudocode here
exports.isPackageNameAvailable = async pkg => {
const latest = await latestVersion()(pkg.name);
return latest == undefined // so it is not published
}; (inspired by update-notifier) Test Info // package.json
{
"name": "@seognil-playground/npm-feature-test",
// ...
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
} # shell
$ np --version
5.0.3
$ np
Publish a new version of @seognil-playground/npm-feature-test (current: 0.0.12)
# ...
? Select semver increment or specify new version patch 0.0.13
? This scoped repo @seognil-playground/npm-feature-test hasn't been published. Do you want to publish it publicly? (y/N) |
is it going to support custom registry? I've switched to https://npm.taobao.org/ , but 3 tests failed: index › version is invalid
/Users/weiran/repo/work/np/test/index.js:6
5: const message = 'Version should be either patch, minor, major, prepatch, preminor, premajor, prerelease, or a valid semver version.';
6: await t.throwsAsync(np('foo'), message);
7: await t.throwsAsync(np('4.x.3'), message);
Promise rejected with unexpected exception:
Error {
context: {},
message: 'Connection to npm registry failed',
}
Expected message to equal:
'Version should be either patch, minor, major, prepatch, preminor, premajor, prerelease, or a valid semver version.'
index › errors on too low version
/Users/weiran/repo/work/np/test/index.js:21
20: test('errors on too low version', async t => {
21: await t.throwsAsync(np('1.0.0'), /New version `1\.0\.0` should be higher than current version `\d+\.\d+\.\d+`/);
22: await t.throwsAsync(np('1.0.0-beta'), /New version `1\.0\.0-beta` should be higher than current version `\d+\.\d+\.\d+`/);
Promise rejected with unexpected exception:
Error {
context: {},
message: 'Connection to npm registry failed',
}
Expected message to match:
/New version `1\.0\.0` should be higher than current version `\d+\.\d+\.\d+`/
index › version is pre-release
/Users/weiran/repo/work/np/test/index.js:12
11: const message = 'You must specify a dist-tag using --tag when publishing a pre-release version. This prevents accidentally tagging unstable ver…
12: await t.throwsAsync(np('premajor'), message);
13: await t.throwsAsync(np('preminor'), message);
Promise rejected with unexpected exception:
Error {
context: {},
message: 'Connection to npm registry failed',
}
Expected message to equal:
'You must specify a dist-tag using --tag when publishing a pre-release version. This prevents accidentally tagging unstable versions as "latest". https://docs.npmjs.com/cli/dist-tag'
npm ERR! Test failed. See above for more details.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #424 (comment)