@teambit/cli 0.0.861 → 0.0.862

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.861" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.harmony/cli@0.0.862" 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={22203:(e,t,o)=>{var n={id:"teambit.harmony/cli@0.0.861",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={};return(()=>{o.r(n),o.d(n,{compositions:()=>p,compositions_metadata:()=>u,overview:()=>l});var e={};o.r(e),o.d(e,{default:()=>m});var t=o(22203);o(41594);const r=MdxJsReact,a=TeambitMdxUiMdxScopeContext;var i=["components"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},s.apply(this,arguments)}var c={},d="wrapper";function m(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,n,r={},a=Object.keys(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,i);return(0,r.mdx)(d,s({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.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,r.mdx)("h2",null,"Features"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},"Allow to register new commands"),(0,r.mdx)("li",{parentName:"ul"},"Use commander commands."),(0,r.mdx)("li",{parentName:"ul"},"Render to stdout as string or as a React component by Ink."))))}m.isMDXComponent=!0;const p=[t],l=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),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={27441:(e,t,o)=>{var n={id:"teambit.harmony/cli@0.0.862",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={};return(()=>{o.r(n),o.d(n,{compositions:()=>p,compositions_metadata:()=>u,overview:()=>l});var e={};o.r(e),o.d(e,{default:()=>m});var t=o(27441);o(41594);const r=MdxJsReact,a=TeambitMdxUiMdxScopeContext;var i=["components"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},s.apply(this,arguments)}var c={},d="wrapper";function m(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,n,r={},a=Object.keys(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,i);return(0,r.mdx)(d,s({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.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,r.mdx)("h2",null,"Features"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},"Allow to register new commands"),(0,r.mdx)("li",{parentName:"ul"},"Use commander commands."),(0,r.mdx)("li",{parentName:"ul"},"Render to stdout as string or as a React component by Ink."))))}m.isMDXComponent=!0;const p=[t],l=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
@@ -90,7 +90,8 @@
90
90
  "line": 33,
91
91
  "character": 26
92
92
  },
93
- "name": "OnStartSlot"
93
+ "name": "OnStartSlot",
94
+ "internalFilePath": "cli.main.runtime.ts"
94
95
  },
95
96
  "isOptional": false,
96
97
  "isSpread": false
@@ -110,7 +111,8 @@
110
111
  "line": 34,
111
112
  "character": 34
112
113
  },
113
- "name": "OnCommandStartSlot"
114
+ "name": "OnCommandStartSlot",
115
+ "internalFilePath": "cli.main.runtime.ts"
114
116
  },
115
117
  "isOptional": false,
116
118
  "isSpread": false
@@ -130,7 +132,8 @@
130
132
  "line": 35,
131
133
  "character": 31
132
134
  },
133
- "name": "OnBeforeExitSlot"
135
+ "name": "OnBeforeExitSlot",
136
+ "internalFilePath": "cli.main.runtime.ts"
134
137
  },
135
138
  "isOptional": false,
136
139
  "isSpread": false
@@ -150,7 +153,11 @@
150
153
  "line": 36,
151
154
  "character": 21
152
155
  },
153
- "name": "Logger"
156
+ "name": "Logger",
157
+ "componentId": {
158
+ "scope": "teambit.harmony",
159
+ "name": "logger"
160
+ }
154
161
  },
155
162
  "isOptional": false,
156
163
  "isSpread": false
@@ -346,7 +353,8 @@
346
353
  "line": 74,
347
354
  "character": 29
348
355
  },
349
- "name": "Command"
356
+ "name": "Command",
357
+ "packageName": "@teambit/legacy/dist/cli/command"
350
358
  },
351
359
  {
352
360
  "__schema": "KeywordTypeSchema",
@@ -468,7 +476,8 @@
468
476
  "line": 95,
469
477
  "character": 30
470
478
  },
471
- "name": "OnStart"
479
+ "name": "OnStart",
480
+ "internalFilePath": "cli.main.runtime.ts"
472
481
  },
473
482
  "isOptional": false,
474
483
  "isSpread": false
@@ -520,7 +529,8 @@
520
529
  "line": 104,
521
530
  "character": 44
522
531
  },
523
- "name": "OnCommandStart"
532
+ "name": "OnCommandStart",
533
+ "internalFilePath": "cli.main.runtime.ts"
524
534
  },
525
535
  "isOptional": false,
526
536
  "isSpread": false
@@ -593,7 +603,8 @@
593
603
  "line": 124,
594
604
  "character": 40
595
605
  },
596
- "name": "OnBeforeExitFn"
606
+ "name": "OnBeforeExitFn",
607
+ "internalFilePath": "cli.main.runtime.ts"
597
608
  },
598
609
  "isOptional": false,
599
610
  "isSpread": false
@@ -760,7 +771,11 @@
760
771
  "line": 172,
761
772
  "character": 20
762
773
  },
763
- "name": "LoggerMain"
774
+ "name": "LoggerMain",
775
+ "componentId": {
776
+ "scope": "teambit.harmony",
777
+ "name": "logger"
778
+ }
764
779
  }
765
780
  ]
766
781
  },
@@ -819,7 +834,8 @@
819
834
  "line": 176,
820
835
  "character": 7
821
836
  },
822
- "name": "OnStartSlot"
837
+ "name": "OnStartSlot",
838
+ "internalFilePath": "cli.main.runtime.ts"
823
839
  },
824
840
  {
825
841
  "__schema": "TypeRefSchema",
@@ -828,7 +844,8 @@
828
844
  "line": 177,
829
845
  "character": 7
830
846
  },
831
- "name": "OnCommandStartSlot"
847
+ "name": "OnCommandStartSlot",
848
+ "internalFilePath": "cli.main.runtime.ts"
832
849
  },
833
850
  {
834
851
  "__schema": "TypeRefSchema",
@@ -837,7 +854,8 @@
837
854
  "line": 178,
838
855
  "character": 7
839
856
  },
840
- "name": "OnBeforeExitSlot"
857
+ "name": "OnBeforeExitSlot",
858
+ "internalFilePath": "cli.main.runtime.ts"
841
859
  }
842
860
  ]
843
861
  },
@@ -888,7 +906,8 @@
888
906
  "line": 19,
889
907
  "character": 33
890
908
  },
891
- "name": "Command"
909
+ "name": "Command",
910
+ "packageName": "@teambit/legacy/dist/cli/command"
892
911
  }
893
912
  ]
894
913
  }
@@ -910,6 +929,11 @@
910
929
  "character": 28
911
930
  },
912
931
  "name": "SlotRegistry",
932
+ "componentId": {
933
+ "scope": "teambit.harmony",
934
+ "name": "harmony",
935
+ "version": "0.4.6"
936
+ },
913
937
  "typeArgs": [
914
938
  {
915
939
  "__schema": "TypeRefSchema",
@@ -1068,7 +1092,7 @@
1068
1092
  "_legacy": {
1069
1093
  "scope": "teambit.harmony",
1070
1094
  "name": "cli",
1071
- "version": "0.0.861"
1095
+ "version": "0.0.862"
1072
1096
  },
1073
1097
  "_scope": "teambit.harmony"
1074
1098
  }
@@ -1192,7 +1216,8 @@
1192
1216
  "line": 19,
1193
1217
  "character": 33
1194
1218
  },
1195
- "name": "Command"
1219
+ "name": "Command",
1220
+ "packageName": "@teambit/legacy/dist/cli/command"
1196
1221
  }
1197
1222
  ]
1198
1223
  }
@@ -1296,7 +1321,7 @@
1296
1321
  "line": 21,
1297
1322
  "character": 30
1298
1323
  },
1299
- "signature": "(commandName: string, args: CLIArgs, flags: Flags): Promise<void>",
1324
+ "signature": "(commandName: string, args: \u001b[2m(package: @teambit/legacy/dist/cli/command)\u001b[22m CLIArgs, flags: \u001b[2m(package: @teambit/legacy/dist/cli/command)\u001b[22m Flags): Promise<void>",
1300
1325
  "name": "",
1301
1326
  "params": [
1302
1327
  {
@@ -1334,7 +1359,8 @@
1334
1359
  "line": 21,
1335
1360
  "character": 58
1336
1361
  },
1337
- "name": "CLIArgs"
1362
+ "name": "CLIArgs",
1363
+ "packageName": "@teambit/legacy/dist/cli/command"
1338
1364
  },
1339
1365
  "isOptional": false,
1340
1366
  "isSpread": false
@@ -1354,7 +1380,8 @@
1354
1380
  "line": 21,
1355
1381
  "character": 74
1356
1382
  },
1357
- "name": "Flags"
1383
+ "name": "Flags",
1384
+ "packageName": "@teambit/legacy/dist/cli/command"
1358
1385
  },
1359
1386
  "isOptional": false,
1360
1387
  "isSpread": false
@@ -1442,6 +1469,11 @@
1442
1469
  "character": 27
1443
1470
  },
1444
1471
  "name": "SlotRegistry",
1472
+ "componentId": {
1473
+ "scope": "teambit.harmony",
1474
+ "name": "harmony",
1475
+ "version": "0.4.6"
1476
+ },
1445
1477
  "typeArgs": [
1446
1478
  {
1447
1479
  "__schema": "TypeRefSchema",
@@ -1450,7 +1482,8 @@
1450
1482
  "line": 24,
1451
1483
  "character": 40
1452
1484
  },
1453
- "name": "OnStart"
1485
+ "name": "OnStart",
1486
+ "internalFilePath": "cli.main.runtime.ts"
1454
1487
  }
1455
1488
  ]
1456
1489
  }
@@ -1472,6 +1505,11 @@
1472
1505
  "character": 34
1473
1506
  },
1474
1507
  "name": "SlotRegistry",
1508
+ "componentId": {
1509
+ "scope": "teambit.harmony",
1510
+ "name": "harmony",
1511
+ "version": "0.4.6"
1512
+ },
1475
1513
  "typeArgs": [
1476
1514
  {
1477
1515
  "__schema": "TypeRefSchema",
@@ -1480,7 +1518,8 @@
1480
1518
  "line": 25,
1481
1519
  "character": 47
1482
1520
  },
1483
- "name": "OnCommandStart"
1521
+ "name": "OnCommandStart",
1522
+ "internalFilePath": "cli.main.runtime.ts"
1484
1523
  }
1485
1524
  ]
1486
1525
  }
@@ -1502,6 +1541,11 @@
1502
1541
  "character": 28
1503
1542
  },
1504
1543
  "name": "SlotRegistry",
1544
+ "componentId": {
1545
+ "scope": "teambit.harmony",
1546
+ "name": "harmony",
1547
+ "version": "0.4.6"
1548
+ },
1505
1549
  "typeArgs": [
1506
1550
  {
1507
1551
  "__schema": "TypeRefSchema",
@@ -1532,6 +1576,11 @@
1532
1576
  "character": 32
1533
1577
  },
1534
1578
  "name": "SlotRegistry",
1579
+ "componentId": {
1580
+ "scope": "teambit.harmony",
1581
+ "name": "harmony",
1582
+ "version": "0.4.6"
1583
+ },
1535
1584
  "typeArgs": [
1536
1585
  {
1537
1586
  "__schema": "TypeRefSchema",
@@ -1540,7 +1589,8 @@
1540
1589
  "line": 27,
1541
1590
  "character": 45
1542
1591
  },
1543
- "name": "OnBeforeExitFn"
1592
+ "name": "OnBeforeExitFn",
1593
+ "internalFilePath": "cli.main.runtime.ts"
1544
1594
  }
1545
1595
  ]
1546
1596
  }
@@ -1622,7 +1672,8 @@
1622
1672
  "line": 33,
1623
1673
  "character": 26
1624
1674
  },
1625
- "name": "OnStartSlot"
1675
+ "name": "OnStartSlot",
1676
+ "internalFilePath": "cli.main.runtime.ts"
1626
1677
  },
1627
1678
  "isOptional": false,
1628
1679
  "isSpread": false
@@ -1642,7 +1693,8 @@
1642
1693
  "line": 34,
1643
1694
  "character": 34
1644
1695
  },
1645
- "name": "OnCommandStartSlot"
1696
+ "name": "OnCommandStartSlot",
1697
+ "internalFilePath": "cli.main.runtime.ts"
1646
1698
  },
1647
1699
  "isOptional": false,
1648
1700
  "isSpread": false
@@ -1662,7 +1714,8 @@
1662
1714
  "line": 35,
1663
1715
  "character": 31
1664
1716
  },
1665
- "name": "OnBeforeExitSlot"
1717
+ "name": "OnBeforeExitSlot",
1718
+ "internalFilePath": "cli.main.runtime.ts"
1666
1719
  },
1667
1720
  "isOptional": false,
1668
1721
  "isSpread": false
@@ -1682,7 +1735,11 @@
1682
1735
  "line": 36,
1683
1736
  "character": 21
1684
1737
  },
1685
- "name": "Logger"
1738
+ "name": "Logger",
1739
+ "componentId": {
1740
+ "scope": "teambit.harmony",
1741
+ "name": "logger"
1742
+ }
1686
1743
  },
1687
1744
  "isOptional": false,
1688
1745
  "isSpread": false
@@ -1878,7 +1935,8 @@
1878
1935
  "line": 74,
1879
1936
  "character": 29
1880
1937
  },
1881
- "name": "Command"
1938
+ "name": "Command",
1939
+ "packageName": "@teambit/legacy/dist/cli/command"
1882
1940
  },
1883
1941
  {
1884
1942
  "__schema": "KeywordTypeSchema",
@@ -2000,7 +2058,8 @@
2000
2058
  "line": 95,
2001
2059
  "character": 30
2002
2060
  },
2003
- "name": "OnStart"
2061
+ "name": "OnStart",
2062
+ "internalFilePath": "cli.main.runtime.ts"
2004
2063
  },
2005
2064
  "isOptional": false,
2006
2065
  "isSpread": false
@@ -2052,7 +2111,8 @@
2052
2111
  "line": 104,
2053
2112
  "character": 44
2054
2113
  },
2055
- "name": "OnCommandStart"
2114
+ "name": "OnCommandStart",
2115
+ "internalFilePath": "cli.main.runtime.ts"
2056
2116
  },
2057
2117
  "isOptional": false,
2058
2118
  "isSpread": false
@@ -2125,7 +2185,8 @@
2125
2185
  "line": 124,
2126
2186
  "character": 40
2127
2187
  },
2128
- "name": "OnBeforeExitFn"
2188
+ "name": "OnBeforeExitFn",
2189
+ "internalFilePath": "cli.main.runtime.ts"
2129
2190
  },
2130
2191
  "isOptional": false,
2131
2192
  "isSpread": false
@@ -2292,7 +2353,11 @@
2292
2353
  "line": 172,
2293
2354
  "character": 20
2294
2355
  },
2295
- "name": "LoggerMain"
2356
+ "name": "LoggerMain",
2357
+ "componentId": {
2358
+ "scope": "teambit.harmony",
2359
+ "name": "logger"
2360
+ }
2296
2361
  }
2297
2362
  ]
2298
2363
  },
@@ -2351,7 +2416,8 @@
2351
2416
  "line": 176,
2352
2417
  "character": 7
2353
2418
  },
2354
- "name": "OnStartSlot"
2419
+ "name": "OnStartSlot",
2420
+ "internalFilePath": "cli.main.runtime.ts"
2355
2421
  },
2356
2422
  {
2357
2423
  "__schema": "TypeRefSchema",
@@ -2360,7 +2426,8 @@
2360
2426
  "line": 177,
2361
2427
  "character": 7
2362
2428
  },
2363
- "name": "OnCommandStartSlot"
2429
+ "name": "OnCommandStartSlot",
2430
+ "internalFilePath": "cli.main.runtime.ts"
2364
2431
  },
2365
2432
  {
2366
2433
  "__schema": "TypeRefSchema",
@@ -2369,7 +2436,8 @@
2369
2436
  "line": 178,
2370
2437
  "character": 7
2371
2438
  },
2372
- "name": "OnBeforeExitSlot"
2439
+ "name": "OnBeforeExitSlot",
2440
+ "internalFilePath": "cli.main.runtime.ts"
2373
2441
  }
2374
2442
  ]
2375
2443
  },
@@ -2562,7 +2630,7 @@
2562
2630
  "componentId": {
2563
2631
  "scope": "teambit.harmony",
2564
2632
  "name": "cli",
2565
- "version": "0.0.861"
2633
+ "version": "0.0.862"
2566
2634
  },
2567
2635
  "taggedModuleExports": []
2568
2636
  }
@@ -0,0 +1,35 @@
1
+ import yargs from 'yargs';
2
+ import { Command } from '@teambit/legacy/dist/cli/command';
3
+ import { GroupsType } from '@teambit/legacy/dist/cli/command-groups';
4
+ import { OnCommandStartSlot } from './cli.main.runtime';
5
+ export declare class CLIParser {
6
+ private commands;
7
+ private groups;
8
+ private onCommandStartSlot;
9
+ parser: yargs.Argv<{}>;
10
+ constructor(commands: Command[], groups: GroupsType, onCommandStartSlot: OnCommandStartSlot);
11
+ parse(args?: string[]): Promise<void>;
12
+ private setHelpMiddleware;
13
+ private handleCommandFailure;
14
+ private configureCompletion;
15
+ private printHelp;
16
+ private configureParser;
17
+ private parseCommandWithSubCommands;
18
+ private getYargsCommand;
19
+ private configureGlobalFlags;
20
+ private throwForNonExistsCommand;
21
+ /**
22
+ * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.
23
+ * see https://github.com/yargs/yargs/issues/1956
24
+ *
25
+ * the original order of the output:
26
+ * description
27
+ * Options
28
+ * Commands
29
+ * Global
30
+ * Positionals
31
+ * Examples
32
+ */
33
+ private logCommandHelp;
34
+ private findCommandByArgv;
35
+ }
@@ -0,0 +1,4 @@
1
+ import { Aspect, RuntimeDefinition } from '@teambit/harmony';
2
+ export declare const MainRuntime: RuntimeDefinition;
3
+ export declare const CLIAspect: Aspect;
4
+ export default CLIAspect;
@@ -0,0 +1,32 @@
1
+ import type { Command } from '@teambit/legacy/dist/cli/command';
2
+ import type { CommandOptions } from '@teambit/legacy/dist/cli/legacy-command';
3
+ import { CLIMain } from './cli.main.runtime';
4
+ import { GenerateOpts } from './generate-doc-md';
5
+ export declare class CliGenerateCmd implements Command {
6
+ private cliMain;
7
+ name: string;
8
+ description: string;
9
+ alias: string;
10
+ loader: boolean;
11
+ group: string;
12
+ options: CommandOptions;
13
+ constructor(cliMain: CLIMain);
14
+ report(args: any, { metadata, docs }: GenerateOpts & {
15
+ docs?: boolean;
16
+ }): Promise<string>;
17
+ json(): Promise<(Partial<Command> & {
18
+ commands?: any;
19
+ })[]>;
20
+ }
21
+ export declare class CliCmd implements Command {
22
+ private cliMain;
23
+ name: string;
24
+ description: string;
25
+ alias: string;
26
+ commands: Command[];
27
+ loader: boolean;
28
+ group: string;
29
+ options: CommandOptions;
30
+ constructor(cliMain: CLIMain);
31
+ report(): Promise<string>;
32
+ }
@@ -0,0 +1 @@
1
+ export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,85 @@
1
+ import { SlotRegistry } from '@teambit/harmony';
2
+ import { CLIArgs, Flags, Command } from '@teambit/legacy/dist/cli/command';
3
+ import { GroupsType } from '@teambit/legacy/dist/cli/command-groups';
4
+ import { Logger, LoggerMain } from '@teambit/logger';
5
+ export type CommandList = Array<Command>;
6
+ export type OnStart = (hasWorkspace: boolean, currentCommand: string) => Promise<void>;
7
+ export type OnCommandStart = (commandName: string, args: CLIArgs, flags: Flags) => Promise<void>;
8
+ export type OnBeforeExitFn = () => Promise<void>;
9
+ export type OnStartSlot = SlotRegistry<OnStart>;
10
+ export type OnCommandStartSlot = SlotRegistry<OnCommandStart>;
11
+ export type CommandsSlot = SlotRegistry<CommandList>;
12
+ export type OnBeforeExitSlot = SlotRegistry<OnBeforeExitFn>;
13
+ export declare class CLIMain {
14
+ private commandsSlot;
15
+ private onStartSlot;
16
+ readonly onCommandStartSlot: OnCommandStartSlot;
17
+ private onBeforeExitSlot;
18
+ private logger;
19
+ groups: GroupsType;
20
+ constructor(commandsSlot: CommandsSlot, onStartSlot: OnStartSlot, onCommandStartSlot: OnCommandStartSlot, onBeforeExitSlot: OnBeforeExitSlot, logger: Logger);
21
+ /**
22
+ * registers a new command in to the CLI.
23
+ */
24
+ register(...commands: CommandList): void;
25
+ /**
26
+ * helpful for having the same command name in different environments (e.g. legacy and non-legacy).
27
+ * for example `cli.unregister('tag');` removes the "bit tag" command.
28
+ */
29
+ unregister(commandName: string): void;
30
+ /**
31
+ * list of all registered commands. (legacy and new).
32
+ */
33
+ get commands(): CommandList;
34
+ /**
35
+ * get an instance of a registered command. (useful for aspects to modify and extend existing commands)
36
+ */
37
+ getCommand(name: string): Command | undefined;
38
+ /**
39
+ * when running `bit help`, commands are grouped by categories.
40
+ * this method helps registering a new group by providing its name and a description.
41
+ * the name is what needs to be assigned to the `group` property of the Command interface.
42
+ * the description is what shown in the `bit help` output.
43
+ */
44
+ registerGroup(name: string, description: string): void;
45
+ /**
46
+ * onStart is when bootstrapping the CLI. (it happens before onCommandStart)
47
+ */
48
+ registerOnStart(onStartFn: OnStart): this;
49
+ /**
50
+ * onCommandStart is when a command is about to start and we have the command object and the parsed args and flags
51
+ * already. (it happens after onStart)
52
+ */
53
+ registerOnCommandStart(onCommandStartFn: OnCommandStart): this;
54
+ /**
55
+ * This will register a function to be called before the process exits.
56
+ * This will run only for "regular" exits
57
+ * e.g.
58
+ * yes - command run and finished successfully
59
+ * yes - command run and failed gracefully (code 1)
60
+ * not SIGKILL (kill -9)
61
+ * not SIGINT (Ctrl+C)
62
+ * not SIGTERM (kill)
63
+ * not uncaughtException
64
+ * not unhandledRejection
65
+ *
66
+ * @param onBeforeExitFn
67
+ * @returns
68
+ */
69
+ registerOnBeforeExit(onBeforeExitFn: OnBeforeExitFn): this;
70
+ /**
71
+ * execute commands registered to this aspect.
72
+ */
73
+ run(hasWorkspace: boolean): Promise<void>;
74
+ private invokeOnStart;
75
+ private setDefaults;
76
+ static dependencies: import("@teambit/harmony").Aspect[];
77
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
78
+ static slots: (((registerFn: () => string) => SlotRegistry<CommandList>) | ((registerFn: () => string) => SlotRegistry<OnStart>) | ((registerFn: () => string) => SlotRegistry<OnCommandStart>))[];
79
+ static provider([loggerMain]: [LoggerMain], config: any, [commandsSlot, onStartSlot, onCommandStartSlot, onBeforeExitSlot]: [
80
+ CommandsSlot,
81
+ OnStartSlot,
82
+ OnCommandStartSlot,
83
+ OnBeforeExitSlot
84
+ ]): Promise<CLIMain>;
85
+ }
@@ -0,0 +1,29 @@
1
+ import { CLIArgs, Command, Flags } from '@teambit/legacy/dist/cli/command';
2
+ import { OnCommandStartSlot } from './cli.main.runtime';
3
+ export declare class CommandRunner {
4
+ private command;
5
+ private args;
6
+ private flags;
7
+ private onCommandStartSlot;
8
+ private commandName;
9
+ constructor(command: Command, args: CLIArgs, flags: Flags, onCommandStartSlot: OnCommandStartSlot);
10
+ /**
11
+ * run command using one of the handler, "json"/"report"/"render". once done, exit the process.
12
+ */
13
+ runCommand(): Promise<boolean | void | null>;
14
+ private bootstrapCommand;
15
+ private invokeOnCommandStart;
16
+ /**
17
+ * this works for both, Harmony commands and Legacy commands (the legacy-command-adapter
18
+ * implements json() method)
19
+ */
20
+ private runJsonHandler;
21
+ private runReportHandler;
22
+ private runWaitHandler;
23
+ /**
24
+ * the loader and logger.console write output to the console during the command execution.
25
+ * for internals commands, such as, _put, _fetch, the command.loader = false.
26
+ */
27
+ private determineConsoleWritingDuringCommand;
28
+ private writeAndExit;
29
+ }
@@ -0,0 +1,8 @@
1
+ import { Command } from '@teambit/legacy/dist/cli/command';
2
+ export declare class CompletionCmd implements Command {
3
+ name: string;
4
+ description: string;
5
+ alias: string;
6
+ group: string;
7
+ options: never[];
8
+ }
@@ -0,0 +1,4 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+ export declare class AlreadyExistsError extends BitError {
3
+ constructor(type: string, name: string);
4
+ }
@@ -0,0 +1,7 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+ export declare class CommandNotFound extends BitError {
3
+ commandName: string;
4
+ suggestion?: string;
5
+ constructor(commandName: string, suggestion?: string);
6
+ report(): string;
7
+ }
@@ -0,0 +1 @@
1
+ export { AlreadyExistsError } from './already-exists';
@@ -0,0 +1,25 @@
1
+ import { Command } from '@teambit/legacy/dist/cli/command';
2
+ export type GenerateOpts = {
3
+ metadata?: Record<string, string>;
4
+ };
5
+ type CommandObject = ReturnType<typeof oneCommandToObject> & {
6
+ commands?: any;
7
+ };
8
+ export declare class GenerateCommandsDoc {
9
+ private commands;
10
+ private options;
11
+ constructor(commands: Command[], options: GenerateOpts);
12
+ generate(): string;
13
+ generateJson(): CommandObject[];
14
+ private commandsToObjects;
15
+ private getFrontmatter;
16
+ private getAllPublicCommandsSorted;
17
+ private generateCommand;
18
+ private generateSubCommands;
19
+ private generateArguments;
20
+ private generateOptions;
21
+ private formatStringToMD;
22
+ private formatDescription;
23
+ }
24
+ declare function oneCommandToObject(command: Command): Partial<Command>;
25
+ export {};
@@ -0,0 +1 @@
1
+ export declare function getCommandId(cmdName: string): string;
@@ -0,0 +1,16 @@
1
+ import type { Command } from '@teambit/legacy/dist/cli/command';
2
+ import type { CommandOptions } from '@teambit/legacy/dist/cli/legacy-command';
3
+ import { CLIMain } from './cli.main.runtime';
4
+ export declare class HelpCmd implements Command {
5
+ private cliMain;
6
+ name: string;
7
+ description: string;
8
+ alias: string;
9
+ loader: boolean;
10
+ group: string;
11
+ options: CommandOptions;
12
+ constructor(cliMain: CLIMain);
13
+ report(_: any, { internal }: {
14
+ internal: boolean;
15
+ }): Promise<string>;
16
+ }
package/dist/help.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { GroupsType } from '@teambit/legacy/dist/cli/command-groups';
2
+ import { CommandList } from './cli.main.runtime';
3
+ export declare function formatHelp(commands: CommandList, groups: GroupsType, showPrivateCommands?: boolean): string;
@@ -0,0 +1,6 @@
1
+ import { CLIAspect, MainRuntime } from './cli.aspect';
2
+ export type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';
3
+ export type { Command, CLIArgs, Flags, GenericObject } from '@teambit/legacy/dist/cli/command';
4
+ export type { CommandOptions } from '@teambit/legacy/dist/cli/legacy-command';
5
+ export * from './exceptions';
6
+ export { CLIAspect as default, MainRuntime, CLIAspect };
@@ -0,0 +1,29 @@
1
+ import { LegacyCommand } from '@teambit/legacy/dist/cli/legacy-command';
2
+ import { Command, CommandOptions, GenericObject } from '.';
3
+ import { CLIMain } from './cli.main.runtime';
4
+ export declare class LegacyCommandAdapter implements Command {
5
+ private cmd;
6
+ alias: string;
7
+ name: string;
8
+ description: string;
9
+ options: CommandOptions;
10
+ extendedDescription?: string;
11
+ group?: string;
12
+ loader?: boolean;
13
+ commands: Command[];
14
+ private?: boolean;
15
+ skipWorkspace?: boolean;
16
+ helpUrl?: string;
17
+ _packageManagerArgs?: string[];
18
+ constructor(cmd: LegacyCommand, cliExtension: CLIMain);
19
+ private action;
20
+ report(params: any, options: {
21
+ [key: string]: any;
22
+ }): Promise<{
23
+ data: string;
24
+ code: number;
25
+ }>;
26
+ json(params: any, options: {
27
+ [key: string]: any;
28
+ }): Promise<GenericObject>;
29
+ }
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.861/dist/cli.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.861/dist/cli.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.862/dist/cli.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.862/dist/cli.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -0,0 +1,14 @@
1
+ import type { Command } from '@teambit/legacy/dist/cli/command';
2
+ import type { CommandOptions } from '@teambit/legacy/dist/cli/legacy-command';
3
+ export declare class VersionCmd implements Command {
4
+ name: string;
5
+ description: string;
6
+ alias: string;
7
+ loader: boolean;
8
+ group: string;
9
+ options: CommandOptions;
10
+ report(): Promise<any>;
11
+ json(): Promise<{
12
+ bit: any;
13
+ }>;
14
+ }
@@ -0,0 +1,20 @@
1
+ import { Command } from '@teambit/legacy/dist/cli/command';
2
+ import { Arguments, CommandModule, Argv, Options } from 'yargs';
3
+ import { OnCommandStartSlot } from './cli.main.runtime';
4
+ export declare const GLOBAL_GROUP = "Global";
5
+ export declare const STANDARD_GROUP = "Options";
6
+ export declare class YargsAdapter implements CommandModule {
7
+ private commanderCommand;
8
+ private onCommandStartSlot;
9
+ command: string;
10
+ describe?: string;
11
+ aliases?: string;
12
+ constructor(commanderCommand: Command, onCommandStartSlot: OnCommandStartSlot);
13
+ builder(yargs: Argv): Argv<{}>;
14
+ handler(argv: Arguments): Promise<boolean | void | null>;
15
+ get positional(): import("@teambit/legacy/dist/cli/command").CommandArg[] | undefined;
16
+ static optionsToBuilder(command: Command): {
17
+ [key: string]: Options;
18
+ };
19
+ static getGlobalOptions(command: Command): Record<string, any>;
20
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/cli",
3
- "version": "0.0.861",
3
+ "version": "0.0.862",
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.861"
9
+ "version": "0.0.862"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,7 +17,7 @@
17
17
  "pad-right": "0.2.2",
18
18
  "@teambit/harmony": "0.4.6",
19
19
  "@teambit/bit-error": "0.0.404",
20
- "@teambit/logger": "0.0.954"
20
+ "@teambit/logger": "0.0.955"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/didyoumean": "1.2.0",
@@ -25,7 +25,7 @@
25
25
  "@types/yargs": "17.0.0",
26
26
  "@types/mocha": "9.1.0",
27
27
  "chai": "4.3.0",
28
- "@teambit/harmony.envs.core-aspect-env": "0.0.30"
28
+ "@teambit/harmony.envs.core-aspect-env": "0.0.33"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "^17.0.0 || ^18.0.0",
package/tsconfig.json CHANGED
@@ -20,8 +20,7 @@
20
20
  "emitDeclarationOnly": true,
21
21
  "strict": true,
22
22
  "strictPropertyInitialization": false,
23
- "noImplicitAny": false,
24
- "composite": true
23
+ "noImplicitAny": false
25
24
  },
26
25
  "exclude": [
27
26
  "artifacts",
@@ -36,10 +35,5 @@
36
35
  "include": [
37
36
  "**/*",
38
37
  "**/*.json"
39
- ],
40
- "references": [
41
- {
42
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.954"
43
- }
44
38
  ]
45
39
  }