@teambit/remove 0.0.6 → 0.0.9

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.
@@ -18,13 +18,14 @@ export declare class RemoveCmd implements Command {
18
18
  migration: boolean;
19
19
  remoteOp: boolean;
20
20
  constructor(remove: RemoveMain);
21
- report([componentsPattern]: [string], { force, remote, track, deleteFiles, silent, keepFiles, }: {
21
+ report([componentsPattern]: [string], { soft, force, remote, track, deleteFiles, silent, keepFiles, }: {
22
22
  force: boolean;
23
23
  remote: boolean;
24
24
  track: boolean;
25
25
  deleteFiles: boolean;
26
26
  silent: boolean;
27
27
  keepFiles: boolean;
28
+ soft: boolean;
28
29
  }): Promise<string>;
29
30
  paintArray(removedObjectsArray: RemovedObjects[]): string[];
30
31
  }
@@ -104,13 +104,14 @@ class RemoveCmd {
104
104
  (0, _defineProperty2().default)(this, "helpUrl", 'components/removing-components');
105
105
  (0, _defineProperty2().default)(this, "skipWorkspace", true);
106
106
  (0, _defineProperty2().default)(this, "alias", 'rm');
107
- (0, _defineProperty2().default)(this, "options", [['r', 'remote', 'remove a component from a remote scope'], ['t', 'track', 'keep tracking component in .bitmap (default = false), helps transform a tagged-component to new'], ['d', 'delete-files', 'DEPRECATED (this is now the default). delete local component files'], ['', 'keep-files', 'keep component files (just untrack the component)'], ['f', 'force', 'removes the component from the scope, even if used as a dependency. WARNING: components that depend on this component will corrupt'], ['s', 'silent', 'skip confirmation']]);
107
+ (0, _defineProperty2().default)(this, "options", [['', 'soft', 'EXPERIMENTAL. mark the component as deleted. after tag/snap and export the remote will be updated'], ['r', 'remote', 'remove a component completely from a remote scope (Careful! this is a permanent change. prefer --soft and tag+export)'], ['t', 'track', 'keep tracking component in .bitmap (default = false), helps transform a tagged-component to new'], ['d', 'delete-files', 'DEPRECATED (this is now the default). delete local component files'], ['', 'keep-files', 'keep component files (just untrack the component)'], ['f', 'force', 'removes the component from the scope, even if used as a dependency. WARNING: components that depend on this component will corrupt'], ['s', 'silent', 'skip confirmation']]);
108
108
  (0, _defineProperty2().default)(this, "loader", true);
109
109
  (0, _defineProperty2().default)(this, "migration", true);
110
110
  (0, _defineProperty2().default)(this, "remoteOp", true);
111
111
  }
112
112
 
113
113
  async report([componentsPattern], {
114
+ soft = false,
114
115
  force = false,
115
116
  remote = false,
116
117
  track = false,
@@ -118,6 +119,17 @@ class RemoveCmd {
118
119
  silent = false,
119
120
  keepFiles = false
120
121
  }) {
122
+ if (soft) {
123
+ if (remote) throw new (_bitError().BitError)(`error: --remote and --soft cannot be used together. soft delete can only be done locally, after tag/snap and export it updates the remote`);
124
+ if (track) throw new (_bitError().BitError)(`error: please use either --soft or --track, not both`);
125
+ if (keepFiles) throw new (_bitError().BitError)(`error: please use either --soft or --keep-files, not both`);
126
+ const removedCompIds = await this.remove.softRemove(componentsPattern);
127
+ return `${_chalk().default.green('successfully soft-removed the following components:')}
128
+ ${removedCompIds.join('\n')}
129
+
130
+ ${_chalk().default.bold('to update the remote, please tag/snap and then export')}`;
131
+ }
132
+
121
133
  if (deleteFiles) {
122
134
  _loader().default.stop(); // eslint-disable-next-line no-console
123
135
 
@@ -127,7 +139,7 @@ class RemoveCmd {
127
139
 
128
140
  if (!silent) {
129
141
  const willDeleteFiles = !remote && !keepFiles;
130
- const removePromptResult = await (0, _prompts().removePrompt)(willDeleteFiles)(); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
142
+ const removePromptResult = await (0, _prompts().removePrompt)(willDeleteFiles, remote)(); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
131
143
 
132
144
  if (!(0, _yn().default)(removePromptResult.shouldRemove)) {
133
145
  throw new (_bitError().BitError)('the operation has been canceled');
@@ -1 +1 @@
1
- {"version":3,"names":["RemoveCmd","constructor","remove","name","description","COMPONENT_PATTERN_HELP","report","componentsPattern","force","remote","track","deleteFiles","silent","keepFiles","loader","stop","console","warn","chalk","yellow","willDeleteFiles","removePromptResult","removePrompt","yn","shouldRemove","BitError","localResult","remoteResult","paintRemoved","paintArray","removedObjectsArray","map","item"],"sources":["remove-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport yn from 'yn';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { removePrompt } from '@teambit/legacy/dist/prompts';\nimport RemovedObjects from '@teambit/legacy/dist/scope/removed-components';\nimport RemovedLocalObjects from '@teambit/legacy/dist/scope/removed-local-objects';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport paintRemoved from '@teambit/legacy/dist/cli/templates/remove-template';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { RemoveMain } from './remove.main.runtime';\n\nexport class RemoveCmd implements Command {\n name = 'remove <component-pattern>';\n description = 'remove component(s) from the workspace, or a remote scope';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'collaborate';\n helpUrl = 'components/removing-components';\n skipWorkspace = true;\n alias = 'rm';\n options = [\n ['r', 'remote', 'remove a component from a remote scope'],\n ['t', 'track', 'keep tracking component in .bitmap (default = false), helps transform a tagged-component to new'],\n ['d', 'delete-files', 'DEPRECATED (this is now the default). delete local component files'],\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: components that depend on this component will corrupt',\n ],\n ['s', 'silent', 'skip confirmation'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private remove: RemoveMain) {}\n\n async report(\n [componentsPattern]: [string],\n {\n force = false,\n remote = false,\n track = false,\n deleteFiles = false,\n silent = false,\n keepFiles = false,\n }: { force: boolean; remote: boolean; track: boolean; deleteFiles: boolean; silent: boolean; keepFiles: boolean }\n ) {\n if (deleteFiles) {\n loader.stop();\n // eslint-disable-next-line no-console\n console.warn(\n chalk.yellow(\n '--delete-files flag is deprecated. by default the files are deleted, unless --keep-files was provided'\n )\n );\n }\n if (!silent) {\n const willDeleteFiles = !remote && !keepFiles;\n const removePromptResult = await removePrompt(willDeleteFiles)();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (!yn(removePromptResult.shouldRemove)) {\n throw new BitError('the operation has been canceled');\n }\n }\n const {\n localResult,\n remoteResult = [],\n }: {\n localResult: RemovedLocalObjects;\n remoteResult: RemovedObjects[];\n } = await this.remove.remove({ componentsPattern, remote, force, track, deleteFiles: !keepFiles });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return paintRemoved(localResult, false) + this.paintArray(remoteResult);\n }\n paintArray(removedObjectsArray: RemovedObjects[]) {\n return removedObjectsArray.map((item) => paintRemoved(item, true));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;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;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,SAAN,CAAmC;EA6BxCC,WAAW,CAASC,MAAT,EAA6B;IAAA,KAApBA,MAAoB,GAApBA,MAAoB;IAAA,8CA5BjC,4BA4BiC;IAAA,qDA3B1B,2DA2B0B;IAAA,mDA1B5B,CACV;MACEC,IAAI,EAAE,mBADR;MAEEC,WAAW,EAAEC;IAFf,CADU,CA0B4B;IAAA,+CApBhC,aAoBgC;IAAA,iDAnB9B,gCAmB8B;IAAA,uDAlBxB,IAkBwB;IAAA,+CAjBhC,IAiBgC;IAAA,iDAhB9B,CACR,CAAC,GAAD,EAAM,QAAN,EAAgB,wCAAhB,CADQ,EAER,CAAC,G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A1B,IAAmC,KAAKG,UAAL,CAAgBF,YAAhB,CAA1C;EACD;;EACDE,UAAU,CAACC,mBAAD,EAAwC;IAChD,OAAOA,mBAAmB,CAACC,GAApB,CAAyBC,IAAD,IAAU,IAAAJ,yBAAA,EAAaI,IAAb,EAAmB,IAAnB,CAAlC,CAAP;EACD;;AAvEuC"}
1
+ {"version":3,"names":["RemoveCmd","constructor","remove","name","description","COMPONENT_PATTERN_HELP","report","componentsPattern","soft","force","remote","track","deleteFiles","silent","keepFiles","BitError","removedCompIds","softRemove","chalk","green","join","bold","loader","stop","console","warn","yellow","willDeleteFiles","removePromptResult","removePrompt","yn","shouldRemove","localResult","remoteResult","paintRemoved","paintArray","removedObjectsArray","map","item"],"sources":["remove-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport yn from 'yn';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { removePrompt } from '@teambit/legacy/dist/prompts';\nimport RemovedObjects from '@teambit/legacy/dist/scope/removed-components';\nimport RemovedLocalObjects from '@teambit/legacy/dist/scope/removed-local-objects';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport paintRemoved from '@teambit/legacy/dist/cli/templates/remove-template';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { RemoveMain } from './remove.main.runtime';\n\nexport class RemoveCmd implements Command {\n name = 'remove <component-pattern>';\n description = 'remove component(s) from the workspace, or a remote scope';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n group = 'collaborate';\n helpUrl = 'components/removing-components';\n skipWorkspace = true;\n alias = 'rm';\n options = [\n ['', 'soft', 'EXPERIMENTAL. mark the component as deleted. after tag/snap and export the remote will be updated'],\n [\n 'r',\n 'remote',\n 'remove a component completely from a remote scope (Careful! this is a permanent change. prefer --soft and tag+export)',\n ],\n ['t', 'track', 'keep tracking component in .bitmap (default = false), helps transform a tagged-component to new'],\n ['d', 'delete-files', 'DEPRECATED (this is now the default). delete local component files'],\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: components that depend on this component will corrupt',\n ],\n ['s', 'silent', 'skip confirmation'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private remove: RemoveMain) {}\n\n async report(\n [componentsPattern]: [string],\n {\n soft = false,\n force = false,\n remote = false,\n track = false,\n deleteFiles = false,\n silent = false,\n keepFiles = false,\n }: {\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: boolean;\n silent: boolean;\n keepFiles: boolean;\n soft: boolean;\n }\n ) {\n if (soft) {\n if (remote)\n throw new BitError(\n `error: --remote and --soft cannot be used together. soft delete can only be done locally, after tag/snap and export it updates the remote`\n );\n if (track) throw new BitError(`error: please use either --soft or --track, not both`);\n if (keepFiles) throw new BitError(`error: please use either --soft or --keep-files, not both`);\n const removedCompIds = await this.remove.softRemove(componentsPattern);\n return `${chalk.green('successfully soft-removed the following components:')}\n${removedCompIds.join('\\n')}\n\n${chalk.bold('to update the remote, please tag/snap and then export')}`;\n }\n\n if (deleteFiles) {\n loader.stop();\n // eslint-disable-next-line no-console\n console.warn(\n chalk.yellow(\n '--delete-files flag is deprecated. by default the files are deleted, unless --keep-files was provided'\n )\n );\n }\n if (!silent) {\n const willDeleteFiles = !remote && !keepFiles;\n const removePromptResult = await removePrompt(willDeleteFiles, remote)();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (!yn(removePromptResult.shouldRemove)) {\n throw new BitError('the operation has been canceled');\n }\n }\n const {\n localResult,\n remoteResult = [],\n }: {\n localResult: RemovedLocalObjects;\n remoteResult: RemovedObjects[];\n } = await this.remove.remove({ componentsPattern, remote, force, track, deleteFiles: !keepFiles });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return paintRemoved(localResult, false) + this.paintArray(remoteResult);\n }\n paintArray(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B;MAAEK,iBAAF;MAAqBG,MAArB;MAA6BD,KAA7B;MAAoCE,KAApC;MAA2CC,WAAW,EAAE,CAACE;IAAzD,CAAnB,CANV,CAhCA,CAuCA;;IACA,OAAO,IAAAoB,yBAAA,EAAaF,WAAb,EAA0B,KAA1B,IAAmC,KAAKG,UAAL,CAAgBF,YAAhB,CAA1C;EACD;;EACDE,UAAU,CAACC,mBAAD,EAAwC;IAChD,OAAOA,mBAAmB,CAACC,GAApB,CAAyBC,IAAD,IAAU,IAAAJ,yBAAA,EAAaI,IAAb,EAAmB,IAAnB,CAAlC,CAAP;EACD;;AAnGuC"}
@@ -0,0 +1,16 @@
1
+ import { Component, ShowFragment } from '@teambit/component';
2
+ import { RemoveMain } from './remove.main.runtime';
3
+ export declare class RemoveFragment implements ShowFragment {
4
+ private remove;
5
+ constructor(remove: RemoveMain);
6
+ title: string;
7
+ renderRow(component: Component): Promise<{
8
+ title: string;
9
+ content: string;
10
+ }>;
11
+ json(component: Component): Promise<{
12
+ title: string;
13
+ json: import("./remove.main.runtime").RemoveInfo;
14
+ }>;
15
+ weight: number;
16
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ require("core-js/modules/es.promise.js");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.RemoveFragment = void 0;
11
+
12
+ function _defineProperty2() {
13
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
+
15
+ _defineProperty2 = function () {
16
+ return data;
17
+ };
18
+
19
+ return data;
20
+ }
21
+
22
+ class RemoveFragment {
23
+ constructor(remove) {
24
+ this.remove = remove;
25
+ (0, _defineProperty2().default)(this, "title", 'removed');
26
+ (0, _defineProperty2().default)(this, "weight", 3);
27
+ }
28
+
29
+ async renderRow(component) {
30
+ const isRemoved = this.remove.isRemoved(component);
31
+ return {
32
+ title: this.title,
33
+ // when it's not removed, set as an empty string so then it won't be shown in bit-show
34
+ content: isRemoved ? isRemoved.toString() : ''
35
+ };
36
+ }
37
+
38
+ async json(component) {
39
+ return {
40
+ title: this.title,
41
+ json: this.remove.getRemoveInfo(component)
42
+ };
43
+ }
44
+
45
+ }
46
+
47
+ exports.RemoveFragment = RemoveFragment;
48
+
49
+ //# sourceMappingURL=remove.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RemoveFragment","constructor","remove","renderRow","component","isRemoved","title","content","toString","json","getRemoveInfo"],"sources":["remove.fragment.ts"],"sourcesContent":["import { Component, ShowFragment } from '@teambit/component';\nimport { RemoveMain } from './remove.main.runtime';\n\nexport class RemoveFragment implements ShowFragment {\n constructor(private remove: RemoveMain) {}\n\n title = 'removed';\n\n async renderRow(component: Component) {\n const isRemoved = this.remove.isRemoved(component);\n return {\n title: this.title,\n // when it's not removed, set as an empty string so then it won't be shown in bit-show\n content: isRemoved ? isRemoved.toString() : '',\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: this.remove.getRemoveInfo(component),\n };\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGO,MAAMA,cAAN,CAA6C;EAClDC,WAAW,CAASC,MAAT,EAA6B;IAAA,KAApBA,MAAoB,GAApBA,MAAoB;IAAA,+CAEhC,SAFgC;IAAA,gDAoB/B,CApB+B;EAAE;;EAI3B,MAATC,SAAS,CAACC,SAAD,EAAuB;IACpC,MAAMC,SAAS,GAAG,KAAKH,MAAL,CAAYG,SAAZ,CAAsBD,SAAtB,CAAlB;IACA,OAAO;MACLE,KAAK,EAAE,KAAKA,KADP;MAEL;MACAC,OAAO,EAAEF,SAAS,GAAGA,SAAS,CAACG,QAAV,EAAH,GAA0B;IAHvC,CAAP;EAKD;;EAES,MAAJC,IAAI,CAACL,SAAD,EAAuB;IAC/B,OAAO;MACLE,KAAK,EAAE,KAAKA,KADP;MAELG,IAAI,EAAE,KAAKP,MAAL,CAAYQ,aAAZ,CAA0BN,SAA1B;IAFD,CAAP;EAID;;AAnBiD"}
@@ -1,6 +1,11 @@
1
1
  import { CLIMain } from '@teambit/cli';
2
2
  import { Logger, LoggerMain } from '@teambit/logger';
3
3
  import { Workspace } from '@teambit/workspace';
4
+ import { ComponentID } from '@teambit/component-id';
5
+ import { Component, ComponentMain } from '@teambit/component';
6
+ export declare type RemoveInfo = {
7
+ removed: boolean;
8
+ };
4
9
  export declare class RemoveMain {
5
10
  private workspace;
6
11
  private logger;
@@ -12,11 +17,23 @@ export declare class RemoveMain {
12
17
  track: boolean;
13
18
  deleteFiles: boolean;
14
19
  }): Promise<any>;
20
+ softRemove(componentsPattern: string): Promise<ComponentID[]>;
21
+ getRemoveInfo(component: Component): RemoveInfo;
22
+ isRemoved(component: Component): boolean;
23
+ /**
24
+ * get components that were soft-removed and tagged/snapped but not exported yet.
25
+ */
26
+ getRemovedStaged(): Promise<ComponentID[]>;
15
27
  private getLocalBitIdsToRemove;
16
28
  private getRemoteBitIdsToRemove;
17
29
  static slots: never[];
18
30
  static dependencies: import("@teambit/harmony").Aspect[];
19
31
  static runtime: import("@teambit/harmony").RuntimeDefinition;
20
- static provider([workspace, cli, loggerMain]: [Workspace, CLIMain, LoggerMain]): Promise<RemoveMain>;
32
+ static provider([workspace, cli, loggerMain, componentAspect]: [
33
+ Workspace,
34
+ CLIMain,
35
+ LoggerMain,
36
+ ComponentMain
37
+ ]): Promise<RemoveMain>;
21
38
  }
22
39
  export default RemoveMain;
@@ -111,6 +111,46 @@ function _listScope() {
111
111
  return data;
112
112
  }
113
113
 
114
+ function _bitError() {
115
+ const data = require("@teambit/bit-error");
116
+
117
+ _bitError = function () {
118
+ return data;
119
+ };
120
+
121
+ return data;
122
+ }
123
+
124
+ function _deleteComponentFiles() {
125
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/delete-component-files"));
126
+
127
+ _deleteComponentFiles = function () {
128
+ return data;
129
+ };
130
+
131
+ return data;
132
+ }
133
+
134
+ function _component() {
135
+ const data = _interopRequireDefault(require("@teambit/component"));
136
+
137
+ _component = function () {
138
+ return data;
139
+ };
140
+
141
+ return data;
142
+ }
143
+
144
+ function _packageJsonUtils() {
145
+ const data = require("@teambit/legacy/dist/consumer/component/package-json-utils");
146
+
147
+ _packageJsonUtils = function () {
148
+ return data;
149
+ };
150
+
151
+ return data;
152
+ }
153
+
114
154
  function _removeCmd() {
115
155
  const data = require("./remove-cmd");
116
156
 
@@ -131,6 +171,16 @@ function _remove() {
131
171
  return data;
132
172
  }
133
173
 
174
+ function _remove2() {
175
+ const data = require("./remove.fragment");
176
+
177
+ _remove2 = function () {
178
+ return data;
179
+ };
180
+
181
+ return data;
182
+ }
183
+
134
184
  const BEFORE_REMOVE = 'removing components';
135
185
 
136
186
  class RemoveMain {
@@ -165,6 +215,56 @@ class RemoveMain {
165
215
  return removeResults;
166
216
  }
167
217
 
218
+ async softRemove(componentsPattern) {
219
+ if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
220
+ const componentIds = await this.workspace.idsByPattern(componentsPattern);
221
+ const components = await this.workspace.getMany(componentIds);
222
+ const newComps = components.filter(c => !c.id.hasVersion());
223
+
224
+ if (newComps.length) {
225
+ throw new (_bitError().BitError)(`unable to soft-remove the following new component(s), please remove them without --soft\n${newComps.map(c => c.id.toString()).join('\n')}`);
226
+ }
227
+
228
+ await (0, _packageJsonUtils().removeComponentsFromNodeModules)(this.workspace.consumer, components.map(c => c.state._consumer)); // don't use `this.workspace.addSpecificComponentConfig`, if the component has component.json it will be deleted
229
+ // during this removal along with the entire component dir.
230
+
231
+ componentIds.map(compId => this.workspace.bitMap.addComponentConfig(compId, _remove().RemoveAspect.id, {
232
+ removed: true
233
+ }));
234
+ await this.workspace.bitMap.write();
235
+
236
+ const bitIds = _bitId().BitIds.fromArray(componentIds.map(id => id._legacy));
237
+
238
+ await (0, _deleteComponentFiles().default)(this.workspace.consumer, bitIds);
239
+ return componentIds;
240
+ }
241
+
242
+ getRemoveInfo(component) {
243
+ var _component$config$ext;
244
+
245
+ const data = (_component$config$ext = component.config.extensions.findExtension(_remove().RemoveAspect.id)) === null || _component$config$ext === void 0 ? void 0 : _component$config$ext.config;
246
+ return {
247
+ removed: (data === null || data === void 0 ? void 0 : data.removed) || false
248
+ };
249
+ }
250
+
251
+ isRemoved(component) {
252
+ return this.getRemoveInfo(component).removed;
253
+ }
254
+ /**
255
+ * get components that were soft-removed and tagged/snapped but not exported yet.
256
+ */
257
+
258
+
259
+ async getRemovedStaged() {
260
+ const stagedConfig = await this.workspace.scope.getStagedConfig();
261
+ return stagedConfig.getAll().filter(compConfig => {
262
+ var _compConfig$config, _compConfig$config$Re;
263
+
264
+ return (_compConfig$config = compConfig.config) === null || _compConfig$config === void 0 ? void 0 : (_compConfig$config$Re = _compConfig$config[_remove().RemoveAspect.id]) === null || _compConfig$config$Re === void 0 ? void 0 : _compConfig$config$Re.removed;
265
+ }).map(compConfig => compConfig.id);
266
+ }
267
+
168
268
  async getLocalBitIdsToRemove(componentsPattern) {
169
269
  if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
170
270
  const componentIds = await this.workspace.idsByPattern(componentsPattern);
@@ -179,9 +279,10 @@ class RemoveMain {
179
279
  return [_legacyBitId().BitId.parse(componentsPattern, true)];
180
280
  }
181
281
 
182
- static async provider([workspace, cli, loggerMain]) {
282
+ static async provider([workspace, cli, loggerMain, componentAspect]) {
183
283
  const logger = loggerMain.createLogger(_remove().RemoveAspect.id);
184
284
  const removeMain = new RemoveMain(workspace, logger);
285
+ componentAspect.registerShowFragments([new (_remove2().RemoveFragment)(removeMain)]);
185
286
  cli.register(new (_removeCmd().RemoveCmd)(removeMain));
186
287
  return new RemoveMain(workspace, logger);
187
288
  }
@@ -190,7 +291,7 @@ class RemoveMain {
190
291
 
191
292
  exports.RemoveMain = RemoveMain;
192
293
  (0, _defineProperty2().default)(RemoveMain, "slots", []);
193
- (0, _defineProperty2().default)(RemoveMain, "dependencies", [_workspace().default, _cli().CLIAspect, _logger().LoggerAspect]);
294
+ (0, _defineProperty2().default)(RemoveMain, "dependencies", [_workspace().default, _cli().CLIAspect, _logger().LoggerAspect, _component().default]);
194
295
  (0, _defineProperty2().default)(RemoveMain, "runtime", _cli().MainRuntime);
195
296
 
196
297
  _remove().RemoveAspect.addRuntime(RemoveMain);
@@ -1 +1 @@
1
- {"version":3,"names":["BEFORE_REMOVE","RemoveMain","constructor","workspace","logger","remove","componentsPattern","force","remote","track","deleteFiles","setStatusLine","bitIds","getRemoteBitIdsToRemove","getLocalBitIdsToRemove","consumer","removeResults","removeComponents","ids","BitIds","fromArray","onDestroy","ConsumerNotFound","componentIds","idsByPattern","map","id","_legacy","hasWildcard","getRemoteBitIdsByWildcards","BitId","parse","provider","cli","loggerMain","createLogger","RemoveAspect","removeMain","register","RemoveCmd","WorkspaceAspect","CLIAspect","LoggerAspect","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 removeComponents from '@teambit/legacy/dist/consumer/component-ops/remove-components';\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 { RemoveCmd } from './remove-cmd';\nimport { RemoveAspect } from './remove.aspect';\n\nconst BEFORE_REMOVE = 'removing components';\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 }: {\n componentsPattern: string;\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: 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 });\n if (consumer) await consumer.onDestroy();\n return removeResults;\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];\n static runtime = MainRuntime;\n\n static async provider([workspace, cli, loggerMain]: [Workspace, CLIMain, LoggerMain]) {\n const logger = loggerMain.createLogger(RemoveAspect.id);\n const removeMain = new RemoveMain(workspace, logger);\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;;AACA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OAAOiB,YAAY,CAACE,GAAb,CAAkBC,EAAD,IAAQA,EAAE,CAACC,OAA5B,CAAP;EACD;;EAEoC,MAAvBd,uBAAuB,CAACP,iBAAD,EAA8C;IACjF,IAAI,IAAAsB,sBAAA,EAAYtB,iBAAZ,CAAJ,EAAoC;MAClC,OAAO,IAAAuB,uCAAA,EAA2BvB,iBAA3B,CAAP;IACD;;IACD,OAAO,CAACwB,oBAAA,CAAMC,KAAN,CAAYzB,iBAAZ,EAA+B,IAA/B,CAAD,CAAP;EACD;;EAMoB,aAAR0B,QAAQ,CAAC,CAAC7B,SAAD,EAAY8B,GAAZ,EAAiBC,UAAjB,CAAD,EAAiE;IACpF,MAAM9B,MAAM,GAAG8B,UAAU,CAACC,YAAX,CAAwBC,sBAAA,CAAaV,EAArC,CAAf;IACA,MAAMW,UAAU,GAAG,IAAIpC,UAAJ,CAAeE,SAAf,EAA0BC,MAA1B,CAAnB;IACA6B,GAAG,CAACK,QAAJ,CAAa,KAAIC,sBAAJ,EAAcF,UAAd,CAAb;IACA,OAAO,IAAIpC,UAAJ,CAAeE,SAAf,EAA0BC,MAA1B,CAAP;EACD;;AAxDqB;;;gCAAXH,U,WA+CI,E;gCA/CJA,U,kBAgDW,CAACuC,oBAAD,EAAkBC,gBAAlB,EAA6BC,sBAA7B,C;gCAhDXzC,U,aAiDM0C,kB;;AAUnBP,sBAAA,CAAaQ,UAAb,CAAwB3C,UAAxB;;eAEeA,U"}
1
+ {"version":3,"names":["BEFORE_REMOVE","RemoveMain","constructor","workspace","logger","remove","componentsPattern","force","remote","track","deleteFiles","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","removeComponentsFromNodeModules","state","_consumer","compId","bitMap","addComponentConfig","RemoveAspect","removed","write","_legacy","deleteComponentsFiles","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 removeComponents from '@teambit/legacy/dist/consumer/component-ops/remove-components';\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 { 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 }: {\n componentsPattern: string;\n force: boolean;\n remote: boolean;\n track: boolean;\n deleteFiles: 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 });\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 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 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;;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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X,CAAwB1B,sBAAA,CAAab,EAArC,CAAf;IACA,MAAMwC,UAAU,GAAG,IAAItE,UAAJ,CAAeE,SAAf,EAA0BC,MAA1B,CAAnB;IACAiE,eAAe,CAACG,qBAAhB,CAAsC,CAAC,KAAIC,yBAAJ,EAAmBF,UAAnB,CAAD,CAAtC;IACAJ,GAAG,CAACO,QAAJ,CAAa,KAAIC,sBAAJ,EAAcJ,UAAd,CAAb;IACA,OAAO,IAAItE,UAAJ,CAAeE,SAAf,EAA0BC,MAA1B,CAAP;EACD;;AAlHqB;;;gCAAXH,U,WAmGI,E;gCAnGJA,U,kBAoGW,CAAC2E,oBAAD,EAAkBC,gBAAlB,EAA6BC,sBAA7B,EAA2CC,oBAA3C,C;gCApGX9E,U,aAqGM+E,kB;;AAgBnBpC,sBAAA,CAAaqC,UAAb,CAAwBhF,UAAxB;;eAEeA,U"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/remove",
3
- "version": "0.0.6",
3
+ "version": "0.0.9",
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.6"
9
+ "version": "0.0.9"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -14,11 +14,13 @@
14
14
  "@babel/runtime": "7.12.18",
15
15
  "core-js": "^3.0.0",
16
16
  "@teambit/harmony": "0.3.3",
17
- "@teambit/bit-error": "0.0.394",
18
- "@teambit/cli": "0.0.555",
19
- "@teambit/legacy-bit-id": "0.0.402",
20
- "@teambit/logger": "0.0.648",
21
- "@teambit/workspace": "0.0.829"
17
+ "@teambit/bit-error": "0.0.395",
18
+ "@teambit/cli": "0.0.557",
19
+ "@teambit/component": "0.0.832",
20
+ "@teambit/component-id": "0.0.406",
21
+ "@teambit/legacy-bit-id": "0.0.403",
22
+ "@teambit/logger": "0.0.650",
23
+ "@teambit/workspace": "0.0.832"
22
24
  },
23
25
  "devDependencies": {
24
26
  "@types/mocha": "9.1.0",
@@ -29,7 +31,7 @@
29
31
  "@types/node": "12.20.4"
30
32
  },
31
33
  "peerDependencies": {
32
- "@teambit/legacy": "1.0.338",
34
+ "@teambit/legacy": "1.0.340",
33
35
  "react-dom": "^16.8.0 || ^17.0.0",
34
36
  "react": "^16.8.0 || ^17.0.0"
35
37
  },
@@ -51,8 +53,6 @@
51
53
  "react",
52
54
  "react-components",
53
55
  "angular",
54
- "angular-components",
55
- "vue",
56
- "vue-components"
56
+ "angular-components"
57
57
  ]
58
58
  }