@teambit/snapping 0.0.482 → 0.0.486
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.d.ts +3 -1
- package/dist/snap-cmd.js +3 -9
- package/dist/snap-cmd.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +4 -2
- package/dist/snapping.main.runtime.js +18 -11
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/tag-cmd.d.ts +3 -1
- package/dist/tag-cmd.js +7 -10
- package/dist/tag-cmd.js.map +1 -1
- package/dist/tag-model-component.js +4 -4
- package/dist/tag-model-component.js.map +1 -1
- package/package.json +24 -23
- /package/dist/{preview-1695053895626.js → preview-1695124733440.js} +0 -0
package/dist/snap-cmd.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GlobalConfigMain } from '@teambit/global-config';
|
|
1
2
|
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
3
|
import { Logger } from '@teambit/logger';
|
|
3
4
|
import { SnappingMain } from './snapping.main.runtime';
|
|
@@ -5,6 +6,7 @@ import { BasicTagSnapParams } from './tag-model-component';
|
|
|
5
6
|
export declare class SnapCmd implements Command {
|
|
6
7
|
private snapping;
|
|
7
8
|
private logger;
|
|
9
|
+
private globalConfig;
|
|
8
10
|
name: string;
|
|
9
11
|
description: string;
|
|
10
12
|
extendedDescription: string;
|
|
@@ -18,7 +20,7 @@ export declare class SnapCmd implements Command {
|
|
|
18
20
|
options: CommandOptions;
|
|
19
21
|
loader: boolean;
|
|
20
22
|
migration: boolean;
|
|
21
|
-
constructor(snapping: SnappingMain, logger: Logger);
|
|
23
|
+
constructor(snapping: SnappingMain, logger: Logger, globalConfig: GlobalConfigMain);
|
|
22
24
|
report([pattern]: string[], { message, all, force, unmerged, editor, ignoreIssues, build, skipTests, skipAutoSnap, disableSnapPipeline, forceDeploy, ignoreBuildErrors, unmodified, failFast, }: {
|
|
23
25
|
all?: boolean;
|
|
24
26
|
force?: boolean;
|
package/dist/snap-cmd.js
CHANGED
|
@@ -18,13 +18,6 @@ function _componentIssues() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function _featureToggle() {
|
|
22
|
-
const data = require("@teambit/legacy/dist/api/consumer/lib/feature-toggle");
|
|
23
|
-
_featureToggle = function () {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
21
|
function _constants() {
|
|
29
22
|
const data = require("@teambit/legacy/dist/constants");
|
|
30
23
|
_constants = function () {
|
|
@@ -44,9 +37,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
44
37
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
45
38
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
46
39
|
class SnapCmd {
|
|
47
|
-
constructor(snapping, logger) {
|
|
40
|
+
constructor(snapping, logger, globalConfig) {
|
|
48
41
|
this.snapping = snapping;
|
|
49
42
|
this.logger = logger;
|
|
43
|
+
this.globalConfig = globalConfig;
|
|
50
44
|
_defineProperty(this, "name", 'snap [component-pattern]');
|
|
51
45
|
_defineProperty(this, "description", 'create an immutable and exportable component snapshot (non-release version)');
|
|
52
46
|
_defineProperty(this, "extendedDescription", void 0);
|
|
@@ -79,7 +73,7 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
79
73
|
unmodified = false,
|
|
80
74
|
failFast = false
|
|
81
75
|
}) {
|
|
82
|
-
build = (
|
|
76
|
+
build = (await this.globalConfig.getBool(_constants().CFG_FORCE_LOCAL_BUILD)) || Boolean(build);
|
|
83
77
|
const disableTagAndSnapPipelines = disableSnapPipeline;
|
|
84
78
|
if (all) {
|
|
85
79
|
this.logger.consoleWarning(`--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`);
|
package/dist/snap-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_featureToggle","_constants","_tagCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapCmd","constructor","snapping","logger","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","ignoreBuildErrors","unmodified","failFast","isFeatureEnabled","BUILD_ON_CI","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","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","green","outputIdsIfExists","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { NOTHING_TO_SNAP_MSG, AUTO_SNAPPED_MSG, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/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 ['', '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 [\n 'b',\n 'build',\n 'not needed for now. run the build pipeline locally in case the feature-flag build-on-ci is enabled',\n ],\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 ['', '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 ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\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 ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'],\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 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-snap even if tests are failing and even when component has not changed',\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n all = false,\n force = false,\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n forceDeploy = false,\n ignoreBuildErrors = false,\n unmodified = false,\n failFast = false,\n }: {\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --ignore-build-errors depending on the use case`\n );\n if (pattern) unmodified = true;\n }\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 if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n unmodified,\n exitOnFirstFailedTask: failFast,\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(\n (component) => !newComponents.searchWithoutVersion(component.id)\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\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)\\n`;\n\n const compInBold = (id: BitId) => {\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) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\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 warningsOutput +\n chalk.green(`${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation +\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 );\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;AAEA,SAAAI,eAAA;EAAA,MAAAJ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AAM,CAAEmB,MAAM,IAC/CA,MAAM,CAACC,WAAW,CAACC,4BAA4B,CAACpB,SAAS,CAACE,EAAE,CAC9D,CAAC;QACD,IAAIe,OAAO,CAACZ,MAAM,EAAE;UAClB,MAAMgB,WAAW,GAAGJ,OAAO,CAACF,GAAG,CAAEO,CAAC,IAAKd,UAAU,CAACc,CAAC,CAACtB,SAAS,CAACE,EAAE,CAAC,CAAC;UAClEc,eAAe,IAAK,YAAWO,6BAAiB,KAAIF,WAAW,CAAChB,MAAO;AACnF,cAAcgB,WAAW,CAACzD,IAAI,CAAC,gBAAgB,CAAE,EAAC;QACxC;QACA,OAAOoD,eAAe;MACxB,CAAC,CAAC,CACDpD,IAAI,CAAC,IAAI,CAAC;IACf,CAAC;IAED,MAAM4D,cAAc,GAAGA,CAACC,KAAK,EAAEC,WAAW,EAAEC,UAAU,KAAK;MACzD,IAAI,CAACA,UAAU,CAACtB,MAAM,EAAE,OAAO,EAAE;MACjC,OAAQ,KAAIhB,gBAAK,CAACuC,SAAS,CAACH,KAAK,CAAE,MAAKC,WAAY,MAAKb,gBAAgB,CAACc,UAAU,CAAE,IAAG;IAC3F,CAAC;IACD,MAAME,OAAO,GAAGjC,QAAQ,GAAI,QAAOA,QAAS,QAAO,GAAG,EAAE;IAExD,OACEU,cAAc,GACdjB,gBAAK,CAACyC,KAAK,CAAE,GAAEtC,iBAAiB,CAACa,MAAM,GAAGD,eAAgB,wBAAuByB,OAAQ,EAAC,CAAC,GAC3FtB,eAAe,GACfiB,cAAc,CAAC,gBAAgB,EAAE,8BAA8B,EAAErB,eAAe,CAAC,GACjFqB,cAAc,CAAC,oBAAoB,EAAE,oCAAoC,EAAE1B,iBAAiB,CAAC,GAC7F,IAAAiC,2BAAiB,EAAC,oBAAoB,EAAElC,iBAAiB,CAAC;EAE9D;AACF;AAACmC,OAAA,CAAA7E,OAAA,GAAAA,OAAA"}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_constants","_tagCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapCmd","constructor","snapping","logger","globalConfig","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","ignoreBuildErrors","unmodified","failFast","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","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","green","outputIdsIfExists","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/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/dist/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 ['', '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 [\n 'b',\n 'build',\n 'not needed for now. run the build pipeline locally in case the feature-flag build-on-ci is enabled',\n ],\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 ['', '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 ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\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 ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'],\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 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-snap even if tests are failing and even when component has not changed',\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n all = false,\n force = false,\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n forceDeploy = false,\n ignoreBuildErrors = false,\n unmodified = false,\n failFast = false,\n }: {\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: 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 (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --ignore-build-errors depending on the use case`\n );\n if (pattern) unmodified = true;\n }\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 if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n unmodified,\n exitOnFirstFailedTask: failFast,\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(\n (component) => !newComponents.searchWithoutVersion(component.id)\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\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)\\n`;\n\n const compInBold = (id: BitId) => {\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) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\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 warningsOutput +\n chalk.green(`${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation +\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 );\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,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA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EAAE,CAAC,CAAC;UAClEc,eAAe,IAAK,YAAWO,6BAAiB,KAAIF,WAAW,CAAChB,MAAO;AACnF,cAAcgB,WAAW,CAACzD,IAAI,CAAC,gBAAgB,CAAE,EAAC;QACxC;QACA,OAAOoD,eAAe;MACxB,CAAC,CAAC,CACDpD,IAAI,CAAC,IAAI,CAAC;IACf,CAAC;IAED,MAAM4D,cAAc,GAAGA,CAACC,KAAK,EAAEC,WAAW,EAAEC,UAAU,KAAK;MACzD,IAAI,CAACA,UAAU,CAACtB,MAAM,EAAE,OAAO,EAAE;MACjC,OAAQ,KAAIhB,gBAAK,CAACuC,SAAS,CAACH,KAAK,CAAE,MAAKC,WAAY,MAAKb,gBAAgB,CAACc,UAAU,CAAE,IAAG;IAC3F,CAAC;IACD,MAAME,OAAO,GAAGjC,QAAQ,GAAI,QAAOA,QAAS,QAAO,GAAG,EAAE;IAExD,OACEU,cAAc,GACdjB,gBAAK,CAACyC,KAAK,CAAE,GAAEtC,iBAAiB,CAACa,MAAM,GAAGD,eAAgB,wBAAuByB,OAAQ,EAAC,CAAC,GAC3FtB,eAAe,GACfiB,cAAc,CAAC,gBAAgB,EAAE,8BAA8B,EAAErB,eAAe,CAAC,GACjFqB,cAAc,CAAC,oBAAoB,EAAE,oCAAoC,EAAE1B,iBAAiB,CAAC,GAC7F,IAAAiC,2BAAiB,EAAC,oBAAoB,EAAElC,iBAAiB,CAAC;EAE9D;AACF;AAACmC,OAAA,CAAA9E,OAAA,GAAAA,OAAA"}
|
|
@@ -18,6 +18,7 @@ import { ImporterMain } from '@teambit/importer';
|
|
|
18
18
|
import { ExportMain } from '@teambit/export';
|
|
19
19
|
import { ComponentID } from '@teambit/component-id';
|
|
20
20
|
import { BitObject } from '@teambit/legacy/dist/scope/objects';
|
|
21
|
+
import { GlobalConfigMain } from '@teambit/global-config';
|
|
21
22
|
import { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag';
|
|
22
23
|
import Version, { Log } from '@teambit/legacy/dist/scope/models/version';
|
|
23
24
|
import { BasicTagParams } from './tag-model-component';
|
|
@@ -156,7 +157,7 @@ export declare class SnappingMain {
|
|
|
156
157
|
static slots: never[];
|
|
157
158
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
158
159
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
159
|
-
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer,]: [
|
|
160
|
+
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig,]: [
|
|
160
161
|
Workspace,
|
|
161
162
|
CLIMain,
|
|
162
163
|
LoggerMain,
|
|
@@ -166,7 +167,8 @@ export declare class SnappingMain {
|
|
|
166
167
|
ScopeMain,
|
|
167
168
|
ExportMain,
|
|
168
169
|
BuilderMain,
|
|
169
|
-
ImporterMain
|
|
170
|
+
ImporterMain,
|
|
171
|
+
GlobalConfigMain
|
|
170
172
|
]): Promise<SnappingMain>;
|
|
171
173
|
}
|
|
172
174
|
export default SnappingMain;
|
|
@@ -242,6 +242,13 @@ function _objects() {
|
|
|
242
242
|
};
|
|
243
243
|
return data;
|
|
244
244
|
}
|
|
245
|
+
function _globalConfig() {
|
|
246
|
+
const data = _interopRequireDefault(require("@teambit/global-config"));
|
|
247
|
+
_globalConfig = function () {
|
|
248
|
+
return data;
|
|
249
|
+
};
|
|
250
|
+
return data;
|
|
251
|
+
}
|
|
245
252
|
function _artifactFiles() {
|
|
246
253
|
const data = require("@teambit/legacy/dist/consumer/component/sources/artifact-files");
|
|
247
254
|
_artifactFiles = function () {
|
|
@@ -323,7 +330,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
323
330
|
const HooksManagerInstance = _hooks().default.getInstance();
|
|
324
331
|
class SnappingMain {
|
|
325
332
|
constructor(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer) {
|
|
326
|
-
var _this$scope
|
|
333
|
+
var _this$scope;
|
|
327
334
|
this.workspace = workspace;
|
|
328
335
|
this.logger = logger;
|
|
329
336
|
this.issues = issues;
|
|
@@ -334,7 +341,7 @@ class SnappingMain {
|
|
|
334
341
|
this.builder = builder;
|
|
335
342
|
this.importer = importer;
|
|
336
343
|
_defineProperty(this, "objectsRepo", void 0);
|
|
337
|
-
this.objectsRepo = (_this$scope = this.scope) === null || _this$scope === void 0
|
|
344
|
+
this.objectsRepo = (_this$scope = this.scope) === null || _this$scope === void 0 || (_this$scope = _this$scope.legacyScope) === null || _this$scope === void 0 ? void 0 : _this$scope.objects;
|
|
338
345
|
}
|
|
339
346
|
|
|
340
347
|
/**
|
|
@@ -433,7 +440,7 @@ class SnappingMain {
|
|
|
433
440
|
removedComponents
|
|
434
441
|
};
|
|
435
442
|
const postHook = isAll ? _constants().POST_TAG_ALL_HOOK : _constants().POST_TAG_HOOK;
|
|
436
|
-
HooksManagerInstance === null || HooksManagerInstance === void 0
|
|
443
|
+
HooksManagerInstance === null || HooksManagerInstance === void 0 || HooksManagerInstance.triggerHook(postHook, tagResults);
|
|
437
444
|
_analytics().Analytics.setExtraData('num_components',
|
|
438
445
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
439
446
|
_ramda().default.concat(tagResults.taggedComponents, tagResults.autoTaggedResults, tagResults.newComponents).length);
|
|
@@ -927,10 +934,10 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
927
934
|
}
|
|
928
935
|
_getPublishedPackages(components) {
|
|
929
936
|
const publishedPackages = components.map(comp => {
|
|
930
|
-
var _builderExt$data,
|
|
937
|
+
var _builderExt$data, _pkgData$data;
|
|
931
938
|
const builderExt = comp.extensions.findCoreExtension(_constants().Extensions.builder);
|
|
932
|
-
const pkgData = builderExt === null || builderExt === void 0
|
|
933
|
-
return pkgData === null || pkgData === void 0
|
|
939
|
+
const pkgData = builderExt === null || builderExt === void 0 || (_builderExt$data = builderExt.data) === null || _builderExt$data === void 0 || (_builderExt$data = _builderExt$data.aspectsData) === null || _builderExt$data === void 0 ? void 0 : _builderExt$data.find(a => a.aspectId === _constants().Extensions.pkg);
|
|
940
|
+
return pkgData === null || pkgData === void 0 || (_pkgData$data = pkgData.data) === null || _pkgData$data === void 0 ? void 0 : _pkgData$data.publishedPackage;
|
|
934
941
|
});
|
|
935
942
|
return (0, _lodash().compact)(publishedPackages);
|
|
936
943
|
}
|
|
@@ -1124,7 +1131,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1124
1131
|
if (updatedBitId) {
|
|
1125
1132
|
var _dependenciesList$fin, _dependenciesList$fin2;
|
|
1126
1133
|
const depIdStr = dep.id.toString();
|
|
1127
|
-
const packageName = (_dependenciesList$fin = dependenciesList.findDependency(depIdStr)) === null || _dependenciesList$fin === void 0
|
|
1134
|
+
const packageName = (_dependenciesList$fin = dependenciesList.findDependency(depIdStr)) === null || _dependenciesList$fin === void 0 || (_dependenciesList$fin2 = _dependenciesList$fin.getPackageName) === null || _dependenciesList$fin2 === void 0 ? void 0 : _dependenciesList$fin2.call(_dependenciesList$fin);
|
|
1128
1135
|
if (!packageName) {
|
|
1129
1136
|
throw new Error(`unable to find the package-name of "${depIdStr}" dependency inside the dependency-resolver data of "${componentIdStr}"`);
|
|
1130
1137
|
}
|
|
@@ -1216,11 +1223,11 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1216
1223
|
warnings
|
|
1217
1224
|
};
|
|
1218
1225
|
}
|
|
1219
|
-
static async provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer]) {
|
|
1226
|
+
static async provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig]) {
|
|
1220
1227
|
const logger = loggerMain.createLogger(_snapping().SnappingAspect.id);
|
|
1221
1228
|
const snapping = new SnappingMain(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer);
|
|
1222
|
-
const snapCmd = new (_snapCmd().SnapCmd)(snapping, logger);
|
|
1223
|
-
const tagCmd = new (_tagCmd().TagCmd)(snapping, logger);
|
|
1229
|
+
const snapCmd = new (_snapCmd().SnapCmd)(snapping, logger, globalConfig);
|
|
1230
|
+
const tagCmd = new (_tagCmd().TagCmd)(snapping, logger, globalConfig);
|
|
1224
1231
|
const tagFromScopeCmd = new (_tagFromScope().TagFromScopeCmd)(snapping, logger);
|
|
1225
1232
|
const snapFromScopeCmd = new (_snapFromScope().SnapFromScopeCmd)(snapping, logger);
|
|
1226
1233
|
const resetCmd = new (_resetCmd().default)(snapping);
|
|
@@ -1230,7 +1237,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1230
1237
|
}
|
|
1231
1238
|
exports.SnappingMain = SnappingMain;
|
|
1232
1239
|
_defineProperty(SnappingMain, "slots", []);
|
|
1233
|
-
_defineProperty(SnappingMain, "dependencies", [_workspace().default, _cli().CLIAspect, _logger().LoggerAspect, _issues().default, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().default]);
|
|
1240
|
+
_defineProperty(SnappingMain, "dependencies", [_workspace().default, _cli().CLIAspect, _logger().LoggerAspect, _issues().default, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().default, _globalConfig().default]);
|
|
1234
1241
|
_defineProperty(SnappingMain, "runtime", _cli().MainRuntime);
|
|
1235
1242
|
_snapping().SnappingAspect.addRuntime(SnappingMain);
|
|
1236
1243
|
var _default = SnappingMain;
|