@teambit/cli 0.0.971 → 0.0.973

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/cli@0.0.971" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.harmony/cli@0.0.973" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/cli-preview"]=t():e["teambit.harmony/cli-preview"]=t()}(self,(()=>(()=>{"use strict";var e={77743:(e,t,o)=>{var n={id:"teambit.harmony/cli@0.0.971",homepage:"https://bit.cloud/teambit/harmony/cli",exported:!0};function r(){const e=a(o(41594));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,a.__bit_component=n;const i=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/cli.svg"}));i.__bit_component=n,t.Logo=i},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{compositions:()=>u,compositions_metadata:()=>y,overview:()=>f});var r={};o.r(r),o.d(r,{default:()=>p});var a=o(77743);o(41594);const i=MdxJsReact,s=TeambitMdxUiMdxScopeContext;var c=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)({}).hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},l.apply(null,arguments)}var d={},m="wrapper";function p(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;o[n]=e[n]}return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)o=a[n],t.includes(o)||{}.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,c);return(0,i.mdx)(m,l({},d,o,{components:t,mdxType:"MDXLayout"}),(0,i.mdx)(s.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,i.mdx)("p",null,"CLI Aspect manages the commands in the CLI. New commands are registered to this aspect with the necessary data such as, command-name, description and flags. Parsing the args from the CLI is done by Commander package."),(0,i.mdx)("h2",null,"Features"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Allow to register new commands"),(0,i.mdx)("li",{parentName:"ul"},"Use commander commands."),(0,i.mdx)("li",{parentName:"ul"},"Render to stdout as string or as a React component by Ink."))))}p.isMDXComponent=!0;const u=[a],f=[r],y={compositions:[{displayName:"Logo",identifier:"Logo"}]};return n})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/cli-preview"]=t():e["teambit.harmony/cli-preview"]=t()}(self,(()=>(()=>{"use strict";var e={83377:(e,t,o)=>{var n={id:"teambit.harmony/cli@0.0.973",homepage:"https://bit.cloud/teambit/harmony/cli",exported:!0};function r(){const e=a(o(41594));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,a.__bit_component=n;const i=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/cli.svg"}));i.__bit_component=n,t.Logo=i},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{compositions:()=>u,compositions_metadata:()=>y,overview:()=>f});var r={};o.r(r),o.d(r,{default:()=>p});var a=o(83377);o(41594);const i=MdxJsReact,s=TeambitMdxUiMdxScopeContext;var c=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)({}).hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},l.apply(null,arguments)}var d={},m="wrapper";function p(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;o[n]=e[n]}return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)o=a[n],t.includes(o)||{}.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,c);return(0,i.mdx)(m,l({},d,o,{components:t,mdxType:"MDXLayout"}),(0,i.mdx)(s.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,i.mdx)("p",null,"CLI Aspect manages the commands in the CLI. New commands are registered to this aspect with the necessary data such as, command-name, description and flags. Parsing the args from the CLI is done by Commander package."),(0,i.mdx)("h2",null,"Features"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Allow to register new commands"),(0,i.mdx)("li",{parentName:"ul"},"Use commander commands."),(0,i.mdx)("li",{parentName:"ul"},"Render to stdout as string or as a React component by Ink."))))}p.isMDXComponent=!0;const u=[a],f=[r],y={compositions:[{displayName:"Logo",identifier:"Logo"}]};return n})()));
@@ -1220,7 +1220,7 @@
1220
1220
  "__schema": "FunctionLikeSchema",
1221
1221
  "location": {
1222
1222
  "filePath": "handle-errors.ts",
1223
- "line": 20,
1223
+ "line": 31,
1224
1224
  "character": 1
1225
1225
  },
1226
1226
  "signature": "function handleUnhandledRejection(err: Error | null | undefined | {}): Promise<void>",
@@ -1230,7 +1230,7 @@
1230
1230
  "__schema": "ParameterSchema",
1231
1231
  "location": {
1232
1232
  "filePath": "handle-errors.ts",
1233
- "line": 20,
1233
+ "line": 31,
1234
1234
  "character": 48
1235
1235
  },
1236
1236
  "name": "err",
@@ -1238,7 +1238,7 @@
1238
1238
  "__schema": "TypeUnionSchema",
1239
1239
  "location": {
1240
1240
  "filePath": "handle-errors.ts",
1241
- "line": 20,
1241
+ "line": 31,
1242
1242
  "character": 53
1243
1243
  },
1244
1244
  "types": [
@@ -1246,7 +1246,7 @@
1246
1246
  "__schema": "TypeRefSchema",
1247
1247
  "location": {
1248
1248
  "filePath": "handle-errors.ts",
1249
- "line": 20,
1249
+ "line": 31,
1250
1250
  "character": 53
1251
1251
  },
1252
1252
  "name": "Error"
@@ -1255,7 +1255,7 @@
1255
1255
  "__schema": "LiteralTypeSchema",
1256
1256
  "location": {
1257
1257
  "filePath": "handle-errors.ts",
1258
- "line": 20,
1258
+ "line": 31,
1259
1259
  "character": 61
1260
1260
  },
1261
1261
  "name": "null"
@@ -1264,7 +1264,7 @@
1264
1264
  "__schema": "KeywordTypeSchema",
1265
1265
  "location": {
1266
1266
  "filePath": "handle-errors.ts",
1267
- "line": 20,
1267
+ "line": 31,
1268
1268
  "character": 68
1269
1269
  },
1270
1270
  "name": "undefined"
@@ -1273,7 +1273,7 @@
1273
1273
  "__schema": "TypeLiteralSchema",
1274
1274
  "location": {
1275
1275
  "filePath": "handle-errors.ts",
1276
- "line": 20,
1276
+ "line": 31,
1277
1277
  "character": 80
1278
1278
  },
1279
1279
  "members": []
@@ -1288,7 +1288,7 @@
1288
1288
  "__schema": "InferenceTypeSchema",
1289
1289
  "location": {
1290
1290
  "filePath": "handle-errors.ts",
1291
- "line": 20,
1291
+ "line": 31,
1292
1292
  "character": 1
1293
1293
  },
1294
1294
  "type": "Promise<void>"
@@ -1311,7 +1311,7 @@
1311
1311
  "__schema": "FunctionLikeSchema",
1312
1312
  "location": {
1313
1313
  "filePath": "handle-errors.ts",
1314
- "line": 5,
1314
+ "line": 16,
1315
1315
  "character": 1
1316
1316
  },
1317
1317
  "signature": "function handleErrorAndExit(err: Error, commandName: string): Promise<void>",
@@ -1321,7 +1321,7 @@
1321
1321
  "__schema": "ParameterSchema",
1322
1322
  "location": {
1323
1323
  "filePath": "handle-errors.ts",
1324
- "line": 5,
1324
+ "line": 16,
1325
1325
  "character": 42
1326
1326
  },
1327
1327
  "name": "err",
@@ -1329,7 +1329,7 @@
1329
1329
  "__schema": "TypeRefSchema",
1330
1330
  "location": {
1331
1331
  "filePath": "handle-errors.ts",
1332
- "line": 5,
1332
+ "line": 16,
1333
1333
  "character": 47
1334
1334
  },
1335
1335
  "name": "Error"
@@ -1341,7 +1341,7 @@
1341
1341
  "__schema": "ParameterSchema",
1342
1342
  "location": {
1343
1343
  "filePath": "handle-errors.ts",
1344
- "line": 5,
1344
+ "line": 16,
1345
1345
  "character": 54
1346
1346
  },
1347
1347
  "name": "commandName",
@@ -1349,7 +1349,7 @@
1349
1349
  "__schema": "KeywordTypeSchema",
1350
1350
  "location": {
1351
1351
  "filePath": "handle-errors.ts",
1352
- "line": 5,
1352
+ "line": 16,
1353
1353
  "character": 67
1354
1354
  },
1355
1355
  "name": "string"
@@ -1362,7 +1362,7 @@
1362
1362
  "__schema": "TypeRefSchema",
1363
1363
  "location": {
1364
1364
  "filePath": "handle-errors.ts",
1365
- "line": 5,
1365
+ "line": 16,
1366
1366
  "character": 76
1367
1367
  },
1368
1368
  "name": "Promise",
@@ -1371,7 +1371,7 @@
1371
1371
  "__schema": "KeywordTypeSchema",
1372
1372
  "location": {
1373
1373
  "filePath": "handle-errors.ts",
1374
- "line": 5,
1374
+ "line": 16,
1375
1375
  "character": 84
1376
1376
  },
1377
1377
  "name": "void"
@@ -1384,6 +1384,59 @@
1384
1384
  ]
1385
1385
  }
1386
1386
  },
1387
+ {
1388
+ "__schema": "ExportSchema",
1389
+ "location": {
1390
+ "filePath": "index.ts",
1391
+ "line": 4,
1392
+ "character": 56
1393
+ },
1394
+ "name": "setExitOnUnhandledRejection",
1395
+ "exportNode": {
1396
+ "__schema": "FunctionLikeSchema",
1397
+ "location": {
1398
+ "filePath": "handle-errors.ts",
1399
+ "line": 12,
1400
+ "character": 1
1401
+ },
1402
+ "signature": "function setExitOnUnhandledRejection(exit: boolean): void",
1403
+ "name": "setExitOnUnhandledRejection",
1404
+ "params": [
1405
+ {
1406
+ "__schema": "ParameterSchema",
1407
+ "location": {
1408
+ "filePath": "handle-errors.ts",
1409
+ "line": 12,
1410
+ "character": 45
1411
+ },
1412
+ "name": "exit",
1413
+ "type": {
1414
+ "__schema": "KeywordTypeSchema",
1415
+ "location": {
1416
+ "filePath": "handle-errors.ts",
1417
+ "line": 12,
1418
+ "character": 51
1419
+ },
1420
+ "name": "boolean"
1421
+ },
1422
+ "isOptional": false,
1423
+ "isSpread": false
1424
+ }
1425
+ ],
1426
+ "returnType": {
1427
+ "__schema": "InferenceTypeSchema",
1428
+ "location": {
1429
+ "filePath": "handle-errors.ts",
1430
+ "line": 12,
1431
+ "character": 1
1432
+ },
1433
+ "type": "void"
1434
+ },
1435
+ "modifiers": [
1436
+ "export"
1437
+ ]
1438
+ }
1439
+ },
1387
1440
  {
1388
1441
  "__schema": "ExportSchema",
1389
1442
  "location": {
@@ -1582,7 +1635,7 @@
1582
1635
  "_legacy": {
1583
1636
  "scope": "teambit.harmony",
1584
1637
  "name": "cli",
1585
- "version": "0.0.971"
1638
+ "version": "0.0.973"
1586
1639
  },
1587
1640
  "_scope": "teambit.harmony"
1588
1641
  }
@@ -1695,7 +1748,7 @@
1695
1748
  "_legacy": {
1696
1749
  "scope": "teambit.harmony",
1697
1750
  "name": "cli",
1698
- "version": "0.0.971"
1751
+ "version": "0.0.973"
1699
1752
  },
1700
1753
  "_scope": "teambit.harmony"
1701
1754
  }
@@ -3570,7 +3623,7 @@
3570
3623
  "componentId": {
3571
3624
  "scope": "teambit.harmony",
3572
3625
  "name": "cli",
3573
- "version": "0.0.971"
3626
+ "version": "0.0.973"
3574
3627
  },
3575
3628
  "taggedModuleExports": []
3576
3629
  }
@@ -1,2 +1,3 @@
1
+ export declare function setExitOnUnhandledRejection(exit: boolean): void;
1
2
  export declare function handleErrorAndExit(err: Error, commandName: string): Promise<void>;
2
3
  export declare function handleUnhandledRejection(err: Error | null | undefined | {}): Promise<void>;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.handleErrorAndExit = handleErrorAndExit;
7
7
  exports.handleUnhandledRejection = handleUnhandledRejection;
8
+ exports.setExitOnUnhandledRejection = setExitOnUnhandledRejection;
8
9
  function _logger() {
9
10
  const data = _interopRequireDefault(require("@teambit/legacy/dist/logger/logger"));
10
11
  _logger = function () {
@@ -27,6 +28,16 @@ function _loader() {
27
28
  return data;
28
29
  }
29
30
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
31
+ let exitOnUnhandled = true;
32
+
33
+ // This provide a way to not exit when an unhandled rejection is found
34
+ // This is main required when we load plugins which are esm modules and they require cjs modules
35
+ // and there is as an error in the cjs module
36
+ // in such case the regular catch will not catch the error and the process will exit
37
+ // we don't want to exit in such case (of plugins load) so we provide a way to not exit
38
+ function setExitOnUnhandledRejection(exit) {
39
+ exitOnUnhandled = exit;
40
+ }
30
41
  async function handleErrorAndExit(err, commandName) {
31
42
  try {
32
43
  _loader().default.off();
@@ -45,7 +56,11 @@ async function handleErrorAndExit(err, commandName) {
45
56
  }
46
57
  async function handleUnhandledRejection(err) {
47
58
  // eslint-disable-next-line no-console
48
- console.error('** unhandled rejection found, please make sure the promise is resolved/rejected correctly! **');
59
+ console.error('** unhandled rejection found, please make sure the promise is resolved/rejected correctly! **', err);
60
+ if (!exitOnUnhandled) {
61
+ _logger().default.error(`ignoring unhandled rejection error:`, err);
62
+ return;
63
+ }
49
64
  if (err instanceof Error) {
50
65
  return handleErrorAndExit(err, process.argv[2]);
51
66
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_logger","data","_interopRequireDefault","require","_defaultErrorHandler","_loader","e","__esModule","default","handleErrorAndExit","err","commandName","loader","off","logger","error","message","defaultHandleError","logErrAndExit","console","process","exit","handleUnhandledRejection","Error","argv","errMsg","errObj","env","CI","exitAfterFlush","toString"],"sources":["handle-errors.ts"],"sourcesContent":["import logger from '@teambit/legacy/dist/logger/logger';\nimport defaultHandleError from '@teambit/legacy/dist/cli/default-error-handler';\nimport loader from '@teambit/legacy/dist/cli/loader';\n\nexport async function handleErrorAndExit(err: Error, commandName: string): Promise<void> {\n try {\n loader.off();\n logger.error(`got an error from command ${commandName}: ${err}`, err);\n const { message } = defaultHandleError(err);\n await logErrAndExit(message, commandName, err);\n } catch (e: any) {\n // eslint-disable-next-line no-console\n console.error('failed to log the error properly, failure error', e);\n // eslint-disable-next-line no-console\n console.error('failed to log the error properly, original error', err);\n process.exit(1);\n }\n}\n\nexport async function handleUnhandledRejection(err: Error | null | undefined | {}) {\n // eslint-disable-next-line no-console\n console.error('** unhandled rejection found, please make sure the promise is resolved/rejected correctly! **');\n if (err instanceof Error) {\n return handleErrorAndExit(err, process.argv[2]);\n }\n console.error(err); // eslint-disable-line\n return handleErrorAndExit(new Error(`unhandledRejections found. err ${err}`), process.argv[2]);\n}\n\nasync function logErrAndExit(errMsg: Error | string, commandName: string, errObj: Error) {\n if (!errMsg) throw new Error(`logErrAndExit expects to get either an Error or a string, got nothing`);\n console.error(errMsg); // eslint-disable-line\n // for CI, print the entire error with the stacktrace\n if (process.env.CI) console.error(errObj); // eslint-disable-line\n await logger.exitAfterFlush(1, commandName, errMsg.toString());\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,qBAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqD,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C,eAAeG,kBAAkBA,CAACC,GAAU,EAAEC,WAAmB,EAAiB;EACvF,IAAI;IACFC,iBAAM,CAACC,GAAG,CAAC,CAAC;IACZC,iBAAM,CAACC,KAAK,CAAC,6BAA6BJ,WAAW,KAAKD,GAAG,EAAE,EAAEA,GAAG,CAAC;IACrE,MAAM;MAAEM;IAAQ,CAAC,GAAG,IAAAC,8BAAkB,EAACP,GAAG,CAAC;IAC3C,MAAMQ,aAAa,CAACF,OAAO,EAAEL,WAAW,EAAED,GAAG,CAAC;EAChD,CAAC,CAAC,OAAOJ,CAAM,EAAE;IACf;IACAa,OAAO,CAACJ,KAAK,CAAC,iDAAiD,EAAET,CAAC,CAAC;IACnE;IACAa,OAAO,CAACJ,KAAK,CAAC,kDAAkD,EAAEL,GAAG,CAAC;IACtEU,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;EACjB;AACF;AAEO,eAAeC,wBAAwBA,CAACZ,GAAkC,EAAE;EACjF;EACAS,OAAO,CAACJ,KAAK,CAAC,+FAA+F,CAAC;EAC9G,IAAIL,GAAG,YAAYa,KAAK,EAAE;IACxB,OAAOd,kBAAkB,CAACC,GAAG,EAAEU,OAAO,CAACI,IAAI,CAAC,CAAC,CAAC,CAAC;EACjD;EACAL,OAAO,CAACJ,KAAK,CAACL,GAAG,CAAC,CAAC,CAAC;EACpB,OAAOD,kBAAkB,CAAC,IAAIc,KAAK,CAAC,kCAAkCb,GAAG,EAAE,CAAC,EAAEU,OAAO,CAACI,IAAI,CAAC,CAAC,CAAC,CAAC;AAChG;AAEA,eAAeN,aAAaA,CAACO,MAAsB,EAAEd,WAAmB,EAAEe,MAAa,EAAE;EACvF,IAAI,CAACD,MAAM,EAAE,MAAM,IAAIF,KAAK,CAAC,uEAAuE,CAAC;EACrGJ,OAAO,CAACJ,KAAK,CAACU,MAAM,CAAC,CAAC,CAAC;EACvB;EACA,IAAIL,OAAO,CAACO,GAAG,CAACC,EAAE,EAAET,OAAO,CAACJ,KAAK,CAACW,MAAM,CAAC,CAAC,CAAC;EAC3C,MAAMZ,iBAAM,CAACe,cAAc,CAAC,CAAC,EAAElB,WAAW,EAAEc,MAAM,CAACK,QAAQ,CAAC,CAAC,CAAC;AAChE","ignoreList":[]}
1
+ {"version":3,"names":["_logger","data","_interopRequireDefault","require","_defaultErrorHandler","_loader","e","__esModule","default","exitOnUnhandled","setExitOnUnhandledRejection","exit","handleErrorAndExit","err","commandName","loader","off","logger","error","message","defaultHandleError","logErrAndExit","console","process","handleUnhandledRejection","Error","argv","errMsg","errObj","env","CI","exitAfterFlush","toString"],"sources":["handle-errors.ts"],"sourcesContent":["import logger from '@teambit/legacy/dist/logger/logger';\nimport defaultHandleError from '@teambit/legacy/dist/cli/default-error-handler';\nimport loader from '@teambit/legacy/dist/cli/loader';\n\nlet exitOnUnhandled = true;\n\n// This provide a way to not exit when an unhandled rejection is found\n// This is main required when we load plugins which are esm modules and they require cjs modules\n// and there is as an error in the cjs module\n// in such case the regular catch will not catch the error and the process will exit\n// we don't want to exit in such case (of plugins load) so we provide a way to not exit\nexport function setExitOnUnhandledRejection(exit: boolean) {\n exitOnUnhandled = exit;\n}\n\nexport async function handleErrorAndExit(err: Error, commandName: string): Promise<void> {\n try {\n loader.off();\n logger.error(`got an error from command ${commandName}: ${err}`, err);\n const { message } = defaultHandleError(err);\n await logErrAndExit(message, commandName, err);\n } catch (e: any) {\n // eslint-disable-next-line no-console\n console.error('failed to log the error properly, failure error', e);\n // eslint-disable-next-line no-console\n console.error('failed to log the error properly, original error', err);\n process.exit(1);\n }\n}\n\nexport async function handleUnhandledRejection(err: Error | null | undefined | {}) {\n // eslint-disable-next-line no-console\n console.error('** unhandled rejection found, please make sure the promise is resolved/rejected correctly! **', err);\n if (!exitOnUnhandled) {\n logger.error(`ignoring unhandled rejection error:`, err);\n return;\n }\n if (err instanceof Error) {\n return handleErrorAndExit(err, process.argv[2]);\n }\n console.error(err); // eslint-disable-line\n return handleErrorAndExit(new Error(`unhandledRejections found. err ${err}`), process.argv[2]);\n}\n\nasync function logErrAndExit(errMsg: Error | string, commandName: string, errObj: Error) {\n if (!errMsg) throw new Error(`logErrAndExit expects to get either an Error or a string, got nothing`);\n console.error(errMsg); // eslint-disable-line\n // for CI, print the entire error with the stacktrace\n if (process.env.CI) console.error(errObj); // eslint-disable-line\n await logger.exitAfterFlush(1, commandName, errMsg.toString());\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,qBAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqD,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErD,IAAIG,eAAe,GAAG,IAAI;;AAE1B;AACA;AACA;AACA;AACA;AACO,SAASC,2BAA2BA,CAACC,IAAa,EAAE;EACzDF,eAAe,GAAGE,IAAI;AACxB;AAEO,eAAeC,kBAAkBA,CAACC,GAAU,EAAEC,WAAmB,EAAiB;EACvF,IAAI;IACFC,iBAAM,CAACC,GAAG,CAAC,CAAC;IACZC,iBAAM,CAACC,KAAK,CAAC,6BAA6BJ,WAAW,KAAKD,GAAG,EAAE,EAAEA,GAAG,CAAC;IACrE,MAAM;MAAEM;IAAQ,CAAC,GAAG,IAAAC,8BAAkB,EAACP,GAAG,CAAC;IAC3C,MAAMQ,aAAa,CAACF,OAAO,EAAEL,WAAW,EAAED,GAAG,CAAC;EAChD,CAAC,CAAC,OAAOP,CAAM,EAAE;IACf;IACAgB,OAAO,CAACJ,KAAK,CAAC,iDAAiD,EAAEZ,CAAC,CAAC;IACnE;IACAgB,OAAO,CAACJ,KAAK,CAAC,kDAAkD,EAAEL,GAAG,CAAC;IACtEU,OAAO,CAACZ,IAAI,CAAC,CAAC,CAAC;EACjB;AACF;AAEO,eAAea,wBAAwBA,CAACX,GAAkC,EAAE;EACjF;EACAS,OAAO,CAACJ,KAAK,CAAC,+FAA+F,EAAEL,GAAG,CAAC;EACnH,IAAI,CAACJ,eAAe,EAAE;IACpBQ,iBAAM,CAACC,KAAK,CAAC,qCAAqC,EAAEL,GAAG,CAAC;IACxD;EACF;EACA,IAAIA,GAAG,YAAYY,KAAK,EAAE;IACxB,OAAOb,kBAAkB,CAACC,GAAG,EAAEU,OAAO,CAACG,IAAI,CAAC,CAAC,CAAC,CAAC;EACjD;EACAJ,OAAO,CAACJ,KAAK,CAACL,GAAG,CAAC,CAAC,CAAC;EACpB,OAAOD,kBAAkB,CAAC,IAAIa,KAAK,CAAC,kCAAkCZ,GAAG,EAAE,CAAC,EAAEU,OAAO,CAACG,IAAI,CAAC,CAAC,CAAC,CAAC;AAChG;AAEA,eAAeL,aAAaA,CAACM,MAAsB,EAAEb,WAAmB,EAAEc,MAAa,EAAE;EACvF,IAAI,CAACD,MAAM,EAAE,MAAM,IAAIF,KAAK,CAAC,uEAAuE,CAAC;EACrGH,OAAO,CAACJ,KAAK,CAACS,MAAM,CAAC,CAAC,CAAC;EACvB;EACA,IAAIJ,OAAO,CAACM,GAAG,CAACC,EAAE,EAAER,OAAO,CAACJ,KAAK,CAACU,MAAM,CAAC,CAAC,CAAC;EAC3C,MAAMX,iBAAM,CAACc,cAAc,CAAC,CAAC,EAAEjB,WAAW,EAAEa,MAAM,CAACK,QAAQ,CAAC,CAAC,CAAC;AAChE","ignoreList":[]}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CLIAspect, MainRuntime } from './cli.aspect';
2
2
  export { CLIParser } from './cli-parser';
3
3
  export type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';
4
- export { handleUnhandledRejection, handleErrorAndExit } from './handle-errors';
4
+ export { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';
5
5
  export type { Command, CLIArgs, Flags, GenericObject, CommandOptions } from '@teambit/legacy/dist/cli/command';
6
6
  export * from './exceptions';
7
7
  export { CLIAspect as default, MainRuntime, CLIAspect };
package/dist/index.js CHANGED
@@ -8,7 +8,8 @@ var _exportNames = {
8
8
  MainRuntime: true,
9
9
  CLIParser: true,
10
10
  handleUnhandledRejection: true,
11
- handleErrorAndExit: true
11
+ handleErrorAndExit: true,
12
+ setExitOnUnhandledRejection: true
12
13
  };
13
14
  Object.defineProperty(exports, "CLIAspect", {
14
15
  enumerable: true,
@@ -46,6 +47,12 @@ Object.defineProperty(exports, "handleUnhandledRejection", {
46
47
  return _handleErrors().handleUnhandledRejection;
47
48
  }
48
49
  });
50
+ Object.defineProperty(exports, "setExitOnUnhandledRejection", {
51
+ enumerable: true,
52
+ get: function () {
53
+ return _handleErrors().setExitOnUnhandledRejection;
54
+ }
55
+ });
49
56
  function _cli() {
50
57
  const data = require("./cli.aspect");
51
58
  _cli = function () {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_cliParser","_handleErrors","_exceptions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["import { CLIAspect, MainRuntime } from './cli.aspect';\nexport { CLIParser } from './cli-parser';\nexport type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';\nexport { handleUnhandledRejection, handleErrorAndExit } from './handle-errors';\nexport type { Command, CLIArgs, Flags, GenericObject, CommandOptions } from '@teambit/legacy/dist/cli/command';\nexport * from './exceptions';\n\nexport { CLIAspect as default, MainRuntime, CLIAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAI,WAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_cliParser","_handleErrors","_exceptions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["import { CLIAspect, MainRuntime } from './cli.aspect';\nexport { CLIParser } from './cli-parser';\nexport type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';\nexport { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';\nexport type { Command, CLIArgs, Flags, GenericObject, CommandOptions } from '@teambit/legacy/dist/cli/command';\nexport * from './exceptions';\n\nexport { CLIAspect as default, MainRuntime, CLIAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAI,WAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.971/dist/cli.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.971/dist/cli.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.973/dist/cli.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.973/dist/cli.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/cli",
3
- "version": "0.0.971",
3
+ "version": "0.0.973",
4
4
  "homepage": "https://bit.cloud/teambit/harmony/cli",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "cli",
9
- "version": "0.0.971"
9
+ "version": "0.0.973"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -18,9 +18,9 @@
18
18
  "@teambit/harmony": "0.4.6",
19
19
  "@teambit/bit-error": "0.0.404",
20
20
  "@teambit/bit.get-bit-version": "0.0.1",
21
- "@teambit/host-initializer": "0.0.107",
22
- "@teambit/logger": "0.0.1064",
23
- "@teambit/legacy.analytics": "0.0.28"
21
+ "@teambit/host-initializer": "0.0.109",
22
+ "@teambit/logger": "0.0.1066",
23
+ "@teambit/legacy.analytics": "0.0.29"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/didyoumean": "1.2.0",