@teambit/eject 1.0.331 → 1.0.333
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_workspace_eject-preview.js +1 -1
- package/artifacts/schema.json +89 -89
- package/dist/components-ejector.js +5 -12
- package/dist/components-ejector.js.map +1 -1
- package/dist/{preview-1720667996237.js → preview-1720754434554.js} +2 -2
- package/package.json +8 -7
@@ -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.workspace/eject@1.0.
|
3
|
+
<testsuite name="teambit.workspace/eject@1.0.333" 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.workspace/eject-preview"]=t():e["teambit.workspace/eject-preview"]=t()}(self,(()=>(()=>{"use strict";var e={
|
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.workspace/eject-preview"]=t():e["teambit.workspace/eject-preview"]=t()}(self,(()=>(()=>{"use strict";var e={61276:(e,t,o)=>{var n={id:"teambit.workspace/eject@1.0.333",homepage:"https://bit.cloud/teambit/workspace/eject",exported:!0};function r(){const e=i(o(41594));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,i.__bit_component=n;const a=()=>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/eject.svg"}));a.__bit_component=n,t.Logo=a},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.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:()=>b,overview:()=>f});var r={};o.r(r),o.d(r,{default:()=>s});var i=o(61276);o(41594);const a=MdxJsReact,p=TeambitMdxUiMdxScopeContext;var c=["components"];function d(){return d=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},d.apply(null,arguments)}var l={},m="wrapper";function s(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.indexOf(n)>=0)continue;o[n]=e[n]}return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||{}.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,c);return(0,a.mdx)(m,d({},l,o,{components:t,mdxType:"MDXLayout"}),(0,a.mdx)(p.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,a.mdx)("p",null,"One of the common scenarios of using ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit eject")," is to make a quick change to an external (component) dependency. The component needs to be imported first and once it's changed and exported, there is no need to keep it in the current workspace. Without ",(0,a.mdx)("inlineCode",{parentName:"p"},"eject"),", the next steps would be: 1) remove the component from the workspace by ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit remove")," and 2) installing the component by ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit install"),"."),(0,a.mdx)("p",null,(0,a.mdx)("inlineCode",{parentName:"p"},"bit eject")," combines the commands above to one command."),(0,a.mdx)("h2",null,"Eject process"),(0,a.mdx)("p",null,"The following steps are done during the ",(0,a.mdx)("inlineCode",{parentName:"p"},"eject")," process."),(0,a.mdx)("ol",null,(0,a.mdx)("li",{parentName:"ol"},"remove the component's data from node-modules so then it won't interfere with the package installation."),(0,a.mdx)("li",{parentName:"ol"},"remove the component from the .bitmap file."),(0,a.mdx)("li",{parentName:"ol"},"install the component as a package by the package manager and add the package to the ",(0,a.mdx)("inlineCode",{parentName:"li"},"workspace.json")," file."),(0,a.mdx)("li",{parentName:"ol"},"depends on the ",(0,a.mdx)("inlineCode",{parentName:"li"},"--keep-files")," flag, deletes the component files from the workspace."))))}s.isMDXComponent=!0;const u=[i],f=[r],b={compositions:[{displayName:"Logo",identifier:"Logo"}]};return n})()));
|
package/artifacts/schema.json
CHANGED
@@ -338,7 +338,7 @@
|
|
338
338
|
"__schema": "TypeSchema",
|
339
339
|
"location": {
|
340
340
|
"filePath": "components-ejector.ts",
|
341
|
-
"line":
|
341
|
+
"line": 22,
|
342
342
|
"character": 1
|
343
343
|
},
|
344
344
|
"signature": "type EjectResults = {\n ejectedComponents: ComponentIdList;\n failedComponents: FailedComponents;\n}",
|
@@ -347,7 +347,7 @@
|
|
347
347
|
"__schema": "TypeLiteralSchema",
|
348
348
|
"location": {
|
349
349
|
"filePath": "components-ejector.ts",
|
350
|
-
"line":
|
350
|
+
"line": 22,
|
351
351
|
"character": 28
|
352
352
|
},
|
353
353
|
"members": [
|
@@ -355,7 +355,7 @@
|
|
355
355
|
"__schema": "VariableLikeSchema",
|
356
356
|
"location": {
|
357
357
|
"filePath": "components-ejector.ts",
|
358
|
-
"line":
|
358
|
+
"line": 23,
|
359
359
|
"character": 3
|
360
360
|
},
|
361
361
|
"signature": "(property) ejectedComponents: ComponentIdList",
|
@@ -364,7 +364,7 @@
|
|
364
364
|
"__schema": "TypeRefSchema",
|
365
365
|
"location": {
|
366
366
|
"filePath": "components-ejector.ts",
|
367
|
-
"line":
|
367
|
+
"line": 23,
|
368
368
|
"character": 3
|
369
369
|
},
|
370
370
|
"name": "ComponentIdList",
|
@@ -380,7 +380,7 @@
|
|
380
380
|
"__schema": "VariableLikeSchema",
|
381
381
|
"location": {
|
382
382
|
"filePath": "components-ejector.ts",
|
383
|
-
"line":
|
383
|
+
"line": 24,
|
384
384
|
"character": 3
|
385
385
|
},
|
386
386
|
"signature": "(property) failedComponents: FailedComponents",
|
@@ -389,7 +389,7 @@
|
|
389
389
|
"__schema": "TypeRefSchema",
|
390
390
|
"location": {
|
391
391
|
"filePath": "components-ejector.ts",
|
392
|
-
"line":
|
392
|
+
"line": 24,
|
393
393
|
"character": 3
|
394
394
|
},
|
395
395
|
"name": "FailedComponents",
|
@@ -861,7 +861,7 @@
|
|
861
861
|
"__schema": "TypeSchema",
|
862
862
|
"location": {
|
863
863
|
"filePath": "components-ejector.ts",
|
864
|
-
"line":
|
864
|
+
"line": 22,
|
865
865
|
"character": 1
|
866
866
|
},
|
867
867
|
"signature": "type EjectResults = {\n ejectedComponents: ComponentIdList;\n failedComponents: FailedComponents;\n}",
|
@@ -870,7 +870,7 @@
|
|
870
870
|
"__schema": "TypeLiteralSchema",
|
871
871
|
"location": {
|
872
872
|
"filePath": "components-ejector.ts",
|
873
|
-
"line":
|
873
|
+
"line": 22,
|
874
874
|
"character": 28
|
875
875
|
},
|
876
876
|
"members": [
|
@@ -878,7 +878,7 @@
|
|
878
878
|
"__schema": "VariableLikeSchema",
|
879
879
|
"location": {
|
880
880
|
"filePath": "components-ejector.ts",
|
881
|
-
"line":
|
881
|
+
"line": 23,
|
882
882
|
"character": 3
|
883
883
|
},
|
884
884
|
"signature": "(property) ejectedComponents: ComponentIdList",
|
@@ -887,7 +887,7 @@
|
|
887
887
|
"__schema": "TypeRefSchema",
|
888
888
|
"location": {
|
889
889
|
"filePath": "components-ejector.ts",
|
890
|
-
"line":
|
890
|
+
"line": 23,
|
891
891
|
"character": 3
|
892
892
|
},
|
893
893
|
"name": "ComponentIdList",
|
@@ -903,7 +903,7 @@
|
|
903
903
|
"__schema": "VariableLikeSchema",
|
904
904
|
"location": {
|
905
905
|
"filePath": "components-ejector.ts",
|
906
|
-
"line":
|
906
|
+
"line": 24,
|
907
907
|
"character": 3
|
908
908
|
},
|
909
909
|
"signature": "(property) failedComponents: FailedComponents",
|
@@ -912,7 +912,7 @@
|
|
912
912
|
"__schema": "TypeRefSchema",
|
913
913
|
"location": {
|
914
914
|
"filePath": "components-ejector.ts",
|
915
|
-
"line":
|
915
|
+
"line": 24,
|
916
916
|
"character": 3
|
917
917
|
},
|
918
918
|
"name": "FailedComponents",
|
@@ -927,7 +927,7 @@
|
|
927
927
|
"__schema": "TypeSchema",
|
928
928
|
"location": {
|
929
929
|
"filePath": "components-ejector.ts",
|
930
|
-
"line":
|
930
|
+
"line": 27,
|
931
931
|
"character": 1
|
932
932
|
},
|
933
933
|
"signature": "type EjectOptions = {\n force?: boolean | undefined;\n keepFiles?: boolean | undefined;\n skipDependencyInstallation?: boolean | undefined;\n}",
|
@@ -936,7 +936,7 @@
|
|
936
936
|
"__schema": "TypeLiteralSchema",
|
937
937
|
"location": {
|
938
938
|
"filePath": "components-ejector.ts",
|
939
|
-
"line":
|
939
|
+
"line": 27,
|
940
940
|
"character": 28
|
941
941
|
},
|
942
942
|
"members": [
|
@@ -944,7 +944,7 @@
|
|
944
944
|
"__schema": "VariableLikeSchema",
|
945
945
|
"location": {
|
946
946
|
"filePath": "components-ejector.ts",
|
947
|
-
"line":
|
947
|
+
"line": 28,
|
948
948
|
"character": 3
|
949
949
|
},
|
950
950
|
"signature": "(property) force?: boolean | undefined",
|
@@ -953,7 +953,7 @@
|
|
953
953
|
"__schema": "KeywordTypeSchema",
|
954
954
|
"location": {
|
955
955
|
"filePath": "components-ejector.ts",
|
956
|
-
"line":
|
956
|
+
"line": 28,
|
957
957
|
"character": 11
|
958
958
|
},
|
959
959
|
"name": "boolean"
|
@@ -964,7 +964,7 @@
|
|
964
964
|
"__schema": "VariableLikeSchema",
|
965
965
|
"location": {
|
966
966
|
"filePath": "components-ejector.ts",
|
967
|
-
"line":
|
967
|
+
"line": 29,
|
968
968
|
"character": 3
|
969
969
|
},
|
970
970
|
"signature": "(property) keepFiles?: boolean | undefined",
|
@@ -973,7 +973,7 @@
|
|
973
973
|
"__schema": "KeywordTypeSchema",
|
974
974
|
"location": {
|
975
975
|
"filePath": "components-ejector.ts",
|
976
|
-
"line":
|
976
|
+
"line": 29,
|
977
977
|
"character": 15
|
978
978
|
},
|
979
979
|
"name": "boolean"
|
@@ -984,7 +984,7 @@
|
|
984
984
|
"__schema": "VariableLikeSchema",
|
985
985
|
"location": {
|
986
986
|
"filePath": "components-ejector.ts",
|
987
|
-
"line":
|
987
|
+
"line": 30,
|
988
988
|
"character": 3
|
989
989
|
},
|
990
990
|
"signature": "(property) skipDependencyInstallation?: boolean | undefined",
|
@@ -993,7 +993,7 @@
|
|
993
993
|
"__schema": "KeywordTypeSchema",
|
994
994
|
"location": {
|
995
995
|
"filePath": "components-ejector.ts",
|
996
|
-
"line":
|
996
|
+
"line": 30,
|
997
997
|
"character": 32
|
998
998
|
},
|
999
999
|
"name": "boolean"
|
@@ -1007,7 +1007,7 @@
|
|
1007
1007
|
"__schema": "ClassSchema",
|
1008
1008
|
"location": {
|
1009
1009
|
"filePath": "components-ejector.ts",
|
1010
|
-
"line":
|
1010
|
+
"line": 40,
|
1011
1011
|
"character": 1
|
1012
1012
|
},
|
1013
1013
|
"signature": "class ComponentsEjector",
|
@@ -1017,7 +1017,7 @@
|
|
1017
1017
|
"__schema": "VariableLikeSchema",
|
1018
1018
|
"location": {
|
1019
1019
|
"filePath": "components-ejector.ts",
|
1020
|
-
"line":
|
1020
|
+
"line": 41,
|
1021
1021
|
"character": 3
|
1022
1022
|
},
|
1023
1023
|
"signature": "(property) ComponentsEjector.consumer: Consumer",
|
@@ -1026,7 +1026,7 @@
|
|
1026
1026
|
"__schema": "TypeRefSchema",
|
1027
1027
|
"location": {
|
1028
1028
|
"filePath": "components-ejector.ts",
|
1029
|
-
"line":
|
1029
|
+
"line": 41,
|
1030
1030
|
"character": 3
|
1031
1031
|
},
|
1032
1032
|
"name": "Consumer",
|
@@ -1038,7 +1038,7 @@
|
|
1038
1038
|
"__schema": "VariableLikeSchema",
|
1039
1039
|
"location": {
|
1040
1040
|
"filePath": "components-ejector.ts",
|
1041
|
-
"line":
|
1041
|
+
"line": 42,
|
1042
1042
|
"character": 3
|
1043
1043
|
},
|
1044
1044
|
"signature": "(property) ComponentsEjector.idsToEject: ComponentIdList",
|
@@ -1047,7 +1047,7 @@
|
|
1047
1047
|
"__schema": "TypeRefSchema",
|
1048
1048
|
"location": {
|
1049
1049
|
"filePath": "components-ejector.ts",
|
1050
|
-
"line":
|
1050
|
+
"line": 42,
|
1051
1051
|
"character": 3
|
1052
1052
|
},
|
1053
1053
|
"name": "ComponentIdList",
|
@@ -1063,7 +1063,7 @@
|
|
1063
1063
|
"__schema": "VariableLikeSchema",
|
1064
1064
|
"location": {
|
1065
1065
|
"filePath": "components-ejector.ts",
|
1066
|
-
"line":
|
1066
|
+
"line": 43,
|
1067
1067
|
"character": 3
|
1068
1068
|
},
|
1069
1069
|
"signature": "(property) ComponentsEjector.componentsToEject: Component[]",
|
@@ -1072,14 +1072,14 @@
|
|
1072
1072
|
"__schema": "TypeArraySchema",
|
1073
1073
|
"location": {
|
1074
1074
|
"filePath": "components-ejector.ts",
|
1075
|
-
"line":
|
1075
|
+
"line": 43,
|
1076
1076
|
"character": 22
|
1077
1077
|
},
|
1078
1078
|
"type": {
|
1079
1079
|
"__schema": "TypeRefSchema",
|
1080
1080
|
"location": {
|
1081
1081
|
"filePath": "components-ejector.ts",
|
1082
|
-
"line":
|
1082
|
+
"line": 43,
|
1083
1083
|
"character": 22
|
1084
1084
|
},
|
1085
1085
|
"name": "Component"
|
@@ -1092,7 +1092,7 @@
|
|
1092
1092
|
"__schema": "VariableLikeSchema",
|
1093
1093
|
"location": {
|
1094
1094
|
"filePath": "components-ejector.ts",
|
1095
|
-
"line":
|
1095
|
+
"line": 45,
|
1096
1096
|
"character": 3
|
1097
1097
|
},
|
1098
1098
|
"signature": "(property) ComponentsEjector.notEjectedDependents: {\n dependent: Component;\n ejectedDependencies: Component[];\n}[]",
|
@@ -1101,7 +1101,7 @@
|
|
1101
1101
|
"__schema": "TypeRefSchema",
|
1102
1102
|
"location": {
|
1103
1103
|
"filePath": "components-ejector.ts",
|
1104
|
-
"line":
|
1104
|
+
"line": 45,
|
1105
1105
|
"character": 25
|
1106
1106
|
},
|
1107
1107
|
"name": "Array",
|
@@ -1110,7 +1110,7 @@
|
|
1110
1110
|
"__schema": "TypeLiteralSchema",
|
1111
1111
|
"location": {
|
1112
1112
|
"filePath": "components-ejector.ts",
|
1113
|
-
"line":
|
1113
|
+
"line": 45,
|
1114
1114
|
"character": 31
|
1115
1115
|
},
|
1116
1116
|
"members": [
|
@@ -1118,7 +1118,7 @@
|
|
1118
1118
|
"__schema": "VariableLikeSchema",
|
1119
1119
|
"location": {
|
1120
1120
|
"filePath": "components-ejector.ts",
|
1121
|
-
"line":
|
1121
|
+
"line": 45,
|
1122
1122
|
"character": 33
|
1123
1123
|
},
|
1124
1124
|
"signature": "(property) dependent: Component",
|
@@ -1127,7 +1127,7 @@
|
|
1127
1127
|
"__schema": "TypeRefSchema",
|
1128
1128
|
"location": {
|
1129
1129
|
"filePath": "components-ejector.ts",
|
1130
|
-
"line":
|
1130
|
+
"line": 45,
|
1131
1131
|
"character": 33
|
1132
1132
|
},
|
1133
1133
|
"name": "Component",
|
@@ -1139,7 +1139,7 @@
|
|
1139
1139
|
"__schema": "VariableLikeSchema",
|
1140
1140
|
"location": {
|
1141
1141
|
"filePath": "components-ejector.ts",
|
1142
|
-
"line":
|
1142
|
+
"line": 45,
|
1143
1143
|
"character": 55
|
1144
1144
|
},
|
1145
1145
|
"signature": "(property) ejectedDependencies: Component[]",
|
@@ -1148,14 +1148,14 @@
|
|
1148
1148
|
"__schema": "TypeArraySchema",
|
1149
1149
|
"location": {
|
1150
1150
|
"filePath": "components-ejector.ts",
|
1151
|
-
"line":
|
1151
|
+
"line": 45,
|
1152
1152
|
"character": 76
|
1153
1153
|
},
|
1154
1154
|
"type": {
|
1155
1155
|
"__schema": "TypeRefSchema",
|
1156
1156
|
"location": {
|
1157
1157
|
"filePath": "components-ejector.ts",
|
1158
|
-
"line":
|
1158
|
+
"line": 45,
|
1159
1159
|
"character": 76
|
1160
1160
|
},
|
1161
1161
|
"name": "Component"
|
@@ -1173,7 +1173,7 @@
|
|
1173
1173
|
"__schema": "VariableLikeSchema",
|
1174
1174
|
"location": {
|
1175
1175
|
"filePath": "components-ejector.ts",
|
1176
|
-
"line":
|
1176
|
+
"line": 46,
|
1177
1177
|
"character": 3
|
1178
1178
|
},
|
1179
1179
|
"signature": "(property) ComponentsEjector.failedComponents: FailedComponents",
|
@@ -1182,7 +1182,7 @@
|
|
1182
1182
|
"__schema": "TypeRefSchema",
|
1183
1183
|
"location": {
|
1184
1184
|
"filePath": "components-ejector.ts",
|
1185
|
-
"line":
|
1185
|
+
"line": 46,
|
1186
1186
|
"character": 3
|
1187
1187
|
},
|
1188
1188
|
"name": "FailedComponents",
|
@@ -1194,7 +1194,7 @@
|
|
1194
1194
|
"__schema": "ConstructorSchema",
|
1195
1195
|
"location": {
|
1196
1196
|
"filePath": "components-ejector.ts",
|
1197
|
-
"line":
|
1197
|
+
"line": 47,
|
1198
1198
|
"character": 3
|
1199
1199
|
},
|
1200
1200
|
"signature": "constructor ComponentsEjector(workspace: Workspace, install: InstallMain, logger: Logger, componentsIds: ComponentID[], ejectOptions: EjectOptions): ComponentsEjector",
|
@@ -1204,7 +1204,7 @@
|
|
1204
1204
|
"__schema": "ParameterSchema",
|
1205
1205
|
"location": {
|
1206
1206
|
"filePath": "components-ejector.ts",
|
1207
|
-
"line":
|
1207
|
+
"line": 48,
|
1208
1208
|
"character": 5
|
1209
1209
|
},
|
1210
1210
|
"name": "workspace",
|
@@ -1212,7 +1212,7 @@
|
|
1212
1212
|
"__schema": "TypeRefSchema",
|
1213
1213
|
"location": {
|
1214
1214
|
"filePath": "components-ejector.ts",
|
1215
|
-
"line":
|
1215
|
+
"line": 48,
|
1216
1216
|
"character": 24
|
1217
1217
|
},
|
1218
1218
|
"name": "Workspace"
|
@@ -1224,7 +1224,7 @@
|
|
1224
1224
|
"__schema": "ParameterSchema",
|
1225
1225
|
"location": {
|
1226
1226
|
"filePath": "components-ejector.ts",
|
1227
|
-
"line":
|
1227
|
+
"line": 49,
|
1228
1228
|
"character": 5
|
1229
1229
|
},
|
1230
1230
|
"name": "install",
|
@@ -1232,7 +1232,7 @@
|
|
1232
1232
|
"__schema": "TypeRefSchema",
|
1233
1233
|
"location": {
|
1234
1234
|
"filePath": "components-ejector.ts",
|
1235
|
-
"line":
|
1235
|
+
"line": 49,
|
1236
1236
|
"character": 22
|
1237
1237
|
},
|
1238
1238
|
"name": "InstallMain"
|
@@ -1244,7 +1244,7 @@
|
|
1244
1244
|
"__schema": "ParameterSchema",
|
1245
1245
|
"location": {
|
1246
1246
|
"filePath": "components-ejector.ts",
|
1247
|
-
"line":
|
1247
|
+
"line": 50,
|
1248
1248
|
"character": 5
|
1249
1249
|
},
|
1250
1250
|
"name": "logger",
|
@@ -1252,7 +1252,7 @@
|
|
1252
1252
|
"__schema": "TypeRefSchema",
|
1253
1253
|
"location": {
|
1254
1254
|
"filePath": "components-ejector.ts",
|
1255
|
-
"line":
|
1255
|
+
"line": 50,
|
1256
1256
|
"character": 21
|
1257
1257
|
},
|
1258
1258
|
"name": "Logger"
|
@@ -1264,7 +1264,7 @@
|
|
1264
1264
|
"__schema": "ParameterSchema",
|
1265
1265
|
"location": {
|
1266
1266
|
"filePath": "components-ejector.ts",
|
1267
|
-
"line":
|
1267
|
+
"line": 51,
|
1268
1268
|
"character": 5
|
1269
1269
|
},
|
1270
1270
|
"name": "componentsIds",
|
@@ -1272,14 +1272,14 @@
|
|
1272
1272
|
"__schema": "TypeArraySchema",
|
1273
1273
|
"location": {
|
1274
1274
|
"filePath": "components-ejector.ts",
|
1275
|
-
"line":
|
1275
|
+
"line": 51,
|
1276
1276
|
"character": 28
|
1277
1277
|
},
|
1278
1278
|
"type": {
|
1279
1279
|
"__schema": "TypeRefSchema",
|
1280
1280
|
"location": {
|
1281
1281
|
"filePath": "components-ejector.ts",
|
1282
|
-
"line":
|
1282
|
+
"line": 51,
|
1283
1283
|
"character": 28
|
1284
1284
|
},
|
1285
1285
|
"name": "ComponentID"
|
@@ -1292,7 +1292,7 @@
|
|
1292
1292
|
"__schema": "ParameterSchema",
|
1293
1293
|
"location": {
|
1294
1294
|
"filePath": "components-ejector.ts",
|
1295
|
-
"line":
|
1295
|
+
"line": 52,
|
1296
1296
|
"character": 5
|
1297
1297
|
},
|
1298
1298
|
"name": "ejectOptions",
|
@@ -1300,7 +1300,7 @@
|
|
1300
1300
|
"__schema": "TypeRefSchema",
|
1301
1301
|
"location": {
|
1302
1302
|
"filePath": "components-ejector.ts",
|
1303
|
-
"line":
|
1303
|
+
"line": 52,
|
1304
1304
|
"character": 27
|
1305
1305
|
},
|
1306
1306
|
"name": "EjectOptions"
|
@@ -1313,7 +1313,7 @@
|
|
1313
1313
|
"__schema": "ThisTypeSchema",
|
1314
1314
|
"location": {
|
1315
1315
|
"filePath": "components-ejector.ts",
|
1316
|
-
"line":
|
1316
|
+
"line": 40,
|
1317
1317
|
"character": 1
|
1318
1318
|
},
|
1319
1319
|
"name": "ComponentsEjector"
|
@@ -1324,7 +1324,7 @@
|
|
1324
1324
|
"__schema": "FunctionLikeSchema",
|
1325
1325
|
"location": {
|
1326
1326
|
"filePath": "components-ejector.ts",
|
1327
|
-
"line":
|
1327
|
+
"line": 64,
|
1328
1328
|
"character": 3
|
1329
1329
|
},
|
1330
1330
|
"signature": "(method) ComponentsEjector.eject(): Promise<EjectResults>",
|
@@ -1334,7 +1334,7 @@
|
|
1334
1334
|
"__schema": "TypeRefSchema",
|
1335
1335
|
"location": {
|
1336
1336
|
"filePath": "components-ejector.ts",
|
1337
|
-
"line":
|
1337
|
+
"line": 64,
|
1338
1338
|
"character": 18
|
1339
1339
|
},
|
1340
1340
|
"name": "Promise",
|
@@ -1343,7 +1343,7 @@
|
|
1343
1343
|
"__schema": "TypeRefSchema",
|
1344
1344
|
"location": {
|
1345
1345
|
"filePath": "components-ejector.ts",
|
1346
|
-
"line":
|
1346
|
+
"line": 64,
|
1347
1347
|
"character": 26
|
1348
1348
|
},
|
1349
1349
|
"name": "EjectResults"
|
@@ -1358,7 +1358,7 @@
|
|
1358
1358
|
"__schema": "FunctionLikeSchema",
|
1359
1359
|
"location": {
|
1360
1360
|
"filePath": "components-ejector.ts",
|
1361
|
-
"line":
|
1361
|
+
"line": 83,
|
1362
1362
|
"character": 3
|
1363
1363
|
},
|
1364
1364
|
"signature": "(method) ComponentsEjector.decideWhichComponentsToEject(): Promise<void>",
|
@@ -1368,7 +1368,7 @@
|
|
1368
1368
|
"__schema": "TypeRefSchema",
|
1369
1369
|
"location": {
|
1370
1370
|
"filePath": "components-ejector.ts",
|
1371
|
-
"line":
|
1371
|
+
"line": 83,
|
1372
1372
|
"character": 41
|
1373
1373
|
},
|
1374
1374
|
"name": "Promise",
|
@@ -1377,7 +1377,7 @@
|
|
1377
1377
|
"__schema": "KeywordTypeSchema",
|
1378
1378
|
"location": {
|
1379
1379
|
"filePath": "components-ejector.ts",
|
1380
|
-
"line":
|
1380
|
+
"line": 83,
|
1381
1381
|
"character": 49
|
1382
1382
|
},
|
1383
1383
|
"name": "void"
|
@@ -1392,7 +1392,7 @@
|
|
1392
1392
|
"__schema": "FunctionLikeSchema",
|
1393
1393
|
"location": {
|
1394
1394
|
"filePath": "components-ejector.ts",
|
1395
|
-
"line":
|
1395
|
+
"line": 117,
|
1396
1396
|
"character": 3
|
1397
1397
|
},
|
1398
1398
|
"signature": "(method) ComponentsEjector.loadComponentsToEject(): Promise<void>",
|
@@ -1402,7 +1402,7 @@
|
|
1402
1402
|
"__schema": "InferenceTypeSchema",
|
1403
1403
|
"location": {
|
1404
1404
|
"filePath": "components-ejector.ts",
|
1405
|
-
"line":
|
1405
|
+
"line": 117,
|
1406
1406
|
"character": 3
|
1407
1407
|
},
|
1408
1408
|
"type": "Promise<void>"
|
@@ -1415,7 +1415,7 @@
|
|
1415
1415
|
"__schema": "FunctionLikeSchema",
|
1416
1416
|
"location": {
|
1417
1417
|
"filePath": "components-ejector.ts",
|
1418
|
-
"line":
|
1418
|
+
"line": 122,
|
1419
1419
|
"character": 3
|
1420
1420
|
},
|
1421
1421
|
"signature": "(method) ComponentsEjector.removeComponentsFromNodeModules(): Promise<void>",
|
@@ -1425,7 +1425,7 @@
|
|
1425
1425
|
"__schema": "InferenceTypeSchema",
|
1426
1426
|
"location": {
|
1427
1427
|
"filePath": "components-ejector.ts",
|
1428
|
-
"line":
|
1428
|
+
"line": 122,
|
1429
1429
|
"character": 3
|
1430
1430
|
},
|
1431
1431
|
"type": "Promise<void>"
|
@@ -1438,7 +1438,7 @@
|
|
1438
1438
|
"__schema": "FunctionLikeSchema",
|
1439
1439
|
"location": {
|
1440
1440
|
"filePath": "components-ejector.ts",
|
1441
|
-
"line":
|
1441
|
+
"line": 130,
|
1442
1442
|
"character": 3
|
1443
1443
|
},
|
1444
1444
|
"signature": "(method) ComponentsEjector.installPackages(): Promise<void>",
|
@@ -1448,7 +1448,7 @@
|
|
1448
1448
|
"__schema": "InferenceTypeSchema",
|
1449
1449
|
"location": {
|
1450
1450
|
"filePath": "components-ejector.ts",
|
1451
|
-
"line":
|
1451
|
+
"line": 130,
|
1452
1452
|
"character": 3
|
1453
1453
|
},
|
1454
1454
|
"type": "Promise<void>"
|
@@ -1461,7 +1461,7 @@
|
|
1461
1461
|
"__schema": "FunctionLikeSchema",
|
1462
1462
|
"location": {
|
1463
1463
|
"filePath": "components-ejector.ts",
|
1464
|
-
"line":
|
1464
|
+
"line": 137,
|
1465
1465
|
"character": 3
|
1466
1466
|
},
|
1467
1467
|
"signature": "(method) ComponentsEjector.getPackagesToInstall(): string[]",
|
@@ -1471,14 +1471,14 @@
|
|
1471
1471
|
"__schema": "TypeArraySchema",
|
1472
1472
|
"location": {
|
1473
1473
|
"filePath": "components-ejector.ts",
|
1474
|
-
"line":
|
1474
|
+
"line": 137,
|
1475
1475
|
"character": 27
|
1476
1476
|
},
|
1477
1477
|
"type": {
|
1478
1478
|
"__schema": "KeywordTypeSchema",
|
1479
1479
|
"location": {
|
1480
1480
|
"filePath": "components-ejector.ts",
|
1481
|
-
"line":
|
1481
|
+
"line": 137,
|
1482
1482
|
"character": 27
|
1483
1483
|
},
|
1484
1484
|
"name": "string"
|
@@ -1490,7 +1490,7 @@
|
|
1490
1490
|
"__schema": "FunctionLikeSchema",
|
1491
1491
|
"location": {
|
1492
1492
|
"filePath": "components-ejector.ts",
|
1493
|
-
"line":
|
1493
|
+
"line": 141,
|
1494
1494
|
"character": 3
|
1495
1495
|
},
|
1496
1496
|
"signature": "(method) ComponentsEjector._buildExceptionMessageWithRollbackData(action: string): string",
|
@@ -1500,7 +1500,7 @@
|
|
1500
1500
|
"__schema": "ParameterSchema",
|
1501
1501
|
"location": {
|
1502
1502
|
"filePath": "components-ejector.ts",
|
1503
|
-
"line":
|
1503
|
+
"line": 141,
|
1504
1504
|
"character": 42
|
1505
1505
|
},
|
1506
1506
|
"name": "action",
|
@@ -1508,7 +1508,7 @@
|
|
1508
1508
|
"__schema": "KeywordTypeSchema",
|
1509
1509
|
"location": {
|
1510
1510
|
"filePath": "components-ejector.ts",
|
1511
|
-
"line":
|
1511
|
+
"line": 141,
|
1512
1512
|
"character": 50
|
1513
1513
|
},
|
1514
1514
|
"name": "string"
|
@@ -1521,7 +1521,7 @@
|
|
1521
1521
|
"__schema": "KeywordTypeSchema",
|
1522
1522
|
"location": {
|
1523
1523
|
"filePath": "components-ejector.ts",
|
1524
|
-
"line":
|
1524
|
+
"line": 141,
|
1525
1525
|
"character": 59
|
1526
1526
|
},
|
1527
1527
|
"name": "string"
|
@@ -1532,7 +1532,7 @@
|
|
1532
1532
|
"__schema": "FunctionLikeSchema",
|
1533
1533
|
"location": {
|
1534
1534
|
"filePath": "components-ejector.ts",
|
1535
|
-
"line":
|
1535
|
+
"line": 179,
|
1536
1536
|
"character": 3
|
1537
1537
|
},
|
1538
1538
|
"signature": "(method) ComponentsEjector.throwEjectError(message: string, originalError: Error): void",
|
@@ -1542,7 +1542,7 @@
|
|
1542
1542
|
"__schema": "ParameterSchema",
|
1543
1543
|
"location": {
|
1544
1544
|
"filePath": "components-ejector.ts",
|
1545
|
-
"line":
|
1545
|
+
"line": 179,
|
1546
1546
|
"character": 19
|
1547
1547
|
},
|
1548
1548
|
"name": "message",
|
@@ -1550,7 +1550,7 @@
|
|
1550
1550
|
"__schema": "KeywordTypeSchema",
|
1551
1551
|
"location": {
|
1552
1552
|
"filePath": "components-ejector.ts",
|
1553
|
-
"line":
|
1553
|
+
"line": 179,
|
1554
1554
|
"character": 28
|
1555
1555
|
},
|
1556
1556
|
"name": "string"
|
@@ -1562,7 +1562,7 @@
|
|
1562
1562
|
"__schema": "ParameterSchema",
|
1563
1563
|
"location": {
|
1564
1564
|
"filePath": "components-ejector.ts",
|
1565
|
-
"line":
|
1565
|
+
"line": 179,
|
1566
1566
|
"character": 36
|
1567
1567
|
},
|
1568
1568
|
"name": "originalError",
|
@@ -1570,7 +1570,7 @@
|
|
1570
1570
|
"__schema": "TypeRefSchema",
|
1571
1571
|
"location": {
|
1572
1572
|
"filePath": "components-ejector.ts",
|
1573
|
-
"line":
|
1573
|
+
"line": 179,
|
1574
1574
|
"character": 51
|
1575
1575
|
},
|
1576
1576
|
"name": "Error"
|
@@ -1583,7 +1583,7 @@
|
|
1583
1583
|
"__schema": "InferenceTypeSchema",
|
1584
1584
|
"location": {
|
1585
1585
|
"filePath": "components-ejector.ts",
|
1586
|
-
"line":
|
1586
|
+
"line": 179,
|
1587
1587
|
"character": 3
|
1588
1588
|
},
|
1589
1589
|
"type": "void"
|
@@ -1594,7 +1594,7 @@
|
|
1594
1594
|
"__schema": "FunctionLikeSchema",
|
1595
1595
|
"location": {
|
1596
1596
|
"filePath": "components-ejector.ts",
|
1597
|
-
"line":
|
1597
|
+
"line": 187,
|
1598
1598
|
"character": 3
|
1599
1599
|
},
|
1600
1600
|
"signature": "(method) ComponentsEjector._validateIdsHaveScopesAndVersions(): void",
|
@@ -1604,7 +1604,7 @@
|
|
1604
1604
|
"__schema": "InferenceTypeSchema",
|
1605
1605
|
"location": {
|
1606
1606
|
"filePath": "components-ejector.ts",
|
1607
|
-
"line":
|
1607
|
+
"line": 187,
|
1608
1608
|
"character": 3
|
1609
1609
|
},
|
1610
1610
|
"type": "void"
|
@@ -1621,7 +1621,7 @@
|
|
1621
1621
|
"__schema": "TypeSchema",
|
1622
1622
|
"location": {
|
1623
1623
|
"filePath": "components-ejector.ts",
|
1624
|
-
"line":
|
1624
|
+
"line": 33,
|
1625
1625
|
"character": 1
|
1626
1626
|
},
|
1627
1627
|
"signature": "type FailedComponents = {\n modifiedComponents: ComponentIdList;\n stagedComponents: ComponentIdList;\n notExportedComponents: ComponentIdList;\n selfHostedExportedComponents: ComponentIdList;\n}",
|
@@ -1630,7 +1630,7 @@
|
|
1630
1630
|
"__schema": "TypeLiteralSchema",
|
1631
1631
|
"location": {
|
1632
1632
|
"filePath": "components-ejector.ts",
|
1633
|
-
"line":
|
1633
|
+
"line": 33,
|
1634
1634
|
"character": 25
|
1635
1635
|
},
|
1636
1636
|
"members": [
|
@@ -1638,7 +1638,7 @@
|
|
1638
1638
|
"__schema": "VariableLikeSchema",
|
1639
1639
|
"location": {
|
1640
1640
|
"filePath": "components-ejector.ts",
|
1641
|
-
"line":
|
1641
|
+
"line": 34,
|
1642
1642
|
"character": 3
|
1643
1643
|
},
|
1644
1644
|
"signature": "(property) modifiedComponents: ComponentIdList",
|
@@ -1647,7 +1647,7 @@
|
|
1647
1647
|
"__schema": "TypeRefSchema",
|
1648
1648
|
"location": {
|
1649
1649
|
"filePath": "components-ejector.ts",
|
1650
|
-
"line":
|
1650
|
+
"line": 34,
|
1651
1651
|
"character": 3
|
1652
1652
|
},
|
1653
1653
|
"name": "ComponentIdList",
|
@@ -1663,7 +1663,7 @@
|
|
1663
1663
|
"__schema": "VariableLikeSchema",
|
1664
1664
|
"location": {
|
1665
1665
|
"filePath": "components-ejector.ts",
|
1666
|
-
"line":
|
1666
|
+
"line": 35,
|
1667
1667
|
"character": 3
|
1668
1668
|
},
|
1669
1669
|
"signature": "(property) stagedComponents: ComponentIdList",
|
@@ -1672,7 +1672,7 @@
|
|
1672
1672
|
"__schema": "TypeRefSchema",
|
1673
1673
|
"location": {
|
1674
1674
|
"filePath": "components-ejector.ts",
|
1675
|
-
"line":
|
1675
|
+
"line": 35,
|
1676
1676
|
"character": 3
|
1677
1677
|
},
|
1678
1678
|
"name": "ComponentIdList",
|
@@ -1688,7 +1688,7 @@
|
|
1688
1688
|
"__schema": "VariableLikeSchema",
|
1689
1689
|
"location": {
|
1690
1690
|
"filePath": "components-ejector.ts",
|
1691
|
-
"line":
|
1691
|
+
"line": 36,
|
1692
1692
|
"character": 3
|
1693
1693
|
},
|
1694
1694
|
"signature": "(property) notExportedComponents: ComponentIdList",
|
@@ -1697,7 +1697,7 @@
|
|
1697
1697
|
"__schema": "TypeRefSchema",
|
1698
1698
|
"location": {
|
1699
1699
|
"filePath": "components-ejector.ts",
|
1700
|
-
"line":
|
1700
|
+
"line": 36,
|
1701
1701
|
"character": 3
|
1702
1702
|
},
|
1703
1703
|
"name": "ComponentIdList",
|
@@ -1713,7 +1713,7 @@
|
|
1713
1713
|
"__schema": "VariableLikeSchema",
|
1714
1714
|
"location": {
|
1715
1715
|
"filePath": "components-ejector.ts",
|
1716
|
-
"line":
|
1716
|
+
"line": 37,
|
1717
1717
|
"character": 3
|
1718
1718
|
},
|
1719
1719
|
"signature": "(property) selfHostedExportedComponents: ComponentIdList",
|
@@ -1722,7 +1722,7 @@
|
|
1722
1722
|
"__schema": "TypeRefSchema",
|
1723
1723
|
"location": {
|
1724
1724
|
"filePath": "components-ejector.ts",
|
1725
|
-
"line":
|
1725
|
+
"line": 37,
|
1726
1726
|
"character": 3
|
1727
1727
|
},
|
1728
1728
|
"name": "ComponentIdList",
|
@@ -1780,7 +1780,7 @@
|
|
1780
1780
|
"componentId": {
|
1781
1781
|
"scope": "teambit.workspace",
|
1782
1782
|
"name": "eject",
|
1783
|
-
"version": "1.0.
|
1783
|
+
"version": "1.0.333"
|
1784
1784
|
},
|
1785
1785
|
"taggedModuleExports": []
|
1786
1786
|
}
|
@@ -32,16 +32,9 @@ function _pkgModules() {
|
|
32
32
|
};
|
33
33
|
return data;
|
34
34
|
}
|
35
|
-
function
|
36
|
-
const data =
|
37
|
-
|
38
|
-
return data;
|
39
|
-
};
|
40
|
-
return data;
|
41
|
-
}
|
42
|
-
function _removePath() {
|
43
|
-
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/sources/remove-path"));
|
44
|
-
_removePath = function () {
|
35
|
+
function _component() {
|
36
|
+
const data = require("@teambit/component.sources");
|
37
|
+
_component = function () {
|
45
38
|
return data;
|
46
39
|
};
|
47
40
|
return data;
|
@@ -167,7 +160,7 @@ your package.json (if existed) has been restored, however, some bit generated da
|
|
167
160
|
return;
|
168
161
|
}
|
169
162
|
this.logger.setStatusLine('Eject: removing the components files from the filesystem');
|
170
|
-
const dataToPersist = new (
|
163
|
+
const dataToPersist = new (_component().DataToPersist)();
|
171
164
|
this.componentsToEject.forEach(component => {
|
172
165
|
const componentMap = component.componentMap;
|
173
166
|
if (!componentMap) {
|
@@ -177,7 +170,7 @@ your package.json (if existed) has been restored, however, some bit generated da
|
|
177
170
|
if (!rootDir) {
|
178
171
|
throw new Error('ComponentEjector.removeComponentsFiles expect a componentMap to have rootDir');
|
179
172
|
}
|
180
|
-
dataToPersist.removePath(new (
|
173
|
+
dataToPersist.removePath(new (_component().RemovePath)(rootDir, true));
|
181
174
|
});
|
182
175
|
dataToPersist.addBasePath(this.consumer.getPath());
|
183
176
|
await dataToPersist.persistAllToFS();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_componentId","data","require","_defaultErrorHandler","_interopRequireDefault","_scopeRemotes","_pkgModules","_dataToPersist","_removePath","_remove","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ComponentsEjector","constructor","workspace","install","logger","componentsIds","ejectOptions","consumer","idsToEject","ComponentIdList","failedComponents","modifiedComponents","stagedComponents","notExportedComponents","selfHostedExportedComponents","eject","decideWhichComponentsToEject","debug","length","loadComponentsToEject","_validateIdsHaveScopesAndVersions","removeComponentsFromNodeModules","untrackComponents","installPackages","removeComponentsFiles","writeBitMap","ejectedComponents","setStatusLine","remotes","getScopeRemotes","scope","hubExportedComponents","forEach","componentId","bitId","isExported","push","isHub","force","Promise","all","map","id","componentStatus","getComponentStatusById","modified","staged","err","throwEjectError","toString","consoleSuccess","components","loadComponents","componentsToEject","action","skipDependencyInstallation","packages","getPackagesToInstall","c","componentIdToPackageName","_buildExceptionMessageWithRollbackData","keepFiles","dataToPersist","DataToPersist","component","componentMap","Error","rootDir","removePath","RemovePath","addBasePath","getPath","persistAllToFS","cleanFromBitMap","message","originalError","originalErrorMessage","defaultErrorHandler","error","hasScope","hasVersion","exports"],"sources":["components-ejector.ts"],"sourcesContent":["/**\n * a classic use case of eject is when a user imports a component using `bit import` to update it,\n * but the user has no intention to have the code as part of the project source code.\n * the eject provides the option to delete the component locally and install it via the NPM client.\n *\n * an implementation note, the entire process is done with rollback in mind.\n * since installing the component via NPM client is an error prone process, we do it first, before\n * removing the component files, so then it's easier to rollback.\n */\nimport { Workspace } from '@teambit/workspace';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ComponentIdList, ComponentID } from '@teambit/component-id';\nimport defaultErrorHandler from '@teambit/legacy/dist/cli/default-error-handler';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { Logger } from '@teambit/logger';\nimport { InstallMain } from '@teambit/install';\nimport { removeComponentsFromNodeModules } from '@teambit/remove';\n\nexport type EjectResults = {\n ejectedComponents: ComponentIdList;\n failedComponents: FailedComponents;\n};\n\nexport type EjectOptions = {\n force?: boolean; // eject although a component is modified/staged\n keepFiles?: boolean; // keep component files on the workspace\n skipDependencyInstallation?: boolean; // skip installing the dependencies\n};\n\ntype FailedComponents = {\n modifiedComponents: ComponentIdList;\n stagedComponents: ComponentIdList;\n notExportedComponents: ComponentIdList;\n selfHostedExportedComponents: ComponentIdList;\n};\n\nexport class ComponentsEjector {\n consumer: Consumer;\n idsToEject: ComponentIdList;\n componentsToEject: Component[] = [];\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n notEjectedDependents: Array<{ dependent: Component; ejectedDependencies: Component[] }>;\n failedComponents: FailedComponents;\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private logger: Logger,\n private componentsIds: ComponentID[],\n private ejectOptions: EjectOptions\n ) {\n this.consumer = this.workspace.consumer;\n this.idsToEject = new ComponentIdList();\n this.failedComponents = {\n modifiedComponents: new ComponentIdList(),\n stagedComponents: new ComponentIdList(),\n notExportedComponents: new ComponentIdList(),\n selfHostedExportedComponents: new ComponentIdList(),\n };\n }\n\n async eject(): Promise<EjectResults> {\n await this.decideWhichComponentsToEject();\n this.logger.debug(`${this.idsToEject.length} to eject`);\n await this.loadComponentsToEject();\n if (this.idsToEject.length) {\n this._validateIdsHaveScopesAndVersions();\n await this.removeComponentsFromNodeModules();\n await this.untrackComponents();\n await this.installPackages();\n await this.removeComponentsFiles();\n await this.consumer.writeBitMap();\n }\n this.logger.debug('eject: completed successfully');\n return {\n ejectedComponents: this.idsToEject,\n failedComponents: this.failedComponents,\n };\n }\n\n async decideWhichComponentsToEject(): Promise<void> {\n this.logger.setStatusLine('Eject: getting the components status');\n if (!this.componentsIds.length) return;\n const remotes = await getScopeRemotes(this.consumer.scope);\n const hubExportedComponents = new ComponentIdList();\n this.componentsIds.forEach((componentId) => {\n const bitId = componentId;\n if (!this.workspace.isExported(bitId)) this.failedComponents.notExportedComponents.push(bitId);\n else if (remotes.isHub(bitId.scope as string)) hubExportedComponents.push(bitId);\n else this.failedComponents.selfHostedExportedComponents.push(bitId);\n });\n if (this.ejectOptions.force) {\n this.idsToEject = hubExportedComponents;\n } else {\n await Promise.all(\n hubExportedComponents.map(async (id) => {\n try {\n const componentStatus = await this.workspace.getComponentStatusById(id);\n if (componentStatus.modified) this.failedComponents.modifiedComponents.push(id);\n else if (componentStatus.staged) this.failedComponents.stagedComponents.push(id);\n else this.idsToEject.push(id);\n } catch (err: any) {\n this.throwEjectError(\n `eject operation failed getting the status of ${id.toString()}, no action has been done.\n please fix the issue to continue.`,\n err\n );\n }\n })\n );\n }\n this.logger.consoleSuccess();\n }\n\n async loadComponentsToEject() {\n const { components } = await this.consumer.loadComponents(this.idsToEject);\n this.componentsToEject = components;\n }\n\n async removeComponentsFromNodeModules() {\n const action = 'Eject: removing the existing components from node_modules';\n this.logger.setStatusLine(action);\n this.logger.debug(action);\n await removeComponentsFromNodeModules(this.consumer, this.componentsToEject);\n this.logger.consoleSuccess(action);\n }\n\n async installPackages() {\n if (this.ejectOptions.skipDependencyInstallation) return;\n this.logger.setStatusLine('Eject: installing packages using the package-manager');\n const packages = this.getPackagesToInstall();\n await this.install.install(packages);\n }\n\n getPackagesToInstall(): string[] {\n return this.componentsToEject.map((c) => componentIdToPackageName(c));\n }\n\n _buildExceptionMessageWithRollbackData(action: string): string {\n return `eject failed ${action}.\nyour package.json (if existed) has been restored, however, some bit generated data may have been deleted, please run \"bit link\" to restore them.`;\n }\n\n /**\n * as part of the 'eject' operation, a component is removed locally. as opposed to the remove\n * command, in this case, no need to remove the objects from the scope, only remove from the\n * filesystem, which means, delete the component files, untrack from .bitmap and clean\n * package.json and bit.json traces.\n */\n private async removeComponentsFiles() {\n if (this.ejectOptions.keepFiles) {\n return;\n }\n this.logger.setStatusLine('Eject: removing the components files from the filesystem');\n const dataToPersist = new DataToPersist();\n this.componentsToEject.forEach((component) => {\n const componentMap = component.componentMap;\n if (!componentMap) {\n throw new Error('ComponentEjector.removeComponentsFiles expect a component to have componentMap prop');\n }\n const rootDir = componentMap.rootDir;\n if (!rootDir) {\n throw new Error('ComponentEjector.removeComponentsFiles expect a componentMap to have rootDir');\n }\n dataToPersist.removePath(new RemovePath(rootDir, true));\n });\n dataToPersist.addBasePath(this.consumer.getPath());\n await dataToPersist.persistAllToFS();\n this.logger.consoleSuccess();\n }\n\n private async untrackComponents() {\n this.logger.debug('eject: removing the components from the .bitmap');\n await this.consumer.cleanFromBitMap(this.idsToEject);\n }\n\n throwEjectError(message: string, originalError: Error) {\n const { message: originalErrorMessage } = defaultErrorHandler(originalError);\n this.logger.error(`eject has stopped due to an error ${originalErrorMessage}`, originalError);\n throw new Error(`${message}\n\ngot the following error: ${originalErrorMessage}`);\n }\n\n _validateIdsHaveScopesAndVersions() {\n this.idsToEject.forEach((id) => {\n if (!id.hasScope() || !id.hasVersion()) {\n throw new TypeError(`EjectComponents expects ids with scope and version, got ${id.toString()}`);\n }\n });\n }\n}\n"],"mappings":";;;;;;AAWA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;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EAACF,OAAO,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC,CAAC;IACFL,aAAa,CAACQ,WAAW,CAAC,IAAI,CAAC/D,QAAQ,CAACgE,OAAO,CAAC,CAAC,CAAC;IAClD,MAAMT,aAAa,CAACU,cAAc,CAAC,CAAC;IACpC,IAAI,CAACpE,MAAM,CAAC8C,cAAc,CAAC,CAAC;EAC9B;EAEA,MAAc5B,iBAAiBA,CAAA,EAAG;IAChC,IAAI,CAAClB,MAAM,CAACa,KAAK,CAAC,iDAAiD,CAAC;IACpE,MAAM,IAAI,CAACV,QAAQ,CAACkE,eAAe,CAAC,IAAI,CAACjE,UAAU,CAAC;EACtD;EAEAwC,eAAeA,CAAC0B,OAAe,EAAEC,aAAoB,EAAE;IACrD,MAAM;MAAED,OAAO,EAAEE;IAAqB,CAAC,GAAG,IAAAC,8BAAmB,EAACF,aAAa,CAAC;IAC5E,IAAI,CAACvE,MAAM,CAAC0E,KAAK,CAAC,qCAAqCF,oBAAoB,EAAE,EAAED,aAAa,CAAC;IAC7F,MAAM,IAAIT,KAAK,CAAC,GAAGQ,OAAO;AAC9B;AACA,2BAA2BE,oBAAoB,EAAE,CAAC;EAChD;EAEAxD,iCAAiCA,CAAA,EAAG;IAClC,IAAI,CAACZ,UAAU,CAACwB,OAAO,CAAEU,EAAE,IAAK;MAC9B,IAAI,CAACA,EAAE,CAACqC,QAAQ,CAAC,CAAC,IAAI,CAACrC,EAAE,CAACsC,UAAU,CAAC,CAAC,EAAE;QACtC,MAAM,IAAInF,SAAS,CAAC,2DAA2D6C,EAAE,CAACO,QAAQ,CAAC,CAAC,EAAE,CAAC;MACjG;IACF,CAAC,CAAC;EACJ;AACF;AAACgC,OAAA,CAAAjF,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_componentId","data","require","_defaultErrorHandler","_interopRequireDefault","_scopeRemotes","_pkgModules","_component","_remove","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ComponentsEjector","constructor","workspace","install","logger","componentsIds","ejectOptions","consumer","idsToEject","ComponentIdList","failedComponents","modifiedComponents","stagedComponents","notExportedComponents","selfHostedExportedComponents","eject","decideWhichComponentsToEject","debug","length","loadComponentsToEject","_validateIdsHaveScopesAndVersions","removeComponentsFromNodeModules","untrackComponents","installPackages","removeComponentsFiles","writeBitMap","ejectedComponents","setStatusLine","remotes","getScopeRemotes","scope","hubExportedComponents","forEach","componentId","bitId","isExported","push","isHub","force","Promise","all","map","id","componentStatus","getComponentStatusById","modified","staged","err","throwEjectError","toString","consoleSuccess","components","loadComponents","componentsToEject","action","skipDependencyInstallation","packages","getPackagesToInstall","c","componentIdToPackageName","_buildExceptionMessageWithRollbackData","keepFiles","dataToPersist","DataToPersist","component","componentMap","Error","rootDir","removePath","RemovePath","addBasePath","getPath","persistAllToFS","cleanFromBitMap","message","originalError","originalErrorMessage","defaultErrorHandler","error","hasScope","hasVersion","exports"],"sources":["components-ejector.ts"],"sourcesContent":["/**\n * a classic use case of eject is when a user imports a component using `bit import` to update it,\n * but the user has no intention to have the code as part of the project source code.\n * the eject provides the option to delete the component locally and install it via the NPM client.\n *\n * an implementation note, the entire process is done with rollback in mind.\n * since installing the component via NPM client is an error prone process, we do it first, before\n * removing the component files, so then it's easier to rollback.\n */\nimport { Workspace } from '@teambit/workspace';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ComponentIdList, ComponentID } from '@teambit/component-id';\nimport defaultErrorHandler from '@teambit/legacy/dist/cli/default-error-handler';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { DataToPersist, RemovePath } from '@teambit/component.sources';\nimport { Logger } from '@teambit/logger';\nimport { InstallMain } from '@teambit/install';\nimport { removeComponentsFromNodeModules } from '@teambit/remove';\n\nexport type EjectResults = {\n ejectedComponents: ComponentIdList;\n failedComponents: FailedComponents;\n};\n\nexport type EjectOptions = {\n force?: boolean; // eject although a component is modified/staged\n keepFiles?: boolean; // keep component files on the workspace\n skipDependencyInstallation?: boolean; // skip installing the dependencies\n};\n\ntype FailedComponents = {\n modifiedComponents: ComponentIdList;\n stagedComponents: ComponentIdList;\n notExportedComponents: ComponentIdList;\n selfHostedExportedComponents: ComponentIdList;\n};\n\nexport class ComponentsEjector {\n consumer: Consumer;\n idsToEject: ComponentIdList;\n componentsToEject: Component[] = [];\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n notEjectedDependents: Array<{ dependent: Component; ejectedDependencies: Component[] }>;\n failedComponents: FailedComponents;\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private logger: Logger,\n private componentsIds: ComponentID[],\n private ejectOptions: EjectOptions\n ) {\n this.consumer = this.workspace.consumer;\n this.idsToEject = new ComponentIdList();\n this.failedComponents = {\n modifiedComponents: new ComponentIdList(),\n stagedComponents: new ComponentIdList(),\n notExportedComponents: new ComponentIdList(),\n selfHostedExportedComponents: new ComponentIdList(),\n };\n }\n\n async eject(): Promise<EjectResults> {\n await this.decideWhichComponentsToEject();\n this.logger.debug(`${this.idsToEject.length} to eject`);\n await this.loadComponentsToEject();\n if (this.idsToEject.length) {\n this._validateIdsHaveScopesAndVersions();\n await this.removeComponentsFromNodeModules();\n await this.untrackComponents();\n await this.installPackages();\n await this.removeComponentsFiles();\n await this.consumer.writeBitMap();\n }\n this.logger.debug('eject: completed successfully');\n return {\n ejectedComponents: this.idsToEject,\n failedComponents: this.failedComponents,\n };\n }\n\n async decideWhichComponentsToEject(): Promise<void> {\n this.logger.setStatusLine('Eject: getting the components status');\n if (!this.componentsIds.length) return;\n const remotes = await getScopeRemotes(this.consumer.scope);\n const hubExportedComponents = new ComponentIdList();\n this.componentsIds.forEach((componentId) => {\n const bitId = componentId;\n if (!this.workspace.isExported(bitId)) this.failedComponents.notExportedComponents.push(bitId);\n else if (remotes.isHub(bitId.scope as string)) hubExportedComponents.push(bitId);\n else this.failedComponents.selfHostedExportedComponents.push(bitId);\n });\n if (this.ejectOptions.force) {\n this.idsToEject = hubExportedComponents;\n } else {\n await Promise.all(\n hubExportedComponents.map(async (id) => {\n try {\n const componentStatus = await this.workspace.getComponentStatusById(id);\n if (componentStatus.modified) this.failedComponents.modifiedComponents.push(id);\n else if (componentStatus.staged) this.failedComponents.stagedComponents.push(id);\n else this.idsToEject.push(id);\n } catch (err: any) {\n this.throwEjectError(\n `eject operation failed getting the status of ${id.toString()}, no action has been done.\n please fix the issue to continue.`,\n err\n );\n }\n })\n );\n }\n this.logger.consoleSuccess();\n }\n\n async loadComponentsToEject() {\n const { components } = await this.consumer.loadComponents(this.idsToEject);\n this.componentsToEject = components;\n }\n\n async removeComponentsFromNodeModules() {\n const action = 'Eject: removing the existing components from node_modules';\n this.logger.setStatusLine(action);\n this.logger.debug(action);\n await removeComponentsFromNodeModules(this.consumer, this.componentsToEject);\n this.logger.consoleSuccess(action);\n }\n\n async installPackages() {\n if (this.ejectOptions.skipDependencyInstallation) return;\n this.logger.setStatusLine('Eject: installing packages using the package-manager');\n const packages = this.getPackagesToInstall();\n await this.install.install(packages);\n }\n\n getPackagesToInstall(): string[] {\n return this.componentsToEject.map((c) => componentIdToPackageName(c));\n }\n\n _buildExceptionMessageWithRollbackData(action: string): string {\n return `eject failed ${action}.\nyour package.json (if existed) has been restored, however, some bit generated data may have been deleted, please run \"bit link\" to restore them.`;\n }\n\n /**\n * as part of the 'eject' operation, a component is removed locally. as opposed to the remove\n * command, in this case, no need to remove the objects from the scope, only remove from the\n * filesystem, which means, delete the component files, untrack from .bitmap and clean\n * package.json and bit.json traces.\n */\n private async removeComponentsFiles() {\n if (this.ejectOptions.keepFiles) {\n return;\n }\n this.logger.setStatusLine('Eject: removing the components files from the filesystem');\n const dataToPersist = new DataToPersist();\n this.componentsToEject.forEach((component) => {\n const componentMap = component.componentMap;\n if (!componentMap) {\n throw new Error('ComponentEjector.removeComponentsFiles expect a component to have componentMap prop');\n }\n const rootDir = componentMap.rootDir;\n if (!rootDir) {\n throw new Error('ComponentEjector.removeComponentsFiles expect a componentMap to have rootDir');\n }\n dataToPersist.removePath(new RemovePath(rootDir, true));\n });\n dataToPersist.addBasePath(this.consumer.getPath());\n await dataToPersist.persistAllToFS();\n this.logger.consoleSuccess();\n }\n\n private async untrackComponents() {\n this.logger.debug('eject: removing the components from the .bitmap');\n await this.consumer.cleanFromBitMap(this.idsToEject);\n }\n\n throwEjectError(message: string, originalError: Error) {\n const { message: originalErrorMessage } = defaultErrorHandler(originalError);\n this.logger.error(`eject has stopped due to an error ${originalErrorMessage}`, originalError);\n throw new Error(`${message}\n\ngot the following error: ${originalErrorMessage}`);\n }\n\n _validateIdsHaveScopesAndVersions() {\n this.idsToEject.forEach((id) => {\n if (!id.hasScope() || !id.hasVersion()) {\n throw new TypeError(`EjectComponents expects ids with scope and version, got ${id.toString()}`);\n }\n });\n }\n}\n"],"mappings":";;;;;;AAWA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,WAAA;EAAA,MAAAN,IAAA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AAC0B,OAAe,EAAEC,aAAoB,EAAE;IACrD,MAAM;MAAED,OAAO,EAAEE;IAAqB,CAAC,GAAG,IAAAC,8BAAmB,EAACF,aAAa,CAAC;IAC5E,IAAI,CAACvE,MAAM,CAAC0E,KAAK,CAAC,qCAAqCF,oBAAoB,EAAE,EAAED,aAAa,CAAC;IAC7F,MAAM,IAAIT,KAAK,CAAC,GAAGQ,OAAO;AAC9B;AACA,2BAA2BE,oBAAoB,EAAE,CAAC;EAChD;EAEAxD,iCAAiCA,CAAA,EAAG;IAClC,IAAI,CAACZ,UAAU,CAACwB,OAAO,CAAEU,EAAE,IAAK;MAC9B,IAAI,CAACA,EAAE,CAACqC,QAAQ,CAAC,CAAC,IAAI,CAACrC,EAAE,CAACsC,UAAU,CAAC,CAAC,EAAE;QACtC,MAAM,IAAInF,SAAS,CAAC,2DAA2D6C,EAAE,CAACO,QAAQ,CAAC,CAAC,EAAE,CAAC;MACjG;IACF,CAAC,CAAC;EACJ;AACF;AAACgC,OAAA,CAAAjF,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_eject@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_eject@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_eject@1.0.333/dist/eject.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_eject@1.0.333/dist/eject.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/eject",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.333",
|
4
4
|
"homepage": "https://bit.cloud/teambit/workspace/eject",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.workspace",
|
8
8
|
"name": "eject",
|
9
|
-
"version": "1.0.
|
9
|
+
"version": "1.0.333"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"chalk": "2.4.2",
|
13
13
|
"@teambit/component-id": "1.2.0",
|
14
14
|
"@teambit/harmony": "0.4.6",
|
15
|
-
"@teambit/
|
16
|
-
"@teambit/
|
15
|
+
"@teambit/component.sources": "0.0.2",
|
16
|
+
"@teambit/install": "1.0.333",
|
17
|
+
"@teambit/logger": "0.0.1003",
|
17
18
|
"@teambit/pkg.modules.component-package-name": "0.0.2",
|
18
|
-
"@teambit/remove": "1.0.
|
19
|
-
"@teambit/workspace": "1.0.
|
20
|
-
"@teambit/cli": "0.0.
|
19
|
+
"@teambit/remove": "1.0.333",
|
20
|
+
"@teambit/workspace": "1.0.333",
|
21
|
+
"@teambit/cli": "0.0.910"
|
21
22
|
},
|
22
23
|
"devDependencies": {
|
23
24
|
"@types/mocha": "9.1.0",
|