@teambit/snapping 1.0.495 → 1.0.497

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/dist/tag-cmd.js CHANGED
@@ -46,7 +46,7 @@ const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepa
46
46
  const tagCmdOptions = exports.tagCmdOptions = [['m', 'message <message>', 'a log message describing latest changes'], ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are tagged)'], ['', 'editor [editor]', 'open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).'], ['v', 'ver <version>', 'tag with the given version'], ['l', 'increment <level>', `options are: [${RELEASE_TYPES.join(', ')}], default to patch`], ['', 'prerelease-id <id>', 'prerelease identifier (e.g. "dev" to get "1.0.0-dev.1")'], ['p', 'patch', 'syntactic sugar for "--increment patch"'], ['', 'minor', 'syntactic sugar for "--increment minor"'], ['', 'major', 'syntactic sugar for "--increment major"'], ['', 'pre-release [identifier]', 'syntactic sugar for "--increment prerelease" and `--prerelease-id <identifier>`'], ['', 'snapped', 'tag only components whose head is a snap (not a tag)'], ['', 'unmerged', 'complete a merge process by tagging the unmerged components'], ['', 'skip-tests', 'skip running component tests during tag process'], ['', 'skip-tasks <string>', `skip the given tasks. for multiple tasks, separate by a comma and wrap with quotes.
47
47
  specify the task-name (e.g. "TypescriptCompiler") or the task-aspect-id (e.g. teambit.compilation/compiler)`], ['', 'skip-auto-tag', 'skip auto tagging dependents'], ['', 'soft', 'do not persist. only keep note of the changes to be made'], ['', 'persist [skip-build]', 'persist the changes generated by --soft tag. by default, run the build pipeline, unless "skip-build" is provided'], ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'], ['', 'ignore-build-errors', 'proceed to tag pipeline even when build pipeline fails'], ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'], ['', 'increment-by <number>', '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.'], ['i', 'ignore-issues <issues>', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
48
48
  [${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
49
- to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['I', 'ignore-newest-version', 'allow tagging even when the component has newer versions e.g. for hotfixes (default = false)'], ['', 'fail-fast', 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)'], ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the tag']];
49
+ to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['I', 'ignore-newest-version', 'allow tagging even when the component has newer versions e.g. for hotfixes.'], ['', 'fail-fast', 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)'], ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the tag'], ['', 'detach-head', 'UNSUPPORTED YET. in case a component is checked out to an older version, tag it without changing the head']];
50
50
  class TagCmd {
51
51
  constructor(snapping, logger, globalConfig) {
52
52
  this.snapping = snapping;
@@ -93,7 +93,8 @@ if patterns are entered, you can specify a version per pattern using "@" sign, e
93
93
  ignoreBuildErrors = false,
94
94
  rebuildDepsGraph,
95
95
  failFast = false,
96
- incrementBy = 1
96
+ incrementBy = 1,
97
+ detachHead
97
98
  } = options;
98
99
  if (!message && !persist && !editor) {
99
100
  this.logger.consoleWarning(`--message will be mandatory in the next few releases. make sure to add a message with your tag`);
@@ -138,7 +139,8 @@ To undo local tag use the "bit reset" command.`);
138
139
  rebuildDepsGraph,
139
140
  incrementBy,
140
141
  version: ver,
141
- failFast
142
+ failFast,
143
+ detachHead
142
144
  };
143
145
  const results = await this.snapping.tag(params);
144
146
  if (!results) return _chalk().default.yellow(persist ? 'no soft-tag found' : NOTHING_TO_TAG_MSG);
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_legacy","_componentIssues","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","NOTHING_TO_TAG_MSG","exports","AUTO_TAGGED_MSG","RELEASE_TYPES","tagCmdOptions","join","keys","IssuesClasses","TagCmd","constructor","snapping","logger","globalConfig","name","description","COMPONENT_PATTERN_HELP","cmd","report","patterns","options","message","ver","editor","snapped","unmerged","ignoreIssues","ignoreNewestVersion","skipTests","skipTasks","skipAutoTag","unmodified","soft","persist","disableTagPipeline","ignoreBuildErrors","rebuildDepsGraph","failFast","incrementBy","consoleWarning","releaseType","preReleaseId","validateOptions","disableTagAndSnapPipelines","build","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","BitError","params","ids","version","results","tag","chalk","yellow","tagResultOutput","patch","minor","major","preRelease","increment","prereleaseId","releaseFlags","filter","x","length","getReleaseType","includes","DEFAULT_BIT_RELEASE_TYPE","getPreReleaseId","undefined","taggedComponents","autoTaggedResults","warnings","newComponents","removedComponents","exportedIds","changedComponents","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","warningsOutput","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","compInBold","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","autoTagComp","a","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","exportedOutput","title","underline","softTagPrefix","outputIfExists","label","explanation","components","newDesc","changedDesc","softTagClarification","outputIdsIfExists"],"sources":["tag-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentIdList, ComponentID } from '@teambit/component-id';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { DEFAULT_BIT_RELEASE_TYPE, COMPONENT_PATTERN_HELP, CFG_FORCE_LOCAL_BUILD } from '@teambit/legacy.constants';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ReleaseType } from 'semver';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { TagResults, SnappingMain } from './snapping.main.runtime';\nimport { BasicTagParams } from './tag-model-component';\n\nexport const NOTHING_TO_TAG_MSG = 'nothing to tag';\nexport const AUTO_TAGGED_MSG = 'auto-tagged dependents';\n\nconst RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];\n\nexport const tagCmdOptions = [\n ['m', 'message <message>', 'a log message describing latest changes'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are tagged)'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).',\n ],\n ['v', 'ver <version>', 'tag with the given version'],\n ['l', 'increment <level>', `options are: [${RELEASE_TYPES.join(', ')}], default to patch`],\n ['', 'prerelease-id <id>', 'prerelease identifier (e.g. \"dev\" to get \"1.0.0-dev.1\")'],\n ['p', 'patch', 'syntactic sugar for \"--increment patch\"'],\n ['', 'minor', 'syntactic sugar for \"--increment minor\"'],\n ['', 'major', 'syntactic sugar for \"--increment major\"'],\n ['', 'pre-release [identifier]', 'syntactic sugar for \"--increment prerelease\" and `--prerelease-id <identifier>`'],\n ['', 'snapped', 'tag only components whose head is a snap (not a tag)'],\n ['', 'unmerged', 'complete a merge process by tagging the unmerged components'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n [\n '',\n 'skip-tasks <string>',\n `skip the given tasks. for multiple tasks, separate by a comma and wrap with quotes.\nspecify the task-name (e.g. \"TypescriptCompiler\") or the task-aspect-id (e.g. teambit.compilation/compiler)`,\n ],\n ['', 'skip-auto-tag', 'skip auto tagging dependents'],\n ['', 'soft', 'do not persist. only keep note of the changes to be made'],\n [\n '',\n 'persist [skip-build]',\n 'persist the changes generated by --soft tag. by default, run the build pipeline, unless \"skip-build\" is provided',\n ],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'ignore-build-errors', 'proceed to tag pipeline even when build pipeline fails'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\n [\n 'i',\n 'ignore-issues <issues>',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n [\n 'I',\n 'ignore-newest-version',\n 'allow tagging even when the component has newer versions e.g. for hotfixes (default = false)',\n ],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the tag'],\n] as CommandOptions;\n\nexport type TagParams = {\n snapped?: boolean;\n unmerged?: boolean;\n ver?: string;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n increment?: ReleaseType;\n preRelease?: string;\n prereleaseId?: string;\n ignoreUnresolvedDependencies?: boolean;\n ignoreIssues?: string;\n incrementBy?: number;\n failFast?: boolean;\n disableTagPipeline?: boolean;\n} & Partial<BasicTagParams>;\n\nexport class TagCmd implements Command {\n name = 'tag [component-patterns...]';\n group = 'development';\n description = 'create an immutable and exportable component snapshot, tagged with a release version.';\n extendedDescription = `if no patterns are provided, it will tag all new and modified components.\nif patterns are entered, you can specify a version per pattern using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major`;\n arguments = [\n {\n name: 'component-patterns...',\n description: `${COMPONENT_PATTERN_HELP}. By default, all new and modified are tagged.`,\n },\n ];\n helpUrl = 'reference/components/snaps#create-a-tag-(release-version)';\n alias = 't';\n loader = true;\n options = tagCmdOptions;\n remoteOp = true; // In case a compiler / tester is not installed\n examples = [{ cmd: 'tag --ver 1.0.0', description: 'tag all components to version 1.0.0' }];\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger,\n private globalConfig: GlobalConfigMain\n ) {}\n\n // eslint-disable-next-line complexity\n async report([patterns = []]: [string[]], options: TagParams): Promise<string> {\n const {\n message = '',\n ver,\n editor = '',\n snapped = false,\n unmerged = false,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipTasks,\n skipAutoTag = false,\n unmodified = false,\n soft = false,\n persist = false,\n disableTagPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n failFast = false,\n incrementBy = 1,\n } = options;\n\n if (!message && !persist && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your tag`\n );\n }\n const { releaseType, preReleaseId } = validateOptions(options);\n\n const disableTagAndSnapPipelines = disableTagPipeline;\n let build = options.build;\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n if (persist) {\n if (persist === true) build = true;\n else if (persist === 'skip-build') build = false;\n else throw new BitError(`unknown value for --persist, use either --persist or --persist=skip-build`);\n }\n if (!build && !soft) {\n this.logger.consoleWarning(\n `tagging components on \"main\" lane when using remote build is not recommended. To avoid SemVer versions of your component with failing builds, please refer to:\n- Snap changes in a different lane and merge to \"main\" on your remote (learn more on lanes - https://bit.dev/reference/lanes/getting-started-with-lanes)\n- Use \\`bit tag --build\\` to build your components locally.\n- Use \\`snap\\` or \\`build\\` first to validate your build passing, and then version and export safely.\n\nTo undo local tag use the \"bit reset\" command.`\n );\n }\n\n const params = {\n ids: patterns,\n snapped,\n unmerged,\n editor,\n message,\n releaseType,\n preReleaseId,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipTasks,\n skipAutoTag,\n build,\n soft,\n persist,\n unmodified,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n incrementBy,\n version: ver,\n failFast,\n };\n\n const results = await this.snapping.tag(params);\n if (!results) return chalk.yellow(persist ? 'no soft-tag found' : NOTHING_TO_TAG_MSG);\n return tagResultOutput(results);\n }\n}\n\nexport function validateOptions(options: TagParams) {\n const { patch, minor, major, preRelease, increment, prereleaseId } = options;\n if (prereleaseId && (!increment || increment === 'major' || increment === 'minor' || increment === 'patch')) {\n throw new BitError(\n `--prerelease-id should be entered along with --increment flag, while --increment must be one of the following: [prepatch, prerelease, preminor, premajor]`\n );\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new BitError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n const getReleaseType = (): ReleaseType => {\n if (increment) {\n if (!RELEASE_TYPES.includes(increment)) {\n throw new BitError(`invalid increment-level \"${increment}\".\nsemver allows the following options only: ${RELEASE_TYPES.join(', ')}`);\n }\n return increment;\n }\n if (major) return 'major';\n if (minor) return 'minor';\n if (patch) return 'patch';\n if (preRelease) return 'prerelease';\n return DEFAULT_BIT_RELEASE_TYPE;\n };\n const getPreReleaseId = (): string | undefined => {\n if (prereleaseId) {\n return prereleaseId;\n }\n if (preRelease && typeof preRelease === 'string') {\n return preRelease;\n }\n return undefined;\n };\n\n return {\n releaseType: getReleaseType(),\n preReleaseId: getPreReleaseId(),\n };\n}\n\nexport function tagResultOutput(results: TagResults): string {\n const { taggedComponents, autoTaggedResults, warnings, newComponents, removedComponents, exportedIds }: TagResults =\n results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = exportedIds\n ? ''\n : `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset\" to unstage versions)`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the soft-tagged changes as a fully tagged version\")\n(use \"bit reset --soft\" to remove the soft-tags)`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const compInBold = (id: ComponentID) => {\n const version = id.hasVersion() ? `@${id.version}` : '';\n return `${chalk.bold(id.toStringWithoutVersion())}${version}`;\n };\n\n const outputComponents = (comps: ConsumerComponent[]) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${compInBold(component.id)}`;\n const autoTag = autoTaggedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => compInBold(a.component.id));\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const exportedOutput = () => {\n if (!exportedIds) return '';\n if (!exportedIds.length) return `\\n${chalk.yellow('no component has been exported')}\\n`;\n const title = `\\n${chalk.underline('exported components')}\\n`;\n const ids = exportedIds.map((id) => ` > ${compInBold(id)}`).join('\\n');\n return `${title}${ids}\\n`;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label: string, explanation: string, components: ConsumerComponent[]) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged with first version for components when persisted'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that are set to get a version bump when persisted'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n '\\nkeep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n outputIdsIfExists('removed components', removedComponents) +\n publishOutput() +\n exportedOutput() +\n warningsOutput +\n chalk.green(\n `\\n${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged${\n exportedIds ? ' and exported' : ''\n }`\n ) +\n tagExplanation +\n softTagClarification\n );\n}\n\nexport function outputIdsIfExists(label: string, ids?: ComponentIdList) {\n if (!ids?.length) return '';\n return `\\n${chalk.underline(label)}\\n${ids.map((id) => id.toStringWithoutVersion()).join('\\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;AAIA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,iBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,gBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAK,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,CAAA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iBAAiBA,CAACN,KAAa,EAAE/D,GAAqB,EAAE;EACtE,IAAI,CAACA,GAAG,EAAEgB,MAAM,EAAE,OAAO,EAAE;EAC3B,OAAO,KAAKZ,gBAAK,CAACwD,SAAS,CAACG,KAAK,CAAC,KAAK/D,GAAG,CAAC6C,GAAG,CAAEd,EAAE,IAAKA,EAAE,CAACW,sBAAsB,CAAC,CAAC,CAAC,CAACtF,IAAI,CAAC,IAAI,CAAC,IAAI;AACpG","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_legacy","_componentIssues","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","NOTHING_TO_TAG_MSG","exports","AUTO_TAGGED_MSG","RELEASE_TYPES","tagCmdOptions","join","keys","IssuesClasses","TagCmd","constructor","snapping","logger","globalConfig","name","description","COMPONENT_PATTERN_HELP","cmd","report","patterns","options","message","ver","editor","snapped","unmerged","ignoreIssues","ignoreNewestVersion","skipTests","skipTasks","skipAutoTag","unmodified","soft","persist","disableTagPipeline","ignoreBuildErrors","rebuildDepsGraph","failFast","incrementBy","detachHead","consoleWarning","releaseType","preReleaseId","validateOptions","disableTagAndSnapPipelines","build","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","BitError","params","ids","version","results","tag","chalk","yellow","tagResultOutput","patch","minor","major","preRelease","increment","prereleaseId","releaseFlags","filter","x","length","getReleaseType","includes","DEFAULT_BIT_RELEASE_TYPE","getPreReleaseId","undefined","taggedComponents","autoTaggedResults","warnings","newComponents","removedComponents","exportedIds","changedComponents","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","warningsOutput","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","compInBold","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","autoTagComp","a","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","exportedOutput","title","underline","softTagPrefix","outputIfExists","label","explanation","components","newDesc","changedDesc","softTagClarification","outputIdsIfExists"],"sources":["tag-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentIdList, ComponentID } from '@teambit/component-id';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { DEFAULT_BIT_RELEASE_TYPE, COMPONENT_PATTERN_HELP, CFG_FORCE_LOCAL_BUILD } from '@teambit/legacy.constants';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ReleaseType } from 'semver';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { TagResults, SnappingMain } from './snapping.main.runtime';\nimport { BasicTagParams } from './tag-model-component';\n\nexport const NOTHING_TO_TAG_MSG = 'nothing to tag';\nexport const AUTO_TAGGED_MSG = 'auto-tagged dependents';\n\nconst RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];\n\nexport const tagCmdOptions = [\n ['m', 'message <message>', 'a log message describing latest changes'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are tagged)'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).',\n ],\n ['v', 'ver <version>', 'tag with the given version'],\n ['l', 'increment <level>', `options are: [${RELEASE_TYPES.join(', ')}], default to patch`],\n ['', 'prerelease-id <id>', 'prerelease identifier (e.g. \"dev\" to get \"1.0.0-dev.1\")'],\n ['p', 'patch', 'syntactic sugar for \"--increment patch\"'],\n ['', 'minor', 'syntactic sugar for \"--increment minor\"'],\n ['', 'major', 'syntactic sugar for \"--increment major\"'],\n ['', 'pre-release [identifier]', 'syntactic sugar for \"--increment prerelease\" and `--prerelease-id <identifier>`'],\n ['', 'snapped', 'tag only components whose head is a snap (not a tag)'],\n ['', 'unmerged', 'complete a merge process by tagging the unmerged components'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n [\n '',\n 'skip-tasks <string>',\n `skip the given tasks. for multiple tasks, separate by a comma and wrap with quotes.\nspecify the task-name (e.g. \"TypescriptCompiler\") or the task-aspect-id (e.g. teambit.compilation/compiler)`,\n ],\n ['', 'skip-auto-tag', 'skip auto tagging dependents'],\n ['', 'soft', 'do not persist. only keep note of the changes to be made'],\n [\n '',\n 'persist [skip-build]',\n 'persist the changes generated by --soft tag. by default, run the build pipeline, unless \"skip-build\" is provided',\n ],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'ignore-build-errors', 'proceed to tag pipeline even when build pipeline fails'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\n [\n 'i',\n 'ignore-issues <issues>',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['I', 'ignore-newest-version', 'allow tagging even when the component has newer versions e.g. for hotfixes.'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the tag'],\n [\n '',\n 'detach-head',\n 'UNSUPPORTED YET. in case a component is checked out to an older version, tag it without changing the head',\n ],\n] as CommandOptions;\n\nexport type TagParams = {\n snapped?: boolean;\n unmerged?: boolean;\n ver?: string;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n increment?: ReleaseType;\n preRelease?: string;\n prereleaseId?: string;\n ignoreUnresolvedDependencies?: boolean;\n ignoreIssues?: string;\n incrementBy?: number;\n failFast?: boolean;\n disableTagPipeline?: boolean;\n} & Partial<BasicTagParams>;\n\nexport class TagCmd implements Command {\n name = 'tag [component-patterns...]';\n group = 'development';\n description = 'create an immutable and exportable component snapshot, tagged with a release version.';\n extendedDescription = `if no patterns are provided, it will tag all new and modified components.\nif patterns are entered, you can specify a version per pattern using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major`;\n arguments = [\n {\n name: 'component-patterns...',\n description: `${COMPONENT_PATTERN_HELP}. By default, all new and modified are tagged.`,\n },\n ];\n helpUrl = 'reference/components/snaps#create-a-tag-(release-version)';\n alias = 't';\n loader = true;\n options = tagCmdOptions;\n remoteOp = true; // In case a compiler / tester is not installed\n examples = [{ cmd: 'tag --ver 1.0.0', description: 'tag all components to version 1.0.0' }];\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger,\n private globalConfig: GlobalConfigMain\n ) {}\n\n // eslint-disable-next-line complexity\n async report([patterns = []]: [string[]], options: TagParams): Promise<string> {\n const {\n message = '',\n ver,\n editor = '',\n snapped = false,\n unmerged = false,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipTasks,\n skipAutoTag = false,\n unmodified = false,\n soft = false,\n persist = false,\n disableTagPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n failFast = false,\n incrementBy = 1,\n detachHead,\n } = options;\n\n if (!message && !persist && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your tag`\n );\n }\n const { releaseType, preReleaseId } = validateOptions(options);\n\n const disableTagAndSnapPipelines = disableTagPipeline;\n let build = options.build;\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n if (persist) {\n if (persist === true) build = true;\n else if (persist === 'skip-build') build = false;\n else throw new BitError(`unknown value for --persist, use either --persist or --persist=skip-build`);\n }\n if (!build && !soft) {\n this.logger.consoleWarning(\n `tagging components on \"main\" lane when using remote build is not recommended. To avoid SemVer versions of your component with failing builds, please refer to:\n- Snap changes in a different lane and merge to \"main\" on your remote (learn more on lanes - https://bit.dev/reference/lanes/getting-started-with-lanes)\n- Use \\`bit tag --build\\` to build your components locally.\n- Use \\`snap\\` or \\`build\\` first to validate your build passing, and then version and export safely.\n\nTo undo local tag use the \"bit reset\" command.`\n );\n }\n\n const params = {\n ids: patterns,\n snapped,\n unmerged,\n editor,\n message,\n releaseType,\n preReleaseId,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipTasks,\n skipAutoTag,\n build,\n soft,\n persist,\n unmodified,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n incrementBy,\n version: ver,\n failFast,\n detachHead,\n };\n\n const results = await this.snapping.tag(params);\n if (!results) return chalk.yellow(persist ? 'no soft-tag found' : NOTHING_TO_TAG_MSG);\n return tagResultOutput(results);\n }\n}\n\nexport function validateOptions(options: TagParams) {\n const { patch, minor, major, preRelease, increment, prereleaseId } = options;\n if (prereleaseId && (!increment || increment === 'major' || increment === 'minor' || increment === 'patch')) {\n throw new BitError(\n `--prerelease-id should be entered along with --increment flag, while --increment must be one of the following: [prepatch, prerelease, preminor, premajor]`\n );\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new BitError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n const getReleaseType = (): ReleaseType => {\n if (increment) {\n if (!RELEASE_TYPES.includes(increment)) {\n throw new BitError(`invalid increment-level \"${increment}\".\nsemver allows the following options only: ${RELEASE_TYPES.join(', ')}`);\n }\n return increment;\n }\n if (major) return 'major';\n if (minor) return 'minor';\n if (patch) return 'patch';\n if (preRelease) return 'prerelease';\n return DEFAULT_BIT_RELEASE_TYPE;\n };\n const getPreReleaseId = (): string | undefined => {\n if (prereleaseId) {\n return prereleaseId;\n }\n if (preRelease && typeof preRelease === 'string') {\n return preRelease;\n }\n return undefined;\n };\n\n return {\n releaseType: getReleaseType(),\n preReleaseId: getPreReleaseId(),\n };\n}\n\nexport function tagResultOutput(results: TagResults): string {\n const { taggedComponents, autoTaggedResults, warnings, newComponents, removedComponents, exportedIds }: TagResults =\n results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = exportedIds\n ? ''\n : `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset\" to unstage versions)`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the soft-tagged changes as a fully tagged version\")\n(use \"bit reset --soft\" to remove the soft-tags)`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const compInBold = (id: ComponentID) => {\n const version = id.hasVersion() ? `@${id.version}` : '';\n return `${chalk.bold(id.toStringWithoutVersion())}${version}`;\n };\n\n const outputComponents = (comps: ConsumerComponent[]) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${compInBold(component.id)}`;\n const autoTag = autoTaggedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => compInBold(a.component.id));\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const exportedOutput = () => {\n if (!exportedIds) return '';\n if (!exportedIds.length) return `\\n${chalk.yellow('no component has been exported')}\\n`;\n const title = `\\n${chalk.underline('exported components')}\\n`;\n const ids = exportedIds.map((id) => ` > ${compInBold(id)}`).join('\\n');\n return `${title}${ids}\\n`;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label: string, explanation: string, components: ConsumerComponent[]) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged with first version for components when persisted'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that are set to get a version bump when persisted'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n '\\nkeep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n outputIdsIfExists('removed components', removedComponents) +\n publishOutput() +\n exportedOutput() +\n warningsOutput +\n chalk.green(\n `\\n${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged${\n exportedIds ? ' and exported' : ''\n }`\n ) +\n tagExplanation +\n softTagClarification\n );\n}\n\nexport function outputIdsIfExists(label: string, ids?: ComponentIdList) {\n if (!ids?.length) return '';\n return `\\n${chalk.underline(label)}\\n${ids.map((id) => id.toStringWithoutVersion()).join('\\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;AAIA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,iBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,gBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,UAA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oC,SAAS,GAC1ClC,gBAAK,CAACqC,IAAI,CACR,mHACF,CAAC,GACD,EAAE;EACN,OACEqB,cAAc,CAAC,gBAAgB,EAAEI,OAAO,EAAElC,eAAe,CAAC,GAC1D8B,cAAc,CAAC,oBAAoB,EAAEK,WAAW,EAAEvC,iBAAiB,CAAC,GACpEyC,iBAAiB,CAAC,oBAAoB,EAAE3C,iBAAiB,CAAC,GAC1D0B,aAAa,CAAC,CAAC,GACfM,cAAc,CAAC,CAAC,GAChBxB,cAAc,GACd9B,gBAAK,CAACmD,KAAK,CACT,KAAKjC,gBAAgB,CAACN,MAAM,GAAGiB,eAAe,iBAAiB/B,OAAO,CAACoC,SAAS,GAAG,OAAO,GAAG,EAAE,SAC7FX,WAAW,GAAG,eAAe,GAAG,EAAE,EAEtC,CAAC,GACDU,cAAc,GACd+B,oBAAoB;AAExB;AAEO,SAASC,iBAAiBA,CAACN,KAAa,EAAE/D,GAAqB,EAAE;EACtE,IAAI,CAACA,GAAG,EAAEgB,MAAM,EAAE,OAAO,EAAE;EAC3B,OAAO,KAAKZ,gBAAK,CAACwD,SAAS,CAACG,KAAK,CAAC,KAAK/D,GAAG,CAAC6C,GAAG,CAAEd,EAAE,IAAKA,EAAE,CAACW,sBAAsB,CAAC,CAAC,CAAC,CAACvF,IAAI,CAAC,IAAI,CAAC,IAAI;AACpG","ignoreList":[]}
@@ -53,7 +53,7 @@ an example of the final data: '[{"componentId":"ci.remote2/comp-b","dependencies
53
53
  `);
54
54
  _defineProperty(this, "alias", '');
55
55
  _defineProperty(this, "loader", true);
56
- _defineProperty(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['', 'rebuild-artifacts', 'run the full build pipeline. do not use the saved artifacts from the last snap'], ['', 'ignore-last-pkg-json', 'ignore the package.json created by the last snap'], ..._tagCmd().tagCmdOptions.filter(o => !excludeOptions.includes(o[1]))]);
56
+ _defineProperty(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['', 'rebuild-artifacts', 'run the full build pipeline. do not use the saved artifacts from the last snap'], ['', 'ignore-last-pkg-json', 'ignore the package.json created by the last snap'], ['', 'override-head', 'opposite of detach-head. in case a component is checked out to an older version, change head to the newly created version'], ..._tagCmd().tagCmdOptions.filter(o => !excludeOptions.includes(o[1]))]);
57
57
  _defineProperty(this, "remoteOp", true);
58
58
  }
59
59
 
@@ -76,7 +76,9 @@ an example of the final data: '[{"componentId":"ci.remote2/comp-b","dependencies
76
76
  rebuildArtifacts,
77
77
  ignoreLastPkgJson,
78
78
  rebuildDepsGraph,
79
- incrementBy = 1
79
+ incrementBy = 1,
80
+ detachHead,
81
+ overrideHead
80
82
  } = options;
81
83
  const params = {
82
84
  push,
@@ -95,7 +97,9 @@ an example of the final data: '[{"componentId":"ci.remote2/comp-b","dependencies
95
97
  incrementBy,
96
98
  version: ver,
97
99
  rebuildArtifacts,
98
- ignoreLastPkgJson
100
+ ignoreLastPkgJson,
101
+ detachHead,
102
+ overrideHead
99
103
  };
100
104
  const tagDataPerCompRaw = this.parseData(data);
101
105
  this.logger.console(`tagging using ${(0, _bit().getBitVersion)()} version`);
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_tagCmd","_bit","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","excludeOptions","TagFromScopeCmd","constructor","snapping","logger","tagCmdOptions","filter","o","includes","report","options","releaseType","preReleaseId","validateOptions","push","message","ver","ignoreIssues","ignoreNewestVersion","skipTests","skipTasks","disableTagPipeline","ignoreBuildErrors","rebuildArtifacts","ignoreLastPkgJson","rebuildDepsGraph","incrementBy","params","build","persist","disableTagAndSnapPipelines","version","tagDataPerCompRaw","parseData","console","getBitVersion","results","tagFromScope","chalk","yellow","NOTHING_TO_TAG_MSG","tagResultOutput","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId","exports"],"sources":["tag-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { NOTHING_TO_TAG_MSG, tagCmdOptions, TagParams, validateOptions, tagResultOutput } from './tag-cmd';\nimport { getBitVersion } from '@teambit/bit.get-bit-version';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\n\nconst excludeOptions = ['unmodified', 'editor [editor]', 'snapped', 'unmerged', 'soft', 'persist [skip-build]'];\n\nexport type TagDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n versionToTag?: string;\n prereleaseId?: string;\n message?: string;\n};\n\nexport class TagFromScopeCmd implements Command {\n name = '_tag <data>';\n group = 'development';\n private = true;\n description =\n 'tag components from a bare-scope by using build artifacts from previous snap and running the deploy-pipeline only';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the tag.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester^@1.0.0, teambit/linter~@0.0.1]\n versionToTag?: string; // specific version (e.g. '1.0.0') or semver (e.g. 'minor', 'patch')\n prereleaseId?: string; // applicable when versionToTag is a pre-release. (e.g. \"dev\", for 1.0.0-dev.1)\n message?: string; // tag-message.\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"dependencies\":[\"ci.remote/comp1@0.0.2\"]}]'\n`;\n alias = '';\n loader = true;\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['', 'rebuild-artifacts', 'run the full build pipeline. do not use the saved artifacts from the last snap'],\n ['', 'ignore-last-pkg-json', 'ignore the package.json created by the last snap'],\n ...tagCmdOptions.filter((o) => !excludeOptions.includes(o[1])),\n ] as CommandOptions;\n remoteOp = true; // In case a compiler / tester is not installed\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger\n ) {}\n\n // eslint-disable-next-line complexity\n async report(\n [data]: [string],\n options: {\n push?: boolean;\n rebuildArtifacts?: boolean;\n ignoreLastPkgJson?: boolean;\n } & Partial<TagParams>\n ): Promise<string> {\n const { releaseType, preReleaseId } = validateOptions(options);\n\n const {\n push,\n message = '',\n ver,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipTasks,\n disableTagPipeline = false,\n ignoreBuildErrors = false,\n rebuildArtifacts,\n ignoreLastPkgJson,\n rebuildDepsGraph,\n incrementBy = 1,\n } = options;\n\n const params = {\n push,\n message,\n releaseType,\n preReleaseId,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipTasks,\n build: true,\n persist: true,\n disableTagAndSnapPipelines: disableTagPipeline,\n ignoreBuildErrors,\n rebuildDepsGraph,\n incrementBy,\n version: ver,\n rebuildArtifacts,\n ignoreLastPkgJson,\n };\n\n const tagDataPerCompRaw = this.parseData(data);\n this.logger.console(`tagging using ${getBitVersion()} version`);\n const results = await this.snapping.tagFromScope(tagDataPerCompRaw, params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n return tagResultOutput(results);\n }\n private parseData(data: string): TagDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n });\n return dataParsed;\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;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAA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AAG;MACZO,gBAAgB;MAChBC;IACF,CAAC;IAED,MAAMQ,iBAAiB,GAAG,IAAI,CAACC,SAAS,CAAC3D,IAAI,CAAC;IAC9C,IAAI,CAAC8B,MAAM,CAAC8B,OAAO,CAAC,iBAAiB,IAAAC,oBAAa,EAAC,CAAC,UAAU,CAAC;IAC/D,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACjC,QAAQ,CAACkC,YAAY,CAACL,iBAAiB,EAAEL,MAAM,CAAC;IAC3E,IAAI,CAACS,OAAO,EAAE,OAAOE,gBAAK,CAACC,MAAM,CAACC,4BAAkB,CAAC;IACrD,OAAO,IAAAC,yBAAe,EAACL,OAAO,CAAC;EACjC;EACQH,SAASA,CAAC3D,IAAY,EAAuB;IACnD,IAAIoE,UAAmB;IACvB,IAAI;MACFA,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACtE,IAAI,CAAC;IAC/B,CAAC,CAAC,OAAOuE,GAAQ,EAAE;MACjB,MAAM,IAAIC,KAAK,CAAC,gDAAgDD,GAAG,CAAC9B,OAAO,EAAE,CAAC;IAChF;IACA,IAAI,CAACgC,KAAK,CAACC,OAAO,CAACN,UAAU,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,4BAA4B,CAAC;IAC/C;IACAJ,UAAU,CAACO,OAAO,CAAEC,QAAQ,IAAK;MAC/B,IAAI,CAACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;IAC3F,CAAC,CAAC;IACF,OAAOJ,UAAU;EACnB;AACF;AAACU,OAAA,CAAAnD,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_tagCmd","_bit","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","excludeOptions","TagFromScopeCmd","constructor","snapping","logger","tagCmdOptions","filter","o","includes","report","options","releaseType","preReleaseId","validateOptions","push","message","ver","ignoreIssues","ignoreNewestVersion","skipTests","skipTasks","disableTagPipeline","ignoreBuildErrors","rebuildArtifacts","ignoreLastPkgJson","rebuildDepsGraph","incrementBy","detachHead","overrideHead","params","build","persist","disableTagAndSnapPipelines","version","tagDataPerCompRaw","parseData","console","getBitVersion","results","tagFromScope","chalk","yellow","NOTHING_TO_TAG_MSG","tagResultOutput","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId","exports"],"sources":["tag-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { NOTHING_TO_TAG_MSG, tagCmdOptions, TagParams, validateOptions, tagResultOutput } from './tag-cmd';\nimport { getBitVersion } from '@teambit/bit.get-bit-version';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\n\nconst excludeOptions = ['unmodified', 'editor [editor]', 'snapped', 'unmerged', 'soft', 'persist [skip-build]'];\n\nexport type TagDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n versionToTag?: string;\n prereleaseId?: string;\n message?: string;\n};\n\nexport class TagFromScopeCmd implements Command {\n name = '_tag <data>';\n group = 'development';\n private = true;\n description =\n 'tag components from a bare-scope by using build artifacts from previous snap and running the deploy-pipeline only';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the tag.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester^@1.0.0, teambit/linter~@0.0.1]\n versionToTag?: string; // specific version (e.g. '1.0.0') or semver (e.g. 'minor', 'patch')\n prereleaseId?: string; // applicable when versionToTag is a pre-release. (e.g. \"dev\", for 1.0.0-dev.1)\n message?: string; // tag-message.\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"dependencies\":[\"ci.remote/comp1@0.0.2\"]}]'\n`;\n alias = '';\n loader = true;\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['', 'rebuild-artifacts', 'run the full build pipeline. do not use the saved artifacts from the last snap'],\n ['', 'ignore-last-pkg-json', 'ignore the package.json created by the last snap'],\n [\n '',\n 'override-head',\n 'opposite of detach-head. in case a component is checked out to an older version, change head to the newly created version',\n ],\n ...tagCmdOptions.filter((o) => !excludeOptions.includes(o[1])),\n ] as CommandOptions;\n remoteOp = true; // In case a compiler / tester is not installed\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger\n ) {}\n\n // eslint-disable-next-line complexity\n async report(\n [data]: [string],\n options: {\n push?: boolean;\n rebuildArtifacts?: boolean;\n ignoreLastPkgJson?: boolean;\n } & Partial<TagParams>\n ): Promise<string> {\n const { releaseType, preReleaseId } = validateOptions(options);\n\n const {\n push,\n message = '',\n ver,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipTasks,\n disableTagPipeline = false,\n ignoreBuildErrors = false,\n rebuildArtifacts,\n ignoreLastPkgJson,\n rebuildDepsGraph,\n incrementBy = 1,\n detachHead,\n overrideHead,\n } = options;\n\n const params = {\n push,\n message,\n releaseType,\n preReleaseId,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipTasks,\n build: true,\n persist: true,\n disableTagAndSnapPipelines: disableTagPipeline,\n ignoreBuildErrors,\n rebuildDepsGraph,\n incrementBy,\n version: ver,\n rebuildArtifacts,\n ignoreLastPkgJson,\n detachHead,\n overrideHead,\n };\n\n const tagDataPerCompRaw = this.parseData(data);\n this.logger.console(`tagging using ${getBitVersion()} version`);\n const results = await this.snapping.tagFromScope(tagDataPerCompRaw, params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n return tagResultOutput(results);\n }\n private parseData(data: string): TagDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n });\n return dataParsed;\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;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6D,SAAAC,uBAAAI,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,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA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AAO,CAACN,UAAU,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,4BAA4B,CAAC;IAC/C;IACAJ,UAAU,CAACO,OAAO,CAAEC,QAAQ,IAAK;MAC/B,IAAI,CAACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;IAC3F,CAAC,CAAC;IACF,OAAOJ,UAAU;EACnB;AACF;AAACU,OAAA,CAAArD,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -6,6 +6,7 @@ import { ModelComponent } from '@teambit/scope.objects';
6
6
  import { StagedConfig } from '@teambit/scope';
7
7
  import { Workspace, AutoTagResult } from '@teambit/workspace';
8
8
  import { SnappingMain, TagDataPerComp } from './snapping.main.runtime';
9
+ import { LaneId } from '@teambit/lane-id';
9
10
  export type onTagIdTransformer = (id: ComponentID) => ComponentID | null;
10
11
  export type BasicTagSnapParams = {
11
12
  message: string;
@@ -14,6 +15,8 @@ export type BasicTagSnapParams = {
14
15
  build?: boolean;
15
16
  ignoreBuildErrors?: boolean;
16
17
  rebuildDepsGraph?: boolean;
18
+ detachHead?: boolean;
19
+ overrideHead?: boolean;
17
20
  };
18
21
  export type BasicTagParams = BasicTagSnapParams & {
19
22
  ignoreNewestVersion?: boolean;
@@ -26,7 +29,8 @@ export type BasicTagParams = BasicTagSnapParams & {
26
29
  unmodified?: boolean;
27
30
  };
28
31
  export declare function tagModelComponent({ snapping, consumerComponents, components, ids, tagDataPerComp, populateArtifactsFrom, populateArtifactsIgnorePkgJson, message, editor, exactVersion, releaseType, preReleaseId, ignoreNewestVersion, skipTests, skipTasks, skipAutoTag, soft, build, persist, isSnap, disableTagAndSnapPipelines, ignoreBuildErrors, rebuildDepsGraph, incrementBy, packageManagerConfigRootDir, copyLogFromPreviousSnap, exitOnFirstFailedTask, updateDependentsOnLane, // on lane, adds it into updateDependents prop
29
- setHeadAsParent, }: {
32
+ setHeadAsParent, // kind of rebase. in case component is checked out to older version, ignore that version, use head
33
+ detachHead, overrideHead, }: {
30
34
  snapping: SnappingMain;
31
35
  components: Component[];
32
36
  consumerComponents: ConsumerComponent[];
@@ -56,4 +60,5 @@ export type BitCloudUser = {
56
60
  displayName?: string;
57
61
  profileImage?: string;
58
62
  };
59
- export declare function updateComponentsVersions(workspace: Workspace, components: Array<ModelComponent>, isTag?: boolean): Promise<StagedConfig>;
63
+ export declare function updateVersions(workspace: Workspace, stagedConfig: StagedConfig, currentLane: LaneId, modelComponent: ModelComponent, versionToSetInBitmap?: string, // helpful for detached head
64
+ isTag?: boolean): Promise<void>;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.tagModelComponent = tagModelComponent;
7
- exports.updateComponentsVersions = updateComponentsVersions;
7
+ exports.updateVersions = updateVersions;
8
8
  function _pMapSeries() {
9
9
  const data = _interopRequireDefault(require("p-map-series"));
10
10
  _pMapSeries = function () {
@@ -124,6 +124,13 @@ function _toolboxPromise() {
124
124
  };
125
125
  return data;
126
126
  }
127
+ function _harmonyModules2() {
128
+ const data = require("@teambit/harmony.modules.feature-toggle");
129
+ _harmonyModules2 = function () {
130
+ return data;
131
+ };
132
+ return data;
133
+ }
127
134
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
128
135
  function updateDependenciesVersions(allComponentsToTag, dependencyResolver) {
129
136
  // filter out removed components.
@@ -198,6 +205,8 @@ function getVersionByEnteredId(enteredIds, component, modelComponent) {
198
205
  }
199
206
  return undefined;
200
207
  }
208
+
209
+ // eslint-disable-next-line complexity
201
210
  async function tagModelComponent({
202
211
  snapping,
203
212
  consumerComponents,
@@ -228,7 +237,10 @@ async function tagModelComponent({
228
237
  exitOnFirstFailedTask = false,
229
238
  updateDependentsOnLane = false,
230
239
  // on lane, adds it into updateDependents prop
231
- setHeadAsParent // kind of rebase. in case component is checked out to older version, ignore that version, use head
240
+ setHeadAsParent,
241
+ // kind of rebase. in case component is checked out to older version, ignore that version, use head
242
+ detachHead,
243
+ overrideHead
232
244
  }) {
233
245
  const workspace = snapping.workspace;
234
246
  const scope = snapping.scope;
@@ -268,30 +280,16 @@ async function tagModelComponent({
268
280
  const messagePerId = await getMessagePerId();
269
281
 
270
282
  // check for each one of the components whether it is using an old version
283
+ // TODO: once --detach-head is supported by the remote, deprecate --ignore-newest-version. and change this
284
+ // throwForNewestVersion to suggest using --detach-head instead. also, it the error should not be limited
285
+ // to tags and can be thrown for snaps as well.
286
+ // once --ignore-newest-version is removed, no need for this condition. it's ok to not provide the override-head option.
287
+ if (detachHead && !(0, _harmonyModules2().isFeatureEnabled)(_harmonyModules2().DETACH_HEAD)) {
288
+ throw new Error('unable to detach head, the feature is not enabled');
289
+ }
290
+ if (ignoreNewestVersion && !detachHead) overrideHead = true;
271
291
  if (!ignoreNewestVersion && !isSnap) {
272
- const newestVersionsP = allComponentsToTag.map(async component => {
273
- if (component.componentFromModel) {
274
- // otherwise it's a new component, so this check is irrelevant
275
- const modelComponent = await legacyScope.getModelComponentIfExist(component.id);
276
- if (!modelComponent) throw new (_bitError().BitError)(`component ${component.id} was not found in the model`);
277
- if (!modelComponent.listVersions().length) return null; // no versions yet, no issues.
278
- const latest = modelComponent.getHeadRegardlessOfLaneAsTagOrHash();
279
- if (latest !== component.version) {
280
- return {
281
- componentId: component.id.toStringWithoutVersion(),
282
- currentVersion: component.version,
283
- latestVersion: latest
284
- };
285
- }
286
- }
287
- return null;
288
- });
289
- const newestVersions = await Promise.all(newestVersionsP);
290
- const newestVersionsWithoutEmpty = newestVersions.filter(newest => newest);
291
- if (!(0, _lodash().isEmpty)(newestVersionsWithoutEmpty)) {
292
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
293
- throw new (_legacy3().NewerVersionFound)(newestVersionsWithoutEmpty);
294
- }
292
+ await throwForNewestVersion(allComponentsToTag, legacyScope);
295
293
  }
296
294
  _legacy4().logger.debugAndAddBreadCrumb('tag-model-components', 'sequentially persist all components');
297
295
  setCurrentSchema(allComponentsToTag);
@@ -305,7 +303,7 @@ async function tagModelComponent({
305
303
  // (it's being deleted in snapping.main.runtime - `_addCompToObjects` method)
306
304
  const unmergedComps = workspace ? await workspace.listComponentsDuringMerge() : [];
307
305
  const lane = await legacyScope.getCurrentLaneObject();
308
- let stagedConfig;
306
+ const stagedConfig = workspace ? await workspace.scope.getStagedConfig() : undefined;
309
307
  if (soft) {
310
308
  if (!consumer) throw new Error(`unable to soft-tag without consumer`);
311
309
  consumer.updateNextVersionOnBitmap(allComponentsToTag, preReleaseId);
@@ -315,15 +313,29 @@ async function tagModelComponent({
315
313
  await snapping.throwForDepsFromAnotherLane(allComponentsToTag);
316
314
  if (!build) emptyBuilderData(allComponentsToTag);
317
315
  addBuildStatus(allComponentsToTag, _legacy().BuildStatus.Pending);
318
- await addComponentsToScope(snapping, allComponentsToTag, lane, Boolean(build), consumer, tagDataPerComp, {
319
- addToUpdateDependentsInLane: updateDependentsOnLane,
320
- setHeadAsParent
316
+ const currentLane = consumer ? consumer.getCurrentLaneId() : undefined;
317
+ await (0, _pMapSeries().default)(allComponentsToTag, async component => {
318
+ const results = await snapping._addCompToObjects({
319
+ source: component,
320
+ lane,
321
+ shouldValidateVersion: Boolean(build),
322
+ addVersionOpts: {
323
+ addToUpdateDependentsInLane: updateDependentsOnLane,
324
+ setHeadAsParent,
325
+ detachHead,
326
+ overrideHead: overrideHead
327
+ }
328
+ });
329
+ if (workspace) {
330
+ const modelComponent = component.modelComponent || (await legacyScope.getModelComponent(component.id));
331
+ await updateVersions(workspace, stagedConfig, currentLane, modelComponent, results.addedVersionStr, true);
332
+ } else {
333
+ const tagData = tagDataPerComp?.find(t => t.componentId.isEqualWithoutVersion(component.id));
334
+ if (tagData?.isNew) results.version.removeAllParents();
335
+ }
321
336
  });
322
337
  if (workspace) {
323
- const modelComponents = await Promise.all(allComponentsToTag.map(c => {
324
- return c.modelComponent || legacyScope.getModelComponent(c.id);
325
- }));
326
- stagedConfig = await updateComponentsVersions(workspace, modelComponents);
338
+ await workspace.scope.legacyScope.stagedSnaps.write();
327
339
  }
328
340
  }
329
341
  const publishedPackages = [];
@@ -390,6 +402,30 @@ async function tagModelComponent({
390
402
  removedComponents
391
403
  };
392
404
  }
405
+ async function throwForNewestVersion(allComponentsToTag, legacyScope) {
406
+ const newestVersionsP = allComponentsToTag.map(async component => {
407
+ if (component.componentFromModel) {
408
+ // otherwise it's a new component, so this check is irrelevant
409
+ const modelComponent = await legacyScope.getModelComponentIfExist(component.id);
410
+ if (!modelComponent) throw new (_bitError().BitError)(`component ${component.id} was not found in the model`);
411
+ if (!modelComponent.listVersions().length) return null; // no versions yet, no issues.
412
+ const latest = modelComponent.getHeadRegardlessOfLaneAsTagOrHash();
413
+ if (latest !== component.version) {
414
+ return {
415
+ componentId: component.id.toStringWithoutVersion(),
416
+ currentVersion: component.version,
417
+ latestVersion: latest
418
+ };
419
+ }
420
+ }
421
+ return null;
422
+ });
423
+ const newestVersions = await Promise.all(newestVersionsP);
424
+ const newestVersionsWithoutEmpty = (0, _lodash().compact)(newestVersions);
425
+ if (newestVersionsWithoutEmpty.length) {
426
+ throw new (_legacy3().NewerVersionFound)(newestVersionsWithoutEmpty);
427
+ }
428
+ }
393
429
  function addIntegritiesToConsumerComponentsGraphs(packageIntegritiesByPublishedPackages, consumerComponents) {
394
430
  const _addIntegritiesToDependenciesGraph = addIntegritiesToDependenciesGraph.bind(null, packageIntegritiesByPublishedPackages);
395
431
  for (const consumerComponent of consumerComponents) {
@@ -459,20 +495,6 @@ async function removeMergeConfigFromComponents(unmergedComps, components, worksp
459
495
  await configMergeFile.delete();
460
496
  }
461
497
  }
462
- async function addComponentsToScope(snapping, components, lane, shouldValidateVersion, consumer, tagDataPerComp, addVersionOpts) {
463
- await (0, _pMapSeries().default)(components, async component => {
464
- const results = await snapping._addCompToObjects({
465
- source: component,
466
- lane,
467
- shouldValidateVersion,
468
- addVersionOpts
469
- });
470
- if (!consumer) {
471
- const tagData = tagDataPerComp?.find(t => t.componentId.isEqualWithoutVersion(component.id));
472
- if (tagData?.isNew) results.version.removeAllParents();
473
- }
474
- });
475
- }
476
498
 
477
499
  /**
478
500
  * otherwise, tagging without build will have the old build data of the previous snap/tag.
@@ -533,61 +555,52 @@ function addBuildStatus(components, buildStatus) {
533
555
  component.buildStatus = component.isRemoved() ? _legacy().BuildStatus.Skipped : buildStatus;
534
556
  });
535
557
  }
536
- async function updateComponentsVersions(workspace, components, isTag = true) {
558
+ function isAvailableOnMain(currentLane, modelComponent, id) {
559
+ if (currentLane.isDefault()) {
560
+ return true;
561
+ }
562
+ if (!id.hasVersion()) {
563
+ // component was unsnapped on the current lane and is back to a new component
564
+ return true;
565
+ }
566
+ return modelComponent.hasHead();
567
+ }
568
+ async function updateVersions(workspace, stagedConfig, currentLane, modelComponent, versionToSetInBitmap,
569
+ // helpful for detached head
570
+ isTag = true) {
537
571
  const consumer = workspace.consumer;
538
- const currentLane = consumer.getCurrentLaneId();
539
- const stagedConfig = await workspace.scope.getStagedConfig();
540
- const isAvailableOnMain = async (component, id) => {
541
- if (currentLane.isDefault()) {
542
- return true;
543
- }
544
- if (!id.hasVersion()) {
545
- // component was unsnapped on the current lane and is back to a new component
546
- return true;
547
- }
548
- const modelComponent = component instanceof _scope().ModelComponent ? component : await consumer.scope.getModelComponent(component.id);
549
- return modelComponent.hasHead();
550
- };
551
- const updateVersions = async modelComponent => {
552
- const id = modelComponent.toBitIdWithLatestVersionAllowNull();
553
- const isOnBitmap = consumer.bitMap.getComponentIfExist(id, {
554
- ignoreVersion: true
555
- });
556
- if (!isOnBitmap && !isTag) {
557
- // handle the case when a component was deleted, snapped/tagged and is now reset.
558
- const stagedData = stagedConfig.getPerId(id);
559
- if (stagedData?.config && stagedData.config[_remove().RemoveAspect.id]) {
560
- consumer.bitMap.addFromComponentJson(stagedData.id, stagedData.componentMapObject);
561
- }
562
- }
563
- consumer.bitMap.updateComponentId(id, undefined, undefined, true);
564
- const availableOnMain = await isAvailableOnMain(modelComponent, id);
565
- if (!availableOnMain) {
566
- consumer.bitMap.setOnLanesOnly(id, true);
567
- }
568
- const componentMap = consumer.bitMap.getComponent(id);
569
- const compId = await workspace.resolveComponentId(id);
570
- // it can be either a tag/snap or reset.
571
- if (isTag) {
572
- const compMapObj = componentMap.toPlainObject();
573
- const config = componentMap.config;
574
- stagedConfig.addComponentConfig(compId, config, compMapObj);
575
- consumer.bitMap.removeConfig(id);
576
- const hash = modelComponent.getRef(id.version);
577
- if (!hash) throw new Error(`updateComponentsVersions: unable to find a hash for ${id.toString()}`);
578
- workspace.scope.legacyScope.stagedSnaps.addSnap(hash?.toString());
579
- } else if (!componentMap.config) {
580
- componentMap.config = stagedConfig.getConfigPerId(compId);
572
+ const idLatest = modelComponent.toBitIdWithLatestVersionAllowNull();
573
+ const id = versionToSetInBitmap ? idLatest.changeVersion(versionToSetInBitmap) : idLatest;
574
+ const isOnBitmap = consumer.bitMap.getComponentIfExist(id, {
575
+ ignoreVersion: true
576
+ });
577
+ if (!isOnBitmap && !isTag) {
578
+ // handle the case when a component was deleted, snapped/tagged and is now reset.
579
+ const stagedData = stagedConfig.getPerId(id);
580
+ if (stagedData?.config && stagedData.config[_remove().RemoveAspect.id]) {
581
+ consumer.bitMap.addFromComponentJson(stagedData.id, stagedData.componentMapObject);
581
582
  }
582
- componentMap.clearNextVersion();
583
- };
584
- // * the comment below is probably not relevant anymore, but it's good to keep it for future reference. *
585
- // important! DO NOT use Promise.all here! otherwise, you're gonna enter into a whole world of pain.
586
- // imagine tagging comp1 with auto-tagged comp2, comp1 package.json is written while comp2 is
587
- // trying to get the dependencies of comp1 using its package.json.
588
- await (0, _pMapSeries().default)(components, updateVersions);
589
- await workspace.scope.legacyScope.stagedSnaps.write();
590
- return stagedConfig;
583
+ }
584
+ consumer.bitMap.updateComponentId(id, undefined, undefined, true);
585
+ const availableOnMain = isAvailableOnMain(currentLane, modelComponent, id);
586
+ if (!availableOnMain) {
587
+ consumer.bitMap.setOnLanesOnly(id, true);
588
+ }
589
+ const componentMap = consumer.bitMap.getComponent(id);
590
+ const compId = await workspace.resolveComponentId(id);
591
+ // it can be either a tag/snap or reset.
592
+ if (isTag) {
593
+ const compMapObj = componentMap.toPlainObject();
594
+ const config = componentMap.config;
595
+ stagedConfig.addComponentConfig(compId, config, compMapObj);
596
+ consumer.bitMap.removeConfig(id);
597
+ const hash = modelComponent.getRef(id.version);
598
+ if (!hash) throw new Error(`updateComponentsVersions: unable to find a hash for ${id.toString()}`);
599
+ workspace.scope.legacyScope.stagedSnaps.addSnap(hash?.toString());
600
+ } else if (!componentMap.config) {
601
+ componentMap.config = stagedConfig.getConfigPerId(compId);
602
+ }
603
+ componentMap.clearNextVersion();
591
604
  }
592
605
  function replacePendingVersions(graph, resolvedVersions) {
593
606
  let s = graph.serialize();