@teambit/snapping 0.0.417 → 0.0.419
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 -5
- package/dist/snap-cmd.js +10 -5
- package/dist/snap-cmd.js.map +1 -1
- package/dist/snap-from-scope.cmd.d.ts +3 -5
- package/dist/snap-from-scope.cmd.js +8 -4
- package/dist/snap-from-scope.cmd.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +3 -3
- package/dist/snapping.main.runtime.js +8 -7
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/tag-cmd.d.ts +2 -1
- package/dist/tag-cmd.js +7 -2
- package/dist/tag-cmd.js.map +1 -1
- package/dist/tag-from-scope.cmd.d.ts +2 -1
- package/dist/tag-from-scope.cmd.js +7 -1
- package/dist/tag-from-scope.cmd.js.map +1 -1
- package/dist/tag-model-component.d.ts +7 -5
- package/dist/tag-model-component.js +2 -2
- package/dist/tag-model-component.js.map +1 -1
- package/package-tar/teambit-snapping-0.0.419.tgz +0 -0
- package/package.json +19 -19
- package/tsconfig.json +1 -1
- package/package-tar/teambit-snapping-0.0.417.tgz +0 -0
- /package/dist/{preview-1689061040556.js → preview-1689218262868.js} +0 -0
package/dist/snap-cmd.d.ts
CHANGED
|
@@ -1,6 +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 './tag-model-component';
|
|
4
5
|
export declare class SnapCmd implements Command {
|
|
5
6
|
private snapping;
|
|
6
7
|
private logger;
|
|
@@ -18,19 +19,16 @@ export declare class SnapCmd implements Command {
|
|
|
18
19
|
loader: boolean;
|
|
19
20
|
migration: boolean;
|
|
20
21
|
constructor(snapping: SnappingMain, logger: Logger);
|
|
21
|
-
report([pattern]: string[], { message, all, force, unmerged, editor, ignoreIssues, build, skipTests, skipAutoSnap, disableSnapPipeline, forceDeploy, unmodified, failFast, }: {
|
|
22
|
-
message?: string;
|
|
22
|
+
report([pattern]: string[], { message, all, force, unmerged, editor, ignoreIssues, build, skipTests, skipAutoSnap, disableSnapPipeline, forceDeploy, ignoreBuildErrors, unmodified, failFast, }: {
|
|
23
23
|
all?: boolean;
|
|
24
24
|
force?: boolean;
|
|
25
25
|
unmerged?: boolean;
|
|
26
26
|
editor?: string;
|
|
27
27
|
ignoreIssues?: string;
|
|
28
|
-
build?: boolean;
|
|
29
|
-
skipTests?: boolean;
|
|
30
28
|
skipAutoSnap?: boolean;
|
|
31
29
|
disableSnapPipeline?: boolean;
|
|
32
30
|
forceDeploy?: boolean;
|
|
33
31
|
unmodified?: boolean;
|
|
34
32
|
failFast?: boolean;
|
|
35
|
-
}): Promise<string>;
|
|
33
|
+
} & BasicTagSnapParams): Promise<string>;
|
|
36
34
|
}
|
package/dist/snap-cmd.js
CHANGED
|
@@ -70,7 +70,7 @@ class SnapCmd {
|
|
|
70
70
|
}]);
|
|
71
71
|
(0, _defineProperty2().default)(this, "helpUrl", 'docs/components/snaps');
|
|
72
72
|
(0, _defineProperty2().default)(this, "alias", '');
|
|
73
|
-
(0, _defineProperty2().default)(this, "options", [['m', 'message <message>', 'log message describing the latest changes'], ['', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'], ['', 'unmerged', 'complete a merge process by snapping the unmerged components'], ['b', 'build', 'not needed for now. run the build pipeline in case the feature-flag build-on-ci is enabled'], ['', 'editor [editor]', 'open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'skip-auto-snap', 'skip auto snapping dependents'], ['', 'disable-snap-pipeline', 'skip the snap pipeline'], ['', 'force-deploy', 'run the
|
|
73
|
+
(0, _defineProperty2().default)(this, "options", [['m', 'message <message>', 'log message describing the latest changes'], ['', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'], ['', 'unmerged', 'complete a merge process by snapping the unmerged components'], ['b', 'build', 'not needed for now. run the build pipeline in case the feature-flag build-on-ci is enabled'], ['', 'editor [editor]', 'open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'skip-auto-snap', 'skip auto snapping dependents'], ['', 'disable-snap-pipeline', 'skip the snap pipeline'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
|
|
74
74
|
[${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
|
|
75
75
|
to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['a', 'all', 'DEPRECATED (not needed anymore, it is the default now). snap all new and modified components'], ['', 'fail-fast', 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependent failed)'], ['f', 'force', 'DEPRECATED (use "--skip-tests" or "--unmodified" instead). force-snap even if tests are failing and even when component has not changed']]);
|
|
76
76
|
(0, _defineProperty2().default)(this, "loader", true);
|
|
@@ -88,14 +88,12 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
88
88
|
skipAutoSnap = false,
|
|
89
89
|
disableSnapPipeline = false,
|
|
90
90
|
forceDeploy = false,
|
|
91
|
+
ignoreBuildErrors = false,
|
|
91
92
|
unmodified = false,
|
|
92
93
|
failFast = false
|
|
93
94
|
}) {
|
|
94
95
|
build = (0, _featureToggle().isFeatureEnabled)(_featureToggle().BUILD_ON_CI) ? Boolean(build) : true;
|
|
95
96
|
const disableTagAndSnapPipelines = disableSnapPipeline;
|
|
96
|
-
if (disableTagAndSnapPipelines && forceDeploy) {
|
|
97
|
-
throw new (_bitError().BitError)('you can use either force-deploy or disable-snap-pipeline, but not both');
|
|
98
|
-
}
|
|
99
97
|
if (all) {
|
|
100
98
|
this.logger.consoleWarning(`--all is deprecated, please omit it. "bit snap" by default will snap all new and modified components`);
|
|
101
99
|
}
|
|
@@ -106,6 +104,13 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
106
104
|
if (!message && !editor) {
|
|
107
105
|
this.logger.consoleWarning(`--message will be mandatory in the next few releases. make sure to add a message with your snap`);
|
|
108
106
|
}
|
|
107
|
+
if (forceDeploy) {
|
|
108
|
+
this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);
|
|
109
|
+
ignoreBuildErrors = true;
|
|
110
|
+
}
|
|
111
|
+
if (disableTagAndSnapPipelines && ignoreBuildErrors) {
|
|
112
|
+
throw new (_bitError().BitError)('you can use either ignore-build-error or disable-snap-pipeline, but not both');
|
|
113
|
+
}
|
|
109
114
|
const results = await this.snapping.snap({
|
|
110
115
|
pattern,
|
|
111
116
|
message,
|
|
@@ -116,7 +121,7 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
116
121
|
skipTests,
|
|
117
122
|
skipAutoSnap,
|
|
118
123
|
disableTagAndSnapPipelines,
|
|
119
|
-
|
|
124
|
+
ignoreBuildErrors,
|
|
120
125
|
unmodified,
|
|
121
126
|
exitOnFirstFailedTask: failFast
|
|
122
127
|
});
|
package/dist/snap-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SnapCmd","constructor","snapping","logger","name","description","COMPONENT_PATTERN_HELP","Object","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","unmodified","failFast","isFeatureEnabled","BUILD_ON_CI","Boolean","disableTagAndSnapPipelines","BitError","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"],"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 { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (no release version)';\n extendedDescription: string;\n group = 'development';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, all new and modified components are snapped.`,\n },\n ];\n helpUrl = 'docs/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'log message describing the latest changes'],\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 ['b', 'build', 'not needed for now. run the build pipeline in case the feature-flag build-on-ci is enabled'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'skip-auto-snap', 'skip auto snapping dependents'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'force-deploy', 'run the deploy pipeline although the build failed'],\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, it is the default now). 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 dependent 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 unmodified = false,\n failFast = false,\n }: {\n message?: string;\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n build?: boolean;\n skipTests?: boolean;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n }\n ) {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (disableTagAndSnapPipelines && forceDeploy) {\n throw new BitError('you can use either force-deploy or disable-snap-pipeline, but not both');\n }\n\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. \"bit snap\" by default will snap all new and modified components`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --unmodified 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`\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 skipAutoSnap,\n disableTagAndSnapPipelines,\n forceDeploy,\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 versions)\\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;EAAA;EAAA;IAAA;EAAA;E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","logger","name","description","COMPONENT_PATTERN_HELP","Object","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","BitError","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"],"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 { BitError } from '@teambit/bit-error';\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 (no release version)';\n extendedDescription: string;\n group = 'development';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, all new and modified components are snapped.`,\n },\n ];\n helpUrl = 'docs/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'log message describing the latest changes'],\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 ['b', 'build', 'not needed for now. run the build pipeline in case the feature-flag build-on-ci is enabled'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'skip-auto-snap', 'skip auto snapping dependents'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\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, it is the default now). 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 dependent 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. \"bit snap\" by default will snap all new and modified components`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --unmodified 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`\n );\n }\n if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-error or disable-snap-pipeline, but not both');\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 versions)\\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;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,OAAO,CAAoB;EAkDtCC,WAAW,CAASC,QAAsB,EAAUC,MAAc,EAAE;IAAA,KAAhDD,QAAsB,GAAtBA,QAAsB;IAAA,KAAUC,MAAc,GAAdA,MAAc;IAAA,8CAjD3D,0BAA0B;IAAA,qDACnB,4EAA4E;IAAA;IAAA,+CAElF,aAAa;IAAA,mDACT,CACV;MACEC,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAG,GAAEC,mCAAuB;IACzC,CAAC,CACF;IAAA,iDACS,uBAAuB;IAAA,+CACzB,EAAE;IAAA,iDACA,CACR,CAAC,GAAG,EAAE,mBAAmB,EAAE,2CAA2C,CAAC,EACvE,CAAC,EAAE,EAAE,Y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qD,eAAe;MACxB,CAAC,CAAC,CACDrD,IAAI,CAAC,IAAI,CAAC;IACf,CAAC;IAED,MAAM6D,cAAc,GAAG,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;AAAC"}
|
|
@@ -1,6 +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 './tag-model-component';
|
|
4
5
|
export declare type SnapDataPerCompRaw = {
|
|
5
6
|
componentId: string;
|
|
6
7
|
dependencies?: string[];
|
|
@@ -9,14 +10,11 @@ export declare type SnapDataPerCompRaw = {
|
|
|
9
10
|
};
|
|
10
11
|
declare type SnapFromScopeOptions = {
|
|
11
12
|
push?: boolean;
|
|
12
|
-
message?: string;
|
|
13
13
|
lane?: string;
|
|
14
14
|
ignoreIssues?: string;
|
|
15
|
-
build?: boolean;
|
|
16
|
-
skipTests?: boolean;
|
|
17
15
|
disableSnapPipeline?: boolean;
|
|
18
16
|
forceDeploy?: boolean;
|
|
19
|
-
};
|
|
17
|
+
} & BasicTagSnapParams;
|
|
20
18
|
export declare class SnapFromScopeCmd implements Command {
|
|
21
19
|
private snapping;
|
|
22
20
|
private logger;
|
|
@@ -30,7 +28,7 @@ export declare class SnapFromScopeCmd implements Command {
|
|
|
30
28
|
migration: boolean;
|
|
31
29
|
constructor(snapping: SnappingMain, logger: Logger);
|
|
32
30
|
report([data]: [string], options: SnapFromScopeOptions): Promise<string>;
|
|
33
|
-
json([data]: [string], { push, message, lane, ignoreIssues, build, skipTests, disableSnapPipeline, forceDeploy, }: SnapFromScopeOptions): Promise<import("./snapping.main.runtime").SnapFromScopeResults>;
|
|
31
|
+
json([data]: [string], { push, message, lane, ignoreIssues, build, skipTests, disableSnapPipeline, ignoreBuildErrors, forceDeploy, }: SnapFromScopeOptions): Promise<import("./snapping.main.runtime").SnapFromScopeResults>;
|
|
34
32
|
private parseData;
|
|
35
33
|
}
|
|
36
34
|
export {};
|
|
@@ -52,7 +52,7 @@ the input data is a stringified JSON of an array of the following object.
|
|
|
52
52
|
an example of the final data: '[{"componentId":"ci.remote2/comp-b","message": "first snap"}]'
|
|
53
53
|
`);
|
|
54
54
|
(0, _defineProperty2().default)(this, "alias", '');
|
|
55
|
-
(0, _defineProperty2().default)(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['m', 'message <message>', 'log message describing the latest changes'], ['', 'lane <lane-id>', 'fetch the components from the given lane'], ['', 'build', 'run the build pipeline'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'disable-snap-pipeline', 'skip the snap pipeline'], ['', 'force-deploy', 'run the
|
|
55
|
+
(0, _defineProperty2().default)(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['m', 'message <message>', 'log message describing the latest changes'], ['', 'lane <lane-id>', 'fetch the components from the given lane'], ['', 'build', 'run the build pipeline'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'disable-snap-pipeline', 'skip the snap pipeline'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
|
|
56
56
|
[${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
|
|
57
57
|
to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['j', 'json', 'output as json format']]);
|
|
58
58
|
(0, _defineProperty2().default)(this, "loader", true);
|
|
@@ -77,11 +77,15 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
77
77
|
build = false,
|
|
78
78
|
skipTests = false,
|
|
79
79
|
disableSnapPipeline = false,
|
|
80
|
+
ignoreBuildErrors = false,
|
|
80
81
|
forceDeploy = false
|
|
81
82
|
}) {
|
|
82
83
|
const disableTagAndSnapPipelines = disableSnapPipeline;
|
|
83
|
-
if (
|
|
84
|
-
|
|
84
|
+
if (forceDeploy) {
|
|
85
|
+
ignoreBuildErrors = true;
|
|
86
|
+
}
|
|
87
|
+
if (disableTagAndSnapPipelines && ignoreBuildErrors) {
|
|
88
|
+
throw new (_bitError().BitError)('you can use either ignore-build-errors or disable-snap-pipeline, but not both');
|
|
85
89
|
}
|
|
86
90
|
const snapDataPerCompRaw = this.parseData(data);
|
|
87
91
|
const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {
|
|
@@ -92,7 +96,7 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
92
96
|
build,
|
|
93
97
|
skipTests,
|
|
94
98
|
disableTagAndSnapPipelines,
|
|
95
|
-
|
|
99
|
+
ignoreBuildErrors
|
|
96
100
|
});
|
|
97
101
|
return results;
|
|
98
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SnapFromScopeCmd","constructor","snapping","logger","Object","keys","IssuesClasses","join","report","data","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","forceDeploy","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId"],"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 { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n
|
|
1
|
+
{"version":3,"names":["SnapFromScopeCmd","constructor","snapping","logger","Object","keys","IssuesClasses","join","report","data","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","forceDeploy","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId"],"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 { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n} & BasicTagSnapParams;\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.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\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 ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\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 ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\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 forceDeploy = false,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (forceDeploy) {\n ignoreBuildErrors = true;\n }\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\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 });\n\n return results;\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 });\n return dataParsed;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAoBO,MAAMA,gBAAgB,CAAoB;EAoC/CC,WAAW,CAASC,QAAsB,EAAUC,MAAc,EAAE;IAAA,KAAhDD,QAAsB,GAAtBA,QAAsB;IAAA,KAAUC,MAAc,GAAdA,MAAc;IAAA,8CAnC3D,cAAc;IAAA,qDACP,mCAAmC;IAAA,6DAC1B;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;IAAA,+CACS,EAAE;IAAA,iDACA,CACR,CAAC,EAAE,EAAE,MAAM,EAAE,6DAA6D,CAAC,EAC3E,CAAC,GAAG,EAAE,mBAAmB,EAAE,2CAA2C,CAAC,EACvE,CAAC,EAAE,EAAE,gBAAgB,EAAE,0CAA0C,CAAC,EAClE,CAAC,EAAE,EAAE,OAAO,EAAE,wBAAwB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IAC3BC,iBAAiB,GAAG,KAAK;IACzBC,WAAW,GAAG;EACM,CAAC,EACvB;IACA,MAAMC,0BAA0B,GAAGH,mBAAmB;IACtD,IAAIE,WAAW,EAAE;MACfD,iBAAiB,GAAG,IAAI;IAC1B;IACA,IAAIE,0BAA0B,IAAIF,iBAAiB,EAAE;MACnD,MAAM,KAAIG,oBAAQ,EAAC,+EAA+E,CAAC;IACrG;IAEA,MAAMC,kBAAkB,GAAG,IAAI,CAACC,SAAS,CAACvB,IAAI,CAAC;IAE/C,MAAME,OAAO,GAAG,MAAM,IAAI,CAACT,QAAQ,CAAC+B,aAAa,CAACF,kBAAkB,EAAE;MACpEX,IAAI;MACJC,OAAO;MACPC,IAAI;MACJC,YAAY;MACZC,KAAK;MACLC,SAAS;MACTI,0BAA0B;MAC1BF;IACF,CAAC,CAAC;IAEF,OAAOhB,OAAO;EAChB;EACQqB,SAAS,CAACvB,IAAY,EAAwB;IACpD,IAAIyB,UAAmB;IACvB,IAAI;MACFA,UAAU,GAAGC,IAAI,CAACC,KAAK,CAAC3B,IAAI,CAAC;IAC/B,CAAC,CAAC,OAAO4B,GAAQ,EAAE;MACjB,MAAM,IAAIC,KAAK,CAAE,gDAA+CD,GAAG,CAAChB,OAAQ,EAAC,CAAC;IAChF;IACA,IAAI,CAACkB,KAAK,CAACC,OAAO,CAACN,UAAU,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,4BAA4B,CAAC;IAC/C;IACAJ,UAAU,CAACO,OAAO,CAAEC,QAAQ,IAAK;MAC/B,IAAI,CAACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;IAC3F,CAAC,CAAC;IACF,OAAOJ,UAAU;EACnB;AACF;AAAC"}
|
|
@@ -68,7 +68,7 @@ export declare class SnappingMain {
|
|
|
68
68
|
* with a valid semver to that version.
|
|
69
69
|
* tag can be done only on main, not on a lane.
|
|
70
70
|
*/
|
|
71
|
-
tag({ ids, message, version, editor, snapped, unmerged, releaseType, preReleaseId, ignoreIssues, ignoreNewestVersion, skipTests, skipAutoTag, build, unmodified, soft, persist,
|
|
71
|
+
tag({ ids, message, version, editor, snapped, unmerged, releaseType, preReleaseId, ignoreIssues, ignoreNewestVersion, skipTests, skipAutoTag, build, unmodified, soft, persist, ignoreBuildErrors, incrementBy, disableTagAndSnapPipelines, failFast, }: {
|
|
72
72
|
ids?: string[];
|
|
73
73
|
all?: boolean | string;
|
|
74
74
|
snapped?: boolean;
|
|
@@ -97,7 +97,7 @@ export declare class SnappingMain {
|
|
|
97
97
|
* once a component is snapped on a lane, it becomes part of it.
|
|
98
98
|
*/
|
|
99
99
|
snap({ pattern, legacyBitIds, // @todo: change to ComponentID[]. pass only if have the ids already parsed.
|
|
100
|
-
unmerged, editor, message, ignoreIssues, skipTests, skipAutoSnap, build, disableTagAndSnapPipelines,
|
|
100
|
+
unmerged, editor, message, ignoreIssues, skipTests, skipAutoSnap, build, disableTagAndSnapPipelines, ignoreBuildErrors, unmodified, exitOnFirstFailedTask, }: {
|
|
101
101
|
pattern?: string;
|
|
102
102
|
legacyBitIds?: BitIds;
|
|
103
103
|
unmerged?: boolean;
|
|
@@ -108,7 +108,7 @@ export declare class SnappingMain {
|
|
|
108
108
|
skipTests?: boolean;
|
|
109
109
|
skipAutoSnap?: boolean;
|
|
110
110
|
disableTagAndSnapPipelines?: boolean;
|
|
111
|
-
|
|
111
|
+
ignoreBuildErrors?: boolean;
|
|
112
112
|
unmodified?: boolean;
|
|
113
113
|
exitOnFirstFailedTask?: boolean;
|
|
114
114
|
}): Promise<SnapResults | null>;
|
|
@@ -364,14 +364,14 @@ class SnappingMain {
|
|
|
364
364
|
unmodified = false,
|
|
365
365
|
soft = false,
|
|
366
366
|
persist = false,
|
|
367
|
-
|
|
367
|
+
ignoreBuildErrors = false,
|
|
368
368
|
incrementBy = 1,
|
|
369
369
|
disableTagAndSnapPipelines = false,
|
|
370
370
|
failFast = false
|
|
371
371
|
}) {
|
|
372
372
|
if (soft) build = false;
|
|
373
|
-
if (disableTagAndSnapPipelines &&
|
|
374
|
-
throw new (_bitError().BitError)('you can use either
|
|
373
|
+
if (disableTagAndSnapPipelines && ignoreBuildErrors) {
|
|
374
|
+
throw new (_bitError().BitError)('you can use either ignore-build-errors or disable-tag-pipeline, but not both');
|
|
375
375
|
}
|
|
376
376
|
if (editor && persist) {
|
|
377
377
|
throw new (_bitError().BitError)('you can use either --editor or --persist, but not both');
|
|
@@ -425,7 +425,7 @@ class SnappingMain {
|
|
|
425
425
|
build,
|
|
426
426
|
persist,
|
|
427
427
|
disableTagAndSnapPipelines,
|
|
428
|
-
|
|
428
|
+
ignoreBuildErrors,
|
|
429
429
|
incrementBy,
|
|
430
430
|
packageManagerConfigRootDir: this.workspace.path,
|
|
431
431
|
dependencyResolver: this.dependencyResolver,
|
|
@@ -527,7 +527,8 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
527
527
|
scope: this.scope.legacyScope,
|
|
528
528
|
ids: legacyIds,
|
|
529
529
|
idsWithFutureScope: legacyIds,
|
|
530
|
-
allVersions: false
|
|
530
|
+
allVersions: false,
|
|
531
|
+
exportOrigin: 'tag'
|
|
531
532
|
});
|
|
532
533
|
}
|
|
533
534
|
return {
|
|
@@ -638,7 +639,7 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
638
639
|
skipAutoSnap = false,
|
|
639
640
|
build,
|
|
640
641
|
disableTagAndSnapPipelines = false,
|
|
641
|
-
|
|
642
|
+
ignoreBuildErrors = false,
|
|
642
643
|
unmodified = false,
|
|
643
644
|
exitOnFirstFailedTask = false
|
|
644
645
|
}) {
|
|
@@ -677,7 +678,7 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
677
678
|
build,
|
|
678
679
|
isSnap: true,
|
|
679
680
|
disableTagAndSnapPipelines,
|
|
680
|
-
|
|
681
|
+
ignoreBuildErrors,
|
|
681
682
|
packageManagerConfigRootDir: this.workspace.path,
|
|
682
683
|
dependencyResolver: this.dependencyResolver,
|
|
683
684
|
exitOnFirstFailedTask
|