@teambit/snapping 1.0.1174 → 1.0.1175
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/snap-cmd.js +3 -2
- package/dist/snap-cmd.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +12 -0
- package/dist/snapping.main.runtime.js +58 -13
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/tag-cmd.js +3 -2
- package/dist/tag-cmd.js.map +1 -1
- package/dist/version-file-parser.d.ts +14 -2
- package/dist/version-file-parser.js +9 -1
- package/dist/version-file-parser.js.map +1 -1
- package/dist/version-file-parser.spec.d.ts +1 -0
- package/dist/version-file-parser.spec.js +50 -0
- package/dist/version-file-parser.spec.js.map +1 -0
- package/dist/version-maker.d.ts +19 -0
- package/dist/version-maker.js +51 -1
- package/dist/version-maker.js.map +1 -1
- package/package.json +41 -40
- /package/dist/{preview-1789911586102.js → preview-1790106115091.js} +0 -0
package/dist/snap-cmd.js
CHANGED
|
@@ -161,6 +161,7 @@ function snapResultReport(results) {
|
|
|
161
161
|
};
|
|
162
162
|
const removedSection = (0, _tagCmd().outputIdsIfExists)('removed components', removedComponents);
|
|
163
163
|
const warningsSection = warnings && warnings.length ? warnings.map(w => `${_cli().warnSymbol} ${_chalk().default.yellow(w)}`).join('\n') : '';
|
|
164
|
+
const workspaceRootHint = results.autoAddedWorkspaceRoot ? (0, _cli().formatHint)(`(${(0, _tagCmd().compInBold)(results.autoAddedWorkspaceRoot)} is the workspace-root component. it was new or modified, so it was snapped along: the other components record the root version they were snapped with)`) : '';
|
|
164
165
|
const laneStr = laneName ? ` on "${laneName}" lane` : '';
|
|
165
166
|
const summary = (0, _cli().formatSuccessSummary)(`${totalCount} component(s) snapped${laneStr}`);
|
|
166
167
|
const snapExplanation = (0, _cli().formatHint)('(use "bit export" to push these components to a remote)\n(use "bit reset" to unstage all local versions, or "bit reset --head" to only unstage the latest local snap)');
|
|
@@ -184,7 +185,7 @@ function snapResultReport(results) {
|
|
|
184
185
|
return `${title}\n${scopes}\n${hint}`;
|
|
185
186
|
})();
|
|
186
187
|
const footerParts = [summary, snapExplanation].filter(Boolean).join('\n');
|
|
187
|
-
const data = (0, _cli().joinSections)([newSection, changedSection, autoSnapSection, removedSection, warningsSection, footerParts]);
|
|
188
|
+
const data = (0, _cli().joinSections)([newSection, changedSection, workspaceRootHint, autoSnapSection, removedSection, warningsSection, footerParts]);
|
|
188
189
|
if (!hasAutoSnapped) {
|
|
189
190
|
return data;
|
|
190
191
|
}
|
|
@@ -195,7 +196,7 @@ function snapResultReport(results) {
|
|
|
195
196
|
changedSection: changedDetailed
|
|
196
197
|
} = buildSections(formatCompDetailed);
|
|
197
198
|
const detailedFooter = [summary, snapExplanation].filter(Boolean).join('\n');
|
|
198
|
-
const details = (0, _cli().joinSections)([newDetailed, changedDetailed, removedSection, warningsSection, detailedFooter]);
|
|
199
|
+
const details = (0, _cli().joinSections)([newDetailed, changedDetailed, workspaceRootHint, removedSection, warningsSection, detailedFooter]);
|
|
199
200
|
return {
|
|
200
201
|
data,
|
|
201
202
|
code: 0,
|
package/dist/snap-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_componentIssues","_cli","_legacy","_tagCmd","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","SnapCmd","constructor","snapping","logger","configStore","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","unmerged","editor","ignoreIssues","build","skipTests","skipTasks","skipAutoSnap","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","noLockDeps","unmodified","failFast","detachHead","loose","getConfigBoolean","CFG_FORCE_LOCAL_BUILD","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snapResultReport","exports","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","totalComponentsCount","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoSnappedCount","length","totalCount","formatCompMinimal","formatItem","compInBold","formatCompDetailed","output","autoSnap","result","triggeredBy","autoSnapComp","map","a","toString","AUTO_SNAPPED_MSG","hasAutoSnapped","buildSections","formatComp","newSection","formatSection","changedSection","removedSection","outputIdsIfExists","warningsSection","w","warnSymbol","laneStr","summary","formatSuccessSummary","snapExplanation","formatHint","autoSnapSection","scopeCounts","countBy","scope","sorted","entries","sort","b","MAX_SHOWN","shown","slice","n","remaining","scopeLine","title","formatTitle","scopes","hint","formatDetailsHint","footerParts","joinSections","newDetailed","changedDetailed","detailedFooter","details","code","snapResultOutput"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { countBy } from 'lodash';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport type { Command, CommandOptions, Report } from '@teambit/cli';\nimport {\n formatItem,\n formatSection,\n formatTitle,\n formatHint,\n formatDetailsHint,\n formatSuccessSummary,\n warnSymbol,\n joinSections,\n} from '@teambit/cli';\nimport {\n NOTHING_TO_SNAP_MSG,\n AUTO_SNAPPED_MSG,\n COMPONENT_PATTERN_HELP,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy.constants';\nimport type { Logger } from '@teambit/logger';\nimport type { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists, compInBold } from './tag-cmd';\nimport type { BasicTagSnapParams } from './version-maker';\nimport type { ConfigStoreMain } from '@teambit/config-store';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create immutable component snapshots for development versions';\n extendedDescription = `creates snapshots with hash-based versions for development and testing. snapshots are immutable and exportable.\nby default snaps only new and modified components. use for development iterations before creating semantic version tags.\nsnapshots maintain component history and enable collaboration without formal releases.`;\n group = 'version-control';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`,\n },\n ];\n helpUrl = 'reference/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'],\n ['', 'unmerged', 'complete a merge process by snapping the unmerged components'],\n ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the snap'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap 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-snap', 'skip auto snapping dependents'],\n [\n '',\n 'disable-snap-pipeline',\n 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment',\n ],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\n ['', 'loose', 'allow snap --build to succeed even if tasks like tests or lint fail'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\n ['', 'no-lock-deps', 'do not save the dependencies graph in the snap'],\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 '',\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 [\n '',\n 'detach-head',\n 'UNSUPPORTED YET. in case a component is checked out to an older version, snap it without changing the head',\n ],\n ] as CommandOptions;\n loader = true;\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger,\n private configStore: ConfigStoreMain\n ) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipTasks,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n noLockDeps = false,\n unmodified = false,\n failFast = false,\n detachHead,\n loose = false,\n }: {\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = this.configStore.getConfigBoolean(CFG_FORCE_LOCAL_BUILD) || Boolean(build);\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (!message && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your snap, will be displayed in the version history`\n );\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipTasks,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n noLockDeps,\n unmodified,\n exitOnFirstFailedTask: failFast,\n detachHead,\n loose,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n return snapResultReport(results);\n }\n}\n\nexport function snapResultReport(results: SnapResults): string | Report {\n const {\n snappedComponents,\n autoSnappedResults,\n warnings,\n newComponents,\n laneName,\n removedComponents,\n totalComponentsCount,\n }: SnapResults = results;\n const changedComponents = snappedComponents.filter((component) => {\n return !newComponents.searchWithoutVersion(component.id) && !removedComponents?.searchWithoutVersion(component.id);\n });\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoSnappedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n const totalCount = totalComponentsCount ?? snappedComponents.length + autoSnappedCount;\n\n const formatCompMinimal = (component: ConsumerComponent): string => {\n return formatItem(compInBold(component.id));\n };\n\n const formatCompDetailed = (component: ConsumerComponent): string => {\n let output = formatItem(compInBold(component.id));\n const autoSnap = (autoSnappedResults ?? []).filter((result) =>\n result.triggeredBy.searchWithoutVersion(component.id)\n );\n if (autoSnap.length) {\n const autoSnapComp = autoSnap.map((a) => a.component.id.toString());\n output += `\\n ${AUTO_SNAPPED_MSG} (${autoSnapComp.length} total):\\n ${autoSnapComp.join('\\n ')}`;\n }\n return output;\n };\n\n const hasAutoSnapped = autoSnappedCount > 0;\n\n const buildSections = (formatComp: (c: ConsumerComponent) => string) => {\n const newSection = formatSection('new components', 'first version for components', addedComponents.map(formatComp));\n const changedSection = formatSection(\n 'changed components',\n 'components that got a version bump',\n changedComponents.map(formatComp)\n );\n return { newSection, changedSection };\n };\n\n const removedSection = outputIdsIfExists('removed components', removedComponents);\n\n const warningsSection =\n warnings && warnings.length ? warnings.map((w) => `${warnSymbol} ${chalk.yellow(w)}`).join('\\n') : '';\n\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n const summary = formatSuccessSummary(`${totalCount} component(s) snapped${laneStr}`);\n const snapExplanation = formatHint(\n '(use \"bit export\" to push these components to a remote)\\n(use \"bit reset\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)'\n );\n\n // Build minimal output (no auto-snapped listing, just counts grouped by scope)\n const { newSection, changedSection } = buildSections(hasAutoSnapped ? formatCompMinimal : formatCompDetailed);\n\n const autoSnapSection = (() => {\n if (!hasAutoSnapped) return '';\n const scopeCounts = countBy(autoSnappedResults, (r) => r.component.id.scope);\n const sorted = Object.entries(scopeCounts).sort(([, a], [, b]) => b - a);\n const MAX_SHOWN = 4;\n const shown = sorted.slice(0, MAX_SHOWN).map(([scope, n]) => `${scope} (${n})`);\n const remaining = sorted.length - MAX_SHOWN;\n const scopeLine = remaining > 0 ? [...shown, `+ ${remaining} more scopes`].join(' · ') : shown.join(' · ');\n const title = formatTitle(`auto-snapped dependents (${autoSnappedCount})`);\n const scopes = ` ${scopeLine}`;\n const hint = formatDetailsHint('full list of auto-snapped dependents');\n return `${title}\\n${scopes}\\n${hint}`;\n })();\n\n const footerParts = [summary, snapExplanation].filter(Boolean).join('\\n');\n const data = joinSections([\n newSection,\n changedSection,\n autoSnapSection,\n removedSection,\n warningsSection,\n footerParts,\n ]);\n\n if (!hasAutoSnapped) {\n return data;\n }\n\n // Build detailed output (with full auto-snapped listing)\n const { newSection: newDetailed, changedSection: changedDetailed } = buildSections(formatCompDetailed);\n const detailedFooter = [summary, snapExplanation].filter(Boolean).join('\\n');\n const details = joinSections([newDetailed, changedDetailed, removedSection, warningsSection, detailedFooter]);\n\n return { data, code: 0, details };\n}\n\n/** @deprecated use snapResultReport instead */\nexport function snapResultOutput(results: SnapResults): string {\n const result = snapResultReport(results);\n return typeof result === 'string' ? result : result.details || result.data;\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,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,KAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAA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Ac,EAAEiC;EAAgB,CAAC,GAAGrC,aAAa,CAACX,kBAAkB,CAAC;EACtG,MAAMiD,cAAc,GAAG,CAAC3B,OAAO,EAAEE,eAAe,CAAC,CAACnC,MAAM,CAACnB,OAAO,CAAC,CAACrB,IAAI,CAAC,IAAI,CAAC;EAC5E,MAAMqG,OAAO,GAAG,IAAAJ,mBAAY,EAAC,CAACC,WAAW,EAAEC,eAAe,EAAEhC,cAAc,EAAEE,eAAe,EAAE+B,cAAc,CAAC,CAAC;EAE7G,OAAO;IAAE3I,IAAI;IAAE6I,IAAI,EAAE,CAAC;IAAED;EAAQ,CAAC;AACnC;;AAEA;AACO,SAASE,gBAAgBA,CAAC/E,OAAoB,EAAU;EAC7D,MAAM8B,MAAM,GAAGxB,gBAAgB,CAACN,OAAO,CAAC;EACxC,OAAO,OAAO8B,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAGA,MAAM,CAAC+C,OAAO,IAAI/C,MAAM,CAAC7F,IAAI;AAC5E","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_componentIssues","_cli","_legacy","_tagCmd","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","SnapCmd","constructor","snapping","logger","configStore","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","unmerged","editor","ignoreIssues","build","skipTests","skipTasks","skipAutoSnap","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","noLockDeps","unmodified","failFast","detachHead","loose","getConfigBoolean","CFG_FORCE_LOCAL_BUILD","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snapResultReport","exports","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","totalComponentsCount","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoSnappedCount","length","totalCount","formatCompMinimal","formatItem","compInBold","formatCompDetailed","output","autoSnap","result","triggeredBy","autoSnapComp","map","a","toString","AUTO_SNAPPED_MSG","hasAutoSnapped","buildSections","formatComp","newSection","formatSection","changedSection","removedSection","outputIdsIfExists","warningsSection","w","warnSymbol","workspaceRootHint","autoAddedWorkspaceRoot","formatHint","laneStr","summary","formatSuccessSummary","snapExplanation","autoSnapSection","scopeCounts","countBy","scope","sorted","entries","sort","b","MAX_SHOWN","shown","slice","n","remaining","scopeLine","title","formatTitle","scopes","hint","formatDetailsHint","footerParts","joinSections","newDetailed","changedDetailed","detailedFooter","details","code","snapResultOutput"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { countBy } from 'lodash';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport type { Command, CommandOptions, Report } from '@teambit/cli';\nimport {\n formatItem,\n formatSection,\n formatTitle,\n formatHint,\n formatDetailsHint,\n formatSuccessSummary,\n warnSymbol,\n joinSections,\n} from '@teambit/cli';\nimport {\n NOTHING_TO_SNAP_MSG,\n AUTO_SNAPPED_MSG,\n COMPONENT_PATTERN_HELP,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy.constants';\nimport type { Logger } from '@teambit/logger';\nimport type { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists, compInBold } from './tag-cmd';\nimport type { BasicTagSnapParams } from './version-maker';\nimport type { ConfigStoreMain } from '@teambit/config-store';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create immutable component snapshots for development versions';\n extendedDescription = `creates snapshots with hash-based versions for development and testing. snapshots are immutable and exportable.\nby default snaps only new and modified components. use for development iterations before creating semantic version tags.\nsnapshots maintain component history and enable collaboration without formal releases.`;\n group = 'version-control';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`,\n },\n ];\n helpUrl = 'reference/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'],\n ['', 'unmerged', 'complete a merge process by snapping the unmerged components'],\n ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the snap'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap 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-snap', 'skip auto snapping dependents'],\n [\n '',\n 'disable-snap-pipeline',\n 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment',\n ],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\n ['', 'loose', 'allow snap --build to succeed even if tasks like tests or lint fail'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\n ['', 'no-lock-deps', 'do not save the dependencies graph in the snap'],\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 '',\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 [\n '',\n 'detach-head',\n 'UNSUPPORTED YET. in case a component is checked out to an older version, snap it without changing the head',\n ],\n ] as CommandOptions;\n loader = true;\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger,\n private configStore: ConfigStoreMain\n ) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipTasks,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n noLockDeps = false,\n unmodified = false,\n failFast = false,\n detachHead,\n loose = false,\n }: {\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = this.configStore.getConfigBoolean(CFG_FORCE_LOCAL_BUILD) || Boolean(build);\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (!message && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your snap, will be displayed in the version history`\n );\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipTasks,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n noLockDeps,\n unmodified,\n exitOnFirstFailedTask: failFast,\n detachHead,\n loose,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n return snapResultReport(results);\n }\n}\n\nexport function snapResultReport(results: SnapResults): string | Report {\n const {\n snappedComponents,\n autoSnappedResults,\n warnings,\n newComponents,\n laneName,\n removedComponents,\n totalComponentsCount,\n }: SnapResults = results;\n const changedComponents = snappedComponents.filter((component) => {\n return !newComponents.searchWithoutVersion(component.id) && !removedComponents?.searchWithoutVersion(component.id);\n });\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoSnappedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n const totalCount = totalComponentsCount ?? snappedComponents.length + autoSnappedCount;\n\n const formatCompMinimal = (component: ConsumerComponent): string => {\n return formatItem(compInBold(component.id));\n };\n\n const formatCompDetailed = (component: ConsumerComponent): string => {\n let output = formatItem(compInBold(component.id));\n const autoSnap = (autoSnappedResults ?? []).filter((result) =>\n result.triggeredBy.searchWithoutVersion(component.id)\n );\n if (autoSnap.length) {\n const autoSnapComp = autoSnap.map((a) => a.component.id.toString());\n output += `\\n ${AUTO_SNAPPED_MSG} (${autoSnapComp.length} total):\\n ${autoSnapComp.join('\\n ')}`;\n }\n return output;\n };\n\n const hasAutoSnapped = autoSnappedCount > 0;\n\n const buildSections = (formatComp: (c: ConsumerComponent) => string) => {\n const newSection = formatSection('new components', 'first version for components', addedComponents.map(formatComp));\n const changedSection = formatSection(\n 'changed components',\n 'components that got a version bump',\n changedComponents.map(formatComp)\n );\n return { newSection, changedSection };\n };\n\n const removedSection = outputIdsIfExists('removed components', removedComponents);\n\n const warningsSection =\n warnings && warnings.length ? warnings.map((w) => `${warnSymbol} ${chalk.yellow(w)}`).join('\\n') : '';\n\n const workspaceRootHint = results.autoAddedWorkspaceRoot\n ? formatHint(\n `(${compInBold(results.autoAddedWorkspaceRoot)} is the workspace-root component. it was new or modified, so it was snapped along: the other components record the root version they were snapped with)`\n )\n : '';\n\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n const summary = formatSuccessSummary(`${totalCount} component(s) snapped${laneStr}`);\n const snapExplanation = formatHint(\n '(use \"bit export\" to push these components to a remote)\\n(use \"bit reset\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)'\n );\n\n // Build minimal output (no auto-snapped listing, just counts grouped by scope)\n const { newSection, changedSection } = buildSections(hasAutoSnapped ? formatCompMinimal : formatCompDetailed);\n\n const autoSnapSection = (() => {\n if (!hasAutoSnapped) return '';\n const scopeCounts = countBy(autoSnappedResults, (r) => r.component.id.scope);\n const sorted = Object.entries(scopeCounts).sort(([, a], [, b]) => b - a);\n const MAX_SHOWN = 4;\n const shown = sorted.slice(0, MAX_SHOWN).map(([scope, n]) => `${scope} (${n})`);\n const remaining = sorted.length - MAX_SHOWN;\n const scopeLine = remaining > 0 ? [...shown, `+ ${remaining} more scopes`].join(' · ') : shown.join(' · ');\n const title = formatTitle(`auto-snapped dependents (${autoSnappedCount})`);\n const scopes = ` ${scopeLine}`;\n const hint = formatDetailsHint('full list of auto-snapped dependents');\n return `${title}\\n${scopes}\\n${hint}`;\n })();\n\n const footerParts = [summary, snapExplanation].filter(Boolean).join('\\n');\n const data = joinSections([\n newSection,\n changedSection,\n workspaceRootHint,\n autoSnapSection,\n removedSection,\n warningsSection,\n footerParts,\n ]);\n\n if (!hasAutoSnapped) {\n return data;\n }\n\n // Build detailed output (with full auto-snapped listing)\n const { newSection: newDetailed, changedSection: changedDetailed } = buildSections(formatCompDetailed);\n const detailedFooter = [summary, snapExplanation].filter(Boolean).join('\\n');\n const details = joinSections([\n newDetailed,\n changedDetailed,\n workspaceRootHint,\n removedSection,\n warningsSection,\n detailedFooter,\n ]);\n\n return { data, code: 0, details };\n}\n\n/** @deprecated use snapResultReport instead */\nexport function snapResultOutput(results: SnapResults): string {\n const result = snapResultReport(results);\n return typeof result === 'string' ? result : result.details || result.data;\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,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,KAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,I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I,CAAC;EACzE,MAAMvC,IAAI,GAAG,IAAA0I,mBAAY,EAAC,CACxBnC,UAAU,EACVE,cAAc,EACdM,iBAAiB,EACjBO,eAAe,EACfZ,cAAc,EACdE,eAAe,EACf6B,WAAW,CACZ,CAAC;EAEF,IAAI,CAACrC,cAAc,EAAE;IACnB,OAAOpG,IAAI;EACb;;EAEA;EACA,MAAM;IAAEuG,UAAU,EAAEoC,WAAW;IAAElC,cAAc,EAAEmC;EAAgB,CAAC,GAAGvC,aAAa,CAACX,kBAAkB,CAAC;EACtG,MAAMmD,cAAc,GAAG,CAAC1B,OAAO,EAAEE,eAAe,CAAC,CAACtC,MAAM,CAACnB,OAAO,CAAC,CAACrB,IAAI,CAAC,IAAI,CAAC;EAC5E,MAAMuG,OAAO,GAAG,IAAAJ,mBAAY,EAAC,CAC3BC,WAAW,EACXC,eAAe,EACf7B,iBAAiB,EACjBL,cAAc,EACdE,eAAe,EACfiC,cAAc,CACf,CAAC;EAEF,OAAO;IAAE7I,IAAI;IAAE+I,IAAI,EAAE,CAAC;IAAED;EAAQ,CAAC;AACnC;;AAEA;AACO,SAASE,gBAAgBA,CAACjF,OAAoB,EAAU;EAC7D,MAAM8B,MAAM,GAAGxB,gBAAgB,CAACN,OAAO,CAAC;EACxC,OAAO,OAAO8B,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAGA,MAAM,CAACiD,OAAO,IAAIjD,MAAM,CAAC7F,IAAI;AAC5E","ignoreList":[]}
|
|
@@ -71,6 +71,11 @@ export type BasicTagResults = {
|
|
|
71
71
|
newComponents: ComponentIdList;
|
|
72
72
|
removedComponents?: ComponentIdList;
|
|
73
73
|
totalComponentsCount?: number;
|
|
74
|
+
/**
|
|
75
|
+
* the workspace-root component that joined the batch because it was new or modified, at its new
|
|
76
|
+
* version. see getWorkspaceRootToTagAlong.
|
|
77
|
+
*/
|
|
78
|
+
autoAddedWorkspaceRoot?: ComponentID;
|
|
74
79
|
};
|
|
75
80
|
export type FileData = {
|
|
76
81
|
path: string;
|
|
@@ -269,6 +274,13 @@ export declare class SnappingMain {
|
|
|
269
274
|
* 2. save all dependencies data from the legacy into DependencyResolver aspect.
|
|
270
275
|
*/
|
|
271
276
|
UpdateDepsAspectsSaveIntoDepsResolver(component: Component, updatedIds: string[]): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* a new or modified workspace-root component joins every tag and snap of its members. they record
|
|
279
|
+
* the root at the version that has their files (see VersionMaker.recordWorkspaceRoot), and a build
|
|
280
|
+
* of a member elsewhere needs the workspace.jsonc, lockfile and configs it was made with. a root
|
|
281
|
+
* that is up to date is recorded at its current version and stays out of the batch.
|
|
282
|
+
*/
|
|
283
|
+
private getWorkspaceRootToTagAlong;
|
|
272
284
|
private getTagPendingComponentsIds;
|
|
273
285
|
private getComponentsToTag;
|
|
274
286
|
static slots: ((registerFn: () => string) => SlotRegistry<OnPreSnap>)[];
|
|
@@ -67,6 +67,13 @@ function _componentId() {
|
|
|
67
67
|
};
|
|
68
68
|
return data;
|
|
69
69
|
}
|
|
70
|
+
function _workspaceRoot() {
|
|
71
|
+
const data = require("@teambit/workspace-root");
|
|
72
|
+
_workspaceRoot = function () {
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
70
77
|
function _legacy2() {
|
|
71
78
|
const data = require("@teambit/legacy.constants");
|
|
72
79
|
_legacy2 = function () {
|
|
@@ -404,8 +411,11 @@ class SnappingMain {
|
|
|
404
411
|
} = await this.getComponentsToTag(unmodified, exactVersion, persist, ids, snapped, unmerged);
|
|
405
412
|
if (!bitIds.length) return null;
|
|
406
413
|
const compIds = _componentId().ComponentIdList.fromArray(bitIds);
|
|
407
|
-
|
|
408
|
-
const
|
|
414
|
+
// --persist tags what the soft-tag recorded, and the soft-tag has already brought the root along
|
|
415
|
+
const autoAddedWorkspaceRoot = persist ? undefined : await this.getWorkspaceRootToTagAlong(compIds);
|
|
416
|
+
const idsToTag = autoAddedWorkspaceRoot ? _componentId().ComponentIdList.fromArray([...compIds, autoAddedWorkspaceRoot]) : compIds;
|
|
417
|
+
this.logger.debug(`tagging the following components: ${idsToTag.toString()}`);
|
|
418
|
+
const components = await this.loadComponentsForTagOrSnap(idsToTag, !soft);
|
|
409
419
|
await this.throwForVariousIssues(components, ignoreIssues);
|
|
410
420
|
const params = {
|
|
411
421
|
message,
|
|
@@ -433,7 +443,8 @@ class SnappingMain {
|
|
|
433
443
|
detachHead,
|
|
434
444
|
overrideHead,
|
|
435
445
|
loose,
|
|
436
|
-
ignoreIssues
|
|
446
|
+
ignoreIssues,
|
|
447
|
+
autoAddedWorkspaceRoot
|
|
437
448
|
};
|
|
438
449
|
const {
|
|
439
450
|
taggedComponents,
|
|
@@ -442,7 +453,7 @@ class SnappingMain {
|
|
|
442
453
|
stagedConfig,
|
|
443
454
|
removedComponents,
|
|
444
455
|
totalComponentsCount
|
|
445
|
-
} = await this.makeVersion(
|
|
456
|
+
} = await this.makeVersion(idsToTag, components, params);
|
|
446
457
|
const tagResults = {
|
|
447
458
|
taggedComponents,
|
|
448
459
|
autoTaggedResults,
|
|
@@ -451,7 +462,8 @@ class SnappingMain {
|
|
|
451
462
|
warnings,
|
|
452
463
|
newComponents,
|
|
453
464
|
removedComponents,
|
|
454
|
-
totalComponentsCount
|
|
465
|
+
totalComponentsCount,
|
|
466
|
+
autoAddedWorkspaceRoot: findVersioned(taggedComponents, autoAddedWorkspaceRoot)
|
|
455
467
|
};
|
|
456
468
|
await consumer.onDestroy(`tag (message: ${message || 'N/A'})`);
|
|
457
469
|
await stagedConfig?.write();
|
|
@@ -713,8 +725,10 @@ class SnappingMain {
|
|
|
713
725
|
const self = this;
|
|
714
726
|
const ids = legacyBitIds || (await getIdsToSnap());
|
|
715
727
|
if (!ids) return null;
|
|
716
|
-
|
|
717
|
-
const
|
|
728
|
+
const autoAddedWorkspaceRoot = await this.getWorkspaceRootToTagAlong(ids);
|
|
729
|
+
const idsToSnap = autoAddedWorkspaceRoot ? _componentId().ComponentIdList.fromArray([...ids, autoAddedWorkspaceRoot]) : ids;
|
|
730
|
+
this.logger.debug(`snapping the following components: ${idsToSnap.toString()}`);
|
|
731
|
+
const components = await this.loadComponentsForTagOrSnap(idsToSnap);
|
|
718
732
|
await this.throwForVariousIssues(components, ignoreIssues);
|
|
719
733
|
const makeVersionParams = {
|
|
720
734
|
editor,
|
|
@@ -735,7 +749,8 @@ class SnappingMain {
|
|
|
735
749
|
exitOnFirstFailedTask,
|
|
736
750
|
detachHead,
|
|
737
751
|
loose,
|
|
738
|
-
ignoreIssues
|
|
752
|
+
ignoreIssues,
|
|
753
|
+
autoAddedWorkspaceRoot
|
|
739
754
|
};
|
|
740
755
|
const {
|
|
741
756
|
taggedComponents,
|
|
@@ -743,13 +758,14 @@ class SnappingMain {
|
|
|
743
758
|
stagedConfig,
|
|
744
759
|
removedComponents,
|
|
745
760
|
totalComponentsCount
|
|
746
|
-
} = await this.makeVersion(
|
|
761
|
+
} = await this.makeVersion(idsToSnap, components, makeVersionParams);
|
|
747
762
|
const snapResults = {
|
|
748
763
|
snappedComponents: taggedComponents,
|
|
749
764
|
autoSnappedResults: autoTaggedResults,
|
|
750
765
|
newComponents,
|
|
751
766
|
removedComponents,
|
|
752
|
-
totalComponentsCount
|
|
767
|
+
totalComponentsCount,
|
|
768
|
+
autoAddedWorkspaceRoot: findVersioned(taggedComponents, autoAddedWorkspaceRoot)
|
|
753
769
|
};
|
|
754
770
|
const currentLane = consumer.getCurrentLaneId();
|
|
755
771
|
snapResults.laneName = currentLane.isDefault() ? null : currentLane.toString();
|
|
@@ -814,12 +830,20 @@ in case you're unsure about the pattern syntax, use "bit pattern [--help]"`);
|
|
|
814
830
|
if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
|
|
815
831
|
if (!visibleIds.length && !hiddenLegacyComponents.length) return null;
|
|
816
832
|
this.logger.debug(`snapForMerge, visible: ${visibleIds.length}, hidden: ${hiddenLegacyComponents.length}`);
|
|
817
|
-
|
|
833
|
+
// a merge snap is a snap: a new or modified root joins it the way it joins tag and snap, so the
|
|
834
|
+
// members snapped here record the root version their files were merged with, rather than the one
|
|
835
|
+
// the root was last snapped at (see getWorkspaceRootToTagAlong). only the visible ids can take
|
|
836
|
+
// it - a hidden entry is scope-only, with no workspace state to snap the root against and no
|
|
837
|
+
// record of it to make right, so a merge of nothing else leaves the root where it is. the root
|
|
838
|
+
// was snapped as a result of the merge, so it is reported in that section like the rest.
|
|
839
|
+
const autoAddedWorkspaceRoot = visibleIds.length ? await this.getWorkspaceRootToTagAlong(visibleIds) : undefined;
|
|
840
|
+
const visibleIdsToSnap = autoAddedWorkspaceRoot ? _componentId().ComponentIdList.fromArray([...visibleIds, autoAddedWorkspaceRoot]) : visibleIds;
|
|
841
|
+
const visibleHarmony = visibleIdsToSnap.length ? await this.loadComponentsForTagOrSnap(visibleIdsToSnap) : [];
|
|
818
842
|
const hiddenHarmony = hiddenLegacyComponents.length ? await this.scope.getManyByLegacy(hiddenLegacyComponents) : [];
|
|
819
843
|
// issue checks are workspace-source-tree concerns — hidden entries are scope-only
|
|
820
844
|
if (visibleHarmony.length) await this.throwForVariousIssues(visibleHarmony);
|
|
821
845
|
const hiddenIds = _componentId().ComponentIdList.fromArray(hiddenLegacyComponents.map(c => c.componentId));
|
|
822
|
-
const allIds = _componentId().ComponentIdList.uniqFromArray([...
|
|
846
|
+
const allIds = _componentId().ComponentIdList.uniqFromArray([...visibleIdsToSnap, ...hiddenIds]);
|
|
823
847
|
const allComponents = [...visibleHarmony, ...hiddenHarmony];
|
|
824
848
|
const makeVersionParams = {
|
|
825
849
|
ignoreNewestVersion: false,
|
|
@@ -831,7 +855,8 @@ in case you're unsure about the pattern syntax, use "bit pattern [--help]"`);
|
|
|
831
855
|
build,
|
|
832
856
|
isSnap: true,
|
|
833
857
|
packageManagerConfigRootDir: this.workspace.path,
|
|
834
|
-
loose
|
|
858
|
+
loose,
|
|
859
|
+
autoAddedWorkspaceRoot
|
|
835
860
|
};
|
|
836
861
|
const {
|
|
837
862
|
taggedComponents,
|
|
@@ -1428,6 +1453,19 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1428
1453
|
const extension = new (_legacy5().ExtensionDataEntry)(undefined, undefined, extId, undefined, data);
|
|
1429
1454
|
component.config.extensions.push(extension);
|
|
1430
1455
|
}
|
|
1456
|
+
|
|
1457
|
+
/**
|
|
1458
|
+
* a new or modified workspace-root component joins every tag and snap of its members. they record
|
|
1459
|
+
* the root at the version that has their files (see VersionMaker.recordWorkspaceRoot), and a build
|
|
1460
|
+
* of a member elsewhere needs the workspace.jsonc, lockfile and configs it was made with. a root
|
|
1461
|
+
* that is up to date is recorded at its current version and stays out of the batch.
|
|
1462
|
+
*/
|
|
1463
|
+
async getWorkspaceRootToTagAlong(ids) {
|
|
1464
|
+
const rootId = (0, _workspaceRoot().findWorkspaceRootMap)(this.workspace.consumer.bitMap)?.id;
|
|
1465
|
+
if (!rootId || ids.hasWithoutVersion(rootId)) return undefined;
|
|
1466
|
+
const status = await this.workspace.getComponentStatusById(rootId);
|
|
1467
|
+
return status.newlyCreated || status.modified ? rootId.changeVersion(undefined) : undefined;
|
|
1468
|
+
}
|
|
1431
1469
|
async getTagPendingComponentsIds(includeUnmodified = false) {
|
|
1432
1470
|
const ids = includeUnmodified ? await this.workspace.listPotentialTagIds() : await this.workspace.listTagPendingIds();
|
|
1433
1471
|
const localOnlyIds = this.workspace.filter.byLocalOnly(ids);
|
|
@@ -1515,10 +1553,17 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1515
1553
|
return snapping;
|
|
1516
1554
|
}
|
|
1517
1555
|
}
|
|
1556
|
+
|
|
1557
|
+
/**
|
|
1558
|
+
* the id of the given component as it was just versioned, for the results.
|
|
1559
|
+
*/
|
|
1518
1560
|
exports.SnappingMain = SnappingMain;
|
|
1519
1561
|
_defineProperty(SnappingMain, "slots", [_harmony().Slot.withType()]);
|
|
1520
1562
|
_defineProperty(SnappingMain, "dependencies", [_workspace().WorkspaceAspect, _cli().CLIAspect, _logger().LoggerAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().ImporterAspect, _configStore().ConfigStoreAspect, _dependencies().DependenciesAspect, _application().ApplicationAspect, _remove().RemoveAspect]);
|
|
1521
1563
|
_defineProperty(SnappingMain, "runtime", _cli().MainRuntime);
|
|
1564
|
+
function findVersioned(components, id) {
|
|
1565
|
+
return id && components.find(component => component.id.isEqualWithoutVersion(id))?.id;
|
|
1566
|
+
}
|
|
1522
1567
|
_snapping().SnappingAspect.addRuntime(SnappingMain);
|
|
1523
1568
|
var _default = exports.default = SnappingMain;
|
|
1524
1569
|
|