duoops 0.2.5 → 0.2.6
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/dist/commands/init.js +5 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -24,10 +24,13 @@ const hasBinary = (command) => {
|
|
|
24
24
|
const detectGlabToken = (host = 'gitlab.com') => {
|
|
25
25
|
try {
|
|
26
26
|
const token = execSync(`glab config get token --host ${host}`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
|
|
27
|
-
if (token)
|
|
27
|
+
if (!token)
|
|
28
|
+
return;
|
|
29
|
+
const status = execSync(`curl -sf -o /dev/null -w "%{http_code}" -H "Authorization: Bearer ${token}" "https://${host}/api/v4/user"`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'], timeout: 5000 }).trim();
|
|
30
|
+
if (status === '200')
|
|
28
31
|
return { source: 'glab CLI', token };
|
|
29
32
|
}
|
|
30
|
-
catch { /* glab not installed
|
|
33
|
+
catch { /* glab not installed, not authenticated, or token expired */ }
|
|
31
34
|
};
|
|
32
35
|
const detectGitRemotePath = () => {
|
|
33
36
|
try {
|
package/oclif.manifest.json
CHANGED