@kenan/npm-cli-login 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +2 -1
- package/lib/login.js +9 -4
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -21,7 +21,7 @@ module.exports = function (user, pass, email, registry, scope, quotes, configPat
|
|
|
21
21
|
throw new TypeError('`email` is a required argument.')
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
ncl.login(finalArgs, function (err,
|
|
24
|
+
ncl.login(finalArgs, function (err, data) {
|
|
25
25
|
if (err) {
|
|
26
26
|
throw err;
|
|
27
27
|
}
|
|
@@ -30,6 +30,7 @@ module.exports = function (user, pass, email, registry, scope, quotes, configPat
|
|
|
30
30
|
throw err;
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
+
const { token } = data;
|
|
33
34
|
const newContent = ncl.generateFileContents(
|
|
34
35
|
finalArgs,
|
|
35
36
|
content,
|
package/lib/login.js
CHANGED
|
@@ -78,9 +78,15 @@ module.exports = {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
let registry = args.registry.slice(args.registry.search(/\:\/\//) + 1);
|
|
82
|
+
|
|
83
|
+
// Trim trailing slash before a new one is added later.
|
|
84
|
+
if (registry.endsWith('/')) {
|
|
85
|
+
registry = registry.slice(0, -1);
|
|
86
|
+
}
|
|
87
|
+
|
|
81
88
|
var authWrite = lines.findIndex(function (element, index, array) {
|
|
82
|
-
if (
|
|
83
|
-
'/:_authToken=') !== -1) {
|
|
89
|
+
if (element.includes(`${registry}/:_authToken=`)) {
|
|
84
90
|
// If an entry for the auth token is found, replace it
|
|
85
91
|
array[index] = element.replace(/authToken\=.*/, 'authToken=' + (args.quotes ? '"' : '') +
|
|
86
92
|
response.token + (args.quotes ? '"' : ''));
|
|
@@ -90,8 +96,7 @@ module.exports = {
|
|
|
90
96
|
|
|
91
97
|
// If no entry for the auth token is found, add one
|
|
92
98
|
if (authWrite === -1) {
|
|
93
|
-
lines.push(args.
|
|
94
|
-
1) + '/:_authToken=' + (args.quotes ? '"' : '') + response.token + (args.quotes ? '"' : ''));
|
|
99
|
+
lines.push(registry + '/:_authToken=' + (args.quotes ? '"' : '') + response.token + (args.quotes ? '"' : ''));
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
var toWrite = lines.filter(function (element) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenan/npm-cli-login",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Fork of npm-cli-login",
|
|
5
5
|
"author": "Postman Team <help@getpostman.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"npm-profile": "^7.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@semantic-release/changelog": "^6.0.
|
|
32
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
33
33
|
"@semantic-release/git": "^10.0.1",
|
|
34
34
|
"chai": "^4.3.7",
|
|
35
35
|
"conventional-changelog-conventionalcommits": "^5.0.0",
|
|
36
36
|
"mocha": "^10.2.0",
|
|
37
|
-
"semantic-release": "^
|
|
37
|
+
"semantic-release": "^21.0.2"
|
|
38
38
|
}
|
|
39
39
|
}
|