@teambit/remove 1.0.487 → 1.0.489
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.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/schema.json +516 -183
- package/dist/delete-cmd.js +4 -4
- package/dist/delete-cmd.js.map +1 -1
- package/dist/delete-component-files.d.ts +1 -1
- package/dist/delete-component-files.js +5 -6
- package/dist/delete-component-files.js.map +1 -1
- package/dist/remove-cmd.js +4 -4
- package/dist/remove-cmd.js.map +1 -1
- package/dist/remove-components.d.ts +3 -3
- package/dist/remove-components.js +28 -35
- package/dist/remove-components.js.map +1 -1
- package/dist/remove.main.runtime.js +13 -13
- package/dist/remove.main.runtime.js.map +1 -1
- package/dist/removed-local-objects.d.ts +1 -1
- package/dist/removed-local-objects.js +4 -5
- package/dist/removed-local-objects.js.map +1 -1
- package/package.json +23 -16
- /package/dist/{preview-1733714450424.js → preview-1733851236714.js} +0 -0
package/dist/delete-cmd.js
CHANGED
|
@@ -25,9 +25,9 @@ function _bitError() {
|
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const data = require("@teambit/legacy
|
|
30
|
-
|
|
28
|
+
function _legacy() {
|
|
29
|
+
const data = require("@teambit/legacy.constants");
|
|
30
|
+
_legacy = function () {
|
|
31
31
|
return data;
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
@@ -54,7 +54,7 @@ this command marks the components as deleted, and after snap/tag and export they
|
|
|
54
54
|
`);
|
|
55
55
|
_defineProperty(this, "arguments", [{
|
|
56
56
|
name: 'component-pattern',
|
|
57
|
-
description:
|
|
57
|
+
description: _legacy().COMPONENT_PATTERN_HELP
|
|
58
58
|
}]);
|
|
59
59
|
_defineProperty(this, "group", 'collaborate');
|
|
60
60
|
_defineProperty(this, "helpUrl", 'reference/components/removing-components');
|
package/dist/delete-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","_legacy","_removeTemplate","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DeleteCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","report","componentsPattern","force","lane","updateMain","hard","silent","range","isOnLane","BitError","isOnMain","removePrompt","localResult","remoteResult","remote","localMessage","removeTemplate","paintArray","removedComps","deleteComps","removedCompIds","map","comp","id","toString","chalk","green","join","bold","removedObjectsArray","item","logger","clearStatusLine","laneOrMainWarning","remoteOrLocalOutput","ok","yesno","question","exports"],"sources":["delete-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport yesno from 'yesno';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport { RemovedObjects } from '@teambit/legacy.scope';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport { RemoveMain } from './remove.main.runtime';\nimport { removeTemplate } from './remove-template';\n\nexport class DeleteCmd implements Command {\n name = 'delete <component-pattern>';\n description = 'mark components as deleted on the remote';\n extendedDescription = `to remove components from your local workspace only, use \"bit remove\" command.\nthis command marks the components as deleted, and after snap/tag and export they will be marked as deleted from the remote scope as well.\n`;\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'collaborate';\n helpUrl = 'reference/components/removing-components';\n skipWorkspace = true;\n alias = '';\n options = [\n ['', 'lane', 'when on a lane, delete the component from this lane only. avoid merging it to main or other lanes'],\n ['', 'update-main', 'delete component/s on the main lane after merging this lane into main'],\n [\n '',\n 'range <string>',\n 'EXPERIMENTAL. enter a Semver range to delete specific tags (cannot be used for snaps). see https://www.npmjs.com/package/semver#ranges for the range syntax',\n ],\n ['s', 'silent', 'skip confirmation'],\n [\n '',\n 'hard',\n 'NOT-RECOMMENDED. delete a component completely from a remote scope. careful! this is a permanent change that could corrupt dependents.',\n ],\n [\n 'f',\n 'force',\n 'relevant for --hard. allow the deletion even if used as a dependency. WARNING: components that depend on this component will corrupt',\n ],\n ] as CommandOptions;\n loader = true;\n remoteOp = true;\n\n constructor(\n private remove: RemoveMain,\n private workspace?: Workspace\n ) {}\n\n async report(\n [componentsPattern]: [string],\n {\n force = false,\n lane = false,\n updateMain = false,\n hard = false,\n silent = false,\n range,\n }: {\n force?: boolean;\n lane?: boolean;\n updateMain?: boolean;\n hard?: boolean;\n silent?: boolean;\n range?: string;\n }\n ) {\n if (this.workspace?.isOnLane() && !hard && !lane && !updateMain) {\n throw new BitError(`error: to delete components when on a lane, use --lane flag`);\n }\n if (this.workspace?.isOnMain() && updateMain) {\n throw new BitError(`--update-main is relevant only when on a lane`);\n }\n\n if (!silent) {\n await this.removePrompt(hard, lane);\n }\n\n if (hard) {\n if (range) throw new BitError(`--range is not supported with --hard flag`);\n const { localResult, remoteResult = [] } = await this.remove.remove({ componentsPattern, remote: true, force });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n let localMessage = removeTemplate(localResult, false);\n if (localMessage !== '') localMessage += '\\n';\n return `${localMessage}${this.paintArray(remoteResult)}`;\n }\n\n const removedComps = await this.remove.deleteComps(componentsPattern, { updateMain, range });\n const removedCompIds = removedComps.map((comp) => comp.id.toString());\n return `${chalk.green('successfully deleted the following components:')}\n${removedCompIds.join('\\n')}\n\n${chalk.bold('to update the remote, please tag/snap and then export. to revert, please use \"bit recover\"')}`;\n }\n\n private paintArray(removedObjectsArray: RemovedObjects[]) {\n return removedObjectsArray.map((item) => removeTemplate(item, true));\n }\n\n private async removePrompt(hard?: boolean, lane?: boolean) {\n this.remove.logger.clearStatusLine();\n const laneOrMainWarning = lane\n ? `this command will mark the component as removed from this lane, resetting the component to its pre-lane state and content (after tag/snap and export)`\n : `this command will mark the component as deleted, and it won’t be visible on the remote scope (after tag/snap and export).`;\n const remoteOrLocalOutput = hard\n ? `WARNING: the component(s) will be permanently deleted from the remote with no option to recover. prefer omitting --hard to only mark the component as soft deleted`\n : `${laneOrMainWarning}\nif your intent is to remove the component only from your local workspace, refer to bit remove or bit eject.`;\n\n const ok = await yesno({\n question: `${remoteOrLocalOutput}\n${chalk.bold('Would you like to proceed? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new BitError('the operation has been canceled');\n }\n }\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;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,gBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmD,SAAAC,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,C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'@teambit/component-id';
|
|
2
|
-
import Consumer from '@teambit/legacy
|
|
2
|
+
import { Consumer } from '@teambit/legacy.consumer';
|
|
3
3
|
export declare function deleteComponentsFiles(consumer: Consumer, bitIds: ComponentIdList): Promise<void>;
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deleteComponentsFiles = deleteComponentsFiles;
|
|
7
|
-
function
|
|
8
|
-
const data =
|
|
9
|
-
|
|
7
|
+
function _legacy() {
|
|
8
|
+
const data = require("@teambit/legacy.logger");
|
|
9
|
+
_legacy = function () {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
@@ -18,9 +18,8 @@ function _component() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
21
|
async function deleteComponentsFiles(consumer, bitIds) {
|
|
23
|
-
|
|
22
|
+
_legacy().logger.debug(`deleteComponentsFiles, ids: ${bitIds.toString()}`);
|
|
24
23
|
const filesToDelete = getFilesToDelete();
|
|
25
24
|
filesToDelete.addBasePath(consumer.getPath());
|
|
26
25
|
return filesToDelete.persistAllToFS();
|
|
@@ -32,7 +31,7 @@ async function deleteComponentsFiles(consumer, bitIds) {
|
|
|
32
31
|
ignoreVersion
|
|
33
32
|
});
|
|
34
33
|
if (!componentMap) {
|
|
35
|
-
|
|
34
|
+
_legacy().logger.warn(`deleteComponentsFiles was unable to delete ${id.toString()} because the id is missing from bitmap`);
|
|
36
35
|
return;
|
|
37
36
|
}
|
|
38
37
|
const rootDir = componentMap.rootDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_legacy","data","require","_component","deleteComponentsFiles","consumer","bitIds","logger","debug","toString","filesToDelete","getFilesToDelete","addBasePath","getPath","persistAllToFS","dataToPersist","DataToPersist","forEach","id","ignoreVersion","scope","isLocal","hasVersion","componentMap","bitMap","getComponentIfExist","warn","rootDir","Error","removePath","RemovePath"],"sources":["delete-component-files.ts"],"sourcesContent":["import { ComponentIdList } from '@teambit/component-id';\nimport { logger } from '@teambit/legacy.logger';\nimport { DataToPersist, RemovePath } from '@teambit/component.sources';\nimport { Consumer } from '@teambit/legacy.consumer';\n\nexport async function deleteComponentsFiles(consumer: Consumer, bitIds: ComponentIdList) {\n logger.debug(`deleteComponentsFiles, ids: ${bitIds.toString()}`);\n const filesToDelete = getFilesToDelete();\n filesToDelete.addBasePath(consumer.getPath());\n return filesToDelete.persistAllToFS();\n\n function getFilesToDelete(): DataToPersist {\n const dataToPersist = new DataToPersist();\n bitIds.forEach((id) => {\n const ignoreVersion = consumer.scope.isLocal(id) || !id.hasVersion();\n const componentMap = consumer.bitMap.getComponentIfExist(id, { ignoreVersion });\n if (!componentMap) {\n logger.warn(\n `deleteComponentsFiles was unable to delete ${id.toString()} because the id is missing from bitmap`\n );\n return;\n }\n const rootDir = componentMap.rootDir;\n if (!rootDir) throw new Error(`rootDir is missing from ${id.toString()}`);\n dataToPersist.removePath(new RemovePath(rootDir, true));\n });\n return dataToPersist;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,eAAeG,qBAAqBA,CAACC,QAAkB,EAAEC,MAAuB,EAAE;EACvFC,gBAAM,CAACC,KAAK,CAAC,+BAA+BF,MAAM,CAACG,QAAQ,CAAC,CAAC,EAAE,CAAC;EAChE,MAAMC,aAAa,GAAGC,gBAAgB,CAAC,CAAC;EACxCD,aAAa,CAACE,WAAW,CAACP,QAAQ,CAACQ,OAAO,CAAC,CAAC,CAAC;EAC7C,OAAOH,aAAa,CAACI,cAAc,CAAC,CAAC;EAErC,SAASH,gBAAgBA,CAAA,EAAkB;IACzC,MAAMI,aAAa,GAAG,KAAIC,0BAAa,EAAC,CAAC;IACzCV,MAAM,CAACW,OAAO,CAAEC,EAAE,IAAK;MACrB,MAAMC,aAAa,GAAGd,QAAQ,CAACe,KAAK,CAACC,OAAO,CAACH,EAAE,CAAC,IAAI,CAACA,EAAE,CAACI,UAAU,CAAC,CAAC;MACpE,MAAMC,YAAY,GAAGlB,QAAQ,CAACmB,MAAM,CAACC,mBAAmB,CAACP,EAAE,EAAE;QAAEC;MAAc,CAAC,CAAC;MAC/E,IAAI,CAACI,YAAY,EAAE;QACjBhB,gBAAM,CAACmB,IAAI,CACT,8CAA8CR,EAAE,CAACT,QAAQ,CAAC,CAAC,wCAC7D,CAAC;QACD;MACF;MACA,MAAMkB,OAAO,GAAGJ,YAAY,CAACI,OAAO;MACpC,IAAI,CAACA,OAAO,EAAE,MAAM,IAAIC,KAAK,CAAC,2BAA2BV,EAAE,CAACT,QAAQ,CAAC,CAAC,EAAE,CAAC;MACzEM,aAAa,CAACc,UAAU,CAAC,KAAIC,uBAAU,EAACH,OAAO,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC,CAAC;IACF,OAAOZ,aAAa;EACtB;AACF","ignoreList":[]}
|
package/dist/remove-cmd.js
CHANGED
|
@@ -25,9 +25,9 @@ function _bitError() {
|
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const data = require("@teambit/legacy
|
|
30
|
-
|
|
28
|
+
function _legacy() {
|
|
29
|
+
const data = require("@teambit/legacy.constants");
|
|
30
|
+
_legacy = function () {
|
|
31
31
|
return data;
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
@@ -52,7 +52,7 @@ class RemoveCmd {
|
|
|
52
52
|
_defineProperty(this, "extendedDescription", `to mark components as deleted on the remote scope, use "bit delete".`);
|
|
53
53
|
_defineProperty(this, "arguments", [{
|
|
54
54
|
name: 'component-pattern',
|
|
55
|
-
description:
|
|
55
|
+
description: _legacy().COMPONENT_PATTERN_HELP
|
|
56
56
|
}]);
|
|
57
57
|
_defineProperty(this, "group", 'collaborate');
|
|
58
58
|
_defineProperty(this, "helpUrl", 'reference/components/removing-components');
|
package/dist/remove-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_yesno","_bitError","_legacy","_removeTemplate","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","RemoveCmd","constructor","remove","workspace","name","description","COMPONENT_PATTERN_HELP","cmd","report","componentsPattern","force","track","silent","keepFiles","removePrompt","localResult","deleteFiles","localMessage","removeTemplate","logger","clearStatusLine","filesDeletionStr","ok","yesno","question","chalk","bold","BitError","exports"],"sources":["remove-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport yesno from 'yesno';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport { RemovedLocalObjects } from './removed-local-objects';\nimport { RemoveMain } from './remove.main.runtime';\nimport { removeTemplate } from './remove-template';\n\nexport class RemoveCmd implements Command {\n name = 'remove <component-pattern>';\n description = 'remove component(s) from the local workspace';\n extendedDescription = `to mark components as deleted on the remote scope, use \"bit delete\".`;\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'collaborate';\n helpUrl = 'reference/components/removing-components';\n skipWorkspace = true;\n alias = 'rm';\n options = [\n ['t', 'track', 'keep tracking component in .bitmap (default = false), helps transform a tagged-component to new'],\n ['', 'keep-files', 'keep component files (just untrack the component)'],\n [\n 'f',\n 'force',\n 'removes the component from the scope, even if used as a dependency. WARNING: you will need to fix the components that depend on this component',\n ],\n ['s', 'silent', 'skip confirmation'],\n ] as CommandOptions;\n loader = true;\n examples = [\n {\n cmd: 'remove \"$deprecated\"',\n description: 'remove all components that are deprecated',\n },\n ];\n remoteOp = true;\n\n constructor(\n private remove: RemoveMain,\n private workspace?: Workspace\n ) {}\n\n async report(\n [componentsPattern]: [string],\n {\n force = false,\n track = false,\n silent = false,\n keepFiles = false,\n }: {\n force?: boolean;\n track?: boolean;\n silent?: boolean;\n keepFiles?: boolean;\n }\n ) {\n if (!silent) {\n await this.removePrompt(!keepFiles);\n }\n const {\n localResult,\n }: {\n localResult: RemovedLocalObjects;\n } = await this.remove.remove({ componentsPattern, force, track, deleteFiles: !keepFiles });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const localMessage = removeTemplate(localResult, false);\n // if (localMessage !== '')\n // localMessage +=\n // '. Note: these components were not deleted from the remote - if you want to delete components run \"bit delete\"\\n';\n return localMessage;\n }\n\n private async removePrompt(deleteFiles?: boolean) {\n this.remove.logger.clearStatusLine();\n const filesDeletionStr = deleteFiles\n ? ' and the files will be deleted from the filesystem (can be avoided by entering --keep-files)'\n : '';\n const ok = await yesno({\n question: `this command will remove the component/s only from your local workspace. if your intent is to delete the component/s also from the remote scope, refer to \"bit delete\".\nthe component(s) will be untracked${filesDeletionStr}.\n${chalk.bold('Would you like to proceed? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new BitError('the operation has been canceled');\n }\n }\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;AACA,SAAAG,OAAA;EAAA,MAAAH,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AAEC,KAAK;MAAEC,KAAK;MAAEK,WAAW,EAAE,CAACH;IAAU,CAAC,CAAC;IAC1F;IACA,MAAMI,YAAY,GAAG,IAAAC,gCAAc,EAACH,WAAW,EAAE,KAAK,CAAC;IACvD;IACA;IACA;IACA,OAAOE,YAAY;EACrB;EAEA,MAAcH,YAAYA,CAACE,WAAqB,EAAE;IAChD,IAAI,CAACd,MAAM,CAACiB,MAAM,CAACC,eAAe,CAAC,CAAC;IACpC,MAAMC,gBAAgB,GAAGL,WAAW,GAChC,8FAA8F,GAC9F,EAAE;IACN,MAAMM,EAAE,GAAG,MAAM,IAAAC,gBAAK,EAAC;MACrBC,QAAQ,EAAE;AAChB,oCAAoCH,gBAAgB;AACpD,EAAEI,gBAAK,CAACC,IAAI,CAAC,2CAA2C,CAAC;IACrD,CAAC,CAAC;IACF,IAAI,CAACJ,EAAE,EAAE;MACP,MAAM,KAAIK,oBAAQ,EAAC,iCAAiC,CAAC;IACvD;EACF;AACF;AAACC,OAAA,CAAA5B,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Workspace } from '@teambit/workspace';
|
|
2
2
|
import { ComponentIdList } from '@teambit/component-id';
|
|
3
|
-
import RemovedObjects from '@teambit/legacy
|
|
4
|
-
import { Consumer } from '@teambit/legacy
|
|
5
|
-
import ConsumerComponent from '@teambit/legacy
|
|
3
|
+
import { RemovedObjects } from '@teambit/legacy.scope';
|
|
4
|
+
import { Consumer } from '@teambit/legacy.consumer';
|
|
5
|
+
import { ConsumerComponent } from '@teambit/legacy.consumer-component';
|
|
6
6
|
import { RemovedLocalObjects } from './removed-local-objects';
|
|
7
7
|
export type RemoveComponentsResult = {
|
|
8
8
|
localResult: RemovedLocalObjects;
|
|
@@ -40,9 +40,9 @@ function _lodash2() {
|
|
|
40
40
|
};
|
|
41
41
|
return data;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const data = require("@teambit/legacy
|
|
45
|
-
|
|
43
|
+
function _legacy() {
|
|
44
|
+
const data = require("@teambit/legacy.constants");
|
|
45
|
+
_legacy = function () {
|
|
46
46
|
return data;
|
|
47
47
|
};
|
|
48
48
|
return data;
|
|
@@ -54,30 +54,23 @@ function _bitError() {
|
|
|
54
54
|
};
|
|
55
55
|
return data;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const data =
|
|
59
|
-
|
|
57
|
+
function _legacy2() {
|
|
58
|
+
const data = require("@teambit/legacy.logger");
|
|
59
|
+
_legacy2 = function () {
|
|
60
60
|
return data;
|
|
61
61
|
};
|
|
62
62
|
return data;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const data = require("@teambit/
|
|
66
|
-
|
|
64
|
+
function _scope() {
|
|
65
|
+
const data = require("@teambit/scope.network");
|
|
66
|
+
_scope = function () {
|
|
67
67
|
return data;
|
|
68
68
|
};
|
|
69
69
|
return data;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const data = require("@teambit/
|
|
73
|
-
|
|
74
|
-
return data;
|
|
75
|
-
};
|
|
76
|
-
return data;
|
|
77
|
-
}
|
|
78
|
-
function _scopeRemotes() {
|
|
79
|
-
const data = require("@teambit/legacy/dist/scope/scope-remotes");
|
|
80
|
-
_scopeRemotes = function () {
|
|
71
|
+
function _scope2() {
|
|
72
|
+
const data = require("@teambit/scope.remotes");
|
|
73
|
+
_scope2 = function () {
|
|
81
74
|
return data;
|
|
82
75
|
};
|
|
83
76
|
return data;
|
|
@@ -89,23 +82,23 @@ function _deleteComponentFiles() {
|
|
|
89
82
|
};
|
|
90
83
|
return data;
|
|
91
84
|
}
|
|
92
|
-
function
|
|
85
|
+
function _legacy3() {
|
|
93
86
|
const data = require("@teambit/legacy.component-list");
|
|
94
|
-
|
|
87
|
+
_legacy3 = function () {
|
|
95
88
|
return data;
|
|
96
89
|
};
|
|
97
90
|
return data;
|
|
98
91
|
}
|
|
99
|
-
function
|
|
100
|
-
const data = _interopRequireDefault(require("
|
|
101
|
-
|
|
92
|
+
function _pMapSeries() {
|
|
93
|
+
const data = _interopRequireDefault(require("p-map-series"));
|
|
94
|
+
_pMapSeries = function () {
|
|
102
95
|
return data;
|
|
103
96
|
};
|
|
104
97
|
return data;
|
|
105
98
|
}
|
|
106
|
-
function
|
|
107
|
-
const data =
|
|
108
|
-
|
|
99
|
+
function _legacy4() {
|
|
100
|
+
const data = require("@teambit/legacy.consumer-component");
|
|
101
|
+
_legacy4 = function () {
|
|
109
102
|
return data;
|
|
110
103
|
};
|
|
111
104
|
return data;
|
|
@@ -147,12 +140,12 @@ async function removeComponents({
|
|
|
147
140
|
track,
|
|
148
141
|
deleteFiles
|
|
149
142
|
}) {
|
|
150
|
-
|
|
143
|
+
_legacy2().logger.debugAndAddBreadCrumb('removeComponents', `{ids}. force: ${force.toString()}`, {
|
|
151
144
|
ids: ids.toString()
|
|
152
145
|
});
|
|
153
146
|
// added this to remove support for remove only one version from a component
|
|
154
147
|
const bitIdsLatest = _componentId().ComponentIdList.fromArray(ids.map(id => {
|
|
155
|
-
return id.changeVersion(
|
|
148
|
+
return id.changeVersion(_legacy().LATEST_BIT_VERSION);
|
|
156
149
|
}));
|
|
157
150
|
const [localIds, remoteIds] = (0, _lodash().default)(bitIdsLatest, id => id.isLocal());
|
|
158
151
|
if (remote && localIds.length) {
|
|
@@ -174,10 +167,10 @@ async function removeComponents({
|
|
|
174
167
|
*/
|
|
175
168
|
async function removeRemote(workspace, bitIds, force) {
|
|
176
169
|
const groupedBitsByScope = (0, _groupArray().default)(bitIds, 'scope');
|
|
177
|
-
const remotes = workspace ? await (0,
|
|
170
|
+
const remotes = workspace ? await (0, _scope2().getScopeRemotes)(workspace.scope.legacyScope) : await _scope2().Remotes.getGlobalRemotes();
|
|
178
171
|
const shouldGoToCentralHub = remotes.shouldGoToCentralHub(Object.keys(groupedBitsByScope));
|
|
179
172
|
if (shouldGoToCentralHub) {
|
|
180
|
-
const http = await
|
|
173
|
+
const http = await _scope().Http.connect(_legacy().CENTRAL_BIT_HUB_URL, _legacy().CENTRAL_BIT_HUB_NAME);
|
|
181
174
|
return http.deleteViaCentralHub(bitIds.map(id => id.toString()), {
|
|
182
175
|
force,
|
|
183
176
|
idsAreLanes: false
|
|
@@ -213,7 +206,7 @@ async function removeLocal(workspace, bitIds, force, track, deleteFiles) {
|
|
|
213
206
|
if (componentStatus.modified) modifiedComponents.push(id);else nonModifiedComponents.push(id);
|
|
214
207
|
} catch (err) {
|
|
215
208
|
// if a component has an error, such as, missing main file, we do want to allow removing that component
|
|
216
|
-
if (
|
|
209
|
+
if (_legacy4().ConsumerComponent.isComponentInvalidByErrorType(err)) {
|
|
217
210
|
nonModifiedComponents.push(id);
|
|
218
211
|
} else {
|
|
219
212
|
throw err;
|
|
@@ -235,7 +228,7 @@ If you understand the risks and wish to proceed with the removal, please use the
|
|
|
235
228
|
}
|
|
236
229
|
}
|
|
237
230
|
const idsToRemove = force ? bitIds : nonModifiedComponents;
|
|
238
|
-
const componentsList = new (
|
|
231
|
+
const componentsList = new (_legacy3().ComponentsList)(consumer);
|
|
239
232
|
const newComponents = await componentsList.listNewComponents(false);
|
|
240
233
|
const idsToRemoveFromScope = _componentId().ComponentIdList.fromArray(idsToRemove.filter(id => !newComponents.hasWithoutVersion(id)));
|
|
241
234
|
const idsToCleanFromWorkspace = _componentId().ComponentIdList.fromArray(idsToRemove.filter(id => newComponents.hasWithoutVersion(id)));
|
|
@@ -263,14 +256,14 @@ If you understand the risks and wish to proceed with the removal, please use the
|
|
|
263
256
|
return new (_removedLocalObjects().RemovedLocalObjects)(_componentId().ComponentIdList.uniqFromArray([...idsToCleanFromWorkspace, ...removedComponentIds]), missingComponents, modifiedComponents, dependentBits, removedFromLane);
|
|
264
257
|
}
|
|
265
258
|
async function removeComponentsFromNodeModules(consumer, components) {
|
|
266
|
-
|
|
259
|
+
_legacy2().logger.debug(`removeComponentsFromNodeModules: ${components.map(c => c.id.toString()).join(', ')}`);
|
|
267
260
|
const pathsToRemoveWithNulls = components.map(c => {
|
|
268
261
|
return (0, _pkgModules().getNodeModulesPathOfComponent)(_objectSpread(_objectSpread({}, c), {}, {
|
|
269
262
|
id: c.id
|
|
270
263
|
}));
|
|
271
264
|
});
|
|
272
265
|
const pathsToRemove = (0, _lodash2().compact)(pathsToRemoveWithNulls);
|
|
273
|
-
|
|
266
|
+
_legacy2().logger.debug(`deleting the following paths: ${pathsToRemove.join('\n')}`);
|
|
274
267
|
return Promise.all(pathsToRemove.map(componentPath => _fsExtra().default.remove(consumer.toAbsolutePath(componentPath))));
|
|
275
268
|
}
|
|
276
269
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_groupArray","_lodash","_componentId","_lodash2","_constants","_bitError","_logger","_http","_remotes","_scopeRemotes","_deleteComponentFiles","_legacy","_consumerComponent","_pMapSeries","_pkgModules","_removedLocalObjects","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","removeComponents","workspace","ids","force","remote","track","deleteFiles","logger","debugAndAddBreadCrumb","toString","bitIdsLatest","ComponentIdList","fromArray","map","id","changeVersion","LATEST_BIT_VERSION","localIds","remoteIds","partition","isLocal","BitError","join","remoteResult","isEmpty","removeRemote","localResult","removeLocal","RemovedLocalObjects","bitIds","groupedBitsByScope","groupArray","remotes","getScopeRemotes","scope","legacyScope","Remotes","getGlobalRemotes","shouldGoToCentralHub","http","Http","connect","CENTRAL_BIT_HUB_URL","CENTRAL_BIT_HUB_NAME","deleteViaCentralHub","idsAreLanes","context","removeP","key","resolvedRemote","resolve","idsStr","toStringWithoutVersion","deleteMany","Promise","all","consumer","modifiedComponents","nonModifiedComponents","newIds","pMapSeries","componentStatus","getComponentStatusById","newlyCreated","modified","err","Component","isComponentInvalidByErrorType","list","listWithInvalid","components","c","hasWithoutVersion","aspectIds","state","aspects","used","find","newId","includes","idsToRemove","componentsList","ComponentsList","newComponents","listNewComponents","idsToRemoveFromScope","idsToCleanFromWorkspace","componentsToRemove","loadComponents","removedComponentIds","missingComponents","dependentBits","removedFromLane","removeMany","deleteComponentsFiles","removedComponents","packageJson","removeComponentsFromDependencies","removeComponentsFromNodeModules","cleanFromBitMap","cleanFromConfig","uniqFromArray","debug","pathsToRemoveWithNulls","getNodeModulesPathOfComponent","pathsToRemove","compact","componentPath","fs","remove","toAbsolutePath"],"sources":["remove-components.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport groupArray from 'group-array';\nimport partition from 'lodash.partition';\nimport { Workspace } from '@teambit/workspace';\nimport { ComponentIdList } from '@teambit/component-id';\nimport { compact, isEmpty } from 'lodash';\nimport { CENTRAL_BIT_HUB_NAME, CENTRAL_BIT_HUB_URL, LATEST_BIT_VERSION } from '@teambit/legacy/dist/constants';\nimport { BitError } from '@teambit/bit-error';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { Http } from '@teambit/legacy/dist/scope/network/http';\nimport { Remotes } from '@teambit/legacy/dist/remotes';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport { deleteComponentsFiles } from './delete-component-files';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport RemovedObjects from '@teambit/legacy/dist/scope/removed-components';\nimport pMapSeries from 'p-map-series';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { getNodeModulesPathOfComponent } from '@teambit/pkg.modules.component-package-name';\nimport { RemovedLocalObjects } from './removed-local-objects';\n\nexport type RemoveComponentsResult = { localResult: RemovedLocalObjects; remoteResult: RemovedObjects[] };\n\n/**\n * Remove components local and remote\n * splits array of ids into local and remote and removes according to flags\n * @param {string[]} ids - list of remote component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n * @param {boolean} remote - delete component from a remote scope\n * @param {boolean} track - keep tracking local staged components in bitmap.\n * @param {boolean} deleteFiles - delete local added files from fs.\n */\nexport async function removeComponents({\n workspace,\n ids,\n force,\n remote,\n track,\n deleteFiles,\n}: {\n workspace?: Workspace; // when remote is false, it's always set\n ids: ComponentIdList;\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: boolean;\n}): Promise<RemoveComponentsResult> {\n logger.debugAndAddBreadCrumb('removeComponents', `{ids}. force: ${force.toString()}`, { ids: ids.toString() });\n // added this to remove support for remove only one version from a component\n const bitIdsLatest = ComponentIdList.fromArray(\n ids.map((id) => {\n return id.changeVersion(LATEST_BIT_VERSION);\n })\n );\n const [localIds, remoteIds] = partition(bitIdsLatest, (id) => id.isLocal());\n if (remote && localIds.length) {\n throw new BitError(\n `unable to remove the remote components: ${localIds.join(',')} as they don't contain a scope-name`\n );\n }\n const remoteResult = remote && !isEmpty(remoteIds) ? await removeRemote(workspace, remoteIds, force) : [];\n const localResult = !remote\n ? await removeLocal(workspace as Workspace, bitIdsLatest, force, track, deleteFiles)\n : new RemovedLocalObjects();\n\n return { localResult, remoteResult };\n}\n\n/**\n * Remove remote component from the remote\n * this method groups remote components by remote name and deletes remote components together\n * @param {ComponentIdList} bitIds - list of remote component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n */\nasync function removeRemote(\n workspace: Workspace | undefined,\n bitIds: ComponentIdList,\n force: boolean\n): Promise<RemovedObjects[]> {\n const groupedBitsByScope = groupArray(bitIds, 'scope');\n const remotes = workspace ? await getScopeRemotes(workspace.scope.legacyScope) : await Remotes.getGlobalRemotes();\n const shouldGoToCentralHub = remotes.shouldGoToCentralHub(Object.keys(groupedBitsByScope));\n if (shouldGoToCentralHub) {\n const http = await Http.connect(CENTRAL_BIT_HUB_URL, CENTRAL_BIT_HUB_NAME);\n return http.deleteViaCentralHub(\n bitIds.map((id) => id.toString()),\n { force, idsAreLanes: false }\n );\n }\n const context = {};\n const removeP = Object.keys(groupedBitsByScope).map(async (key) => {\n const resolvedRemote = await remotes.resolve(key, workspace?.scope.legacyScope);\n const idsStr = groupedBitsByScope[key].map((id) => id.toStringWithoutVersion());\n return resolvedRemote.deleteMany(idsStr, force, context);\n });\n\n return Promise.all(removeP);\n}\n\n/**\n * removeLocal - remove local (imported, new staged components) from modules and bitmap according to flags\n * @param {ComponentIdList} bitIds - list of component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n * @param {boolean} deleteFiles - delete component that are used by other components.\n */\nasync function removeLocal(\n workspace: Workspace,\n bitIds: ComponentIdList,\n force: boolean,\n track: boolean,\n deleteFiles: boolean\n): Promise<RemovedLocalObjects> {\n const consumer = workspace.consumer;\n // local remove in case user wants to delete tagged components\n const modifiedComponents = new ComponentIdList();\n const nonModifiedComponents = new ComponentIdList();\n if (!bitIds.length) return new RemovedLocalObjects();\n if (!force) {\n const newIds: string[] = [];\n await pMapSeries(bitIds, async (id) => {\n try {\n const componentStatus = await workspace.getComponentStatusById(id);\n if (componentStatus.newlyCreated) newIds.push(id.toStringWithoutVersion());\n if (componentStatus.modified) modifiedComponents.push(id);\n else nonModifiedComponents.push(id);\n } catch (err: any) {\n // if a component has an error, such as, missing main file, we do want to allow removing that component\n if (Component.isComponentInvalidByErrorType(err)) {\n nonModifiedComponents.push(id);\n } else {\n throw err;\n }\n }\n });\n if (newIds.length) {\n const list = await workspace.listWithInvalid();\n list.components.forEach((c) => {\n if (bitIds.hasWithoutVersion(c.id)) return; // it gets deleted anyway\n const aspectIds = c.state.aspects.ids;\n const used = newIds.find((newId) => aspectIds.includes(newId));\n if (used)\n throw new BitError(`Unable to remove ${c.id.toStringWithoutVersion()}.\nThis component is 1) an aspect 2) is used by other components, such as \"${c.id.toStringWithoutVersion()}\" 3) it's a new component so it can't be installed as a package.\nRemoving this component from the workspace will disrupt the functionality of other components that depend on it, and resolving these issues may not be straightforward.\nIf you understand the risks and wish to proceed with the removal, please use the --force flag.\n`);\n });\n }\n }\n const idsToRemove = force ? bitIds : nonModifiedComponents;\n const componentsList = new ComponentsList(consumer);\n const newComponents = (await componentsList.listNewComponents(false)) as ComponentIdList;\n const idsToRemoveFromScope = ComponentIdList.fromArray(\n idsToRemove.filter((id) => !newComponents.hasWithoutVersion(id))\n );\n const idsToCleanFromWorkspace = ComponentIdList.fromArray(\n idsToRemove.filter((id) => newComponents.hasWithoutVersion(id))\n );\n const { components: componentsToRemove } = await consumer.loadComponents(idsToRemove, false);\n const { removedComponentIds, missingComponents, dependentBits, removedFromLane } = await consumer.scope.removeMany(\n idsToRemoveFromScope,\n force,\n consumer\n );\n // otherwise, components should still be in .bitmap file\n idsToCleanFromWorkspace.push(...removedComponentIds);\n if (idsToCleanFromWorkspace.length) {\n if (deleteFiles) await deleteComponentsFiles(consumer, idsToCleanFromWorkspace);\n if (!track) {\n const removedComponents = componentsToRemove.filter((c) => idsToCleanFromWorkspace.hasWithoutVersion(c.id));\n await consumer.packageJson.removeComponentsFromDependencies(removedComponents);\n await removeComponentsFromNodeModules(consumer, removedComponents);\n await consumer.cleanFromBitMap(idsToCleanFromWorkspace);\n await workspace.cleanFromConfig(idsToCleanFromWorkspace);\n }\n }\n return new RemovedLocalObjects(\n ComponentIdList.uniqFromArray([...idsToCleanFromWorkspace, ...removedComponentIds]),\n missingComponents,\n modifiedComponents,\n dependentBits,\n removedFromLane\n );\n}\n\nexport async function removeComponentsFromNodeModules(consumer: Consumer, components: ConsumerComponent[]) {\n logger.debug(`removeComponentsFromNodeModules: ${components.map((c) => c.id.toString()).join(', ')}`);\n const pathsToRemoveWithNulls = components.map((c) => {\n return getNodeModulesPathOfComponent({ ...c, id: c.id });\n });\n const pathsToRemove = compact(pathsToRemoveWithNulls);\n logger.debug(`deleting the following paths: ${pathsToRemove.join('\\n')}`);\n return Promise.all(pathsToRemove.map((componentPath) => fs.remove(consumer.toAbsolutePath(componentPath))));\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,SA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bC,eACF,CAAC;AACH;AAEO,eAAeM,+BAA+BA,CAAC1C,QAAkB,EAAEc,UAA+B,EAAE;EACzG/D,iBAAM,CAAC+F,KAAK,CAAC,oCAAoChC,UAAU,CAACzD,GAAG,CAAE0D,CAAC,IAAKA,CAAC,CAACzD,EAAE,CAACL,QAAQ,CAAC,CAAC,CAAC,CAACa,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;EACrG,MAAMiF,sBAAsB,GAAGjC,UAAU,CAACzD,GAAG,CAAE0D,CAAC,IAAK;IACnD,OAAO,IAAAiC,2CAA6B,EAAA5H,aAAA,CAAAA,aAAA,KAAM2F,CAAC;MAAEzD,EAAE,EAAEyD,CAAC,CAACzD;IAAE,EAAE,CAAC;EAC1D,CAAC,CAAC;EACF,MAAM2F,aAAa,GAAG,IAAAC,kBAAO,EAACH,sBAAsB,CAAC;EACrDhG,iBAAM,CAAC+F,KAAK,CAAC,iCAAiCG,aAAa,CAACnF,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;EACzE,OAAOgC,OAAO,CAACC,GAAG,CAACkD,aAAa,CAAC5F,GAAG,CAAE8F,aAAa,IAAKC,kBAAE,CAACC,MAAM,CAACrD,QAAQ,CAACsD,cAAc,CAACH,aAAa,CAAC,CAAC,CAAC,CAAC;AAC7G","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_groupArray","_lodash","_componentId","_lodash2","_legacy","_bitError","_legacy2","_scope","_scope2","_deleteComponentFiles","_legacy3","_pMapSeries","_legacy4","_pkgModules","_removedLocalObjects","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","removeComponents","workspace","ids","force","remote","track","deleteFiles","logger","debugAndAddBreadCrumb","toString","bitIdsLatest","ComponentIdList","fromArray","map","id","changeVersion","LATEST_BIT_VERSION","localIds","remoteIds","partition","isLocal","BitError","join","remoteResult","isEmpty","removeRemote","localResult","removeLocal","RemovedLocalObjects","bitIds","groupedBitsByScope","groupArray","remotes","getScopeRemotes","scope","legacyScope","Remotes","getGlobalRemotes","shouldGoToCentralHub","http","Http","connect","CENTRAL_BIT_HUB_URL","CENTRAL_BIT_HUB_NAME","deleteViaCentralHub","idsAreLanes","context","removeP","key","resolvedRemote","resolve","idsStr","toStringWithoutVersion","deleteMany","Promise","all","consumer","modifiedComponents","nonModifiedComponents","newIds","pMapSeries","componentStatus","getComponentStatusById","newlyCreated","modified","err","ConsumerComponent","isComponentInvalidByErrorType","list","listWithInvalid","components","c","hasWithoutVersion","aspectIds","state","aspects","used","find","newId","includes","idsToRemove","componentsList","ComponentsList","newComponents","listNewComponents","idsToRemoveFromScope","idsToCleanFromWorkspace","componentsToRemove","loadComponents","removedComponentIds","missingComponents","dependentBits","removedFromLane","removeMany","deleteComponentsFiles","removedComponents","packageJson","removeComponentsFromDependencies","removeComponentsFromNodeModules","cleanFromBitMap","cleanFromConfig","uniqFromArray","debug","pathsToRemoveWithNulls","getNodeModulesPathOfComponent","pathsToRemove","compact","componentPath","fs","remove","toAbsolutePath"],"sources":["remove-components.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport groupArray from 'group-array';\nimport partition from 'lodash.partition';\nimport { Workspace } from '@teambit/workspace';\nimport { ComponentIdList } from '@teambit/component-id';\nimport { compact, isEmpty } from 'lodash';\nimport { CENTRAL_BIT_HUB_NAME, CENTRAL_BIT_HUB_URL, LATEST_BIT_VERSION } from '@teambit/legacy.constants';\nimport { BitError } from '@teambit/bit-error';\nimport { logger } from '@teambit/legacy.logger';\nimport { Http } from '@teambit/scope.network';\nimport { Remotes, getScopeRemotes } from '@teambit/scope.remotes';\nimport { deleteComponentsFiles } from './delete-component-files';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport { RemovedObjects } from '@teambit/legacy.scope';\nimport pMapSeries from 'p-map-series';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { getNodeModulesPathOfComponent } from '@teambit/pkg.modules.component-package-name';\nimport { RemovedLocalObjects } from './removed-local-objects';\n\nexport type RemoveComponentsResult = { localResult: RemovedLocalObjects; remoteResult: RemovedObjects[] };\n\n/**\n * Remove components local and remote\n * splits array of ids into local and remote and removes according to flags\n * @param {string[]} ids - list of remote component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n * @param {boolean} remote - delete component from a remote scope\n * @param {boolean} track - keep tracking local staged components in bitmap.\n * @param {boolean} deleteFiles - delete local added files from fs.\n */\nexport async function removeComponents({\n workspace,\n ids,\n force,\n remote,\n track,\n deleteFiles,\n}: {\n workspace?: Workspace; // when remote is false, it's always set\n ids: ComponentIdList;\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: boolean;\n}): Promise<RemoveComponentsResult> {\n logger.debugAndAddBreadCrumb('removeComponents', `{ids}. force: ${force.toString()}`, { ids: ids.toString() });\n // added this to remove support for remove only one version from a component\n const bitIdsLatest = ComponentIdList.fromArray(\n ids.map((id) => {\n return id.changeVersion(LATEST_BIT_VERSION);\n })\n );\n const [localIds, remoteIds] = partition(bitIdsLatest, (id) => id.isLocal());\n if (remote && localIds.length) {\n throw new BitError(\n `unable to remove the remote components: ${localIds.join(',')} as they don't contain a scope-name`\n );\n }\n const remoteResult = remote && !isEmpty(remoteIds) ? await removeRemote(workspace, remoteIds, force) : [];\n const localResult = !remote\n ? await removeLocal(workspace as Workspace, bitIdsLatest, force, track, deleteFiles)\n : new RemovedLocalObjects();\n\n return { localResult, remoteResult };\n}\n\n/**\n * Remove remote component from the remote\n * this method groups remote components by remote name and deletes remote components together\n * @param {ComponentIdList} bitIds - list of remote component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n */\nasync function removeRemote(\n workspace: Workspace | undefined,\n bitIds: ComponentIdList,\n force: boolean\n): Promise<RemovedObjects[]> {\n const groupedBitsByScope = groupArray(bitIds, 'scope');\n const remotes = workspace ? await getScopeRemotes(workspace.scope.legacyScope) : await Remotes.getGlobalRemotes();\n const shouldGoToCentralHub = remotes.shouldGoToCentralHub(Object.keys(groupedBitsByScope));\n if (shouldGoToCentralHub) {\n const http = await Http.connect(CENTRAL_BIT_HUB_URL, CENTRAL_BIT_HUB_NAME);\n return http.deleteViaCentralHub(\n bitIds.map((id) => id.toString()),\n { force, idsAreLanes: false }\n );\n }\n const context = {};\n const removeP = Object.keys(groupedBitsByScope).map(async (key) => {\n const resolvedRemote = await remotes.resolve(key, workspace?.scope.legacyScope);\n const idsStr = groupedBitsByScope[key].map((id) => id.toStringWithoutVersion());\n return resolvedRemote.deleteMany(idsStr, force, context);\n });\n\n return Promise.all(removeP);\n}\n\n/**\n * removeLocal - remove local (imported, new staged components) from modules and bitmap according to flags\n * @param {ComponentIdList} bitIds - list of component ids to delete\n * @param {boolean} force - delete component that are used by other components.\n * @param {boolean} deleteFiles - delete component that are used by other components.\n */\nasync function removeLocal(\n workspace: Workspace,\n bitIds: ComponentIdList,\n force: boolean,\n track: boolean,\n deleteFiles: boolean\n): Promise<RemovedLocalObjects> {\n const consumer = workspace.consumer;\n // local remove in case user wants to delete tagged components\n const modifiedComponents = new ComponentIdList();\n const nonModifiedComponents = new ComponentIdList();\n if (!bitIds.length) return new RemovedLocalObjects();\n if (!force) {\n const newIds: string[] = [];\n await pMapSeries(bitIds, async (id) => {\n try {\n const componentStatus = await workspace.getComponentStatusById(id);\n if (componentStatus.newlyCreated) newIds.push(id.toStringWithoutVersion());\n if (componentStatus.modified) modifiedComponents.push(id);\n else nonModifiedComponents.push(id);\n } catch (err: any) {\n // if a component has an error, such as, missing main file, we do want to allow removing that component\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n nonModifiedComponents.push(id);\n } else {\n throw err;\n }\n }\n });\n if (newIds.length) {\n const list = await workspace.listWithInvalid();\n list.components.forEach((c) => {\n if (bitIds.hasWithoutVersion(c.id)) return; // it gets deleted anyway\n const aspectIds = c.state.aspects.ids;\n const used = newIds.find((newId) => aspectIds.includes(newId));\n if (used)\n throw new BitError(`Unable to remove ${c.id.toStringWithoutVersion()}.\nThis component is 1) an aspect 2) is used by other components, such as \"${c.id.toStringWithoutVersion()}\" 3) it's a new component so it can't be installed as a package.\nRemoving this component from the workspace will disrupt the functionality of other components that depend on it, and resolving these issues may not be straightforward.\nIf you understand the risks and wish to proceed with the removal, please use the --force flag.\n`);\n });\n }\n }\n const idsToRemove = force ? bitIds : nonModifiedComponents;\n const componentsList = new ComponentsList(consumer);\n const newComponents = (await componentsList.listNewComponents(false)) as ComponentIdList;\n const idsToRemoveFromScope = ComponentIdList.fromArray(\n idsToRemove.filter((id) => !newComponents.hasWithoutVersion(id))\n );\n const idsToCleanFromWorkspace = ComponentIdList.fromArray(\n idsToRemove.filter((id) => newComponents.hasWithoutVersion(id))\n );\n const { components: componentsToRemove } = await consumer.loadComponents(idsToRemove, false);\n const { removedComponentIds, missingComponents, dependentBits, removedFromLane } = await consumer.scope.removeMany(\n idsToRemoveFromScope,\n force,\n consumer\n );\n // otherwise, components should still be in .bitmap file\n idsToCleanFromWorkspace.push(...removedComponentIds);\n if (idsToCleanFromWorkspace.length) {\n if (deleteFiles) await deleteComponentsFiles(consumer, idsToCleanFromWorkspace);\n if (!track) {\n const removedComponents = componentsToRemove.filter((c) => idsToCleanFromWorkspace.hasWithoutVersion(c.id));\n await consumer.packageJson.removeComponentsFromDependencies(removedComponents);\n await removeComponentsFromNodeModules(consumer, removedComponents);\n await consumer.cleanFromBitMap(idsToCleanFromWorkspace);\n await workspace.cleanFromConfig(idsToCleanFromWorkspace);\n }\n }\n return new RemovedLocalObjects(\n ComponentIdList.uniqFromArray([...idsToCleanFromWorkspace, ...removedComponentIds]),\n missingComponents,\n modifiedComponents,\n dependentBits,\n removedFromLane\n );\n}\n\nexport async function removeComponentsFromNodeModules(consumer: Consumer, components: ConsumerComponent[]) {\n logger.debug(`removeComponentsFromNodeModules: ${components.map((c) => c.id.toString()).join(', ')}`);\n const pathsToRemoveWithNulls = components.map((c) => {\n return getNodeModulesPathOfComponent({ ...c, id: c.id });\n });\n const pathsToRemove = compact(pathsToRemoveWithNulls);\n logger.debug(`deleting the following paths: ${pathsToRemove.join('\\n')}`);\n return Promise.all(pathsToRemove.map((componentPath) => fs.remove(consumer.toAbsolutePath(componentPath))));\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,UAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,SAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA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AI1D,0CAAmB,EAC5BjB,8BAAe,CAAC0F,aAAa,CAAC,CAAC,GAAGf,uBAAuB,EAAE,GAAGG,mBAAmB,CAAC,CAAC,EACnFC,iBAAiB,EACjBjC,kBAAkB,EAClBkC,aAAa,EACbC,eACF,CAAC;AACH;AAEO,eAAeM,+BAA+BA,CAAC1C,QAAkB,EAAEc,UAA+B,EAAE;EACzG/D,iBAAM,CAAC+F,KAAK,CAAC,oCAAoChC,UAAU,CAACzD,GAAG,CAAE0D,CAAC,IAAKA,CAAC,CAACzD,EAAE,CAACL,QAAQ,CAAC,CAAC,CAAC,CAACa,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;EACrG,MAAMiF,sBAAsB,GAAGjC,UAAU,CAACzD,GAAG,CAAE0D,CAAC,IAAK;IACnD,OAAO,IAAAiC,2CAA6B,EAAA5H,aAAA,CAAAA,aAAA,KAAM2F,CAAC;MAAEzD,EAAE,EAAEyD,CAAC,CAACzD;IAAE,EAAE,CAAC;EAC1D,CAAC,CAAC;EACF,MAAM2F,aAAa,GAAG,IAAAC,kBAAO,EAACH,sBAAsB,CAAC;EACrDhG,iBAAM,CAAC+F,KAAK,CAAC,iCAAiCG,aAAa,CAACnF,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;EACzE,OAAOgC,OAAO,CAACC,GAAG,CAACkD,aAAa,CAAC5F,GAAG,CAAE8F,aAAa,IAAKC,kBAAE,CAACC,MAAM,CAACrD,QAAQ,CAACsD,cAAc,CAACH,aAAa,CAAC,CAAC,CAAC,CAAC;AAC7G","ignoreList":[]}
|
|
@@ -39,9 +39,9 @@ function _componentId() {
|
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const data = require("@teambit/legacy
|
|
44
|
-
|
|
42
|
+
function _legacy() {
|
|
43
|
+
const data = require("@teambit/legacy.consumer");
|
|
44
|
+
_legacy = function () {
|
|
45
45
|
return data;
|
|
46
46
|
};
|
|
47
47
|
return data;
|
|
@@ -60,9 +60,9 @@ function _lodash() {
|
|
|
60
60
|
};
|
|
61
61
|
return data;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function _legacy2() {
|
|
64
64
|
const data = require("@teambit/legacy.utils");
|
|
65
|
-
|
|
65
|
+
_legacy2 = function () {
|
|
66
66
|
return data;
|
|
67
67
|
};
|
|
68
68
|
return data;
|
|
@@ -102,9 +102,9 @@ function _pMapSeries() {
|
|
|
102
102
|
};
|
|
103
103
|
return data;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
const data = require("@teambit/legacy
|
|
107
|
-
|
|
105
|
+
function _legacy3() {
|
|
106
|
+
const data = require("@teambit/legacy.scope");
|
|
107
|
+
_legacy3 = function () {
|
|
108
108
|
return data;
|
|
109
109
|
};
|
|
110
110
|
return data;
|
|
@@ -267,7 +267,7 @@ class RemoveMain {
|
|
|
267
267
|
return componentsToDeleteFromFs;
|
|
268
268
|
}
|
|
269
269
|
async deleteComps(componentsPattern, opts = {}) {
|
|
270
|
-
if (!this.workspace) throw new (
|
|
270
|
+
if (!this.workspace) throw new (_legacy().ConsumerNotFound)();
|
|
271
271
|
const componentIds = await this.workspace.idsByPattern(componentsPattern);
|
|
272
272
|
const newComps = componentIds.filter(id => !id.hasVersion());
|
|
273
273
|
if (newComps.length) {
|
|
@@ -309,7 +309,7 @@ to delete them eventually from main, use "--update-main" flag and make sure to r
|
|
|
309
309
|
* returns `true` if it was recovered. `false` if the component wasn't soft-removed, so nothing to recover from.
|
|
310
310
|
*/
|
|
311
311
|
async recover(compIdStr, options) {
|
|
312
|
-
if (!this.workspace) throw new (
|
|
312
|
+
if (!this.workspace) throw new (_legacy().ConsumerNotFound)();
|
|
313
313
|
const bitMapEntry = this.workspace.consumer.bitMap.components.find(compMap => {
|
|
314
314
|
return compMap.id.fullName === compIdStr || compMap.id.toStringWithoutVersion() === compIdStr;
|
|
315
315
|
});
|
|
@@ -369,7 +369,7 @@ to delete them eventually from main, use "--update-main" flag and make sure to r
|
|
|
369
369
|
try {
|
|
370
370
|
comp = await this.workspace.scope.getRemoteComponent(compId);
|
|
371
371
|
} catch (err) {
|
|
372
|
-
if (err instanceof
|
|
372
|
+
if (err instanceof _legacy3().NoHeadNoVersion) {
|
|
373
373
|
throw new (_bitError().BitError)(`unable to find the component ${compIdWithPossibleVer.toString()} in the current lane or main`);
|
|
374
374
|
}
|
|
375
375
|
throw err;
|
|
@@ -505,12 +505,12 @@ ${mainComps.map(c => c.id.toString()).join('\n')}`);
|
|
|
505
505
|
return (0, _lodash().compact)(staged);
|
|
506
506
|
}
|
|
507
507
|
async getLocalBitIdsToRemove(componentsPattern) {
|
|
508
|
-
if (!this.workspace) throw new (
|
|
508
|
+
if (!this.workspace) throw new (_legacy().ConsumerNotFound)();
|
|
509
509
|
const componentIds = await this.workspace.idsByPattern(componentsPattern);
|
|
510
510
|
return componentIds.map(id => id);
|
|
511
511
|
}
|
|
512
512
|
async getRemoteBitIdsToRemove(componentsPattern) {
|
|
513
|
-
if ((0,
|
|
513
|
+
if ((0, _legacy2().hasWildcard)(componentsPattern)) {
|
|
514
514
|
return this.lister.getRemoteCompIdsByWildcards(componentsPattern);
|
|
515
515
|
}
|
|
516
516
|
return [_componentId().ComponentID.fromString(componentsPattern)];
|