@opentapd/tplugin-cli 0.20.0-beta.15 → 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 (3) hide show
  1. package/cli.js +8 -6
  2. package/lib/login.js +17 -8
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -58,12 +58,14 @@ program.command('serve')
58
58
  .action(actionRunner(() => require('./lib/serve')()));
59
59
 
60
60
  // install 安装指令,安装插件到某个项目
61
- program.command('install')
62
- .description('安装测试项目')
63
- .action(actionRunner(async () => {
64
- await require('./lib/install')();
65
- console.log('');
66
- }));
61
+ if (tpluginConf.tapd.pluginEnv !== 'cloud') {
62
+ program.command('install')
63
+ .description('安装测试项目')
64
+ .action(actionRunner(async () => {
65
+ await require('./lib/install')();
66
+ console.log('');
67
+ }));
68
+ }
67
69
 
68
70
  // init 初始化插件
69
71
  program.command('init')
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.15",
3
+ "version": "0.20.0-beta.17",
4
4
  "description": "tplugin-cli",
5
5
  "bin": {
6
6
  "tplugin-cli": "index.js"