@opentapd/tplugin-cli 0.20.0-beta.16 → 0.20.0-beta.17

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.
Files changed (2) hide show
  1. package/lib/login.js +17 -8
  2. package/package.json +1 -1
package/lib/login.js CHANGED
@@ -23,18 +23,27 @@ const fs = require('fs-extra');
23
23
  module.exports = async (opts) => {
24
24
  // 当环境是工蜂的IDE时,直接发起静默登录,不需要选择登录方式
25
25
  if (opts.loginByTgit) {
26
- // 获取工蜂身份凭证
27
- const tgitTokenPath = '/home/theia/.git-credentials/credentials';
28
- const tgitToken = fs.readFileSync(tgitTokenPath, 'utf8');
29
- const matchData = tgitToken.match(/oauth2:(\S*)@git/) || [];
30
-
31
- if (matchData.length) {
32
- // 凭证中获取用户accessToken
33
- const accessToken = matchData[1];
26
+ if (!!process.env.GF_IDE_OAUTH_TOKEN) {
27
+ // 新版本直接从环境变量里拿accessToken
28
+ const accessToken = process.env.GF_IDE_OAUTH_TOKEN;
34
29
  // 使用凭证accessToken发起登录请求
35
30
  const res = await loginByTgitaccessToken(accessToken);
36
31
  // 处理登录数据
37
32
  dealLoginData(res);
33
+ } else {
34
+ // 获取工蜂身份凭证
35
+ const tgitTokenPath = '/home/theia/.git-credentials/credentials';
36
+ const tgitToken = fs.readFileSync(tgitTokenPath, 'utf8');
37
+ const matchData = tgitToken.match(/oauth2:(\S*)@git/) || [];
38
+
39
+ if (matchData.length) {
40
+ // 凭证中获取用户accessToken
41
+ const accessToken = matchData[1];
42
+ // 使用凭证accessToken发起登录请求
43
+ const res = await loginByTgitaccessToken(accessToken);
44
+ // 处理登录数据
45
+ dealLoginData(res);
46
+ }
38
47
  }
39
48
  process.exit(0);
40
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentapd/tplugin-cli",
3
- "version": "0.20.0-beta.16",
3
+ "version": "0.20.0-beta.17",
4
4
  "description": "tplugin-cli",
5
5
  "bin": {
6
6
  "tplugin-cli": "index.js"