@teambit/remove 0.0.190 → 0.0.192
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.
|
@@ -159,6 +159,10 @@ class RemoveMain {
|
|
|
159
159
|
}
|
|
160
160
|
async softRemove(componentsPattern) {
|
|
161
161
|
if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
|
|
162
|
+
const currentLane = await this.workspace.getCurrentLaneObject();
|
|
163
|
+
if (currentLane !== null && currentLane !== void 0 && currentLane.isNew) {
|
|
164
|
+
throw new (_bitError().BitError)(`unable to soft-remove on a new (not-exported) lane "${currentLane.name}". please remove without --soft`);
|
|
165
|
+
}
|
|
162
166
|
const componentIds = await this.workspace.idsByPattern(componentsPattern);
|
|
163
167
|
const components = await this.workspace.getMany(componentIds);
|
|
164
168
|
const newComps = components.filter(c => !c.id.hasVersion());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BEFORE_REMOVE","RemoveMain","constructor","workspace","logger","remove","componentsPattern","force","remote","track","deleteFiles","fromLane","setStatusLine","bitIds","getRemoteBitIdsToRemove","getLocalBitIdsToRemove","consumer","removeResults","removeComponents","ids","BitIds","fromArray","onDestroy","softRemove","ConsumerNotFound","componentIds","idsByPattern","components","getMany","newComps","filter","c","id","hasVersion","length","BitError","map","toString","join","throwForMainComponentWhenOnLane","removeComponentsFromNodeModules","state","_consumer","compId","bitMap","addComponentConfig","RemoveAspect","removed","write","_legacy","deleteComponentsFiles","currentLane","getCurrentLaneObject","laneComps","toBitIds","mainComps","comp","hasWithoutVersion","getRemoveInfo","component","data","config","extensions","findExtension","isRemoved","getRemovedStaged","stagedConfig","scope","getStagedConfig","getAll","compConfig","hasWildcard","getRemoteBitIdsByWildcards","BitId","parse","provider","cli","loggerMain","componentAspect","createLogger","removeMain","registerShowFragments","RemoveFragment","register","RemoveCmd","WorkspaceAspect","CLIAspect","LoggerAspect","ComponentAspect","MainRuntime","addRuntime"],"sources":["remove.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport { getRemoteBitIdsByWildcards } from '@teambit/legacy/dist/api/consumer/lib/list-scope';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport ComponentAspect, { Component, ComponentMain } from '@teambit/component';\nimport { removeComponentsFromNodeModules } from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport { RemoveCmd } from './remove-cmd';\nimport { removeComponents } from './remove-components';\nimport { RemoveAspect } from './remove.aspect';\nimport { RemoveFragment } from './remove.fragment';\n\nconst BEFORE_REMOVE = 'removing components';\n\nexport type RemoveInfo = {\n removed: boolean;\n};\n\nexport class RemoveMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\n\n async remove({\n componentsPattern,\n force,\n remote,\n track,\n deleteFiles,\n fromLane,\n }: {\n componentsPattern: string;\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: boolean;\n fromLane: boolean;\n }): Promise<any> {\n this.logger.setStatusLine(BEFORE_REMOVE);\n const bitIds = remote\n ? await this.getRemoteBitIdsToRemove(componentsPattern)\n : await this.getLocalBitIdsToRemove(componentsPattern);\n this.logger.setStatusLine(BEFORE_REMOVE); // again because the loader might changed when talking to the remote\n const consumer = this.workspace?.consumer;\n const removeResults = await removeComponents({\n consumer,\n ids: BitIds.fromArray(bitIds),\n force,\n remote,\n track,\n deleteFiles,\n fromLane,\n });\n if (consumer) await consumer.onDestroy();\n return removeResults;\n }\n\n async softRemove(componentsPattern: string): Promise<ComponentID[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n const components = await this.workspace.getMany(componentIds);\n const newComps = components.filter((c) => !c.id.hasVersion());\n if (newComps.length) {\n throw new BitError(\n `unable to soft-remove the following new component(s), please remove them without --soft\\n${newComps\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n }\n await this.throwForMainComponentWhenOnLane(components);\n await removeComponentsFromNodeModules(\n this.workspace.consumer,\n components.map((c) => c.state._consumer)\n );\n // don't use `this.workspace.addSpecificComponentConfig`, if the component has component.json it will be deleted\n // during this removal along with the entire component dir.\n componentIds.map((compId) =>\n this.workspace.bitMap.addComponentConfig(compId, RemoveAspect.id, {\n removed: true,\n })\n );\n await this.workspace.bitMap.write();\n const bitIds = BitIds.fromArray(componentIds.map((id) => id._legacy));\n await deleteComponentsFiles(this.workspace.consumer, bitIds);\n\n return componentIds;\n }\n\n private async throwForMainComponentWhenOnLane(components: Component[]) {\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (!currentLane) return; // user on main\n const laneComps = currentLane.toBitIds();\n const mainComps = components.filter((comp) => !laneComps.hasWithoutVersion(comp.id._legacy));\n if (mainComps.length) {\n throw new BitError(`the following components belong to main, they cannot be soft-removed when on a lane. consider removing them without --soft.\n${mainComps.map((c) => c.id.toString()).join('\\n')}`);\n }\n }\n\n getRemoveInfo(component: Component): RemoveInfo {\n const data = component.config.extensions.findExtension(RemoveAspect.id)?.config as RemoveInfo | undefined;\n return {\n removed: data?.removed || false,\n };\n }\n\n isRemoved(component: Component): boolean {\n return this.getRemoveInfo(component).removed;\n }\n\n /**\n * get components that were soft-removed and tagged/snapped but not exported yet.\n */\n async getRemovedStaged(): Promise<ComponentID[]> {\n const stagedConfig = await this.workspace.scope.getStagedConfig();\n return stagedConfig\n .getAll()\n .filter((compConfig) => compConfig.config?.[RemoveAspect.id]?.removed)\n .map((compConfig) => compConfig.id);\n }\n\n private async getLocalBitIdsToRemove(componentsPattern: string): Promise<BitId[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n return componentIds.map((id) => id._legacy);\n }\n\n private async getRemoteBitIdsToRemove(componentsPattern: string): Promise<BitId[]> {\n if (hasWildcard(componentsPattern)) {\n return getRemoteBitIdsByWildcards(componentsPattern);\n }\n return [BitId.parse(componentsPattern, true)];\n }\n\n static slots = [];\n static dependencies = [WorkspaceAspect, CLIAspect, LoggerAspect, ComponentAspect];\n static runtime = MainRuntime;\n\n static async provider([workspace, cli, loggerMain, componentAspect]: [\n Workspace,\n CLIMain,\n LoggerMain,\n ComponentMain\n ]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, logger);\n componentAspect.registerShowFragments([new RemoveFragment(removeMain)]);\n cli.register(new RemoveCmd(removeMain));\n return new RemoveMain(workspace, logger);\n }\n}\n\nRemoveAspect.addRuntime(RemoveMain);\n\nexport default RemoveMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA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ructor","workspace","logger","remove","componentsPattern","force","remote","track","deleteFiles","fromLane","setStatusLine","bitIds","getRemoteBitIdsToRemove","getLocalBitIdsToRemove","consumer","removeResults","removeComponents","ids","BitIds","fromArray","onDestroy","softRemove","ConsumerNotFound","currentLane","getCurrentLaneObject","isNew","BitError","name","componentIds","idsByPattern","components","getMany","newComps","filter","c","id","hasVersion","length","map","toString","join","throwForMainComponentWhenOnLane","removeComponentsFromNodeModules","state","_consumer","compId","bitMap","addComponentConfig","RemoveAspect","removed","write","_legacy","deleteComponentsFiles","laneComps","toBitIds","mainComps","comp","hasWithoutVersion","getRemoveInfo","component","data","config","extensions","findExtension","isRemoved","getRemovedStaged","stagedConfig","scope","getStagedConfig","getAll","compConfig","hasWildcard","getRemoteBitIdsByWildcards","BitId","parse","provider","cli","loggerMain","componentAspect","createLogger","removeMain","registerShowFragments","RemoveFragment","register","RemoveCmd","WorkspaceAspect","CLIAspect","LoggerAspect","ComponentAspect","MainRuntime","addRuntime"],"sources":["remove.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport { getRemoteBitIdsByWildcards } from '@teambit/legacy/dist/api/consumer/lib/list-scope';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files';\nimport ComponentAspect, { Component, ComponentMain } from '@teambit/component';\nimport { removeComponentsFromNodeModules } from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport { RemoveCmd } from './remove-cmd';\nimport { removeComponents } from './remove-components';\nimport { RemoveAspect } from './remove.aspect';\nimport { RemoveFragment } from './remove.fragment';\n\nconst BEFORE_REMOVE = 'removing components';\n\nexport type RemoveInfo = {\n removed: boolean;\n};\n\nexport class RemoveMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\n\n async remove({\n componentsPattern,\n force,\n remote,\n track,\n deleteFiles,\n fromLane,\n }: {\n componentsPattern: string;\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: boolean;\n fromLane: boolean;\n }): Promise<any> {\n this.logger.setStatusLine(BEFORE_REMOVE);\n const bitIds = remote\n ? await this.getRemoteBitIdsToRemove(componentsPattern)\n : await this.getLocalBitIdsToRemove(componentsPattern);\n this.logger.setStatusLine(BEFORE_REMOVE); // again because the loader might changed when talking to the remote\n const consumer = this.workspace?.consumer;\n const removeResults = await removeComponents({\n consumer,\n ids: BitIds.fromArray(bitIds),\n force,\n remote,\n track,\n deleteFiles,\n fromLane,\n });\n if (consumer) await consumer.onDestroy();\n return removeResults;\n }\n\n async softRemove(componentsPattern: string): Promise<ComponentID[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (currentLane?.isNew) {\n throw new BitError(\n `unable to soft-remove on a new (not-exported) lane \"${currentLane.name}\". please remove without --soft`\n );\n }\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n const components = await this.workspace.getMany(componentIds);\n const newComps = components.filter((c) => !c.id.hasVersion());\n if (newComps.length) {\n throw new BitError(\n `unable to soft-remove the following new component(s), please remove them without --soft\\n${newComps\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n }\n await this.throwForMainComponentWhenOnLane(components);\n await removeComponentsFromNodeModules(\n this.workspace.consumer,\n components.map((c) => c.state._consumer)\n );\n // don't use `this.workspace.addSpecificComponentConfig`, if the component has component.json it will be deleted\n // during this removal along with the entire component dir.\n componentIds.map((compId) =>\n this.workspace.bitMap.addComponentConfig(compId, RemoveAspect.id, {\n removed: true,\n })\n );\n await this.workspace.bitMap.write();\n const bitIds = BitIds.fromArray(componentIds.map((id) => id._legacy));\n await deleteComponentsFiles(this.workspace.consumer, bitIds);\n\n return componentIds;\n }\n\n private async throwForMainComponentWhenOnLane(components: Component[]) {\n const currentLane = await this.workspace.getCurrentLaneObject();\n if (!currentLane) return; // user on main\n const laneComps = currentLane.toBitIds();\n const mainComps = components.filter((comp) => !laneComps.hasWithoutVersion(comp.id._legacy));\n if (mainComps.length) {\n throw new BitError(`the following components belong to main, they cannot be soft-removed when on a lane. consider removing them without --soft.\n${mainComps.map((c) => c.id.toString()).join('\\n')}`);\n }\n }\n\n getRemoveInfo(component: Component): RemoveInfo {\n const data = component.config.extensions.findExtension(RemoveAspect.id)?.config as RemoveInfo | undefined;\n return {\n removed: data?.removed || false,\n };\n }\n\n isRemoved(component: Component): boolean {\n return this.getRemoveInfo(component).removed;\n }\n\n /**\n * get components that were soft-removed and tagged/snapped but not exported yet.\n */\n async getRemovedStaged(): Promise<ComponentID[]> {\n const stagedConfig = await this.workspace.scope.getStagedConfig();\n return stagedConfig\n .getAll()\n .filter((compConfig) => compConfig.config?.[RemoveAspect.id]?.removed)\n .map((compConfig) => compConfig.id);\n }\n\n private async getLocalBitIdsToRemove(componentsPattern: string): Promise<BitId[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(componentsPattern);\n return componentIds.map((id) => id._legacy);\n }\n\n private async getRemoteBitIdsToRemove(componentsPattern: string): Promise<BitId[]> {\n if (hasWildcard(componentsPattern)) {\n return getRemoteBitIdsByWildcards(componentsPattern);\n }\n return [BitId.parse(componentsPattern, true)];\n }\n\n static slots = [];\n static dependencies = [WorkspaceAspect, CLIAspect, LoggerAspect, ComponentAspect];\n static runtime = MainRuntime;\n\n static async provider([workspace, cli, loggerMain, componentAspect]: [\n Workspace,\n CLIMain,\n LoggerMain,\n ComponentMain\n ]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, logger);\n componentAspect.registerShowFragments([new RemoveFragment(removeMain)]);\n cli.register(new RemoveCmd(removeMain));\n return new RemoveMain(workspace, logger);\n }\n}\n\nRemoveAspect.addRuntime(RemoveMain);\n\nexport default RemoveMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA,MAAMA,aAAa,GAAG,qBAAqB;AAMpC,MAAMC,UAAU,CAAC;EACtBC,WAAW,CAASC,SAAoB,EAAUC,MAAc,EAAE;IAAA,KAA9CD,SAAoB,GAApBA,SAAoB;IAAA,KAAUC,MAAc,GAAdA,MAAc;EAAG;EAEnE,MAAMC,MAAM,CAAC;IACXC,iBAAiB;IACjBC,KAAK;IACLC,MAAM;IACNC,KAAK;IACLC,WAAW;IACXC;EAQF,CAAC,EAAgB;IAAA;IACf,IAAI,CAACP,MAAM,CAACQ,aAAa,CAACZ,aAAa,CAAC;IACxC,MAAMa,MAAM,GAAGL,MAAM,GACjB,MAAM,IAAI,CAACM,uBAAuB,C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AI,IAAAmE,sBAAW,EAACnE,iBAAiB,CAAC,EAAE;MAClC,OAAO,IAAAoE,uCAA0B,EAACpE,iBAAiB,CAAC;IACtD;IACA,OAAO,CAACqE,oBAAK,CAACC,KAAK,CAACtE,iBAAiB,EAAE,IAAI,CAAC,CAAC;EAC/C;EAMA,aAAauE,QAAQ,CAAC,CAAC1E,SAAS,EAAE2E,GAAG,EAAEC,UAAU,EAAEC,eAAe,CAKjE,EAAE;IACD,MAAM5E,MAAM,GAAG2E,UAAU,CAACE,YAAY,CAAC/B,sBAAY,CAACb,EAAE,CAAC;IACvD,MAAM6C,UAAU,GAAG,IAAIjF,UAAU,CAACE,SAAS,EAAEC,MAAM,CAAC;IACpD4E,eAAe,CAACG,qBAAqB,CAAC,CAAC,KAAIC,yBAAc,EAACF,UAAU,CAAC,CAAC,CAAC;IACvEJ,GAAG,CAACO,QAAQ,CAAC,KAAIC,sBAAS,EAACJ,UAAU,CAAC,CAAC;IACvC,OAAO,IAAIjF,UAAU,CAACE,SAAS,EAAEC,MAAM,CAAC;EAC1C;AACF;AAAC;AAAA,gCAxIYH,UAAU,WAwHN,EAAE;AAAA,gCAxHNA,UAAU,kBAyHC,CAACsF,oBAAe,EAAEC,gBAAS,EAAEC,sBAAY,EAAEC,oBAAe,CAAC;AAAA,gCAzHtEzF,UAAU,aA0HJ0F,kBAAW;AAgB9BzC,sBAAY,CAAC0C,UAAU,CAAC3F,UAAU,CAAC;AAAC,eAErBA,UAAU;AAAA"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/remove",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.192",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/component/remove",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "remove",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.192"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"@babel/runtime": "7.20.0",
|
|
20
20
|
"@teambit/harmony": "0.4.6",
|
|
21
21
|
"@teambit/bit-error": "0.0.402",
|
|
22
|
-
"@teambit/cli": "0.0.
|
|
23
|
-
"@teambit/component": "0.0.
|
|
22
|
+
"@teambit/cli": "0.0.679",
|
|
23
|
+
"@teambit/component": "0.0.1015",
|
|
24
24
|
"@teambit/component-id": "0.0.427",
|
|
25
25
|
"@teambit/legacy-bit-id": "0.0.423",
|
|
26
|
-
"@teambit/logger": "0.0.
|
|
27
|
-
"@teambit/workspace": "0.0.
|
|
26
|
+
"@teambit/logger": "0.0.772",
|
|
27
|
+
"@teambit/workspace": "0.0.1015"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/mocha": "9.1.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/testing-library__jest-dom": "5.9.5"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@teambit/legacy": "1.0.
|
|
38
|
+
"@teambit/legacy": "1.0.458",
|
|
39
39
|
"react": "^16.8.0 || ^17.0.0",
|
|
40
40
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
41
41
|
},
|
|
Binary file
|
|
File without changes
|