@teambit/api-server 1.0.357 → 1.0.360
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="0" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.harmony/api-server@1.0.
|
|
3
|
+
<testsuite name="teambit.harmony/api-server@1.0.360" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
package/artifacts/schema.json
CHANGED
package/dist/cli-raw.route.js
CHANGED
|
@@ -66,12 +66,20 @@ class CLIRawRoute {
|
|
|
66
66
|
await this.apiForIDE.logFinishCmdHistory(cmdStrLog, 0);
|
|
67
67
|
res.json(result);
|
|
68
68
|
} catch (err) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
69
|
+
if (err instanceof _cli().YargsExitWorkaround) {
|
|
70
|
+
res.json({
|
|
71
|
+
data: err.helpMsg,
|
|
72
|
+
exitCode: err.exitCode
|
|
73
|
+
});
|
|
74
|
+
} else {
|
|
75
|
+
this.logger.error(`cli-raw server: got an error for ${command}`, err);
|
|
76
|
+
await this.apiForIDE.logFinishCmdHistory(cmdStrLog, 1);
|
|
77
|
+
res.status(500);
|
|
78
|
+
res.jsonp({
|
|
79
|
+
message: err.message,
|
|
80
|
+
error: err
|
|
81
|
+
});
|
|
82
|
+
}
|
|
75
83
|
} finally {
|
|
76
84
|
this.logger.clearStatusLine();
|
|
77
85
|
// change chalk back to false, otherwise, the IDE will have colors. (this is a global setting)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_chalk","_interopRequireDefault","_logger","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIRawRoute","constructor","logger","cli","apiForIDE","req","res","command","pwd","body","debug","process","cwd","startsWith","Error","randomNumber","Math","floor","random","cmdStrLog","logStartCmdHistory","legacyLogger","isDaemon","enableChalk","cliParser","CLIParser","commands","groups","onCommandStartSlot","commandRunner","parse","split","result","runCommand","logFinishCmdHistory","json","err","
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_chalk","_interopRequireDefault","_logger","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIRawRoute","constructor","logger","cli","apiForIDE","req","res","command","pwd","body","debug","process","cwd","startsWith","Error","randomNumber","Math","floor","random","cmdStrLog","logStartCmdHistory","legacyLogger","isDaemon","enableChalk","cliParser","CLIParser","commands","groups","onCommandStartSlot","commandRunner","parse","split","result","runCommand","logFinishCmdHistory","json","err","YargsExitWorkaround","helpMsg","exitCode","error","status","jsonp","message","clearStatusLine","chalk","enabled","exports","level"],"sources":["cli-raw.route.ts"],"sourcesContent":["import { CLIMain, CLIParser, YargsExitWorkaround } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Route, Request, Response } from '@teambit/express';\nimport { Logger } from '@teambit/logger';\nimport legacyLogger from '@teambit/legacy/dist/logger/logger';\nimport { APIForIDE } from './api-for-ide';\n\n/**\n * example usage:\n * post to http://localhost:3000/api/cli\n * with the following json as the body\n *\n{\n \"command\": [\"tag comp1 --build\"]\n}\n */\nexport class CLIRawRoute implements Route {\n constructor(private logger: Logger, private cli: CLIMain, private apiForIDE: APIForIDE) {}\n\n method = 'post';\n route = '/cli-raw';\n\n middlewares = [\n async (req: Request, res: Response) => {\n const { command, pwd } = req.body;\n this.logger.debug(`cli-raw server: got request for ${command}`);\n if (pwd && !process.cwd().startsWith(pwd)) {\n throw new Error(`bit-server is running on a different directory. bit-server: ${process.cwd()}, pwd: ${pwd}`);\n }\n\n const randomNumber = Math.floor(Math.random() * 10000); // helps to distinguish between commands in the log\n const cmdStrLog = `${randomNumber} ${command}`;\n await this.apiForIDE.logStartCmdHistory(cmdStrLog);\n legacyLogger.isDaemon = true;\n enableChalk();\n const cliParser = new CLIParser(this.cli.commands, this.cli.groups, this.cli.onCommandStartSlot);\n try {\n const commandRunner = await cliParser.parse(command.split(' '));\n const result = await commandRunner.runCommand(true);\n await this.apiForIDE.logFinishCmdHistory(cmdStrLog, 0);\n res.json(result);\n } catch (err: any) {\n if (err instanceof YargsExitWorkaround) {\n res.json({ data: err.helpMsg, exitCode: err.exitCode });\n } else {\n this.logger.error(`cli-raw server: got an error for ${command}`, err);\n await this.apiForIDE.logFinishCmdHistory(cmdStrLog, 1);\n res.status(500);\n res.jsonp({\n message: err.message,\n error: err,\n });\n }\n } finally {\n this.logger.clearStatusLine();\n // change chalk back to false, otherwise, the IDE will have colors. (this is a global setting)\n chalk.enabled = false;\n }\n },\n ];\n}\n\n/**\n * because this gets called from the express server, which gets spawn from a script, chalk defaults to false.\n * changing only the \"level\" is not enough, it must be enabled as well.\n * only when calling this route from the terminal, we want colors. on the IDE, we don't want colors.\n */\nfunction enableChalk() {\n chalk.enabled = true;\n chalk.level = 3;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8D,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,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AAK,CAAC,oCAAoCjC,OAAO,EAAE,EAAE6B,GAAG,CAAC;UACrE,MAAM,IAAI,CAAChC,SAAS,CAAC8B,mBAAmB,CAACf,SAAS,EAAE,CAAC,CAAC;UACtDb,GAAG,CAACmC,MAAM,CAAC,GAAG,CAAC;UACfnC,GAAG,CAACoC,KAAK,CAAC;YACRC,OAAO,EAAEP,GAAG,CAACO,OAAO;YACpBH,KAAK,EAAEJ;UACT,CAAC,CAAC;QACJ;MACF,CAAC,SAAS;QACR,IAAI,CAAClC,MAAM,CAAC0C,eAAe,CAAC,CAAC;QAC7B;QACAC,gBAAK,CAACC,OAAO,GAAG,KAAK;MACvB;IACF,CAAC,CACF;EA1CwF;AA2C3F;;AAEA;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAA/C,WAAA,GAAAA,WAAA;AAKA,SAASuB,WAAWA,CAAA,EAAG;EACrBsB,gBAAK,CAACC,OAAO,GAAG,IAAI;EACpBD,gBAAK,CAACG,KAAK,GAAG,CAAC;AACjB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/api-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.360",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/harmony/api-server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "api-server",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.360"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"fs-extra": "10.0.0",
|
|
@@ -18,26 +18,26 @@
|
|
|
18
18
|
"pretty-time": "1.1.0",
|
|
19
19
|
"@teambit/lane-id": "0.0.311",
|
|
20
20
|
"@teambit/harmony": "0.4.6",
|
|
21
|
-
"@teambit/checkout": "1.0.
|
|
22
|
-
"@teambit/component-compare": "1.0.
|
|
23
|
-
"@teambit/component-log": "1.0.
|
|
24
|
-
"@teambit/config": "0.0.
|
|
25
|
-
"@teambit/export": "1.0.
|
|
26
|
-
"@teambit/generator": "1.0.
|
|
27
|
-
"@teambit/install": "1.0.
|
|
28
|
-
"@teambit/lanes": "1.0.
|
|
21
|
+
"@teambit/checkout": "1.0.360",
|
|
22
|
+
"@teambit/component-compare": "1.0.360",
|
|
23
|
+
"@teambit/component-log": "1.0.360",
|
|
24
|
+
"@teambit/config": "0.0.1111",
|
|
25
|
+
"@teambit/export": "1.0.360",
|
|
26
|
+
"@teambit/generator": "1.0.361",
|
|
27
|
+
"@teambit/install": "1.0.360",
|
|
28
|
+
"@teambit/lanes": "1.0.360",
|
|
29
29
|
"@teambit/legacy.utils": "0.0.4",
|
|
30
|
-
"@teambit/merging": "1.0.
|
|
31
|
-
"@teambit/remove": "1.0.
|
|
32
|
-
"@teambit/snapping": "1.0.
|
|
33
|
-
"@teambit/workspace": "1.0.
|
|
34
|
-
"@teambit/cli": "0.0.
|
|
35
|
-
"@teambit/component": "1.0.
|
|
36
|
-
"@teambit/express": "0.0.
|
|
30
|
+
"@teambit/merging": "1.0.360",
|
|
31
|
+
"@teambit/remove": "1.0.360",
|
|
32
|
+
"@teambit/snapping": "1.0.360",
|
|
33
|
+
"@teambit/workspace": "1.0.360",
|
|
34
|
+
"@teambit/cli": "0.0.937",
|
|
35
|
+
"@teambit/component": "1.0.360",
|
|
36
|
+
"@teambit/express": "0.0.1036",
|
|
37
37
|
"@teambit/harmony.modules.send-server-sent-events": "0.0.1",
|
|
38
|
-
"@teambit/importer": "1.0.
|
|
39
|
-
"@teambit/logger": "0.0.
|
|
40
|
-
"@teambit/watcher": "1.0.
|
|
38
|
+
"@teambit/importer": "1.0.360",
|
|
39
|
+
"@teambit/logger": "0.0.1030",
|
|
40
|
+
"@teambit/watcher": "1.0.360"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/fs-extra": "9.0.7",
|
|
File without changes
|