@teambit/eject 1.0.282 → 1.0.283

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.282" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.workspace/eject@1.0.283" 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={87551:(e,t,o)=>{var n={id:"teambit.workspace/eject@1.0.282",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={};return(()=>{o.r(n),o.d(n,{compositions:()=>m,compositions_metadata:()=>f,overview:()=>l});var e={};o.r(e),o.d(e,{default:()=>s});var t=o(87551);o(41594);const r=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var a=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},p.apply(this,arguments)}var c={},d="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(Object.prototype.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||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,a);return(0,r.mdx)(d,p({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.mdx)("p",null,"One of the common scenarios of using ",(0,r.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,r.mdx)("inlineCode",{parentName:"p"},"eject"),", the next steps would be: 1) remove the component from the workspace by ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit remove")," and 2) installing the component by ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit install"),"."),(0,r.mdx)("p",null,(0,r.mdx)("inlineCode",{parentName:"p"},"bit eject")," combines the commands above to one command."),(0,r.mdx)("h2",null,"Eject process"),(0,r.mdx)("p",null,"The following steps are done during the ",(0,r.mdx)("inlineCode",{parentName:"p"},"eject")," process."),(0,r.mdx)("ol",null,(0,r.mdx)("li",{parentName:"ol"},"remove the component's data from node-modules so then it won't interfere with the package installation."),(0,r.mdx)("li",{parentName:"ol"},"remove the component from the .bitmap file."),(0,r.mdx)("li",{parentName:"ol"},"install the component as a package by the package manager and add the package to the ",(0,r.mdx)("inlineCode",{parentName:"li"},"workspace.json")," file."),(0,r.mdx)("li",{parentName:"ol"},"depends on the ",(0,r.mdx)("inlineCode",{parentName:"li"},"--keep-files")," flag, deletes the component files from the workspace."))))}s.isMDXComponent=!0;const m=[t],l=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.workspace/eject-preview"]=t():e["teambit.workspace/eject-preview"]=t()}(self,(()=>(()=>{"use strict";var e={87822:(e,t,o)=>{var n={id:"teambit.workspace/eject@1.0.283",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={};return(()=>{o.r(n),o.d(n,{compositions:()=>m,compositions_metadata:()=>u,overview:()=>s});var e={};o.r(e),o.d(e,{default:()=>l});var t=o(87822);o(41594);const r=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var a=["components"];function p(){return p=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},p.apply(null,arguments)}var c={},d="wrapper";function l(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,a);return(0,r.mdx)(d,p({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.mdx)("p",null,"One of the common scenarios of using ",(0,r.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,r.mdx)("inlineCode",{parentName:"p"},"eject"),", the next steps would be: 1) remove the component from the workspace by ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit remove")," and 2) installing the component by ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit install"),"."),(0,r.mdx)("p",null,(0,r.mdx)("inlineCode",{parentName:"p"},"bit eject")," combines the commands above to one command."),(0,r.mdx)("h2",null,"Eject process"),(0,r.mdx)("p",null,"The following steps are done during the ",(0,r.mdx)("inlineCode",{parentName:"p"},"eject")," process."),(0,r.mdx)("ol",null,(0,r.mdx)("li",{parentName:"ol"},"remove the component's data from node-modules so then it won't interfere with the package installation."),(0,r.mdx)("li",{parentName:"ol"},"remove the component from the .bitmap file."),(0,r.mdx)("li",{parentName:"ol"},"install the component as a package by the package manager and add the package to the ",(0,r.mdx)("inlineCode",{parentName:"li"},"workspace.json")," file."),(0,r.mdx)("li",{parentName:"ol"},"depends on the ",(0,r.mdx)("inlineCode",{parentName:"li"},"--keep-files")," flag, deletes the component files from the workspace."))))}l.isMDXComponent=!0;const m=[t],s=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
@@ -1897,7 +1897,7 @@
1897
1897
  "componentId": {
1898
1898
  "scope": "teambit.workspace",
1899
1899
  "name": "eject",
1900
- "version": "1.0.282"
1900
+ "version": "1.0.283"
1901
1901
  },
1902
1902
  "taggedModuleExports": []
1903
1903
  }
@@ -55,8 +55,8 @@ function _removePath() {
55
55
  }
56
56
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
57
57
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
58
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
59
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
58
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
59
+ 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; }
60
60
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
61
61
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
62
62
  * a classic use case of eject is when a user imports a component using `bit import` to update it,
@@ -1 +1 @@
1
- {"version":3,"names":["_componentId","data","require","_defaultErrorHandler","_interopRequireDefault","_scopeRemotes","_componentIdToPackageName","packageJsonUtils","_interopRequireWildcard","_dataToPersist","_removePath","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","obj","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","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/legacy/dist/utils/bit/component-id-to-package-name';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport PackageJsonFile from '@teambit/legacy/dist/consumer/component/package-json-file';\nimport * as packageJsonUtils from '@teambit/legacy/dist/consumer/component/package-json-utils';\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';\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 // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n packageJsonFilesBeforeChanges: PackageJsonFile[]; // for rollback in case of errors\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 packageJsonUtils.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;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jG;IACF,CAAC,CAAC;EACJ;AACF;AAACgC,OAAA,CAAAjF,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_componentId","data","require","_defaultErrorHandler","_interopRequireDefault","_scopeRemotes","_componentIdToPackageName","packageJsonUtils","_interopRequireWildcard","_dataToPersist","_removePath","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","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/legacy/dist/utils/bit/component-id-to-package-name';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport PackageJsonFile from '@teambit/legacy/dist/consumer/component/package-json-file';\nimport * as packageJsonUtils from '@teambit/legacy/dist/consumer/component/package-json-utils';\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';\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 // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n packageJsonFilesBeforeChanges: PackageJsonFile[]; // for rollback in case of errors\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 packageJsonUtils.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,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AC;MACjG;IACF,CAAC,CAAC;EACJ;AACF;AAACgC,OAAA,CAAAjF,iBAAA,GAAAA,iBAAA","ignoreList":[]}
package/dist/eject-cmd.js CHANGED
@@ -18,7 +18,7 @@ function _ejectTemplate() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
+ 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; }
22
22
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
23
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
24
  class EjectCmd {
@@ -1 +1 @@
1
- {"version":3,"names":["_constants","data","require","_ejectTemplate","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","EjectCmd","constructor","ejectMain","workspace","name","description","COMPONENT_PATTERN_HELP","report","pattern","force","json","keepFiles","skipDependencyInstallation","componentIds","idsByPattern","ejectResults","eject","JSON","stringify","ejectTemplate","exports"],"sources":["eject-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Workspace } from '@teambit/workspace';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { ejectTemplate } from './eject-template';\nimport { EjectMain } from './eject.main.runtime';\n\nexport class EjectCmd implements Command {\n name = 'eject <component-pattern>';\n description = 'remove component from the workspace and install it instead as a regular npm package.';\n extendedDescription = 'By default the component files will be removed from the workspace';\n helpUrl = 'reference/components/exporting-components#ejecting-components';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = 'E';\n options = [\n [\n 'f',\n 'force',\n 'ignore local changes/versions. eject component/s even when they are staged or modified. Note: unexported tags/snaps will be lost',\n ],\n ['x', 'skip-dependency-installation', 'do not auto-install dependencies'],\n ['j', 'json', 'print the results in JSON format'],\n ['', 'keep-files', 'keep the component files in the workspace intact'],\n ] as CommandOptions;\n loader = true;\n group = 'development';\n\n constructor(private ejectMain: EjectMain, private workspace: Workspace) {}\n\n async report(\n [pattern]: [string],\n {\n force = false,\n json = false,\n keepFiles = false,\n skipDependencyInstallation,\n }: {\n force: boolean;\n json: boolean;\n keepFiles: boolean;\n skipDependencyInstallation?: boolean;\n }\n ): Promise<string> {\n const componentIds = await this.workspace.idsByPattern(pattern);\n const ejectResults = await this.ejectMain.eject(componentIds, { force, keepFiles, skipDependencyInstallation });\n if (json) return JSON.stringify(ejectResults, null, 2);\n return ejectTemplate(ejectResults);\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiD,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM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AY,GAAG,MAAM,IAAI,CAACV,SAAS,CAACW,YAAY,CAACN,OAAO,CAAC;IAC/D,MAAMO,YAAY,GAAG,MAAM,IAAI,CAACb,SAAS,CAACc,KAAK,CAACH,YAAY,EAAE;MAAEJ,KAAK;MAAEE,SAAS;MAAEC;IAA2B,CAAC,CAAC;IAC/G,IAAIF,IAAI,EAAE,OAAOO,IAAI,CAACC,SAAS,CAACH,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,IAAAI,8BAAa,EAACJ,YAAY,CAAC;EACpC;AACF;AAACK,OAAA,CAAApB,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_constants","data","require","_ejectTemplate","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","EjectCmd","constructor","ejectMain","workspace","name","description","COMPONENT_PATTERN_HELP","report","pattern","force","json","keepFiles","skipDependencyInstallation","componentIds","idsByPattern","ejectResults","eject","JSON","stringify","ejectTemplate","exports"],"sources":["eject-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Workspace } from '@teambit/workspace';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { ejectTemplate } from './eject-template';\nimport { EjectMain } from './eject.main.runtime';\n\nexport class EjectCmd implements Command {\n name = 'eject <component-pattern>';\n description = 'remove component from the workspace and install it instead as a regular npm package.';\n extendedDescription = 'By default the component files will be removed from the workspace';\n helpUrl = 'reference/components/exporting-components#ejecting-components';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = 'E';\n options = [\n [\n 'f',\n 'force',\n 'ignore local changes/versions. eject component/s even when they are staged or modified. Note: unexported tags/snaps will be lost',\n ],\n ['x', 'skip-dependency-installation', 'do not auto-install dependencies'],\n ['j', 'json', 'print the results in JSON format'],\n ['', 'keep-files', 'keep the component files in the workspace intact'],\n ] as CommandOptions;\n loader = true;\n group = 'development';\n\n constructor(private ejectMain: EjectMain, private workspace: Workspace) {}\n\n async report(\n [pattern]: [string],\n {\n force = false,\n json = false,\n keepFiles = false,\n skipDependencyInstallation,\n }: {\n force: boolean;\n json: boolean;\n keepFiles: boolean;\n skipDependencyInstallation?: boolean;\n }\n ): Promise<string> {\n const componentIds = await this.workspace.idsByPattern(pattern);\n const ejectResults = await this.ejectMain.eject(componentIds, { force, keepFiles, skipDependencyInstallation });\n if (json) return JSON.stringify(ejectResults, null, 2);\n return ejectTemplate(ejectResults);\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiD,SAAAG,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CA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,CAAC;IACtD,OAAO,IAAAI,8BAAa,EAACJ,YAAY,CAAC;EACpC;AACF;AAACK,OAAA,CAAApB,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -19,7 +19,7 @@ function _constants() {
19
19
  };
20
20
  return data;
21
21
  }
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
23
23
  const successEjectMessage = exports.successEjectMessage = 'successfully ejected the following components';
24
24
  const failureEjectMessage = exports.failureEjectMessage = 'failed to eject the following components';
25
25
  function ejectTemplate(ejectResults) {
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_constants","obj","__esModule","default","successEjectMessage","exports","failureEjectMessage","ejectTemplate","ejectResults","getEjectedOutput","ejectedComponents","length","chalk","green","bold","toString","getFailureOutput","failures","failedComponents","title","red","modified","modifiedComponents","staged","stagedComponents","notExported","notExportedComponents","selfHosted","selfHostedExportedComponents","getCloudDomain","body","underline"],"sources":["eject-template.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { getCloudDomain } from '@teambit/legacy/dist/constants';\nimport { EjectResults } from './components-ejector';\n\nexport const successEjectMessage = 'successfully ejected the following components';\nexport const failureEjectMessage = 'failed to eject the following components';\n\nexport function ejectTemplate(ejectResults: EjectResults): string {\n const getEjectedOutput = () => {\n if (!ejectResults.ejectedComponents.length) return '';\n return chalk.green(`${successEjectMessage} ${chalk.bold(ejectResults.ejectedComponents.toString())}\\n`);\n };\n const getFailureOutput = () => {\n const failures = ejectResults.failedComponents;\n const title = chalk.red(`${failureEjectMessage}\\n`);\n const modified = failures.modifiedComponents.length\n ? `stopped the eject process for the following components because they have local changes.\n${chalk.bold(failures.modifiedComponents.toString())}\nejecting modified components discards all local, unstaged, changes.\nuse 'bit diff <component id>' to see the changes and decide if to 'bit tag' them or not.\nuse the '--force' flag to discard local modifications and proceed with the eject process.\\n`\n : '';\n const staged = failures.stagedComponents.length\n ? `components with local versions (use --force to ignore): ${failures.stagedComponents.toString()}\\n`\n : '';\n const notExported = failures.notExportedComponents.length\n ? `local components that were not exported yet: ${failures.notExportedComponents.toString()}\\n`\n : '';\n const selfHosted = failures.selfHostedExportedComponents.length\n ? `components that were exported to a self hosted scope (not ${getCloudDomain()}): ${failures.selfHostedExportedComponents.toString()}\\n`\n : '';\n const body = modified + staged + notExported + selfHosted;\n if (body) return chalk.underline(title) + chalk.red(body);\n return '';\n };\n return getEjectedOutput() + getFailureOutput();\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgE,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGzD,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,+CAA+C;AAC3E,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,0CAA0C;AAEtE,SAASC,aAAaA,CAACC,YAA0B,EAAU;EAChE,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC7B,IAAI,CAACD,YAAY,CAACE,iBAAiB,CAACC,MAAM,EAAE,OAAO,EAAE;IACrD,OAAOC,gBAAK,CAACC,KAAK,CAAE,GAAET,mBAAoB,IAAGQ,gBAAK,CAACE,IAAI,CAACN,YAAY,CAACE,iBAAiB,CAACK,QAAQ,CAAC,CAAC,CAAE,IAAG,CAAC;EACzG,CAAC;EACD,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC7B,MAAMC,QAAQ,GAAGT,YAAY,CAACU,gBAAgB;IAC9C,MAAMC,KAAK,GAAGP,gBAAK,CAACQ,GAAG,CAAE,GAAEd,mBAAoB,IAAG,CAAC;IACnD,MAAMe,QAAQ,GAAGJ,QAAQ,CAACK,kBAAkB,CAACX,MAAM,GAC9C;AACT,EAAEC,gBAAK,CAACE,IAAI,CAACG,QAAQ,CAACK,kBAAkB,CAACP,QAAQ,CAAC,CAAC,CAAE;AACrD;AACA;AACA,4FAA4F,GACpF,EAAE;IACN,MAAMQ,MAAM,GAAGN,QAAQ,CAACO,gBAAgB,CAACb,MAAM,GAC1C,2DAA0DM,QAAQ,CAACO,gBAAgB,CAACT,QAAQ,CAAC,CAAE,IAAG,GACnG,EAAE;IACN,MAAMU,WAAW,GAAGR,QAAQ,CAACS,qBAAqB,CAACf,MAAM,GACpD,gDAA+CM,QAAQ,CAACS,qBAAqB,CAACX,QAAQ,CAAC,CAAE,IAAG,GAC7F,EAAE;IACN,MAAMY,UAAU,GAAGV,QAAQ,CAACW,4BAA4B,CAACjB,MAAM,GAC1D,6DAA4D,IAAAkB,2BAAc,EAAC,CAAE,MAAKZ,QAAQ,CAACW,4BAA4B,CAACb,QAAQ,CAAC,CAAE,IAAG,GACvI,EAAE;IACN,MAAMe,IAAI,GAAGT,QAAQ,GAAGE,MAAM,GAAGE,WAAW,GAAGE,UAAU;IACzD,IAAIG,IAAI,EAAE,OAAOlB,gBAAK,CAACmB,SAAS,CAACZ,KAAK,CAAC,GAAGP,gBAAK,CAACQ,GAAG,CAACU,IAAI,CAAC;IACzD,OAAO,EAAE;EACX,CAAC;EACD,OAAOrB,gBAAgB,CAAC,CAAC,GAAGO,gBAAgB,CAAC,CAAC;AAChD","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_constants","e","__esModule","default","successEjectMessage","exports","failureEjectMessage","ejectTemplate","ejectResults","getEjectedOutput","ejectedComponents","length","chalk","green","bold","toString","getFailureOutput","failures","failedComponents","title","red","modified","modifiedComponents","staged","stagedComponents","notExported","notExportedComponents","selfHosted","selfHostedExportedComponents","getCloudDomain","body","underline"],"sources":["eject-template.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { getCloudDomain } from '@teambit/legacy/dist/constants';\nimport { EjectResults } from './components-ejector';\n\nexport const successEjectMessage = 'successfully ejected the following components';\nexport const failureEjectMessage = 'failed to eject the following components';\n\nexport function ejectTemplate(ejectResults: EjectResults): string {\n const getEjectedOutput = () => {\n if (!ejectResults.ejectedComponents.length) return '';\n return chalk.green(`${successEjectMessage} ${chalk.bold(ejectResults.ejectedComponents.toString())}\\n`);\n };\n const getFailureOutput = () => {\n const failures = ejectResults.failedComponents;\n const title = chalk.red(`${failureEjectMessage}\\n`);\n const modified = failures.modifiedComponents.length\n ? `stopped the eject process for the following components because they have local changes.\n${chalk.bold(failures.modifiedComponents.toString())}\nejecting modified components discards all local, unstaged, changes.\nuse 'bit diff <component id>' to see the changes and decide if to 'bit tag' them or not.\nuse the '--force' flag to discard local modifications and proceed with the eject process.\\n`\n : '';\n const staged = failures.stagedComponents.length\n ? `components with local versions (use --force to ignore): ${failures.stagedComponents.toString()}\\n`\n : '';\n const notExported = failures.notExportedComponents.length\n ? `local components that were not exported yet: ${failures.notExportedComponents.toString()}\\n`\n : '';\n const selfHosted = failures.selfHostedExportedComponents.length\n ? `components that were exported to a self hosted scope (not ${getCloudDomain()}): ${failures.selfHostedExportedComponents.toString()}\\n`\n : '';\n const body = modified + staged + notExported + selfHosted;\n if (body) return chalk.underline(title) + chalk.red(body);\n return '';\n };\n return getEjectedOutput() + getFailureOutput();\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,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GAC7F,EAAE;IACN,MAAMY,UAAU,GAAGV,QAAQ,CAACW,4BAA4B,CAACjB,MAAM,GAC3D,6DAA6D,IAAAkB,2BAAc,EAAC,CAAC,MAAMZ,QAAQ,CAACW,4BAA4B,CAACb,QAAQ,CAAC,CAAC,IAAI,GACvI,EAAE;IACN,MAAMe,IAAI,GAAGT,QAAQ,GAAGE,MAAM,GAAGE,WAAW,GAAGE,UAAU;IACzD,IAAIG,IAAI,EAAE,OAAOlB,gBAAK,CAACmB,SAAS,CAACZ,KAAK,CAAC,GAAGP,gBAAK,CAACQ,GAAG,CAACU,IAAI,CAAC;IACzD,OAAO,EAAE;EACX,CAAC;EACD,OAAOrB,gBAAgB,CAAC,CAAC,GAAGO,gBAAgB,CAAC,CAAC;AAChD","ignoreList":[]}
@@ -11,7 +11,7 @@ function _react() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
16
16
  style: {
17
17
  height: '100%',
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireDefault","require","obj","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["eject.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/eject.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAmD,CAAE,CACjF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","e","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["eject.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/eject.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAmD,CAAE,CACjF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -53,7 +53,7 @@ function _componentsEjector() {
53
53
  };
54
54
  return data;
55
55
  }
56
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
56
+ 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; }
57
57
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
58
58
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
59
59
  class EjectMain {
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_logger","_workspace","_install","_ejectCmd","_eject","_componentsEjector","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","EjectMain","constructor","workspace","install","logger","eject","componentIds","ejectOptions","OutsideWorkspaceError","componentEjector","ComponentsEjector","provider","cli","loggerMain","createLogger","EjectAspect","id","ejectMain","register","EjectCmd","exports","MainRuntime","CLIAspect","WorkspaceAspect","LoggerAspect","InstallAspect","addRuntime"],"sources":["eject.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { EjectCmd } from './eject-cmd';\nimport { EjectAspect } from './eject.aspect';\nimport { ComponentsEjector, EjectOptions, EjectResults } from './components-ejector';\n\nexport class EjectMain {\n constructor(private workspace: Workspace, private install: InstallMain, private logger: Logger) {}\n async eject(componentIds: ComponentID[], ejectOptions: EjectOptions = {}): Promise<EjectResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentEjector = new ComponentsEjector(\n this.workspace,\n this.install,\n this.logger,\n componentIds,\n ejectOptions\n );\n return componentEjector.eject();\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, InstallAspect];\n\n static async provider([cli, workspace, loggerMain, install]: [CLIMain, Workspace, LoggerMain, InstallMain]) {\n const logger = loggerMain.createLogger(EjectAspect.id);\n const ejectMain = new EjectMain(workspace, install, logger);\n cli.register(new EjectCmd(ejectMain, workspace));\n\n return ejectMain;\n }\n}\n\nEjectAspect.addRuntime(EjectMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,MAAA,YAAAA,CAAA;IAAA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AAC;IACtD,MAAMC,gBAAgB,GAAG,KAAIC,sCAAiB,EAC5C,IAAI,CAACR,SAAS,EACd,IAAI,CAACC,OAAO,EACZ,IAAI,CAACC,MAAM,EACXE,YAAY,EACZC,YACF,CAAC;IACD,OAAOE,gBAAgB,CAACJ,KAAK,CAAC,CAAC;EACjC;EAMA,aAAaM,QAAQA,CAAC,CAACC,GAAG,EAAEV,SAAS,EAAEW,UAAU,EAAEV,OAAO,CAAgD,EAAE;IAC1G,MAAMC,MAAM,GAAGS,UAAU,CAACC,YAAY,CAACC,oBAAW,CAACC,EAAE,CAAC;IACtD,MAAMC,SAAS,GAAG,IAAIjB,SAAS,CAACE,SAAS,EAAEC,OAAO,EAAEC,MAAM,CAAC;IAC3DQ,GAAG,CAACM,QAAQ,CAAC,KAAIC,oBAAQ,EAACF,SAAS,EAAEf,SAAS,CAAC,CAAC;IAEhD,OAAOe,SAAS;EAClB;AACF;AAACG,OAAA,CAAApB,SAAA,GAAAA,SAAA;AAAArB,eAAA,CAzBYqB,SAAS,aAcHqB,kBAAW;AAAA1C,eAAA,CAdjBqB,SAAS,kBAgBE,CAACsB,gBAAS,EAAEC,4BAAe,EAAEC,sBAAY,EAAEC,wBAAa,CAAC;AAWjFV,oBAAW,CAACW,UAAU,CAAC1B,SAAS,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_logger","_workspace","_install","_ejectCmd","_eject","_componentsEjector","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","EjectMain","constructor","workspace","install","logger","eject","componentIds","ejectOptions","OutsideWorkspaceError","componentEjector","ComponentsEjector","provider","cli","loggerMain","createLogger","EjectAspect","id","ejectMain","register","EjectCmd","exports","MainRuntime","CLIAspect","WorkspaceAspect","LoggerAspect","InstallAspect","addRuntime"],"sources":["eject.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { EjectCmd } from './eject-cmd';\nimport { EjectAspect } from './eject.aspect';\nimport { ComponentsEjector, EjectOptions, EjectResults } from './components-ejector';\n\nexport class EjectMain {\n constructor(private workspace: Workspace, private install: InstallMain, private logger: Logger) {}\n async eject(componentIds: ComponentID[], ejectOptions: EjectOptions = {}): Promise<EjectResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentEjector = new ComponentsEjector(\n this.workspace,\n this.install,\n this.logger,\n componentIds,\n ejectOptions\n );\n return componentEjector.eject();\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, InstallAspect];\n\n static async provider([cli, workspace, loggerMain, install]: [CLIMain, Workspace, LoggerMain, InstallMain]) {\n const logger = loggerMain.createLogger(EjectAspect.id);\n const ejectMain = new EjectMain(workspace, install, logger);\n cli.register(new EjectCmd(ejectMain, workspace));\n\n return ejectMain;\n }\n}\n\nEjectAspect.addRuntime(EjectMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IA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KAA5EF,SAAoB,GAApBA,SAAoB;IAAA,KAAUC,OAAoB,GAApBA,OAAoB;IAAA,KAAUC,MAAc,GAAdA,MAAc;EAAG;EACjG,MAAMC,KAAKA,CAACC,YAA2B,EAAEC,YAA0B,GAAG,CAAC,CAAC,EAAyB;IAC/F,IAAI,CAAC,IAAI,CAACL,SAAS,EAAE,MAAM,KAAIM,kCAAqB,EAAC,CAAC;IACtD,MAAMC,gBAAgB,GAAG,KAAIC,sCAAiB,EAC5C,IAAI,CAACR,SAAS,EACd,IAAI,CAACC,OAAO,EACZ,IAAI,CAACC,MAAM,EACXE,YAAY,EACZC,YACF,CAAC;IACD,OAAOE,gBAAgB,CAACJ,KAAK,CAAC,CAAC;EACjC;EAMA,aAAaM,QAAQA,CAAC,CAACC,GAAG,EAAEV,SAAS,EAAEW,UAAU,EAAEV,OAAO,CAAgD,EAAE;IAC1G,MAAMC,MAAM,GAAGS,UAAU,CAACC,YAAY,CAACC,oBAAW,CAACC,EAAE,CAAC;IACtD,MAAMC,SAAS,GAAG,IAAIjB,SAAS,CAACE,SAAS,EAAEC,OAAO,EAAEC,MAAM,CAAC;IAC3DQ,GAAG,CAACM,QAAQ,CAAC,KAAIC,oBAAQ,EAACF,SAAS,EAAEf,SAAS,CAAC,CAAC;IAEhD,OAAOe,SAAS;EAClB;AACF;AAACG,OAAA,CAAApB,SAAA,GAAAA,SAAA;AAAAnB,eAAA,CAzBYmB,SAAS,aAcHqB,kBAAW;AAAAxC,eAAA,CAdjBmB,SAAS,kBAgBE,CAACsB,gBAAS,EAAEC,4BAAe,EAAEC,sBAAY,EAAEC,wBAAa,CAAC;AAWjFV,oBAAW,CAACW,UAAU,CAAC1B,SAAS,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_eject@1.0.282/dist/eject.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_eject@1.0.282/dist/eject.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_eject@1.0.283/dist/eject.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_eject@1.0.283/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,20 +1,20 @@
1
1
  {
2
2
  "name": "@teambit/eject",
3
- "version": "1.0.282",
3
+ "version": "1.0.283",
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.282"
9
+ "version": "1.0.283"
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/install": "1.0.282",
15
+ "@teambit/install": "1.0.283",
16
16
  "@teambit/logger": "0.0.958",
17
- "@teambit/workspace": "1.0.282",
17
+ "@teambit/workspace": "1.0.283",
18
18
  "@teambit/cli": "0.0.865"
19
19
  },
20
20
  "devDependencies": {