@teambit/snapping 1.0.459 → 1.0.461
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 +8 -8
- package/artifacts/schema.json +992 -918
- package/dist/reset-cmd.js +1 -1
- package/dist/reset-cmd.js.map +1 -1
- package/dist/reset-component.d.ts +3 -2
- package/dist/reset-component.js +10 -3
- package/dist/reset-component.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +6 -3
- package/dist/snapping.main.runtime.js +14 -6
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/tag-model-component.js +13 -1
- package/dist/tag-model-component.js.map +1 -1
- package/package.json +24 -24
- /package/dist/{preview-1731381751942.js → preview-1731554468308.js} +0 -0
package/dist/reset-cmd.js
CHANGED
|
@@ -71,7 +71,7 @@ class ResetCmd {
|
|
|
71
71
|
results,
|
|
72
72
|
isSoftUntag
|
|
73
73
|
} = await this.snapping.reset(pattern, head, force, soft);
|
|
74
|
-
const titleSuffix = isSoftUntag ? 'soft-untagged (are not candidates for tagging any more)' : '
|
|
74
|
+
const titleSuffix = isSoftUntag ? 'soft-untagged (are not candidates for tagging any more)' : 'reset';
|
|
75
75
|
const title = _chalk().default.green(`${results.length} component(s) were ${titleSuffix}:\n`);
|
|
76
76
|
const components = results.map(result => {
|
|
77
77
|
return `${_chalk().default.cyan(result.id.toStringWithoutVersion())}. version(s): ${result.versions.join(', ')}`;
|
package/dist/reset-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","_chalk","_interopRequireDefault","_constants","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ResetCmd","constructor","snapping","name","description","COMPONENT_PATTERN_HELP","BASE_DOCS_DOMAIN","report","pattern","all","head","force","soft","neverExported","compIds","resetNeverExported","chalk","green","join","BitError","results","isSoftUntag","reset","titleSuffix","title","length","components","map","result","cyan","id","toStringWithoutVersion","versions","exports"],"sources":["reset-cmd.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BASE_DOCS_DOMAIN, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { SnappingMain } from './snapping.main.runtime';\n\nexport default class ResetCmd implements Command {\n name = 'reset [component-pattern]';\n description = 'revert tagged or snapped versions for component(s)';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'component-version',\n description: 'the version to untag (semver for tags. hash for snaps)',\n },\n ];\n group = 'development';\n extendedDescription = `${BASE_DOCS_DOMAIN}components/tags#undoing-a-tag`;\n alias = '';\n options = [\n ['a', 'all', 'revert all unexported tags/snaps for all components'],\n ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'],\n ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'],\n [\n 'f',\n 'force',\n \"revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted\",\n ],\n ['', 'never-exported', 'reset only components that were never exported'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private snapping: SnappingMain) {}\n\n async report(\n [pattern]: [string],\n {\n all = false,\n head = false,\n force = false,\n soft = false,\n neverExported = false,\n }: { all?: boolean; head?: boolean; force?: boolean; soft?: boolean; neverExported?: boolean }\n ) {\n if (neverExported) {\n const compIds = await this.snapping.resetNeverExported();\n return chalk.green(`successfully reset the following never-exported components:\\n${compIds.join('\\n')}`);\n }\n if (!pattern && !all) {\n throw new BitError('please specify a component-pattern or use --all flag');\n }\n if (pattern && all) {\n throw new BitError('please specify either a component-pattern or --all flag, not both');\n }\n if (soft && head) {\n throw new BitError('please specify either --soft or --head flag, not both');\n }\n const { results, isSoftUntag } = await this.snapping.reset(pattern, head, force, soft);\n const titleSuffix = isSoftUntag ? 'soft-untagged (are not candidates for tagging any more)' : '
|
|
1
|
+
{"version":3,"names":["_bitError","data","require","_chalk","_interopRequireDefault","_constants","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ResetCmd","constructor","snapping","name","description","COMPONENT_PATTERN_HELP","BASE_DOCS_DOMAIN","report","pattern","all","head","force","soft","neverExported","compIds","resetNeverExported","chalk","green","join","BitError","results","isSoftUntag","reset","titleSuffix","title","length","components","map","result","cyan","id","toStringWithoutVersion","versions","exports"],"sources":["reset-cmd.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BASE_DOCS_DOMAIN, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { SnappingMain } from './snapping.main.runtime';\n\nexport default class ResetCmd implements Command {\n name = 'reset [component-pattern]';\n description = 'revert tagged or snapped versions for component(s)';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'component-version',\n description: 'the version to untag (semver for tags. hash for snaps)',\n },\n ];\n group = 'development';\n extendedDescription = `${BASE_DOCS_DOMAIN}components/tags#undoing-a-tag`;\n alias = '';\n options = [\n ['a', 'all', 'revert all unexported tags/snaps for all components'],\n ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'],\n ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'],\n [\n 'f',\n 'force',\n \"revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted\",\n ],\n ['', 'never-exported', 'reset only components that were never exported'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private snapping: SnappingMain) {}\n\n async report(\n [pattern]: [string],\n {\n all = false,\n head = false,\n force = false,\n soft = false,\n neverExported = false,\n }: { all?: boolean; head?: boolean; force?: boolean; soft?: boolean; neverExported?: boolean }\n ) {\n if (neverExported) {\n const compIds = await this.snapping.resetNeverExported();\n return chalk.green(`successfully reset the following never-exported components:\\n${compIds.join('\\n')}`);\n }\n if (!pattern && !all) {\n throw new BitError('please specify a component-pattern or use --all flag');\n }\n if (pattern && all) {\n throw new BitError('please specify either a component-pattern or --all flag, not both');\n }\n if (soft && head) {\n throw new BitError('please specify either --soft or --head flag, not both');\n }\n const { results, isSoftUntag } = await this.snapping.reset(pattern, head, force, soft);\n const titleSuffix = isSoftUntag ? 'soft-untagged (are not candidates for tagging any more)' : 'reset';\n const title = chalk.green(`${results.length} component(s) were ${titleSuffix}:\\n`);\n const components = results.map((result) => {\n return `${chalk.cyan(result.id.toStringWithoutVersion())}. version(s): ${result.versions.join(', ')}`;\n });\n return title + components.join('\\n');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0F,SAAAG,uBAAAE,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,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAA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C;EACtC;AACF;AAACe,OAAA,CAAApD,OAAA,GAAAmB,QAAA","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@ import { ComponentID } from '@teambit/component-id';
|
|
|
2
2
|
import { Scope } from '@teambit/legacy/dist/scope';
|
|
3
3
|
import { Consumer } from '@teambit/legacy/dist/consumer';
|
|
4
4
|
import { Lane, ModelComponent } from '@teambit/legacy/dist/scope/models';
|
|
5
|
+
import { RemoveMain } from '@teambit/remove';
|
|
5
6
|
export type untagResult = {
|
|
6
7
|
id: ComponentID;
|
|
7
8
|
versions: string[];
|
|
@@ -11,6 +12,6 @@ export type untagResult = {
|
|
|
11
12
|
* If head is false, remove all local versions.
|
|
12
13
|
*/
|
|
13
14
|
export declare function removeLocalVersion(scope: Scope, id: ComponentID, lane?: Lane, head?: boolean, force?: boolean): Promise<untagResult>;
|
|
14
|
-
export declare function removeLocalVersionsForAllComponents(consumer: Consumer, lane?: Lane, head?: boolean): Promise<untagResult[]>;
|
|
15
|
+
export declare function removeLocalVersionsForAllComponents(consumer: Consumer, remove: RemoveMain, lane?: Lane, head?: boolean): Promise<untagResult[]>;
|
|
15
16
|
export declare function removeLocalVersionsForMultipleComponents(componentsToUntag: ModelComponent[], lane?: Lane, head?: boolean, force: boolean, scope: Scope): Promise<untagResult[]>;
|
|
16
|
-
export declare function getComponentsWithOptionToUntag(consumer: Consumer): Promise<ModelComponent[]>;
|
|
17
|
+
export declare function getComponentsWithOptionToUntag(consumer: Consumer, remove: RemoveMain): Promise<ModelComponent[]>;
|
package/dist/reset-component.js
CHANGED
|
@@ -63,8 +63,8 @@ async function removeLocalVersion(scope, id, lane, head, force = false) {
|
|
|
63
63
|
component
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
async function removeLocalVersionsForAllComponents(consumer, lane, head) {
|
|
67
|
-
const componentsToUntag = await getComponentsWithOptionToUntag(consumer);
|
|
66
|
+
async function removeLocalVersionsForAllComponents(consumer, remove, lane, head) {
|
|
67
|
+
const componentsToUntag = await getComponentsWithOptionToUntag(consumer, remove);
|
|
68
68
|
const force = true; // when removing local versions from all components, no need to check if the component is used as a dependency
|
|
69
69
|
return removeLocalVersionsForMultipleComponents(componentsToUntag, lane, head, force, consumer.scope);
|
|
70
70
|
}
|
|
@@ -98,10 +98,17 @@ force, scope) {
|
|
|
98
98
|
_logger().default.debug(`found ${componentsToUntag.length} components to untag`);
|
|
99
99
|
return Promise.all(componentsToUntag.map(component => removeLocalVersion(scope, component.toComponentId(), lane, head, force)));
|
|
100
100
|
}
|
|
101
|
-
async function getComponentsWithOptionToUntag(consumer) {
|
|
101
|
+
async function getComponentsWithOptionToUntag(consumer, remove) {
|
|
102
102
|
const componentList = new (_legacy().ComponentsList)(consumer);
|
|
103
103
|
const laneObj = await consumer.getCurrentLaneObject();
|
|
104
104
|
const components = await componentList.listExportPendingComponents(laneObj);
|
|
105
|
+
const removedStagedIds = await remove.getRemovedStaged();
|
|
106
|
+
if (!removedStagedIds.length) return components;
|
|
107
|
+
const removedStagedBitIds = removedStagedIds.map(id => id);
|
|
108
|
+
const nonExistsInStaged = removedStagedBitIds.filter(id => !components.find(c => c.toComponentId().isEqualWithoutVersion(id)));
|
|
109
|
+
if (!nonExistsInStaged.length) return components;
|
|
110
|
+
const modelComps = await Promise.all(nonExistsInStaged.map(id => consumer.scope.getModelComponent(id)));
|
|
111
|
+
components.push(...modelComps);
|
|
105
112
|
return components;
|
|
106
113
|
}
|
|
107
114
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","_legacy","_logger","_interopRequireDefault","e","__esModule","default","removeLocalVersion","scope","id","lane","head","force","component","getModelComponent","idStr","toString","localVersions","getLocalHashes","objects","length","BitError","headRef","getHeadRegardlessOfLane","Error","find","v","isEqual","versionsToRemove","versionsToRemoveStr","switchHashesWithTagsIfExist","dependencyGraph","getDependencyGraph","forEach","versionToRemove","idWithVersion","toComponentId","changeVersion","dependents","getImmediateDependentsPerId","join","sources","removeComponentVersions","versions","removeLocalVersionsForAllComponents","consumer","componentsToUntag","getComponentsWithOptionToUntag","removeLocalVersionsForMultipleComponents","candidateComponentsIds","map","bitId","getTagOfRefIfExists","candidateComponentsIdsStr","dependentsNotCandidates","filter","dependent","includes","version","logger","debug","Promise","all","componentList","ComponentsList","laneObj","getCurrentLaneObject","components","listExportPendingComponents"],"sources":["reset-component.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { ComponentID } from '@teambit/component-id';\nimport { Scope } from '@teambit/legacy/dist/scope';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { Lane, ModelComponent } from '@teambit/legacy/dist/scope/models';\n\nexport type untagResult = { id: ComponentID; versions: string[]; component?: ModelComponent };\n\n/**\n * If head is false, remove all local versions.\n */\nexport async function removeLocalVersion(\n scope: Scope,\n id: ComponentID,\n lane?: Lane,\n head?: boolean,\n force = false\n): Promise<untagResult> {\n const component: ModelComponent = await scope.getModelComponent(id);\n const idStr = id.toString();\n const localVersions = await component.getLocalHashes(scope.objects);\n if (!localVersions.length) throw new BitError(`unable to untag ${idStr}, the component is not staged`);\n const headRef = component.getHeadRegardlessOfLane();\n if (!headRef) {\n throw new Error(`unable to reset ${idStr}, it has not head`);\n }\n if (head && !localVersions.find((v) => v.isEqual(headRef))) {\n throw new Error(`unable to reset ${idStr}, the head ${headRef.toString()} is exported`);\n }\n const versionsToRemove = head ? [headRef] : localVersions;\n const versionsToRemoveStr = component.switchHashesWithTagsIfExist(versionsToRemove);\n\n if (!force) {\n const dependencyGraph = await scope.getDependencyGraph();\n\n versionsToRemoveStr.forEach((versionToRemove) => {\n const idWithVersion = component.toComponentId().changeVersion(versionToRemove);\n const dependents = dependencyGraph.getImmediateDependentsPerId(idWithVersion);\n if (dependents.length) {\n throw new BitError(\n `unable to reset ${idStr}, the version ${versionToRemove} has the following dependent(s) ${dependents.join(\n ', '\n )}`\n );\n }\n });\n }\n\n await scope.sources.removeComponentVersions(component, versionsToRemove, versionsToRemoveStr, lane, head);\n\n return { id, versions: versionsToRemoveStr, component };\n}\n\nexport async function removeLocalVersionsForAllComponents(\n consumer: Consumer,\n lane?: Lane,\n head?: boolean\n): Promise<untagResult[]> {\n const componentsToUntag = await getComponentsWithOptionToUntag(consumer);\n const force = true; // when removing local versions from all components, no need to check if the component is used as a dependency\n return removeLocalVersionsForMultipleComponents(componentsToUntag, lane, head, force, consumer.scope);\n}\n\nexport async function removeLocalVersionsForMultipleComponents(\n componentsToUntag: ModelComponent[],\n lane?: Lane,\n head?: boolean,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n force: boolean,\n scope: Scope\n) {\n if (!componentsToUntag.length) {\n throw new BitError(`no components found to reset on your workspace`);\n }\n // if only head is removed, there is risk of deleting dependencies version without their dependents.\n if (!force && head) {\n const dependencyGraph = await scope.getDependencyGraph();\n const candidateComponentsIds = componentsToUntag.map((component) => {\n const bitId = component.toComponentId();\n const headRef = component.getHeadRegardlessOfLane();\n if (!headRef)\n throw new Error(`component ${bitId.toString()} does not have head. it should not be a candidate for reset`);\n\n return bitId.changeVersion(component.getTagOfRefIfExists(headRef) || headRef.toString());\n });\n const candidateComponentsIdsStr = candidateComponentsIds.map((id) => id.toString());\n candidateComponentsIds.forEach((bitId: ComponentID) => {\n const dependents = dependencyGraph.getImmediateDependentsPerId(bitId);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const dependentsNotCandidates = dependents.filter((dependent) => !candidateComponentsIdsStr.includes(dependent));\n if (dependentsNotCandidates.length) {\n throw new BitError( // $FlowFixMe\n `unable to untag ${bitId}, the version ${bitId.version} has the following dependent(s) ${dependents.join(\n ', '\n )}`\n );\n }\n });\n }\n logger.debug(`found ${componentsToUntag.length} components to untag`);\n return Promise.all(\n componentsToUntag.map((component) => removeLocalVersion(scope, component.toComponentId(), lane, head, force))\n );\n}\n\nexport async function getComponentsWithOptionToUntag(consumer: Consumer): Promise<ModelComponent[]> {\n const componentList = new ComponentsList(consumer);\n const laneObj = await consumer.getCurrentLaneObject();\n const components: ModelComponent[] = await componentList.listExportPendingComponents(laneObj);\n\n return components;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwD,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKxD;AACA;AACA;AACO,eAAeG,kBAAkBA,CACtCC,KAAY,EACZC,EAAe,EACfC,IAAW,EACXC,IAAc,EACdC,KAAK,GAAG,KAAK,EACS;EACtB,MAAMC,SAAyB,GAAG,MAAML,KAAK,CAACM,iBAAiB,CAACL,EAAE,CAAC;EACnE,MAAMM,KAAK,GAAGN,EAAE,CAACO,QAAQ,CAAC,CAAC;EAC3B,MAAMC,aAAa,GAAG,MAAMJ,SAAS,CAACK,cAAc,CAACV,KAAK,CAACW,OAAO,CAAC;EACnE,IAAI,CAACF,aAAa,CAACG,MAAM,EAAE,MAAM,KAAIC,oBAAQ,EAAC,mBAAmBN,KAAK,+BAA+B,CAAC;EACtG,MAAMO,OAAO,GAAGT,SAAS,CAACU,uBAAuB,CAAC,CAAC;EACnD,IAAI,CAACD,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CAAC,mBAAmBT,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CAACH,yBAAyB,CAACI,QAAQ,CAACD,SAAS,CAAC,CAAC;MAChH,IAAIF,uBAAuB,CAAClC,MAAM,EAAE;QAClC,MAAM,KAAIC,oBAAQ;QAAE;QAClB,mBAAmB8B,KAAK,iBAAiBA,KAAK,CAACO,OAAO,mCAAmCpB,UAAU,CAACE,IAAI,CACtG,IACF,CAAC,EACH,CAAC;MACH;IACF,CAAC,CAAC;EACJ;EACAmB,iBAAM,CAACC,KAAK,CAAC,SAASd,iBAAiB,CAAC1B,MAAM,sBAAsB,CAAC;EACrE,OAAOyC,OAAO,CAACC,GAAG,CAChBhB,iBAAiB,CAACI,GAAG,CAAErC,SAAS,IAAKN,kBAAkB,CAACC,KAAK,EAAEK,SAAS,CAACuB,aAAa,CAAC,CAAC,EAAE1B,IAAI,EAAEC,IAAI,EAAEC,KAAK,CAAC,CAC9G,CAAC;AACH;AAEO,eAAemC,8BAA8BA,CAACF,QAAkB,EAA6B;EAClG,MAAMkB,aAAa,GAAG,KAAIC,wBAAc,EAACnB,QAAQ,CAAC;EAClD,MAAMoB,OAAO,GAAG,MAAMpB,QAAQ,CAACqB,oBAAoB,CAAC,CAAC;EACrD,MAAMC,UAA4B,GAAG,MAAMJ,aAAa,CAACK,2BAA2B,CAACH,OAAO,CAAC;EAE7F,OAAOE,UAAU;AACnB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_bitError","data","require","_legacy","_logger","_interopRequireDefault","e","__esModule","default","removeLocalVersion","scope","id","lane","head","force","component","getModelComponent","idStr","toString","localVersions","getLocalHashes","objects","length","BitError","headRef","getHeadRegardlessOfLane","Error","find","v","isEqual","versionsToRemove","versionsToRemoveStr","switchHashesWithTagsIfExist","dependencyGraph","getDependencyGraph","forEach","versionToRemove","idWithVersion","toComponentId","changeVersion","dependents","getImmediateDependentsPerId","join","sources","removeComponentVersions","versions","removeLocalVersionsForAllComponents","consumer","remove","componentsToUntag","getComponentsWithOptionToUntag","removeLocalVersionsForMultipleComponents","candidateComponentsIds","map","bitId","getTagOfRefIfExists","candidateComponentsIdsStr","dependentsNotCandidates","filter","dependent","includes","version","logger","debug","Promise","all","componentList","ComponentsList","laneObj","getCurrentLaneObject","components","listExportPendingComponents","removedStagedIds","getRemovedStaged","removedStagedBitIds","nonExistsInStaged","c","isEqualWithoutVersion","modelComps","push"],"sources":["reset-component.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { ComponentID } from '@teambit/component-id';\nimport { Scope } from '@teambit/legacy/dist/scope';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { Lane, ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { RemoveMain } from '@teambit/remove';\n\nexport type untagResult = { id: ComponentID; versions: string[]; component?: ModelComponent };\n\n/**\n * If head is false, remove all local versions.\n */\nexport async function removeLocalVersion(\n scope: Scope,\n id: ComponentID,\n lane?: Lane,\n head?: boolean,\n force = false\n): Promise<untagResult> {\n const component: ModelComponent = await scope.getModelComponent(id);\n const idStr = id.toString();\n const localVersions = await component.getLocalHashes(scope.objects);\n if (!localVersions.length) throw new BitError(`unable to untag ${idStr}, the component is not staged`);\n const headRef = component.getHeadRegardlessOfLane();\n if (!headRef) {\n throw new Error(`unable to reset ${idStr}, it has not head`);\n }\n if (head && !localVersions.find((v) => v.isEqual(headRef))) {\n throw new Error(`unable to reset ${idStr}, the head ${headRef.toString()} is exported`);\n }\n const versionsToRemove = head ? [headRef] : localVersions;\n const versionsToRemoveStr = component.switchHashesWithTagsIfExist(versionsToRemove);\n\n if (!force) {\n const dependencyGraph = await scope.getDependencyGraph();\n\n versionsToRemoveStr.forEach((versionToRemove) => {\n const idWithVersion = component.toComponentId().changeVersion(versionToRemove);\n const dependents = dependencyGraph.getImmediateDependentsPerId(idWithVersion);\n if (dependents.length) {\n throw new BitError(\n `unable to reset ${idStr}, the version ${versionToRemove} has the following dependent(s) ${dependents.join(\n ', '\n )}`\n );\n }\n });\n }\n\n await scope.sources.removeComponentVersions(component, versionsToRemove, versionsToRemoveStr, lane, head);\n\n return { id, versions: versionsToRemoveStr, component };\n}\n\nexport async function removeLocalVersionsForAllComponents(\n consumer: Consumer,\n remove: RemoveMain,\n lane?: Lane,\n head?: boolean\n): Promise<untagResult[]> {\n const componentsToUntag = await getComponentsWithOptionToUntag(consumer, remove);\n const force = true; // when removing local versions from all components, no need to check if the component is used as a dependency\n return removeLocalVersionsForMultipleComponents(componentsToUntag, lane, head, force, consumer.scope);\n}\n\nexport async function removeLocalVersionsForMultipleComponents(\n componentsToUntag: ModelComponent[],\n lane?: Lane,\n head?: boolean,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n force: boolean,\n scope: Scope\n) {\n if (!componentsToUntag.length) {\n throw new BitError(`no components found to reset on your workspace`);\n }\n // if only head is removed, there is risk of deleting dependencies version without their dependents.\n if (!force && head) {\n const dependencyGraph = await scope.getDependencyGraph();\n const candidateComponentsIds = componentsToUntag.map((component) => {\n const bitId = component.toComponentId();\n const headRef = component.getHeadRegardlessOfLane();\n if (!headRef)\n throw new Error(`component ${bitId.toString()} does not have head. it should not be a candidate for reset`);\n\n return bitId.changeVersion(component.getTagOfRefIfExists(headRef) || headRef.toString());\n });\n const candidateComponentsIdsStr = candidateComponentsIds.map((id) => id.toString());\n candidateComponentsIds.forEach((bitId: ComponentID) => {\n const dependents = dependencyGraph.getImmediateDependentsPerId(bitId);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const dependentsNotCandidates = dependents.filter((dependent) => !candidateComponentsIdsStr.includes(dependent));\n if (dependentsNotCandidates.length) {\n throw new BitError( // $FlowFixMe\n `unable to untag ${bitId}, the version ${bitId.version} has the following dependent(s) ${dependents.join(\n ', '\n )}`\n );\n }\n });\n }\n logger.debug(`found ${componentsToUntag.length} components to untag`);\n return Promise.all(\n componentsToUntag.map((component) => removeLocalVersion(scope, component.toComponentId(), lane, head, force))\n );\n}\n\nexport async function getComponentsWithOptionToUntag(\n consumer: Consumer,\n remove: RemoveMain\n): Promise<ModelComponent[]> {\n const componentList = new ComponentsList(consumer);\n const laneObj = await consumer.getCurrentLaneObject();\n const components: ModelComponent[] = await componentList.listExportPendingComponents(laneObj);\n const removedStagedIds = await remove.getRemovedStaged();\n if (!removedStagedIds.length) return components;\n const removedStagedBitIds = removedStagedIds.map((id) => id);\n const nonExistsInStaged = removedStagedBitIds.filter(\n (id) => !components.find((c) => c.toComponentId().isEqualWithoutVersion(id))\n );\n if (!nonExistsInStaged.length) return components;\n const modelComps = await Promise.all(nonExistsInStaged.map((id) => consumer.scope.getModelComponent(id)));\n components.push(...modelComps);\n\n return components;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwD,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMxD;AACA;AACA;AACO,eAAeG,kBAAkBA,CACtCC,KAAY,EACZC,EAAe,EACfC,IAAW,EACXC,IAAc,EACdC,KAAK,GAAG,KAAK,EACS;EACtB,MAAMC,SAAyB,GAAG,MAAML,KAAK,CAACM,iBAAiB,CAACL,EAAE,CAAC;EACnE,MAAMM,KAAK,GAAGN,EAAE,CAACO,QAAQ,CAAC,CAAC;EAC3B,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BAAgB,CAAClD,MAAM,EAAE,OAAOgD,UAAU;EAC/C,MAAMI,mBAAmB,GAAGF,gBAAgB,CAACnB,GAAG,CAAE1C,EAAE,IAAKA,EAAE,CAAC;EAC5D,MAAMgE,iBAAiB,GAAGD,mBAAmB,CAAChB,MAAM,CACjD/C,EAAE,IAAK,CAAC2D,UAAU,CAAC3C,IAAI,CAAEiD,CAAC,IAAKA,CAAC,CAACtC,aAAa,CAAC,CAAC,CAACuC,qBAAqB,CAAClE,EAAE,CAAC,CAC7E,CAAC;EACD,IAAI,CAACgE,iBAAiB,CAACrD,MAAM,EAAE,OAAOgD,UAAU;EAChD,MAAMQ,UAAU,GAAG,MAAMd,OAAO,CAACC,GAAG,CAACU,iBAAiB,CAACtB,GAAG,CAAE1C,EAAE,IAAKoC,QAAQ,CAACrC,KAAK,CAACM,iBAAiB,CAACL,EAAE,CAAC,CAAC,CAAC;EACzG2D,UAAU,CAACS,IAAI,CAAC,GAAGD,UAAU,CAAC;EAE9B,OAAOR,UAAU;AACnB","ignoreList":[]}
|
|
@@ -24,6 +24,7 @@ import { TagDataPerCompRaw } from './tag-from-scope.cmd';
|
|
|
24
24
|
import { SnapDataPerCompRaw, FileData } from './snap-from-scope.cmd';
|
|
25
25
|
import { untagResult } from './reset-component';
|
|
26
26
|
import { ApplicationMain } from '@teambit/application';
|
|
27
|
+
import { RemoveMain } from '@teambit/remove';
|
|
27
28
|
export type TagDataPerComp = {
|
|
28
29
|
componentId: ComponentID;
|
|
29
30
|
dependencies: ComponentID[];
|
|
@@ -82,8 +83,9 @@ export declare class SnappingMain {
|
|
|
82
83
|
private importer;
|
|
83
84
|
private deps;
|
|
84
85
|
private application;
|
|
86
|
+
private remove;
|
|
85
87
|
private objectsRepo;
|
|
86
|
-
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain, insights: InsightsMain, dependencyResolver: DependencyResolverMain, scope: ScopeMain, exporter: ExportMain, builder: BuilderMain, importer: ImporterMain, deps: DependenciesMain, application: ApplicationMain);
|
|
88
|
+
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain, insights: InsightsMain, dependencyResolver: DependencyResolverMain, scope: ScopeMain, exporter: ExportMain, builder: BuilderMain, importer: ImporterMain, deps: DependenciesMain, application: ApplicationMain, remove: RemoveMain);
|
|
87
89
|
/**
|
|
88
90
|
* tag the given component ids or all modified/new components if "all" param is set.
|
|
89
91
|
* tag is a similar operation as a snap, which saves the changes into the local scope, but it also creates an alias
|
|
@@ -189,7 +191,7 @@ export declare class SnappingMain {
|
|
|
189
191
|
static slots: never[];
|
|
190
192
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
191
193
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
192
|
-
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application,]: [
|
|
194
|
+
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application, remove,]: [
|
|
193
195
|
Workspace,
|
|
194
196
|
CLIMain,
|
|
195
197
|
LoggerMain,
|
|
@@ -202,7 +204,8 @@ export declare class SnappingMain {
|
|
|
202
204
|
ImporterMain,
|
|
203
205
|
GlobalConfigMain,
|
|
204
206
|
DependenciesMain,
|
|
205
|
-
ApplicationMain
|
|
207
|
+
ApplicationMain,
|
|
208
|
+
RemoveMain
|
|
206
209
|
]): Promise<SnappingMain>;
|
|
207
210
|
}
|
|
208
211
|
export default SnappingMain;
|
|
@@ -340,6 +340,13 @@ function _lanesModules() {
|
|
|
340
340
|
};
|
|
341
341
|
return data;
|
|
342
342
|
}
|
|
343
|
+
function _remove() {
|
|
344
|
+
const data = require("@teambit/remove");
|
|
345
|
+
_remove = function () {
|
|
346
|
+
return data;
|
|
347
|
+
};
|
|
348
|
+
return data;
|
|
349
|
+
}
|
|
343
350
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
344
351
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
345
352
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -347,7 +354,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
347
354
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
348
355
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
349
356
|
class SnappingMain {
|
|
350
|
-
constructor(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application) {
|
|
357
|
+
constructor(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application, remove) {
|
|
351
358
|
this.workspace = workspace;
|
|
352
359
|
this.logger = logger;
|
|
353
360
|
this.issues = issues;
|
|
@@ -359,6 +366,7 @@ class SnappingMain {
|
|
|
359
366
|
this.importer = importer;
|
|
360
367
|
this.deps = deps;
|
|
361
368
|
this.application = application;
|
|
369
|
+
this.remove = remove;
|
|
362
370
|
_defineProperty(this, "objectsRepo", void 0);
|
|
363
371
|
this.objectsRepo = this.scope?.legacyScope?.objects;
|
|
364
372
|
}
|
|
@@ -831,9 +839,9 @@ in case you're unsure about the pattern syntax, use "bit pattern [--help]"`);
|
|
|
831
839
|
const currentLane = await consumer.getCurrentLaneObject();
|
|
832
840
|
const untag = async () => {
|
|
833
841
|
if (!componentPattern) {
|
|
834
|
-
return (0, _resetComponent().removeLocalVersionsForAllComponents)(consumer, currentLane, head);
|
|
842
|
+
return (0, _resetComponent().removeLocalVersionsForAllComponents)(consumer, this.remove, currentLane, head);
|
|
835
843
|
}
|
|
836
|
-
const candidateComponents = await (0, _resetComponent().getComponentsWithOptionToUntag)(consumer);
|
|
844
|
+
const candidateComponents = await (0, _resetComponent().getComponentsWithOptionToUntag)(consumer, this.remove);
|
|
837
845
|
const idsMatchingPattern = await this.workspace.idsByPattern(componentPattern, true, {
|
|
838
846
|
includeDeleted: true
|
|
839
847
|
});
|
|
@@ -1378,9 +1386,9 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1378
1386
|
warnings
|
|
1379
1387
|
};
|
|
1380
1388
|
}
|
|
1381
|
-
static async provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application]) {
|
|
1389
|
+
static async provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application, remove]) {
|
|
1382
1390
|
const logger = loggerMain.createLogger(_snapping().SnappingAspect.id);
|
|
1383
|
-
const snapping = new SnappingMain(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application);
|
|
1391
|
+
const snapping = new SnappingMain(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application, remove);
|
|
1384
1392
|
const snapCmd = new (_snapCmd().SnapCmd)(snapping, logger, globalConfig);
|
|
1385
1393
|
const tagCmd = new (_tagCmd().TagCmd)(snapping, logger, globalConfig);
|
|
1386
1394
|
const tagFromScopeCmd = new (_tagFromScope().TagFromScopeCmd)(snapping, logger);
|
|
@@ -1393,7 +1401,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1393
1401
|
}
|
|
1394
1402
|
exports.SnappingMain = SnappingMain;
|
|
1395
1403
|
_defineProperty(SnappingMain, "slots", []);
|
|
1396
|
-
_defineProperty(SnappingMain, "dependencies", [_workspace().WorkspaceAspect, _cli().CLIAspect, _logger().LoggerAspect, _issues().IssuesAspect, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().ImporterAspect, _globalConfig().GlobalConfigAspect, _dependencies().DependenciesAspect, _application().ApplicationAspect]);
|
|
1404
|
+
_defineProperty(SnappingMain, "dependencies", [_workspace().WorkspaceAspect, _cli().CLIAspect, _logger().LoggerAspect, _issues().IssuesAspect, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().ImporterAspect, _globalConfig().GlobalConfigAspect, _dependencies().DependenciesAspect, _application().ApplicationAspect, _remove().RemoveAspect]);
|
|
1397
1405
|
_defineProperty(SnappingMain, "runtime", _cli().MainRuntime);
|
|
1398
1406
|
_snapping().SnappingAspect.addRuntime(SnappingMain);
|
|
1399
1407
|
var _default = exports.default = SnappingMain;
|