@teambit/cli 0.0.934 → 0.0.935

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.934" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.harmony/cli@0.0.935" 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={73007:(e,t,o)=>{var n={id:"teambit.harmony/cli@0.0.934",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(73007);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={65002:(e,t,o)=>{var n={id:"teambit.harmony/cli@0.0.935",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(65002);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})()));
@@ -25,7 +25,7 @@
25
25
  "__schema": "ClassSchema",
26
26
  "location": {
27
27
  "filePath": "cli-parser.ts",
28
- "line": 17,
28
+ "line": 18,
29
29
  "character": 1
30
30
  },
31
31
  "signature": "class CLIParser",
@@ -35,7 +35,7 @@
35
35
  "__schema": "VariableLikeSchema",
36
36
  "location": {
37
37
  "filePath": "cli-parser.ts",
38
- "line": 18,
38
+ "line": 19,
39
39
  "character": 3
40
40
  },
41
41
  "signature": "(property) CLIParser.parser: yargs.Argv<{}>",
@@ -44,7 +44,7 @@
44
44
  "__schema": "InferenceTypeSchema",
45
45
  "location": {
46
46
  "filePath": "cli-parser.ts",
47
- "line": 18,
47
+ "line": 19,
48
48
  "character": 3
49
49
  },
50
50
  "type": "yargs.Argv<{}>"
@@ -56,7 +56,7 @@
56
56
  "__schema": "ConstructorSchema",
57
57
  "location": {
58
58
  "filePath": "cli-parser.ts",
59
- "line": 20,
59
+ "line": 21,
60
60
  "character": 3
61
61
  },
62
62
  "signature": "constructor CLIParser(commands: Command[], groups: GroupsType, onCommandStartSlot: OnCommandStartSlot): CLIParser",
@@ -66,7 +66,7 @@
66
66
  "__schema": "ParameterSchema",
67
67
  "location": {
68
68
  "filePath": "cli-parser.ts",
69
- "line": 21,
69
+ "line": 22,
70
70
  "character": 5
71
71
  },
72
72
  "name": "commands",
@@ -74,14 +74,14 @@
74
74
  "__schema": "TypeArraySchema",
75
75
  "location": {
76
76
  "filePath": "cli-parser.ts",
77
- "line": 21,
77
+ "line": 22,
78
78
  "character": 23
79
79
  },
80
80
  "type": {
81
81
  "__schema": "TypeRefSchema",
82
82
  "location": {
83
83
  "filePath": "cli-parser.ts",
84
- "line": 21,
84
+ "line": 22,
85
85
  "character": 23
86
86
  },
87
87
  "name": "Command"
@@ -94,7 +94,7 @@
94
94
  "__schema": "ParameterSchema",
95
95
  "location": {
96
96
  "filePath": "cli-parser.ts",
97
- "line": 22,
97
+ "line": 23,
98
98
  "character": 5
99
99
  },
100
100
  "name": "groups",
@@ -102,7 +102,7 @@
102
102
  "__schema": "TypeRefSchema",
103
103
  "location": {
104
104
  "filePath": "cli-parser.ts",
105
- "line": 22,
105
+ "line": 23,
106
106
  "character": 21
107
107
  },
108
108
  "name": "GroupsType"
@@ -114,7 +114,7 @@
114
114
  "__schema": "ParameterSchema",
115
115
  "location": {
116
116
  "filePath": "cli-parser.ts",
117
- "line": 23,
117
+ "line": 24,
118
118
  "character": 5
119
119
  },
120
120
  "name": "onCommandStartSlot",
@@ -122,7 +122,7 @@
122
122
  "__schema": "TypeRefSchema",
123
123
  "location": {
124
124
  "filePath": "cli-parser.ts",
125
- "line": 23,
125
+ "line": 24,
126
126
  "character": 33
127
127
  },
128
128
  "name": "OnCommandStartSlot"
@@ -135,7 +135,7 @@
135
135
  "__schema": "ThisTypeSchema",
136
136
  "location": {
137
137
  "filePath": "cli-parser.ts",
138
- "line": 17,
138
+ "line": 18,
139
139
  "character": 1
140
140
  },
141
141
  "name": "CLIParser"
@@ -146,7 +146,7 @@
146
146
  "__schema": "FunctionLikeSchema",
147
147
  "location": {
148
148
  "filePath": "cli-parser.ts",
149
- "line": 26,
149
+ "line": 27,
150
150
  "character": 3
151
151
  },
152
152
  "signature": "(method) CLIParser.parse(args?: string[]): Promise<CommandRunner>",
@@ -156,7 +156,7 @@
156
156
  "__schema": "ParameterSchema",
157
157
  "location": {
158
158
  "filePath": "cli-parser.ts",
159
- "line": 26,
159
+ "line": 27,
160
160
  "character": 15
161
161
  },
162
162
  "name": "args",
@@ -164,7 +164,7 @@
164
164
  "__schema": "InferenceTypeSchema",
165
165
  "location": {
166
166
  "filePath": "cli-parser.ts",
167
- "line": 26,
167
+ "line": 27,
168
168
  "character": 15
169
169
  },
170
170
  "type": "string[]"
@@ -178,7 +178,7 @@
178
178
  "__schema": "TypeRefSchema",
179
179
  "location": {
180
180
  "filePath": "cli-parser.ts",
181
- "line": 26,
181
+ "line": 27,
182
182
  "character": 46
183
183
  },
184
184
  "name": "Promise",
@@ -187,7 +187,7 @@
187
187
  "__schema": "TypeRefSchema",
188
188
  "location": {
189
189
  "filePath": "cli-parser.ts",
190
- "line": 26,
190
+ "line": 27,
191
191
  "character": 54
192
192
  },
193
193
  "name": "CommandRunner"
@@ -1582,7 +1582,120 @@
1582
1582
  "_legacy": {
1583
1583
  "scope": "teambit.harmony",
1584
1584
  "name": "cli",
1585
- "version": "0.0.934"
1585
+ "version": "0.0.935"
1586
+ },
1587
+ "_scope": "teambit.harmony"
1588
+ }
1589
+ }
1590
+ }
1591
+ ],
1592
+ "implementNodes": []
1593
+ }
1594
+ },
1595
+ {
1596
+ "__schema": "ExportSchema",
1597
+ "location": {
1598
+ "filePath": "exceptions/index.ts",
1599
+ "line": 2,
1600
+ "character": 10
1601
+ },
1602
+ "name": "YargsExitWorkaround",
1603
+ "exportNode": {
1604
+ "__schema": "ClassSchema",
1605
+ "location": {
1606
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1607
+ "line": 3,
1608
+ "character": 1
1609
+ },
1610
+ "signature": "class YargsExitWorkaround",
1611
+ "name": "YargsExitWorkaround",
1612
+ "members": [
1613
+ {
1614
+ "__schema": "ConstructorSchema",
1615
+ "location": {
1616
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1617
+ "line": 4,
1618
+ "character": 3
1619
+ },
1620
+ "signature": "constructor YargsExitWorkaround(exitCode: number, helpMsg: string): YargsExitWorkaround",
1621
+ "name": "constructor",
1622
+ "params": [
1623
+ {
1624
+ "__schema": "ParameterSchema",
1625
+ "location": {
1626
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1627
+ "line": 4,
1628
+ "character": 15
1629
+ },
1630
+ "name": "exitCode",
1631
+ "type": {
1632
+ "__schema": "KeywordTypeSchema",
1633
+ "location": {
1634
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1635
+ "line": 4,
1636
+ "character": 32
1637
+ },
1638
+ "name": "number"
1639
+ },
1640
+ "isOptional": false,
1641
+ "isSpread": false
1642
+ },
1643
+ {
1644
+ "__schema": "ParameterSchema",
1645
+ "location": {
1646
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1647
+ "line": 4,
1648
+ "character": 40
1649
+ },
1650
+ "name": "helpMsg",
1651
+ "type": {
1652
+ "__schema": "KeywordTypeSchema",
1653
+ "location": {
1654
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1655
+ "line": 4,
1656
+ "character": 56
1657
+ },
1658
+ "name": "string"
1659
+ },
1660
+ "isOptional": false,
1661
+ "isSpread": false
1662
+ }
1663
+ ],
1664
+ "returnType": {
1665
+ "__schema": "ThisTypeSchema",
1666
+ "location": {
1667
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1668
+ "line": 3,
1669
+ "character": 1
1670
+ },
1671
+ "name": "YargsExitWorkaround"
1672
+ },
1673
+ "modifiers": []
1674
+ }
1675
+ ],
1676
+ "extendsNodes": [
1677
+ {
1678
+ "__schema": "ExpressionWithTypeArgumentsSchema",
1679
+ "location": {
1680
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1681
+ "line": 3,
1682
+ "character": 42
1683
+ },
1684
+ "name": "extends BitError",
1685
+ "typeArgs": [],
1686
+ "expression": {
1687
+ "__schema": "TypeRefSchema",
1688
+ "location": {
1689
+ "filePath": "exceptions/yargs-exit-workaround.ts",
1690
+ "line": 3,
1691
+ "character": 42
1692
+ },
1693
+ "name": "BitError",
1694
+ "componentId": {
1695
+ "_legacy": {
1696
+ "scope": "teambit.harmony",
1697
+ "name": "cli",
1698
+ "version": "0.0.935"
1586
1699
  },
1587
1700
  "_scope": "teambit.harmony"
1588
1701
  }
@@ -1714,7 +1827,7 @@
1714
1827
  "__schema": "ClassSchema",
1715
1828
  "location": {
1716
1829
  "filePath": "cli-parser.ts",
1717
- "line": 17,
1830
+ "line": 18,
1718
1831
  "character": 1
1719
1832
  },
1720
1833
  "signature": "class CLIParser",
@@ -1724,7 +1837,7 @@
1724
1837
  "__schema": "VariableLikeSchema",
1725
1838
  "location": {
1726
1839
  "filePath": "cli-parser.ts",
1727
- "line": 18,
1840
+ "line": 19,
1728
1841
  "character": 3
1729
1842
  },
1730
1843
  "signature": "(property) CLIParser.parser: yargs.Argv<{}>",
@@ -1733,7 +1846,7 @@
1733
1846
  "__schema": "InferenceTypeSchema",
1734
1847
  "location": {
1735
1848
  "filePath": "cli-parser.ts",
1736
- "line": 18,
1849
+ "line": 19,
1737
1850
  "character": 3
1738
1851
  },
1739
1852
  "type": "yargs.Argv<{}>"
@@ -1745,7 +1858,7 @@
1745
1858
  "__schema": "ConstructorSchema",
1746
1859
  "location": {
1747
1860
  "filePath": "cli-parser.ts",
1748
- "line": 20,
1861
+ "line": 21,
1749
1862
  "character": 3
1750
1863
  },
1751
1864
  "signature": "constructor CLIParser(commands: Command[], groups: GroupsType, onCommandStartSlot: OnCommandStartSlot): CLIParser",
@@ -1755,7 +1868,7 @@
1755
1868
  "__schema": "ParameterSchema",
1756
1869
  "location": {
1757
1870
  "filePath": "cli-parser.ts",
1758
- "line": 21,
1871
+ "line": 22,
1759
1872
  "character": 5
1760
1873
  },
1761
1874
  "name": "commands",
@@ -1763,14 +1876,14 @@
1763
1876
  "__schema": "TypeArraySchema",
1764
1877
  "location": {
1765
1878
  "filePath": "cli-parser.ts",
1766
- "line": 21,
1879
+ "line": 22,
1767
1880
  "character": 23
1768
1881
  },
1769
1882
  "type": {
1770
1883
  "__schema": "TypeRefSchema",
1771
1884
  "location": {
1772
1885
  "filePath": "cli-parser.ts",
1773
- "line": 21,
1886
+ "line": 22,
1774
1887
  "character": 23
1775
1888
  },
1776
1889
  "name": "Command"
@@ -1783,7 +1896,7 @@
1783
1896
  "__schema": "ParameterSchema",
1784
1897
  "location": {
1785
1898
  "filePath": "cli-parser.ts",
1786
- "line": 22,
1899
+ "line": 23,
1787
1900
  "character": 5
1788
1901
  },
1789
1902
  "name": "groups",
@@ -1791,7 +1904,7 @@
1791
1904
  "__schema": "TypeRefSchema",
1792
1905
  "location": {
1793
1906
  "filePath": "cli-parser.ts",
1794
- "line": 22,
1907
+ "line": 23,
1795
1908
  "character": 21
1796
1909
  },
1797
1910
  "name": "GroupsType"
@@ -1803,7 +1916,7 @@
1803
1916
  "__schema": "ParameterSchema",
1804
1917
  "location": {
1805
1918
  "filePath": "cli-parser.ts",
1806
- "line": 23,
1919
+ "line": 24,
1807
1920
  "character": 5
1808
1921
  },
1809
1922
  "name": "onCommandStartSlot",
@@ -1811,7 +1924,7 @@
1811
1924
  "__schema": "TypeRefSchema",
1812
1925
  "location": {
1813
1926
  "filePath": "cli-parser.ts",
1814
- "line": 23,
1927
+ "line": 24,
1815
1928
  "character": 33
1816
1929
  },
1817
1930
  "name": "OnCommandStartSlot"
@@ -1824,7 +1937,7 @@
1824
1937
  "__schema": "ThisTypeSchema",
1825
1938
  "location": {
1826
1939
  "filePath": "cli-parser.ts",
1827
- "line": 17,
1940
+ "line": 18,
1828
1941
  "character": 1
1829
1942
  },
1830
1943
  "name": "CLIParser"
@@ -1835,7 +1948,7 @@
1835
1948
  "__schema": "FunctionLikeSchema",
1836
1949
  "location": {
1837
1950
  "filePath": "cli-parser.ts",
1838
- "line": 26,
1951
+ "line": 27,
1839
1952
  "character": 3
1840
1953
  },
1841
1954
  "signature": "(method) CLIParser.parse(args?: string[]): Promise<CommandRunner>",
@@ -1845,7 +1958,7 @@
1845
1958
  "__schema": "ParameterSchema",
1846
1959
  "location": {
1847
1960
  "filePath": "cli-parser.ts",
1848
- "line": 26,
1961
+ "line": 27,
1849
1962
  "character": 15
1850
1963
  },
1851
1964
  "name": "args",
@@ -1853,7 +1966,7 @@
1853
1966
  "__schema": "InferenceTypeSchema",
1854
1967
  "location": {
1855
1968
  "filePath": "cli-parser.ts",
1856
- "line": 26,
1969
+ "line": 27,
1857
1970
  "character": 15
1858
1971
  },
1859
1972
  "type": "string[]"
@@ -1867,7 +1980,7 @@
1867
1980
  "__schema": "TypeRefSchema",
1868
1981
  "location": {
1869
1982
  "filePath": "cli-parser.ts",
1870
- "line": 26,
1983
+ "line": 27,
1871
1984
  "character": 46
1872
1985
  },
1873
1986
  "name": "Promise",
@@ -1876,7 +1989,7 @@
1876
1989
  "__schema": "TypeRefSchema",
1877
1990
  "location": {
1878
1991
  "filePath": "cli-parser.ts",
1879
- "line": 26,
1992
+ "line": 27,
1880
1993
  "character": 54
1881
1994
  },
1882
1995
  "name": "CommandRunner"
@@ -1895,7 +2008,7 @@
1895
2008
  "__schema": "FunctionLikeSchema",
1896
2009
  "location": {
1897
2010
  "filePath": "cli-parser.ts",
1898
- "line": 289,
2011
+ "line": 307,
1899
2012
  "character": 1
1900
2013
  },
1901
2014
  "signature": "function findCommandByArgv(commands: Command[]): Command | undefined",
@@ -1905,7 +2018,7 @@
1905
2018
  "__schema": "ParameterSchema",
1906
2019
  "location": {
1907
2020
  "filePath": "cli-parser.ts",
1908
- "line": 289,
2021
+ "line": 307,
1909
2022
  "character": 35
1910
2023
  },
1911
2024
  "name": "commands",
@@ -1913,14 +2026,14 @@
1913
2026
  "__schema": "TypeArraySchema",
1914
2027
  "location": {
1915
2028
  "filePath": "cli-parser.ts",
1916
- "line": 289,
2029
+ "line": 307,
1917
2030
  "character": 45
1918
2031
  },
1919
2032
  "type": {
1920
2033
  "__schema": "TypeRefSchema",
1921
2034
  "location": {
1922
2035
  "filePath": "cli-parser.ts",
1923
- "line": 289,
2036
+ "line": 307,
1924
2037
  "character": 45
1925
2038
  },
1926
2039
  "name": "Command"
@@ -1934,7 +2047,7 @@
1934
2047
  "__schema": "TypeUnionSchema",
1935
2048
  "location": {
1936
2049
  "filePath": "cli-parser.ts",
1937
- "line": 289,
2050
+ "line": 307,
1938
2051
  "character": 57
1939
2052
  },
1940
2053
  "types": [
@@ -1942,7 +2055,7 @@
1942
2055
  "__schema": "TypeRefSchema",
1943
2056
  "location": {
1944
2057
  "filePath": "cli-parser.ts",
1945
- "line": 289,
2058
+ "line": 307,
1946
2059
  "character": 57
1947
2060
  },
1948
2061
  "name": "Command"
@@ -1951,7 +2064,7 @@
1951
2064
  "__schema": "KeywordTypeSchema",
1952
2065
  "location": {
1953
2066
  "filePath": "cli-parser.ts",
1954
- "line": 289,
2067
+ "line": 307,
1955
2068
  "character": 67
1956
2069
  },
1957
2070
  "name": "undefined"
@@ -3457,7 +3570,7 @@
3457
3570
  "componentId": {
3458
3571
  "scope": "teambit.harmony",
3459
3572
  "name": "cli",
3460
- "version": "0.0.934"
3573
+ "version": "0.0.935"
3461
3574
  },
3462
3575
  "taggedModuleExports": []
3463
3576
  }
@@ -82,6 +82,13 @@ function _commandNotFound() {
82
82
  };
83
83
  return data;
84
84
  }
85
+ function _yargsExitWorkaround() {
86
+ const data = require("./exceptions/yargs-exit-workaround");
87
+ _yargsExitWorkaround = function () {
88
+ return data;
89
+ };
90
+ return data;
91
+ }
85
92
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
86
93
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
87
94
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -113,6 +120,7 @@ class CLIParser {
113
120
  this.setHelpMiddleware();
114
121
  this.handleCommandFailure();
115
122
  this.configureCompletion();
123
+ // yargs.showHelpOnFail(false); // doesn't help. it still shows the help on failure.
116
124
  _yargs().default.strict(); // don't allow non-exist flags and non-exist commands
117
125
 
118
126
  _yargs().default
@@ -120,7 +128,12 @@ class CLIParser {
120
128
  .wrap(null);
121
129
  await _yargs().default.parse();
122
130
  const currentYargsCommand = this.yargsCommands.find(y => y.commandRunner);
123
- if (!currentYargsCommand) throw new Error(`unable to find the matched yargs command`);
131
+ if (!currentYargsCommand) {
132
+ // this happens when the args/flags are wrong. in this case, it prints the help of the command and in most cases
133
+ // exits the process before reaching this line. however, in case logger.isDaemon is true, which is for bit-cli-server,
134
+ // it doesn't exits the process, so we need to return undefined here.
135
+ throw new Error(`yargs failed to parse the command "${args.join(' ')}" and also failed to catch it properly`);
136
+ }
124
137
  return currentYargsCommand.commandRunner;
125
138
  }
126
139
  addYargsCommand(yargsCommand) {
@@ -139,7 +152,7 @@ class CLIParser {
139
152
  _loader().default.off(); // stop the "loading bit..." before showing help if needed
140
153
  // this is a command help page
141
154
  _yargs().default.showHelp(this.logCommandHelp.bind(this));
142
- if (!_logger().default.isDaemon) process.exit(0);
155
+ process.exit(0);
143
156
  }
144
157
  }, true);
145
158
  }
@@ -149,16 +162,27 @@ class CLIParser {
149
162
  if (err) {
150
163
  throw err;
151
164
  }
152
- _yargs().default.showHelp(this.logCommandHelp.bind(this));
153
165
  const args = process.argv.slice(2);
154
166
  const isHelpFlagEntered = args.includes('--help') || args.includes('-h');
167
+ let msgForDaemon = '';
168
+ try {
169
+ _yargs().default.showHelp(this.logCommandHelp.bind(this));
170
+ } catch (error) {
171
+ if (error instanceof _yargsExitWorkaround().YargsExitWorkaround) {
172
+ msgForDaemon = error.helpMsg;
173
+ } else {
174
+ throw error;
175
+ }
176
+ }
155
177
  const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');
156
178
  // avoid showing the "Not enough non-option arguments" message when the user is trying to get the command help
157
179
  if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {
158
180
  // eslint-disable-next-line no-console
159
181
  console.log(`\n${_chalk().default.yellow(msg)}`);
182
+ msgForDaemon += `\n${_chalk().default.yellow(msg)}`;
160
183
  }
161
- if (!_logger().default.isDaemon) process.exit(1);
184
+ if (_logger().default.isDaemon) throw new (_yargsExitWorkaround().YargsExitWorkaround)(1, msgForDaemon);
185
+ process.exit(1);
162
186
  });
163
187
  }
164
188
  configureCompletion() {
@@ -175,8 +199,7 @@ class CLIParser {
175
199
  }
176
200
  printHelp(shouldShowInternalCommands = false) {
177
201
  const help = (0, _help().formatHelp)(this.commands, this.groups, shouldShowInternalCommands);
178
- // eslint-disable-next-line no-console
179
- console.log(help);
202
+ if (_logger().default.isDaemon) throw new (_yargsExitWorkaround().YargsExitWorkaround)(0, help);else console.log(help); // eslint-disable-line no-console
180
203
  }
181
204
  configureParser() {
182
205
  _yargs().default.parserConfiguration({
@@ -314,9 +337,7 @@ ${descriptionStr}
314
337
  ${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}
315
338
  ${_yargsAdapter().GLOBAL_GROUP}
316
339
  ${globalOptionsStr}`;
317
-
318
- // eslint-disable-next-line no-console
319
- console.log(finalOutput);
340
+ if (_logger().default.isDaemon) throw new (_yargsExitWorkaround().YargsExitWorkaround)(0, finalOutput);else console.log(finalOutput); // eslint-disable-line no-console
320
341
  }
321
342
  }
322
343
  exports.CLIParser = CLIParser;
@@ -1 +1 @@
1
- {"version":3,"names":["_didyoumean","data","_interopRequireDefault","require","_yargs","_lodash","_consumer","_logger","_loader","_chalk","_getCommandId","_help","_yargsAdapter","_commandNotFound","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIParser","constructor","commands","groups","onCommandStartSlot","yargs","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","writeCommandHistoryStart","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","addYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","currentYargsCommand","yargsCommands","find","y","commandRunner","Error","push","middleware","_","shouldShowInternalCommands","Boolean","internal","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","isDaemon","fail","msg","err","stop","isHelpFlagEntered","includes","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","yarnCommand","builderFunc","cmd","subCommand","options","YargsAdapter","getGlobalOptions","builder","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","replacer","p1","p2","green","lines","split","linesWithoutEmpty","compact","cmdLine","description","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","currentLine","STANDARD_GROUP","optionsColored","opt","replace","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","exports","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs from 'yargs';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport { GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\nimport { OnCommandStartSlot } from './cli.main.runtime';\nimport { CommandRunner } from './command-runner';\n\nexport class CLIParser {\n public parser = yargs;\n private yargsCommands: YargsAdapter[] = [];\n constructor(\n private commands: Command[],\n private groups: GroupsType,\n private onCommandStartSlot: OnCommandStartSlot\n ) {}\n\n async parse(args = process.argv.slice(2)): Promise<CommandRunner> {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n logger.writeCommandHistoryStart();\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n this.addYargsCommand(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n\n const currentYargsCommand = this.yargsCommands.find((y) => y.commandRunner);\n if (!currentYargsCommand) throw new Error(`unable to find the matched yargs command`);\n return currentYargsCommand.commandRunner as CommandRunner;\n }\n\n private addYargsCommand(yargsCommand: YargsAdapter) {\n this.yargsCommands.push(yargsCommand);\n yargs.command(yargsCommand);\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n const shouldShowInternalCommands = Boolean(argv.internal);\n // this is the main help page\n this.printHelp(shouldShowInternalCommands);\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n if (!logger.isDaemon) process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n yargs.showHelp(this.logCommandHelp.bind(this));\n const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n }\n if (!logger.isDaemon) process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp(shouldShowInternalCommands = false) {\n const help = formatHelp(this.commands, this.groups, shouldShowInternalCommands);\n // eslint-disable-next-line no-console\n console.log(help);\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yarnCommand = this.getYargsCommand(command);\n const builderFunc = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n this.addYargsCommand(subCommand);\n });\n // since the \"builder\" method is overridden, the global flags of the main command are gone, this fixes it.\n yargs.options(YargsAdapter.getGlobalOptions(command));\n return yargs;\n };\n yarnCommand.builder = builderFunc;\n this.addYargsCommand(yarnCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yargsCommand = new YargsAdapter(command, this.onCommandStartSlot);\n yargsCommand.builder = yargsCommand.builder.bind(yargsCommand);\n yargsCommand.handler = yargsCommand.handler.bind(yargsCommand);\n\n return yargsCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n *\n * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\n */\n private logCommandHelp(help: string) {\n const command = findCommandByArgv(this.commands);\n\n const replacer = (_, p1, p2) => `${p1}${chalk.green(p2)}`;\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n const cmdLine = linesWithoutEmpty[0];\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((opt) => opt.replace(/(--)([\\w-]+)/, replacer).replace(/(-)([\\w-]+)/, replacer));\n const argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n // eslint-disable-next-line no-console\n console.log(finalOutput);\n }\n}\n\nexport function findCommandByArgv(commands: Command[]): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command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5D,OAAO;AAC9B","ignoreList":[]}
1
+ {"version":3,"names":["_didyoumean","data","_interopRequireDefault","require","_yargs","_lodash","_consumer","_logger","_loader","_chalk","_getCommandId","_help","_yargsAdapter","_commandNotFound","_yargsExitWorkaround","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIParser","constructor","commands","groups","onCommandStartSlot","yargs","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","writeCommandHistoryStart","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","addYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","currentYargsCommand","yargsCommands","find","y","commandRunner","Error","push","middleware","_","shouldShowInternalCommands","Boolean","internal","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","fail","msg","err","stop","isHelpFlagEntered","includes","msgForDaemon","error","YargsExitWorkaround","helpMsg","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","isDaemon","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","yarnCommand","builderFunc","cmd","subCommand","options","YargsAdapter","getGlobalOptions","builder","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","replacer","p1","p2","green","lines","split","linesWithoutEmpty","compact","cmdLine","description","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","currentLine","STANDARD_GROUP","optionsColored","opt","replace","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","exports","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs from 'yargs';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport { GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\nimport { OnCommandStartSlot } from './cli.main.runtime';\nimport { CommandRunner } from './command-runner';\nimport { YargsExitWorkaround } from './exceptions/yargs-exit-workaround';\n\nexport class CLIParser {\n public parser = yargs;\n private yargsCommands: YargsAdapter[] = [];\n constructor(\n private commands: Command[],\n private groups: GroupsType,\n private onCommandStartSlot: OnCommandStartSlot\n ) {}\n\n async parse(args = process.argv.slice(2)): Promise<CommandRunner> {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n logger.writeCommandHistoryStart();\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n this.addYargsCommand(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n // yargs.showHelpOnFail(false); // doesn't help. it still shows the help on failure.\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n\n const currentYargsCommand = this.yargsCommands.find((y) => y.commandRunner);\n if (!currentYargsCommand) {\n // this happens when the args/flags are wrong. in this case, it prints the help of the command and in most cases\n // exits the process before reaching this line. however, in case logger.isDaemon is true, which is for bit-cli-server,\n // it doesn't exits the process, so we need to return undefined here.\n throw new Error(`yargs failed to parse the command \"${args.join(' ')}\" and also failed to catch it properly`);\n }\n return currentYargsCommand.commandRunner as CommandRunner;\n }\n\n private addYargsCommand(yargsCommand: YargsAdapter) {\n this.yargsCommands.push(yargsCommand);\n yargs.command(yargsCommand);\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n const shouldShowInternalCommands = Boolean(argv.internal);\n // this is the main help page\n this.printHelp(shouldShowInternalCommands);\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n let msgForDaemon = '';\n try {\n yargs.showHelp(this.logCommandHelp.bind(this));\n } catch (error: any) {\n if (error instanceof YargsExitWorkaround) {\n msgForDaemon = error.helpMsg;\n } else {\n throw error;\n }\n }\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n msgForDaemon += `\\n${chalk.yellow(msg)}`;\n }\n if (logger.isDaemon) throw new YargsExitWorkaround(1, msgForDaemon);\n process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp(shouldShowInternalCommands = false) {\n const help = formatHelp(this.commands, this.groups, shouldShowInternalCommands);\n if (logger.isDaemon) throw new YargsExitWorkaround(0, help);\n else console.log(help); // eslint-disable-line no-console\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yarnCommand = this.getYargsCommand(command);\n const builderFunc = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n this.addYargsCommand(subCommand);\n });\n // since the \"builder\" method is overridden, the global flags of the main command are gone, this fixes it.\n yargs.options(YargsAdapter.getGlobalOptions(command));\n return yargs;\n };\n yarnCommand.builder = builderFunc;\n this.addYargsCommand(yarnCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yargsCommand = new YargsAdapter(command, this.onCommandStartSlot);\n yargsCommand.builder = yargsCommand.builder.bind(yargsCommand);\n yargsCommand.handler = yargsCommand.handler.bind(yargsCommand);\n\n return yargsCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n *\n * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\n */\n private logCommandHelp(help: string) {\n const command = findCommandByArgv(this.commands);\n\n const replacer = (_, p1, p2) => `${p1}${chalk.green(p2)}`;\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n const cmdLine = linesWithoutEmpty[0];\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((opt) => opt.replace(/(--)([\\w-]+)/, replacer).replace(/(-)([\\w-]+)/, replacer));\n const argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n if (logger.isDaemon) throw new YargsExitWorkaround(0, finalOutput);\n else console.log(finalOutput); // eslint-disable-line no-console\n }\n}\n\nexport function findCommandByArgv(commands: Command[]): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command; // no sub-commands.\n }\n const subCommand = command.commands.find((cmd) => isCommandMatch(cmd, enteredSubCommand));\n return subCommand || command;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,C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;IAClC7E,GAAG,CAACiB,IAAI,KAAK4D,GAAG;IAAI;IACpB7E,GAAG,CAACQ,KAAK,KAAKqE,GAAG,CACjB,CAAC;EACL,CAAC;EACD,MAAM5I,OAAO,GAAGjB,QAAQ,CAAC+B,IAAI,CAAEiD,GAAG,IAAK4E,cAAc,CAAC5E,GAAG,EAAEyE,cAAc,CAAC,CAAC;EAC3E,IAAI,CAACxI,OAAO,EAAE;IACZ,OAAO0I,SAAS;EAClB;EACA,IAAI,CAAC1I,OAAO,CAACjB,QAAQ,IAAI,CAAC0J,iBAAiB,EAAE;IAC3C,OAAOzI,OAAO,CAAC,CAAC;EAClB;EACA,MAAMgE,UAAU,GAAGhE,OAAO,CAACjB,QAAQ,CAAC+B,IAAI,CAAEiD,GAAG,IAAK4E,cAAc,CAAC5E,GAAG,EAAE0E,iBAAiB,CAAC,CAAC;EACzF,OAAOzE,UAAU,IAAIhE,OAAO;AAC9B","ignoreList":[]}
@@ -1 +1,2 @@
1
1
  export { AlreadyExistsError } from './already-exists';
2
+ export { YargsExitWorkaround } from './yargs-exit-workaround';
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "AlreadyExistsError", {
9
9
  return _alreadyExists().AlreadyExistsError;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "YargsExitWorkaround", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _yargsExitWorkaround().YargsExitWorkaround;
16
+ }
17
+ });
12
18
  function _alreadyExists() {
13
19
  const data = require("./already-exists");
14
20
  _alreadyExists = function () {
@@ -16,5 +22,12 @@ function _alreadyExists() {
16
22
  };
17
23
  return data;
18
24
  }
25
+ function _yargsExitWorkaround() {
26
+ const data = require("./yargs-exit-workaround");
27
+ _yargsExitWorkaround = function () {
28
+ return data;
29
+ };
30
+ return data;
31
+ }
19
32
 
20
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_alreadyExists","data","require"],"sources":["index.ts"],"sourcesContent":["export { AlreadyExistsError } from './already-exists';\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_alreadyExists","data","require","_yargsExitWorkaround"],"sources":["index.ts"],"sourcesContent":["export { AlreadyExistsError } from './already-exists';\nexport { YargsExitWorkaround } from './yargs-exit-workaround';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+ export declare class YargsExitWorkaround extends BitError {
3
+ exitCode: number;
4
+ helpMsg: string;
5
+ constructor(exitCode: number, helpMsg: string);
6
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.YargsExitWorkaround = void 0;
7
+ function _bitError() {
8
+ const data = require("@teambit/bit-error");
9
+ _bitError = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ class YargsExitWorkaround extends _bitError().BitError {
15
+ constructor(exitCode, helpMsg) {
16
+ super('Workaround for yargs exit issue');
17
+ this.exitCode = exitCode;
18
+ this.helpMsg = helpMsg;
19
+ }
20
+ }
21
+ exports.YargsExitWorkaround = YargsExitWorkaround;
22
+
23
+ //# sourceMappingURL=yargs-exit-workaround.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_bitError","data","require","YargsExitWorkaround","BitError","constructor","exitCode","helpMsg","exports"],"sources":["yargs-exit-workaround.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport class YargsExitWorkaround extends BitError {\n constructor(public exitCode: number, public helpMsg: string) {\n super('Workaround for yargs exit issue');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,mBAAmB,SAASC,oBAAQ,CAAC;EAChDC,WAAWA,CAAQC,QAAgB,EAASC,OAAe,EAAE;IAC3D,KAAK,CAAC,iCAAiC,CAAC;IAAC,KADxBD,QAAgB,GAAhBA,QAAgB;IAAA,KAASC,OAAe,GAAfA,OAAe;EAE3D;AACF;AAACC,OAAA,CAAAL,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.934/dist/cli.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.934/dist/cli.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.935/dist/cli.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.935/dist/cli.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1 +1,2 @@
1
1
  export { AlreadyExistsError } from './already-exists';
2
+ export { YargsExitWorkaround } from './yargs-exit-workaround';
@@ -0,0 +1,7 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+
3
+ export class YargsExitWorkaround extends BitError {
4
+ constructor(public exitCode: number, public helpMsg: string) {
5
+ super('Workaround for yargs exit issue');
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/cli",
3
- "version": "0.0.934",
3
+ "version": "0.0.935",
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.934"
9
+ "version": "0.0.935"
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.70",
22
- "@teambit/logger": "0.0.1027",
23
- "@teambit/legacy.analytics": "0.0.17"
21
+ "@teambit/host-initializer": "0.0.71",
22
+ "@teambit/logger": "0.0.1028",
23
+ "@teambit/legacy.analytics": "0.0.18"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/didyoumean": "1.2.0",