@teambit/eject 1.0.20 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,8 +20,8 @@ export declare type EjectResults = {
20
20
  failedComponents: FailedComponents;
21
21
  };
22
22
  export declare type EjectOptions = {
23
- force: boolean;
24
- keepFiles: boolean;
23
+ force?: boolean;
24
+ keepFiles?: boolean;
25
25
  };
26
26
  declare type FailedComponents = {
27
27
  modifiedComponents: BitIds;
@@ -1 +1 @@
1
- {"version":3,"names":["_bitId","data","require","_defaultErrorHandler","_interopRequireDefault","_scopeRemotes","_componentIdToPackageName","packageJsonUtils","_interopRequireWildcard","_dataToPersist","_removePath","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ComponentsEjector","constructor","workspace","install","logger","componentsIds","ejectOptions","consumer","idsToEject","BitIds","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","_legacy","hasScope","push","isHub","force","Promise","all","map","id","componentStatus","getComponentStatusById","modified","staged","err","throwEjectError","toString","consoleSuccess","components","loadComponents","componentsToEject","action","packages","getPackagesToInstall","c","componentIdToPackageName","_buildExceptionMessageWithRollbackData","keepFiles","dataToPersist","DataToPersist","component","componentMap","Error","rootDir","removePath","RemovePath","addBasePath","getPath","persistAllToFS","cleanFromBitMap","message","originalError","originalErrorMessage","defaultErrorHandler","error","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 { BitIds } from '@teambit/legacy/dist/bit-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 { ComponentID } from '@teambit/component-id';\nimport { InstallMain } from '@teambit/install';\n\nexport type EjectResults = {\n ejectedComponents: BitIds;\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};\n\ntype FailedComponents = {\n modifiedComponents: BitIds;\n stagedComponents: BitIds;\n notExportedComponents: BitIds;\n selfHostedExportedComponents: BitIds;\n};\n\nexport class ComponentsEjector {\n consumer: Consumer;\n idsToEject: BitIds;\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 BitIds();\n this.failedComponents = {\n modifiedComponents: new BitIds(),\n stagedComponents: new BitIds(),\n notExportedComponents: new BitIds(),\n selfHostedExportedComponents: new BitIds(),\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 BitIds();\n this.componentsIds.forEach((componentId) => {\n const bitId = componentId._legacy;\n if (!bitId.hasScope()) 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.consumer.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 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,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,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,0BAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,yBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,iBAAA;EAAA,MAAAN,IAAA,GAAAO,uBAAA,CAAAN,OAAA;EAAAK,gBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,eAAA;EAAA,MAAAR,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAO,cAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,YAAA;EAAA,MAAAT,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAQ,WAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqF,SAAAU,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD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C9B,IAAI,CAACA,EAAE,CAACP,QAAQ,CAAC,CAAC,IAAI,CAACO,EAAE,CAACoC,UAAU,CAAC,CAAC,EAAE;QACtC,MAAM,IAAIjF,SAAS,CAAE,2DAA0D6C,EAAE,CAACO,QAAQ,CAAC,CAAE,EAAC,CAAC;MACjG;IACF,CAAC,CAAC;EACJ;AACF;AAAC8B,OAAA,CAAAhF,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_bitId","data","require","_defaultErrorHandler","_interopRequireDefault","_scopeRemotes","_componentIdToPackageName","packageJsonUtils","_interopRequireWildcard","_dataToPersist","_removePath","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ComponentsEjector","constructor","workspace","install","logger","componentsIds","ejectOptions","consumer","idsToEject","BitIds","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","_legacy","hasScope","push","isHub","force","Promise","all","map","id","componentStatus","getComponentStatusById","modified","staged","err","throwEjectError","toString","consoleSuccess","components","loadComponents","componentsToEject","action","packages","getPackagesToInstall","c","componentIdToPackageName","_buildExceptionMessageWithRollbackData","keepFiles","dataToPersist","DataToPersist","component","componentMap","Error","rootDir","removePath","RemovePath","addBasePath","getPath","persistAllToFS","cleanFromBitMap","message","originalError","originalErrorMessage","defaultErrorHandler","error","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 { BitIds } from '@teambit/legacy/dist/bit-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 { ComponentID } from '@teambit/component-id';\nimport { InstallMain } from '@teambit/install';\n\nexport type EjectResults = {\n ejectedComponents: BitIds;\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};\n\ntype FailedComponents = {\n modifiedComponents: BitIds;\n stagedComponents: BitIds;\n notExportedComponents: BitIds;\n selfHostedExportedComponents: BitIds;\n};\n\nexport class ComponentsEjector {\n consumer: Consumer;\n idsToEject: BitIds;\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 BitIds();\n this.failedComponents = {\n modifiedComponents: new BitIds(),\n stagedComponents: new BitIds(),\n notExportedComponents: new BitIds(),\n selfHostedExportedComponents: new BitIds(),\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 BitIds();\n this.componentsIds.forEach((componentId) => {\n const bitId = componentId._legacy;\n if (!bitId.hasScope()) 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.consumer.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 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,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,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,0BAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,yBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,iBAAA;EAAA,MAAAN,IAAA,GAAAO,uBAAA,CAAAN,OAAA;EAAAK,gBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,eAAA;EAAA,MAAAR,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAO,cAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,YAAA;EAAA,MAAAT,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAQ,WAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqF,SAAAU,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,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ACO,EAAE,CAACoC,UAAU,CAAC,CAAC,EAAE;QACtC,MAAM,IAAIjF,SAAS,CAAE,2DAA0D6C,EAAE,CAACO,QAAQ,CAAC,CAAE,EAAC,CAAC;MACjG;IACF,CAAC,CAAC;EACJ;AACF;AAAC8B,OAAA,CAAAhF,iBAAA,GAAAA,iBAAA"}
@@ -1,11 +1,9 @@
1
1
  import { Command, CommandOptions } from '@teambit/cli';
2
2
  import { Workspace } from '@teambit/workspace';
3
- import { Logger } from '@teambit/logger';
4
- import { InstallMain } from '@teambit/install';
3
+ import { EjectMain } from './eject.main.runtime';
5
4
  export declare class EjectCmd implements Command {
5
+ private ejectMain;
6
6
  private workspace;
7
- private logger;
8
- private install;
9
7
  name: string;
10
8
  description: string;
11
9
  extendedDescription: string;
@@ -19,7 +17,7 @@ export declare class EjectCmd implements Command {
19
17
  loader: boolean;
20
18
  migration: boolean;
21
19
  group: string;
22
- constructor(workspace: Workspace, logger: Logger, install: InstallMain);
20
+ constructor(ejectMain: EjectMain, workspace: Workspace);
23
21
  report([pattern]: [string], { force, json, keepFiles }: {
24
22
  force: boolean;
25
23
  json: boolean;
package/dist/eject-cmd.js CHANGED
@@ -4,20 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.EjectCmd = void 0;
7
- function _workspace() {
8
- const data = require("@teambit/workspace");
9
- _workspace = function () {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _ejectTemplate() {
15
- const data = _interopRequireDefault(require("@teambit/legacy/dist/cli/templates/eject-template"));
16
- _ejectTemplate = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
7
  function _constants() {
22
8
  const data = require("@teambit/legacy/dist/constants");
23
9
  _constants = function () {
@@ -25,22 +11,20 @@ function _constants() {
25
11
  };
26
12
  return data;
27
13
  }
28
- function _componentsEjector() {
29
- const data = require("./components-ejector");
30
- _componentsEjector = function () {
14
+ function _ejectTemplate() {
15
+ const data = require("./eject-template");
16
+ _ejectTemplate = function () {
31
17
  return data;
32
18
  };
33
19
  return data;
34
20
  }
35
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
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; }
37
22
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
38
23
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
39
24
  class EjectCmd {
40
- constructor(workspace, logger, install) {
25
+ constructor(ejectMain, workspace) {
26
+ this.ejectMain = ejectMain;
41
27
  this.workspace = workspace;
42
- this.logger = logger;
43
- this.install = install;
44
28
  _defineProperty(this, "name", 'eject <component-pattern>');
45
29
  _defineProperty(this, "description", 'remove component from the workspace and install it instead as a regular npm package.');
46
30
  _defineProperty(this, "extendedDescription", 'By default the component files will be removed from the workspace');
@@ -60,15 +44,13 @@ class EjectCmd {
60
44
  json = false,
61
45
  keepFiles = false
62
46
  }) {
63
- if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
64
47
  const componentIds = await this.workspace.idsByPattern(pattern);
65
- const componentEjector = new (_componentsEjector().ComponentsEjector)(this.workspace, this.install, this.logger, componentIds, {
48
+ const ejectResults = await this.ejectMain.eject(componentIds, {
66
49
  force,
67
50
  keepFiles
68
51
  });
69
- const ejectResults = await componentEjector.eject();
70
52
  if (json) return JSON.stringify(ejectResults, null, 2);
71
- return (0, _ejectTemplate().default)(ejectResults);
53
+ return (0, _ejectTemplate().ejectTemplate)(ejectResults);
72
54
  }
73
55
  }
74
56
  exports.EjectCmd = EjectCmd;
@@ -1 +1 @@
1
- {"version":3,"names":["_workspace","data","require","_ejectTemplate","_interopRequireDefault","_constants","_componentsEjector","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","EjectCmd","constructor","workspace","logger","install","name","description","COMPONENT_PATTERN_HELP","report","pattern","force","json","keepFiles","OutsideWorkspaceError","componentIds","idsByPattern","componentEjector","ComponentsEjector","ejectResults","eject","JSON","stringify","ejectTemplate","exports"],"sources":["eject-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport ejectTemplate from '@teambit/legacy/dist/cli/templates/eject-template';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Logger } from '@teambit/logger';\nimport { InstallMain } from '@teambit/install';\nimport { ComponentsEjector } from './components-ejector';\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 ['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 migration = true;\n group = 'development';\n\n constructor(private workspace: Workspace, private logger: Logger, private install: InstallMain) {}\n\n async report(\n [pattern]: [string],\n { force = false, json = false, keepFiles = false }: { force: boolean; json: boolean; keepFiles: boolean }\n ): Promise<string> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentIds = await this.workspace.idsByPattern(pattern);\n const componentEjector = new ComponentsEjector(this.workspace, this.install, this.logger, componentIds, {\n force,\n keepFiles,\n });\n const ejectResults = await componentEjector.eject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B,GAAG,KAAIC,sCAAiB,EAAC,IAAI,CAACf,SAAS,EAAE,IAAI,CAACE,OAAO,EAAE,IAAI,CAACD,MAAM,EAAEW,YAAY,EAAE;MACtGJ,KAAK;MACLE;IACF,CAAC,CAAC;IACF,MAAMM,YAAY,GAAG,MAAMF,gBAAgB,CAACG,KAAK,CAAC,CAAC;IACnD,IAAIR,IAAI,EAAE,OAAOS,IAAI,CAACC,SAAS,CAACH,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,IAAAI,wBAAa,EAACJ,YAAY,CAAC;EACpC;AACF;AAACK,OAAA,CAAAvB,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["_constants","data","require","_ejectTemplate","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","EjectCmd","constructor","ejectMain","workspace","name","description","COMPONENT_PATTERN_HELP","report","pattern","force","json","keepFiles","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 ['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 migration = true;\n group = 'development';\n\n constructor(private ejectMain: EjectMain, private workspace: Workspace) {}\n\n async report(\n [pattern]: [string],\n { force = false, json = false, keepFiles = false }: { force: boolean; json: boolean; keepFiles: boolean }\n ): Promise<string> {\n const componentIds = await this.workspace.idsByPattern(pattern);\n const ejectResults = await this.ejectMain.eject(componentIds, { force, keepFiles });\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,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE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}
@@ -0,0 +1,4 @@
1
+ import { EjectResults } from './components-ejector';
2
+ export declare const successEjectMessage = "successfully ejected the following components";
3
+ export declare const failureEjectMessage = "failed to eject the following components";
4
+ export declare function ejectTemplate(ejectResults: EjectResults): string;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ejectTemplate = ejectTemplate;
7
+ exports.successEjectMessage = exports.failureEjectMessage = void 0;
8
+ function _chalk() {
9
+ const data = _interopRequireDefault(require("chalk"));
10
+ _chalk = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
15
+ function _constants() {
16
+ const data = require("@teambit/legacy/dist/constants");
17
+ _constants = function () {
18
+ return data;
19
+ };
20
+ return data;
21
+ }
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+ const successEjectMessage = 'successfully ejected the following components';
24
+ exports.successEjectMessage = successEjectMessage;
25
+ const failureEjectMessage = 'failed to eject the following components';
26
+ exports.failureEjectMessage = failureEjectMessage;
27
+ function ejectTemplate(ejectResults) {
28
+ const getEjectedOutput = () => {
29
+ if (!ejectResults.ejectedComponents.length) return '';
30
+ return _chalk().default.green(`${successEjectMessage} ${_chalk().default.bold(ejectResults.ejectedComponents.toString())}\n`);
31
+ };
32
+ const getFailureOutput = () => {
33
+ const failures = ejectResults.failedComponents;
34
+ const title = _chalk().default.red(`${failureEjectMessage}\n`);
35
+ const modified = failures.modifiedComponents.length ? `stopped the eject process for the following components because they have local changes.
36
+ ${_chalk().default.bold(failures.modifiedComponents.toString())}
37
+ ejecting modified components discards all local, unstaged, changes.
38
+ use 'bit diff <component id>' to see the changes and decide if to 'bit tag' them or not.
39
+ use the '--force' flag to discard local modifications and proceed with the eject process.\n` : '';
40
+ const staged = failures.stagedComponents.length ? `components with local versions (use --force to ignore): ${failures.stagedComponents.toString()}\n` : '';
41
+ const notExported = failures.notExportedComponents.length ? `local components that were not exported yet: ${failures.notExportedComponents.toString()}\n` : '';
42
+ const selfHosted = failures.selfHostedExportedComponents.length ? `components that were exported to a self hosted scope (not ${(0, _constants().getCloudDomain)()}): ${failures.selfHostedExportedComponents.toString()}\n` : '';
43
+ const body = modified + staged + notExported + selfHosted;
44
+ if (body) return _chalk().default.underline(title) + _chalk().default.red(body);
45
+ return '';
46
+ };
47
+ return getEjectedOutput() + getFailureOutput();
48
+ }
49
+
50
+ //# sourceMappingURL=eject-template.js.map
@@ -0,0 +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,GAAG,+CAA+C;AAACC,OAAA,CAAAD,mBAAA,GAAAA,mBAAA;AAC5E,MAAME,mBAAmB,GAAG,0CAA0C;AAACD,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAEvE,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"}
@@ -1,8 +1,15 @@
1
1
  import { CLIMain } from '@teambit/cli';
2
- import { LoggerMain } from '@teambit/logger';
2
+ import { ComponentID } from '@teambit/component-id';
3
+ import { Logger, LoggerMain } from '@teambit/logger';
3
4
  import { Workspace } from '@teambit/workspace';
4
5
  import { InstallMain } from '@teambit/install';
6
+ import { EjectOptions, EjectResults } from './components-ejector';
5
7
  export declare class EjectMain {
8
+ private workspace;
9
+ private install;
10
+ private logger;
11
+ constructor(workspace: Workspace, install: InstallMain, logger: Logger);
12
+ eject(componentIds: ComponentID[], ejectOptions?: EjectOptions): Promise<EjectResults>;
6
13
  static runtime: import("@teambit/harmony").RuntimeDefinition;
7
14
  static dependencies: import("@teambit/harmony").Aspect[];
8
15
  static provider([cli, workspace, loggerMain, install]: [CLIMain, Workspace, LoggerMain, InstallMain]): Promise<EjectMain>;
@@ -19,7 +19,7 @@ function _logger() {
19
19
  return data;
20
20
  }
21
21
  function _workspace() {
22
- const data = _interopRequireDefault(require("@teambit/workspace"));
22
+ const data = _interopRequireWildcard(require("@teambit/workspace"));
23
23
  _workspace = function () {
24
24
  return data;
25
25
  };
@@ -46,15 +46,34 @@ function _eject() {
46
46
  };
47
47
  return data;
48
48
  }
49
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
+ function _componentsEjector() {
50
+ const data = require("./components-ejector");
51
+ _componentsEjector = function () {
52
+ return data;
53
+ };
54
+ return data;
55
+ }
56
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
57
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
50
58
  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; }
51
59
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
52
60
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
53
61
  class EjectMain {
62
+ constructor(workspace, install, logger) {
63
+ this.workspace = workspace;
64
+ this.install = install;
65
+ this.logger = logger;
66
+ }
67
+ async eject(componentIds, ejectOptions = {}) {
68
+ if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
69
+ const componentEjector = new (_componentsEjector().ComponentsEjector)(this.workspace, this.install, this.logger, componentIds, ejectOptions);
70
+ return componentEjector.eject();
71
+ }
54
72
  static async provider([cli, workspace, loggerMain, install]) {
55
73
  const logger = loggerMain.createLogger(_eject().EjectAspect.id);
56
- cli.register(new (_ejectCmd().EjectCmd)(workspace, logger, install));
57
- return new EjectMain();
74
+ const ejectMain = new EjectMain(workspace, install, logger);
75
+ cli.register(new (_ejectCmd().EjectCmd)(ejectMain, workspace));
76
+ return ejectMain;
58
77
  }
59
78
  }
60
79
  exports.EjectMain = EjectMain;
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_logger","_workspace","_interopRequireDefault","_install","_ejectCmd","_eject","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","EjectMain","provider","cli","workspace","loggerMain","install","logger","createLogger","EjectAspect","id","register","EjectCmd","exports","MainRuntime","CLIAspect","WorkspaceAspect","LoggerAspect","InstallAspect","addRuntime"],"sources":["eject.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { EjectCmd } from './eject-cmd';\nimport { EjectAspect } from './eject.aspect';\n\nexport class EjectMain {\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 cli.register(new EjectCmd(workspace, logger, install));\n\n return new 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;AACA,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,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,MAAA,YAAAA,C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,CAAC;EACxB;AACF;AAACY,OAAA,CAAAZ,SAAA,GAAAA,SAAA;AAAAtB,eAAA,CAXYsB,SAAS,aACHa,kBAAW;AAAAnC,eAAA,CADjBsB,SAAS,kBAGE,CAACc,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wBAAa,CAAC;AAUjFT,oBAAW,CAACU,UAAU,CAAClB,SAAS,CAAC"}
1
+ {"version":3,"names":["_cli","data","require","_logger","_workspace","_interopRequireWildcard","_install","_ejectCmd","_eject","_componentsEjector","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","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,GAAAI,uBAAA,CAAAH,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,mBAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,kBAAA,YAAAA,CAAA;IAAA,OAAAR,I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AEV,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;AAAAlB,eAAA,CAzBYkB,SAAS,aAcHqB,kBAAW;AAAAvC,eAAA,CAdjBkB,SAAS,kBAgBE,CAACsB,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wBAAa,CAAC;AAWjFV,oBAAW,CAACW,UAAU,CAAC1B,SAAS,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export type { EjectMain } from './eject.main.runtime';
2
+ export type { EjectResults } from './components-ejector';
3
+ export { successEjectMessage, ejectTemplate } from './eject-template';
2
4
  export { EjectAspect } from './eject.aspect';
package/dist/index.js CHANGED
@@ -9,6 +9,25 @@ Object.defineProperty(exports, "EjectAspect", {
9
9
  return _eject().EjectAspect;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "ejectTemplate", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _ejectTemplate().ejectTemplate;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "successEjectMessage", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _ejectTemplate().successEjectMessage;
22
+ }
23
+ });
24
+ function _ejectTemplate() {
25
+ const data = require("./eject-template");
26
+ _ejectTemplate = function () {
27
+ return data;
28
+ };
29
+ return data;
30
+ }
12
31
  function _eject() {
13
32
  const data = require("./eject.aspect");
14
33
  _eject = function () {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_eject","data","require"],"sources":["index.ts"],"sourcesContent":["export type { EjectMain } from './eject.main.runtime';\nexport { EjectAspect } from './eject.aspect';\n"],"mappings":";;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA"}
1
+ {"version":3,"names":["_ejectTemplate","data","require","_eject"],"sources":["index.ts"],"sourcesContent":["export type { EjectMain } from './eject.main.runtime';\nexport type { EjectResults } from './components-ejector';\nexport { successEjectMessage, ejectTemplate } from './eject-template';\nexport { EjectAspect } from './eject.aspect';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_eject@1.0.20/dist/eject.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_eject@1.0.20/dist/eject.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_eject@1.0.21/dist/eject.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_eject@1.0.21/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,22 +1,23 @@
1
1
  {
2
2
  "name": "@teambit/eject",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
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.20"
9
+ "version": "1.0.21"
10
10
  },
11
11
  "dependencies": {
12
+ "chalk": "2.4.2",
12
13
  "core-js": "^3.0.0",
13
14
  "@babel/runtime": "7.20.0",
14
- "@teambit/component-id": "0.0.427",
15
15
  "@teambit/harmony": "0.4.6",
16
- "@teambit/install": "1.0.20",
17
- "@teambit/logger": "0.0.890",
18
- "@teambit/workspace": "1.0.20",
19
- "@teambit/cli": "0.0.797"
16
+ "@teambit/component-id": "1.0.1",
17
+ "@teambit/install": "1.0.21",
18
+ "@teambit/logger": "0.0.891",
19
+ "@teambit/workspace": "1.0.21",
20
+ "@teambit/cli": "0.0.798"
20
21
  },
21
22
  "devDependencies": {
22
23
  "@types/react": "^17.0.8",
@@ -27,7 +28,7 @@
27
28
  "@types/testing-library__jest-dom": "5.9.5"
28
29
  },
29
30
  "peerDependencies": {
30
- "@teambit/legacy": "1.0.576",
31
+ "@teambit/legacy": "1.0.577",
31
32
  "react": "^16.8.0 || ^17.0.0",
32
33
  "react-dom": "^16.8.0 || ^17.0.0"
33
34
  },