@teambit/snapping 1.0.517 → 1.0.518
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/index.d.ts +2 -2
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/snap-cmd.d.ts +1 -1
- package/dist/snap-cmd.js.map +1 -1
- package/dist/snap-from-scope.cmd.d.ts +1 -1
- package/dist/snap-from-scope.cmd.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +1 -1
- package/dist/snapping.main.runtime.js +29 -40
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/tag-cmd.d.ts +1 -1
- package/dist/tag-cmd.js.map +1 -1
- package/dist/tag-model-component.d.ts +6 -35
- package/dist/tag-model-component.js +17 -625
- package/dist/tag-model-component.js.map +1 -1
- package/dist/version-maker.d.ts +96 -0
- package/dist/version-maker.js +685 -0
- package/dist/version-maker.js.map +1 -0
- package/package.json +20 -20
- /package/dist/{preview-1737084088495.js → preview-1737170420676.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SnappingAspect } from './snapping.aspect';
|
|
2
|
-
export type { BitCloudUser } from './
|
|
2
|
+
export type { BitCloudUser } from './version-maker';
|
|
3
3
|
export type { SnappingMain, TagResults, SnapResults, SnapFromScopeResults, SnapDataParsed, } from './snapping.main.runtime';
|
|
4
4
|
export default SnappingAspect;
|
|
5
5
|
export { SnappingAspect };
|
|
6
|
-
export {
|
|
6
|
+
export { VersionMaker, onTagIdTransformer, BasicTagParams } from './version-maker';
|
|
7
7
|
export { AUTO_TAGGED_MSG, NOTHING_TO_TAG_MSG } from './tag-cmd';
|
|
8
8
|
export { snapFromScopeOptions, inputDataDescription, SnapDataPerCompRaw, SnapFromScopeOptions, } from './snap-from-scope.cmd';
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "AUTO_TAGGED_MSG", {
|
|
|
12
12
|
Object.defineProperty(exports, "BasicTagParams", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _versionMaker().BasicTagParams;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "NOTHING_TO_TAG_MSG", {
|
|
@@ -39,6 +39,12 @@ Object.defineProperty(exports, "SnappingAspect", {
|
|
|
39
39
|
return _snapping().SnappingAspect;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "VersionMaker", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _versionMaker().VersionMaker;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
42
48
|
exports.default = void 0;
|
|
43
49
|
Object.defineProperty(exports, "inputDataDescription", {
|
|
44
50
|
enumerable: true,
|
|
@@ -49,7 +55,7 @@ Object.defineProperty(exports, "inputDataDescription", {
|
|
|
49
55
|
Object.defineProperty(exports, "onTagIdTransformer", {
|
|
50
56
|
enumerable: true,
|
|
51
57
|
get: function () {
|
|
52
|
-
return
|
|
58
|
+
return _versionMaker().onTagIdTransformer;
|
|
53
59
|
}
|
|
54
60
|
});
|
|
55
61
|
Object.defineProperty(exports, "snapFromScopeOptions", {
|
|
@@ -58,12 +64,6 @@ Object.defineProperty(exports, "snapFromScopeOptions", {
|
|
|
58
64
|
return _snapFromScope().snapFromScopeOptions;
|
|
59
65
|
}
|
|
60
66
|
});
|
|
61
|
-
Object.defineProperty(exports, "tagModelComponent", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: function () {
|
|
64
|
-
return _tagModelComponent().tagModelComponent;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
67
|
function _snapping() {
|
|
68
68
|
const data = require("./snapping.aspect");
|
|
69
69
|
_snapping = function () {
|
|
@@ -71,9 +71,9 @@ function _snapping() {
|
|
|
71
71
|
};
|
|
72
72
|
return data;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
const data = require("./
|
|
76
|
-
|
|
74
|
+
function _versionMaker() {
|
|
75
|
+
const data = require("./version-maker");
|
|
76
|
+
_versionMaker = function () {
|
|
77
77
|
return data;
|
|
78
78
|
};
|
|
79
79
|
return data;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_snapping","data","require","
|
|
1
|
+
{"version":3,"names":["_snapping","data","require","_versionMaker","_tagCmd","_snapFromScope","_default","exports","default","SnappingAspect"],"sources":["index.ts"],"sourcesContent":["import { SnappingAspect } from './snapping.aspect';\n\nexport type { BitCloudUser } from './version-maker';\nexport type {\n SnappingMain,\n TagResults,\n SnapResults,\n SnapFromScopeResults,\n SnapDataParsed,\n} from './snapping.main.runtime';\nexport default SnappingAspect;\nexport { SnappingAspect };\nexport { VersionMaker, onTagIdTransformer, BasicTagParams } from './version-maker';\nexport { AUTO_TAGGED_MSG, NOTHING_TO_TAG_MSG } from './tag-cmd';\nexport {\n snapFromScopeOptions,\n inputDataDescription,\n SnapDataPerCompRaw,\n SnapFromScopeOptions,\n} from './snap-from-scope.cmd';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAYA,SAAAE,cAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,eAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,cAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAK+B,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAThBC,0BAAc","ignoreList":[]}
|
package/dist/snap-cmd.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { GlobalConfigMain } from '@teambit/global-config';
|
|
|
2
2
|
import { Command, CommandOptions } from '@teambit/cli';
|
|
3
3
|
import { Logger } from '@teambit/logger';
|
|
4
4
|
import { SnappingMain } from './snapping.main.runtime';
|
|
5
|
-
import { BasicTagSnapParams } from './
|
|
5
|
+
import { BasicTagSnapParams } from './version-maker';
|
|
6
6
|
export declare class SnapCmd implements Command {
|
|
7
7
|
private snapping;
|
|
8
8
|
private logger;
|
package/dist/snap-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_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","globalConfig","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","unmerged","editor","ignoreIssues","build","skipTests","skipTasks","skipAutoSnap","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","unmodified","failFast","detachHead","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","length","warningsOutput","snapExplanation","compInBold","version","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","outputIdsIfExists","green","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { Command, CommandOptions } 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 { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (non-release version)';\n extendedDescription: string;\n group = 'development';\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 ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\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 globalConfig: GlobalConfigMain\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 unmodified = false,\n failFast = false,\n detachHead,\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 = (await this.globalConfig.getBool(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 unmodified,\n exitOnFirstFailedTask: failFast,\n detachHead,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n const { snappedComponents, autoSnappedResults, warnings, newComponents, laneName, removedComponents }: SnapResults =\n results;\n const changedComponents = snappedComponents.filter((component) => {\n return (\n !newComponents.searchWithoutVersion(component.id) && !removedComponents?.searchWithoutVersion(component.id)\n );\n });\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const snapExplanation = `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset --all\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)`;\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 = autoSnappedResults.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_SNAPPED_MSG} (${autoTagComp.length} total):\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n\n return (\n outputIfExists('new components', 'first version for components', addedComponents) +\n outputIfExists('changed components', 'components that got a version bump', changedComponents) +\n outputIdsIfExists('removed components', removedComponents) +\n warningsOutput +\n chalk.green(`\\n${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;E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,OAAO,CAACF,GAAG,CAAEM,CAAC,IAAKb,UAAU,CAACa,CAAC,CAACrB,SAAS,CAACE,EAAE,CAAC,CAAC;UAClEc,eAAe,IAAI,YAAYM,0BAAgB,KAAKF,WAAW,CAACf,MAAM;AAClF,cAAce,WAAW,CAACxD,IAAI,CAAC,gBAAgB,CAAC,EAAE;QACxC;QACA,OAAOoD,eAAe;MACxB,CAAC,CAAC,CACDpD,IAAI,CAAC,IAAI,CAAC;IACf,CAAC;IAED,MAAM2D,cAAc,GAAGA,CAACC,KAAK,EAAEC,WAAW,EAAEC,UAAU,KAAK;MACzD,IAAI,CAACA,UAAU,CAACrB,MAAM,EAAE,OAAO,EAAE;MACjC,OAAO,KAAKhB,gBAAK,CAACsC,SAAS,CAACH,KAAK,CAAC,MAAMC,WAAW,MAAMZ,gBAAgB,CAACa,UAAU,CAAC,IAAI;IAC3F,CAAC;IACD,MAAME,OAAO,GAAGhC,QAAQ,GAAG,QAAQA,QAAQ,QAAQ,GAAG,EAAE;IAExD,OACE2B,cAAc,CAAC,gBAAgB,EAAE,8BAA8B,EAAEpB,eAAe,CAAC,GACjFoB,cAAc,CAAC,oBAAoB,EAAE,oCAAoC,EAAEzB,iBAAiB,CAAC,GAC7F,IAAA+B,2BAAiB,EAAC,oBAAoB,EAAEhC,iBAAiB,CAAC,GAC1DS,cAAc,GACdjB,gBAAK,CAACyC,KAAK,CAAC,KAAKtC,iBAAiB,CAACa,MAAM,GAAGD,eAAe,wBAAwBwB,OAAO,EAAE,CAAC,GAC7FrB,eAAe;EAEnB;AACF;AAACwB,OAAA,CAAA7E,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_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","globalConfig","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","unmerged","editor","ignoreIssues","build","skipTests","skipTasks","skipAutoSnap","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","unmodified","failFast","detachHead","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","length","warningsOutput","snapExplanation","compInBold","version","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","outputIdsIfExists","green","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { Command, CommandOptions } 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 { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\nimport { BasicTagSnapParams } from './version-maker';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (non-release version)';\n extendedDescription: string;\n group = 'development';\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 ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\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 globalConfig: GlobalConfigMain\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 unmodified = false,\n failFast = false,\n detachHead,\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 = (await this.globalConfig.getBool(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 unmodified,\n exitOnFirstFailedTask: failFast,\n detachHead,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n const { snappedComponents, autoSnappedResults, warnings, newComponents, laneName, removedComponents }: SnapResults =\n results;\n const changedComponents = snappedComponents.filter((component) => {\n return (\n !newComponents.searchWithoutVersion(component.id) && !removedComponents?.searchWithoutVersion(component.id)\n );\n });\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const snapExplanation = `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset --all\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)`;\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 = autoSnappedResults.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_SNAPPED_MSG} (${autoTagComp.length} total):\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n\n return (\n outputIfExists('new components', 'first version for components', addedComponents) +\n outputIfExists('changed components', 'components that got a version bump', changedComponents) +\n outputIdsIfExists('removed components', removedComponents) +\n warningsOutput +\n chalk.green(`\\n${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation\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;AAGA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,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,MA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,EAAEzB,iBAAiB,CAAC,GAC7F,IAAA+B,2BAAiB,EAAC,oBAAoB,EAAEhC,iBAAiB,CAAC,GAC1DS,cAAc,GACdjB,gBAAK,CAACyC,KAAK,CAAC,KAAKtC,iBAAiB,CAACa,MAAM,GAAGD,eAAe,wBAAwBwB,OAAO,EAAE,CAAC,GAC7FrB,eAAe;EAEnB;AACF;AAACwB,OAAA,CAAA7E,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
2
|
import { Logger } from '@teambit/logger';
|
|
3
3
|
import { SnappingMain } from './snapping.main.runtime';
|
|
4
|
-
import { BasicTagSnapParams } from './
|
|
4
|
+
import { BasicTagSnapParams } from './version-maker';
|
|
5
5
|
import { NewDependencies } from './generate-comp-from-scope';
|
|
6
6
|
export type FileData = {
|
|
7
7
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","_lodash","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","inputDataDescription","exports","snapFromScopeOptions","keys","IssuesClasses","join","SnapFromScopeCmd","constructor","snapping","logger","report","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","updateDependents","tag","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","results","snapFromScope","snappedIds","exportedIds","snappedOutput","length","chalk","bold","exportedOutput","compact","json","code","map","id","toString","err","error","stack","dataParsed","JSON","parse","Error","Array","isArray","forEach","dataItem","componentId","files","file","path","content","Buffer","from"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\nimport { NewDependencies } from './generate-comp-from-scope';\n\nexport type FileData = { path: string; content: string; delete?: boolean };\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n files?: FileData[];\n isNew?: boolean;\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: NewDependencies;\n removeDependencies?: string[];\n forkFrom?: string; // origin id to fork from. the componentId is the new id. (no need to populate isNew prop).\n version?: string; // relevant when passing \"--tag\". optionally, specify the semver to tag. default to \"patch\".\n};\n\nexport type SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n updateDependents?: boolean;\n tag?: boolean;\n} & BasicTagSnapParams;\n\nexport const inputDataDescription = `the 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[]; // dependencies include versions. for components use component-id. e.g. [teambit.compilation/compiler@1.0.0, lodash@4.17.21]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.\n isNew?: boolean; // if it's new, it'll be generated from the given files. otherwise, it'll be fetched from the scope and updated.\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{ // new dependencies (components and packages) to add.\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n removeDependencies?: string[]; // component-id (for components) or package-name (for packages) to remove from the dependencies.\n forkFrom?: string; // origin id to fork from. the componentId is the new id. (no need to populate isNew prop).\n version?: string; // relevant when passing \"--tag\". optionally, specify the semver to tag. default to \"patch\".\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'`;\n\nexport const snapFromScopeOptions = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\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 ['', 'tag', 'make a tag instead of a snap'],\n ['', 'stream', 'relevant for --json only. stream loader as json strings'],\n ['j', 'json', 'output as json format'],\n];\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\n${inputDataDescription}\n`;\n alias = '';\n options = [\n ...snapFromScopeOptions,\n [\n '',\n 'update-dependents',\n 'when snapped on a lane, mark it as update-dependents so it will be skipped from the workspace',\n ],\n ] as CommandOptions;\n loader = true;\n private = true;\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger\n ) {}\n\n async report(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n updateDependents,\n tag,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n if (updateDependents && !lane) {\n throw new BitError('update-dependents flag is only available when snapping from a lane');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n updateDependents,\n tag,\n });\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = snappedIds.length ? `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}` : '';\n const exportedOutput =\n exportedIds && exportedIds.length ? `${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return compact([snappedOutput, exportedOutput]).join('\\n\\n');\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n updateDependents,\n tag,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n if (updateDependents && !lane) {\n throw new BitError('update-dependents flag is only available when snapping from a lane');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n try {\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n updateDependents,\n tag,\n });\n\n return {\n code: 0,\n data: {\n exportedIds: results.exportedIds?.map((id) => id.toString()),\n snappedIds: results.snappedIds.map((id) => id.toString()),\n },\n };\n } catch (err: any) {\n this.logger.error('snap-from-scope.json, error: ', err);\n return {\n code: 1,\n error: err.message,\n stack: err.stack,\n };\n }\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\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 dataItem.files?.forEach((file) => {\n if (!file.path) throw new Error('expect file to have \"path\" prop');\n if (file.content) {\n file.content = Buffer.from(file.content, 'base64').toString();\n }\n });\n });\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;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiC,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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,CAACM,OAAO,CAAEC,QAAQ,IAAK;MAC/B,IAAI,CAACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;MACzFI,QAAQ,CAACE,KAAK,EAAEH,OAAO,CAAEI,IAAI,IAAK;QAChC,IAAI,CAACA,IAAI,CAACC,IAAI,EAAE,MAAM,IAAIR,KAAK,CAAC,iCAAiC,CAAC;QAClE,IAAIO,IAAI,CAACE,OAAO,EAAE;UAChBF,IAAI,CAACE,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACJ,IAAI,CAACE,OAAO,EAAE,QAAQ,CAAC,CAAChB,QAAQ,CAAC,CAAC;QAC/D;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAOI,UAAU;EACnB;AACF;AAAC3C,OAAA,CAAAK,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","_lodash","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","inputDataDescription","exports","snapFromScopeOptions","keys","IssuesClasses","join","SnapFromScopeCmd","constructor","snapping","logger","report","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","updateDependents","tag","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","results","snapFromScope","snappedIds","exportedIds","snappedOutput","length","chalk","bold","exportedOutput","compact","json","code","map","id","toString","err","error","stack","dataParsed","JSON","parse","Error","Array","isArray","forEach","dataItem","componentId","files","file","path","content","Buffer","from"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './version-maker';\nimport { NewDependencies } from './generate-comp-from-scope';\n\nexport type FileData = { path: string; content: string; delete?: boolean };\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n files?: FileData[];\n isNew?: boolean;\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: NewDependencies;\n removeDependencies?: string[];\n forkFrom?: string; // origin id to fork from. the componentId is the new id. (no need to populate isNew prop).\n version?: string; // relevant when passing \"--tag\". optionally, specify the semver to tag. default to \"patch\".\n};\n\nexport type SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n updateDependents?: boolean;\n tag?: boolean;\n} & BasicTagSnapParams;\n\nexport const inputDataDescription = `the 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[]; // dependencies include versions. for components use component-id. e.g. [teambit.compilation/compiler@1.0.0, lodash@4.17.21]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.\n isNew?: boolean; // if it's new, it'll be generated from the given files. otherwise, it'll be fetched from the scope and updated.\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{ // new dependencies (components and packages) to add.\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n removeDependencies?: string[]; // component-id (for components) or package-name (for packages) to remove from the dependencies.\n forkFrom?: string; // origin id to fork from. the componentId is the new id. (no need to populate isNew prop).\n version?: string; // relevant when passing \"--tag\". optionally, specify the semver to tag. default to \"patch\".\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'`;\n\nexport const snapFromScopeOptions = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\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 ['', 'tag', 'make a tag instead of a snap'],\n ['', 'stream', 'relevant for --json only. stream loader as json strings'],\n ['j', 'json', 'output as json format'],\n];\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\n${inputDataDescription}\n`;\n alias = '';\n options = [\n ...snapFromScopeOptions,\n [\n '',\n 'update-dependents',\n 'when snapped on a lane, mark it as update-dependents so it will be skipped from the workspace',\n ],\n ] as CommandOptions;\n loader = true;\n private = true;\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger\n ) {}\n\n async report(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n updateDependents,\n tag,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n if (updateDependents && !lane) {\n throw new BitError('update-dependents flag is only available when snapping from a lane');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n updateDependents,\n tag,\n });\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = snappedIds.length ? `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}` : '';\n const exportedOutput =\n exportedIds && exportedIds.length ? `${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return compact([snappedOutput, exportedOutput]).join('\\n\\n');\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n updateDependents,\n tag,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n if (updateDependents && !lane) {\n throw new BitError('update-dependents flag is only available when snapping from a lane');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n try {\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n updateDependents,\n tag,\n });\n\n return {\n code: 0,\n data: {\n exportedIds: results.exportedIds?.map((id) => id.toString()),\n snappedIds: results.snappedIds.map((id) => id.toString()),\n },\n };\n } catch (err: any) {\n this.logger.error('snap-from-scope.json, error: ', err);\n return {\n code: 1,\n error: err.message,\n stack: err.stack,\n };\n }\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\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 dataItem.files?.forEach((file) => {\n if (!file.path) throw new Error('expect file to have \"path\" prop');\n if (file.content) {\n file.content = Buffer.from(file.content, 'base64').toString();\n }\n });\n });\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;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiC,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,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AA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ACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;MACzFI,QAAQ,CAACE,KAAK,EAAEH,OAAO,CAAEI,IAAI,IAAK;QAChC,IAAI,CAACA,IAAI,CAACC,IAAI,EAAE,MAAM,IAAIR,KAAK,CAAC,iCAAiC,CAAC;QAClE,IAAIO,IAAI,CAACE,OAAO,EAAE;UAChBF,IAAI,CAACE,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACJ,IAAI,CAACE,OAAO,EAAE,QAAQ,CAAC,CAAChB,QAAQ,CAAC,CAAC;QAC/D;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAOI,UAAU;EACnB;AACF;AAAC3C,OAAA,CAAAK,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -17,12 +17,12 @@ import { ImporterMain } from '@teambit/importer';
|
|
|
17
17
|
import { ExportMain } from '@teambit/export';
|
|
18
18
|
import { GlobalConfigMain } from '@teambit/global-config';
|
|
19
19
|
import { DependenciesMain } from '@teambit/dependencies';
|
|
20
|
-
import { BasicTagParams, BasicTagSnapParams } from './tag-model-component';
|
|
21
20
|
import { TagDataPerCompRaw } from './tag-from-scope.cmd';
|
|
22
21
|
import { SnapDataPerCompRaw, FileData } from './snap-from-scope.cmd';
|
|
23
22
|
import { ResetResult } from './reset-component';
|
|
24
23
|
import { ApplicationMain } from '@teambit/application';
|
|
25
24
|
import { RemoveMain } from '@teambit/remove';
|
|
25
|
+
import { BasicTagParams, BasicTagSnapParams } from './version-maker';
|
|
26
26
|
export type PackageIntegritiesByPublishedPackages = Map<string, string | undefined>;
|
|
27
27
|
export type TagDataPerComp = {
|
|
28
28
|
componentId: ComponentID;
|
|
@@ -256,13 +256,6 @@ function _resetCmd() {
|
|
|
256
256
|
};
|
|
257
257
|
return data;
|
|
258
258
|
}
|
|
259
|
-
function _tagModelComponent() {
|
|
260
|
-
const data = require("./tag-model-component");
|
|
261
|
-
_tagModelComponent = function () {
|
|
262
|
-
return data;
|
|
263
|
-
};
|
|
264
|
-
return data;
|
|
265
|
-
}
|
|
266
259
|
function _tagFromScope() {
|
|
267
260
|
const data = require("./tag-from-scope.cmd");
|
|
268
261
|
_tagFromScope = function () {
|
|
@@ -333,6 +326,13 @@ function _remove() {
|
|
|
333
326
|
};
|
|
334
327
|
return data;
|
|
335
328
|
}
|
|
329
|
+
function _versionMaker() {
|
|
330
|
+
const data = require("./version-maker");
|
|
331
|
+
_versionMaker = function () {
|
|
332
|
+
return data;
|
|
333
|
+
};
|
|
334
|
+
return data;
|
|
335
|
+
}
|
|
336
336
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
337
337
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
338
338
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -415,17 +415,7 @@ class SnappingMain {
|
|
|
415
415
|
const components = await this.loadComponentsForTagOrSnap(compIds, !soft);
|
|
416
416
|
const consumerComponents = components.map(c => c.state._consumer);
|
|
417
417
|
await this.throwForVariousIssues(components, ignoreIssues);
|
|
418
|
-
const {
|
|
419
|
-
taggedComponents,
|
|
420
|
-
autoTaggedResults,
|
|
421
|
-
publishedPackages,
|
|
422
|
-
stagedConfig,
|
|
423
|
-
removedComponents
|
|
424
|
-
} = await (0, _tagModelComponent().tagModelComponent)({
|
|
425
|
-
snapping: this,
|
|
426
|
-
components,
|
|
427
|
-
consumerComponents,
|
|
428
|
-
ids: compIds,
|
|
418
|
+
const params = {
|
|
429
419
|
message,
|
|
430
420
|
editor,
|
|
431
421
|
exactVersion: validExactVersion,
|
|
@@ -446,7 +436,15 @@ class SnappingMain {
|
|
|
446
436
|
exitOnFirstFailedTask: failFast,
|
|
447
437
|
detachHead,
|
|
448
438
|
overrideHead
|
|
449
|
-
}
|
|
439
|
+
};
|
|
440
|
+
const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, compIds, params);
|
|
441
|
+
const {
|
|
442
|
+
taggedComponents,
|
|
443
|
+
autoTaggedResults,
|
|
444
|
+
publishedPackages,
|
|
445
|
+
stagedConfig,
|
|
446
|
+
removedComponents
|
|
447
|
+
} = await versionMaker.makeVersion();
|
|
450
448
|
const tagResults = {
|
|
451
449
|
taggedComponents,
|
|
452
450
|
autoTaggedResults,
|
|
@@ -524,20 +522,17 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
524
522
|
if (!comp.buildStatus) throw new Error(`tag-from-scope expect ${comp.id.toString()} to have buildStatus`);
|
|
525
523
|
return comp.buildStatus === _legacy2().BuildStatus.Succeed && !params.rebuildArtifacts;
|
|
526
524
|
});
|
|
527
|
-
const
|
|
528
|
-
components,
|
|
529
|
-
consumerComponents,
|
|
525
|
+
const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, componentIds, _objectSpread(_objectSpread({}, params), {}, {
|
|
530
526
|
tagDataPerComp,
|
|
531
527
|
populateArtifactsFrom: shouldUsePopulateArtifactsFrom ? components.map(c => c.id) : undefined,
|
|
532
528
|
populateArtifactsIgnorePkgJson: params.ignoreLastPkgJson,
|
|
533
529
|
copyLogFromPreviousSnap: true,
|
|
534
|
-
snapping: this,
|
|
535
530
|
skipAutoTag: true,
|
|
536
531
|
persist: true,
|
|
537
|
-
ids: componentIds,
|
|
538
532
|
message: params.message,
|
|
539
533
|
setHeadAsParent: params.overrideHead
|
|
540
534
|
}));
|
|
535
|
+
const results = await versionMaker.makeVersion();
|
|
541
536
|
const {
|
|
542
537
|
taggedComponents,
|
|
543
538
|
publishedPackages
|
|
@@ -676,23 +671,20 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
676
671
|
const consumerComponents = components.map(c => c.state._consumer);
|
|
677
672
|
const ids = _componentId().ComponentIdList.fromArray(allCompIds);
|
|
678
673
|
const shouldTag = Boolean(params.tag);
|
|
679
|
-
const
|
|
680
|
-
components,
|
|
681
|
-
consumerComponents,
|
|
674
|
+
const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, ids, _objectSpread(_objectSpread({}, params), {}, {
|
|
682
675
|
tagDataPerComp: snapDataPerComp.map(s => ({
|
|
683
676
|
componentId: s.componentId,
|
|
684
677
|
message: s.message,
|
|
685
678
|
dependencies: [],
|
|
686
679
|
versionToTag: shouldTag ? s.version || 'patch' : undefined
|
|
687
680
|
})),
|
|
688
|
-
snapping: this,
|
|
689
681
|
skipAutoTag: true,
|
|
690
682
|
persist: true,
|
|
691
683
|
isSnap: !shouldTag,
|
|
692
|
-
ids,
|
|
693
684
|
message: params.message,
|
|
694
685
|
updateDependentsOnLane: params.updateDependents
|
|
695
686
|
}));
|
|
687
|
+
const results = await versionMaker.makeVersion();
|
|
696
688
|
const {
|
|
697
689
|
taggedComponents
|
|
698
690
|
} = results;
|
|
@@ -756,17 +748,8 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
756
748
|
const components = await this.loadComponentsForTagOrSnap(ids);
|
|
757
749
|
const consumerComponents = components.map(c => c.state._consumer);
|
|
758
750
|
await this.throwForVariousIssues(components, ignoreIssues);
|
|
759
|
-
const {
|
|
760
|
-
taggedComponents,
|
|
761
|
-
autoTaggedResults,
|
|
762
|
-
stagedConfig,
|
|
763
|
-
removedComponents
|
|
764
|
-
} = await (0, _tagModelComponent().tagModelComponent)({
|
|
765
|
-
snapping: this,
|
|
751
|
+
const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, ids, {
|
|
766
752
|
editor,
|
|
767
|
-
components,
|
|
768
|
-
consumerComponents,
|
|
769
|
-
ids,
|
|
770
753
|
ignoreNewestVersion: false,
|
|
771
754
|
message,
|
|
772
755
|
skipTests,
|
|
@@ -783,6 +766,12 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
783
766
|
exitOnFirstFailedTask,
|
|
784
767
|
detachHead
|
|
785
768
|
});
|
|
769
|
+
const {
|
|
770
|
+
taggedComponents,
|
|
771
|
+
autoTaggedResults,
|
|
772
|
+
stagedConfig,
|
|
773
|
+
removedComponents
|
|
774
|
+
} = await versionMaker.makeVersion();
|
|
786
775
|
const snapResults = {
|
|
787
776
|
snappedComponents: taggedComponents,
|
|
788
777
|
autoSnappedResults: autoTaggedResults,
|
|
@@ -876,7 +865,7 @@ in case you're unsure about the pattern syntax, use "bit pattern [--help]"`);
|
|
|
876
865
|
versionToSetInBitmap
|
|
877
866
|
}) => {
|
|
878
867
|
if (!component) return;
|
|
879
|
-
await (0,
|
|
868
|
+
await (0, _versionMaker().updateVersions)(this.workspace, stagedConfig, currentLaneId, component, versionToSetInBitmap, false);
|
|
880
869
|
});
|
|
881
870
|
await this.workspace.scope.legacyScope.stagedSnaps.write();
|
|
882
871
|
} else {
|