@teambit/snapping 0.0.177 → 0.0.178
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/snapping.main.runtime.d.ts +22 -11
- package/dist/snapping.main.runtime.js +105 -13
- 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-from-scope.cmd.d.ts +33 -0
- package/dist/tag-from-scope.cmd.js +237 -0
- package/dist/tag-from-scope.cmd.js.map +1 -0
- package/dist/tag-model-component.d.ts +20 -3
- package/dist/tag-model-component.js +47 -23
- package/dist/tag-model-component.js.map +1 -1
- package/package-tar/teambit-snapping-0.0.178.tgz +0 -0
- package/package.json +14 -11
- /package/{preview-1663904275528.js → preview-1663990632780.js} +0 -0
- package/package-tar/teambit-snapping-0.0.177.tgz +0 -0
package/dist/tag-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RELEASE_TYPES","TagCmd","constructor","snapping","logger","name","description","join","Object","keys","IssuesClasses","cmd","report","patterns","message","ver","all","editor","snapped","unmerged","patch","minor","major","preRelease","increment","prereleaseId","force","ignoreUnresolvedDependencies","ignoreIssues","ignoreNewestVersion","skipTests","skipAutoTag","scope","unmodified","build","soft","persist","disableDeployPipeline","disableTagPipeline","forceDeploy","incrementBy","BitError","consoleWarning","length","releaseFlags","filter","x","getReleaseType","includes","DEFAULT_BIT_RELEASE_TYPE","getPreReleaseId","undefined","disableTagAndSnapPipelines","params","ids","releaseType","preReleaseId","version","results","tag","chalk","yellow","NOTHING_TO_TAG_MSG","taggedComponents","autoTaggedResults","warnings","newComponents","changedComponents","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","warningsOutput","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","outputComponents","comps","map","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_TAGGED_MSG","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","softTagPrefix","outputIfExists","label","explanation","components","underline","newDesc","changedDesc","softTagClarification","bold"],"sources":["tag-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n TagResults,\n NOTHING_TO_TAG_MSG,\n AUTO_TAGGED_MSG,\n BasicTagParams,\n} from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { DEFAULT_BIT_RELEASE_TYPE } from '@teambit/legacy/dist/constants';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ReleaseType } from 'semver';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\n\nconst RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];\n\nexport class TagCmd implements Command {\n name = 'tag [component-patterns...]';\n group = 'development';\n description = 'create an immutable and exportable component snapshot, tagged with a release version.';\n extendedDescription = `if no patterns are provided, it will tag all new and modified components.\nif patterns are entered, you can specify a version per pattern using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major`;\n arguments = [\n {\n name: 'component-patterns...',\n description:\n 'a list of component names, IDs or patterns (separated by space). run \"bit pattern --help\" to get more data about patterns. By default, all modified are tagged.',\n },\n ];\n helpUrl = 'components/tags';\n alias = 't';\n loader = true;\n options = [\n ['m', 'message <message>', 'a log message describing latest changes'],\n ['', 'unmodified', 'include unmodified components (by default, only new and modified components are tagged)'],\n [\n '',\n 'editor [editor]',\n 'EXPERIMENTAL. open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).',\n ],\n ['v', 'ver <version>', 'tag with the given version'],\n ['l', 'increment <level>', `options are: [${RELEASE_TYPES.join(', ')}], default to patch`],\n ['', 'prerelease-id <id>', 'prerelease identifier (e.g. \"dev\" to get \"1.0.0-dev.1\")'],\n ['p', 'patch', 'syntactic sugar for \"--increment patch\"'],\n ['', 'minor', 'syntactic sugar for \"--increment minor\"'],\n ['', 'major', 'syntactic sugar for \"--increment major\"'],\n ['', 'pre-release [identifier]', 'syntactic sugar for \"--increment prerelease\" and `--prerelease-id <identifier>`'],\n ['', 'snapped', 'EXPERIMENTAL. tag components that their head is a snap (not a tag)'],\n ['', 'unmerged', 'EXPERIMENTAL. complete a merge process by tagging the unmerged components'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n ['', 'skip-auto-tag', 'skip auto tagging dependents'],\n ['', 'soft', 'do not persist. only keep note of the changes to be made'],\n ['', 'persist', 'persist the changes generated by --soft tag'],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'force-deploy', 'run the tag pipeline although the build failed'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'],\n ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],\n [\n 'a',\n 'all [version]',\n 'DEPRECATED (not needed anymore, it is the default now). tag all new and modified components',\n ],\n ['s', 'scope [version]', 'DEPRECATED (use \"--unmodified\" instead). tag all components of the current scope'],\n [\n 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-tag even if tests are failing and even when component has not changed',\n ],\n ['', 'disable-deploy-pipeline', 'DEPRECATED. use --disable-tag-pipeline instead'],\n ] as CommandOptions;\n migration = true;\n remoteOp = true; // In case a compiler / tester is not installed\n examples = [{ cmd: 'tag --ver 1.0.0', description: 'tag all components to version 1.0.0' }];\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n // eslint-disable-next-line complexity\n async report(\n [patterns = []]: [string[]],\n {\n message = '',\n ver,\n all = false,\n editor = '',\n snapped = false,\n unmerged = false,\n patch,\n minor,\n major,\n preRelease,\n increment,\n prereleaseId,\n force = false,\n ignoreUnresolvedDependencies,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipAutoTag = false,\n scope,\n unmodified = false,\n build,\n soft = false,\n persist = false,\n disableDeployPipeline = false,\n disableTagPipeline = false,\n forceDeploy = false,\n incrementBy = 1,\n }: {\n all?: boolean | string;\n snapped?: boolean;\n unmerged?: boolean;\n ver?: string;\n force?: boolean;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n increment?: ReleaseType;\n preRelease?: string;\n prereleaseId?: string;\n ignoreUnresolvedDependencies?: boolean;\n ignoreIssues?: string;\n scope?: string | boolean;\n incrementBy?: number;\n disableDeployPipeline?: boolean;\n disableTagPipeline?: boolean;\n } & Partial<BasicTagParams>\n ): Promise<string> {\n if (typeof ignoreUnresolvedDependencies === 'boolean') {\n throw new BitError(`--ignore-unresolved-dependencies has been removed, please use --ignore-issues instead`);\n }\n if (ignoreIssues && typeof ignoreIssues === 'boolean') {\n throw new BitError(`--ignore-issues expects issues to be ignored, please run \"bit tag -h\" for the issues list`);\n }\n if (disableDeployPipeline) {\n this.logger.consoleWarning(`--disable-deploy-pipeline is deprecated, please use --disable-tag-pipeline instead`);\n }\n if (!message && !persist) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your tag`\n );\n }\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. \"bit tag\" by default will tag all new and modified components. to specify a version, use --ver flag`\n );\n if (typeof all === 'string') {\n ver = all;\n }\n }\n if (scope) {\n this.logger.consoleWarning(`--scope is deprecated, use --unmodified instead`);\n unmodified = true;\n if (typeof scope === 'string') {\n ver = scope;\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 (patterns.length) unmodified = true;\n }\n if (prereleaseId && (!increment || increment === 'major' || increment === 'minor' || increment === 'patch')) {\n throw new BitError(\n `--prerelease-id should be entered along with --increment flag, while --increment must be one of the following: [prepatch, prerelease, preminor, premajor]`\n );\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new BitError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n const getReleaseType = (): ReleaseType => {\n if (increment) {\n if (!RELEASE_TYPES.includes(increment)) {\n throw new BitError(`invalid increment-level \"${increment}\".\n semver allows the following options only: ${RELEASE_TYPES.join(', ')}`);\n }\n return increment;\n }\n if (major) return 'major';\n if (minor) return 'minor';\n if (patch) return 'patch';\n if (preRelease) return 'prerelease';\n return DEFAULT_BIT_RELEASE_TYPE;\n };\n const getPreReleaseId = (): string | undefined => {\n if (prereleaseId) {\n return prereleaseId;\n }\n if (preRelease && typeof preRelease === 'string') {\n return preRelease;\n }\n return undefined;\n };\n\n const disableTagAndSnapPipelines = disableTagPipeline || disableDeployPipeline;\n\n const params = {\n ids: patterns,\n snapped,\n unmerged,\n editor,\n message,\n releaseType: getReleaseType(),\n preReleaseId: getPreReleaseId(),\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipAutoTag,\n build,\n soft,\n persist,\n unmodified,\n disableTagAndSnapPipelines,\n forceDeploy,\n incrementBy,\n version: ver,\n };\n\n const results = await this.snapping.tag(params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n const { taggedComponents, autoTaggedResults, warnings, newComponents }: TagResults = results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = `\\n(use \"bit export [collection]\" to push these components to a remote\")\n(use \"bit reset\" to unstage versions)\\n`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the changes\")\n(use \"bit reset --soft\" to remove the soft-tags)\\n`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoTaggedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged first version for components'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that set to get a version bump'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n 'keep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n warningsOutput +\n chalk.green(\n `${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged`\n ) +\n tagExplanation +\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n publishOutput() +\n softTagClarification\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAA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e,GAAGH,iBAAiB,CAACpF,IAAlB,CAAuB,IAAvB,CAAxB;MACA,MAAMwF,aAAa,GAAGD,eAAe,GAAGF,YAAY,GAAGE,eAAlB,GAAoC,EAAzE;MACA,OAAOC,aAAP;IACD,CATD;;IAWA,MAAMC,aAAa,GAAGtC,OAAO,CAACmB,SAAR,GAAoB,cAApB,GAAqC,EAA3D;;IACA,MAAMoB,cAAc,GAAG,CAACC,KAAD,EAAQC,WAAR,EAAqBC,UAArB,KAAoC;MACzD,IAAI,CAACA,UAAU,CAACzD,MAAhB,EAAwB,OAAO,EAAP;MACxB,OAAQ,KAAIiB,gBAAA,CAAMyC,SAAN,CAAgBL,aAAa,GAAGE,KAAhC,CAAuC,MAAKC,WAAY,MAAKrB,gBAAgB,CAACsB,UAAD,CAAa,IAAtG;IACD,CAHD;;IAKA,MAAME,OAAO,GAAG5C,OAAO,CAACmB,SAAR,GACZ,+CADY,GAEZ,8BAFJ;IAGA,MAAM0B,WAAW,GAAG7C,OAAO,CAACmB,SAAR,GAChB,2CADgB,GAEhB,oCAFJ;IAGA,MAAM2B,oBAAoB,GAAG9C,OAAO,CAACmB,SAAR,GACzBjB,gBAAA,CAAM6C,IAAN,CACE,iHADF,CADyB,GAIzB,EAJJ;IAKA,OACEhC,cAAc,GACdb,gBAAA,CAAMiC,KAAN,CACG,GAAE9B,gBAAgB,CAACpB,MAAjB,GAA0B6B,eAAgB,iBAAgBd,OAAO,CAACmB,SAAR,GAAoB,OAApB,GAA8B,EAAG,QADhG,CADA,GAIAD,cAJA,GAKAqB,cAAc,CAAC,gBAAD,EAAmBK,OAAnB,EAA4B/B,eAA5B,CALd,GAMA0B,cAAc,CAAC,oBAAD,EAAuBM,WAAvB,EAAoCpC,iBAApC,CANd,GAOAuB,aAAa,EAPb,GAQAc,oBATF;EAWD;;AAhSoC"}
|
|
1
|
+
{"version":3,"names":["RELEASE_TYPES","TagCmd","constructor","snapping","logger","name","description","join","Object","keys","IssuesClasses","cmd","report","patterns","message","ver","all","editor","snapped","unmerged","patch","minor","major","preRelease","increment","prereleaseId","force","ignoreUnresolvedDependencies","ignoreIssues","ignoreNewestVersion","skipTests","skipAutoTag","scope","unmodified","build","soft","persist","disableDeployPipeline","disableTagPipeline","forceDeploy","incrementBy","BitError","consoleWarning","length","releaseFlags","filter","x","getReleaseType","includes","DEFAULT_BIT_RELEASE_TYPE","getPreReleaseId","undefined","disableTagAndSnapPipelines","params","ids","releaseType","preReleaseId","version","results","tag","chalk","yellow","NOTHING_TO_TAG_MSG","taggedComponents","autoTaggedResults","warnings","newComponents","changedComponents","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","warningsOutput","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","outputComponents","comps","map","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_TAGGED_MSG","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","softTagPrefix","outputIfExists","label","explanation","components","underline","newDesc","changedDesc","softTagClarification","bold"],"sources":["tag-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { TagResults, NOTHING_TO_TAG_MSG, AUTO_TAGGED_MSG } from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { DEFAULT_BIT_RELEASE_TYPE } from '@teambit/legacy/dist/constants';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ReleaseType } from 'semver';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagParams } from './tag-model-component';\n\nconst RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];\n\nexport class TagCmd implements Command {\n name = 'tag [component-patterns...]';\n group = 'development';\n description = 'create an immutable and exportable component snapshot, tagged with a release version.';\n extendedDescription = `if no patterns are provided, it will tag all new and modified components.\nif patterns are entered, you can specify a version per pattern using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major`;\n arguments = [\n {\n name: 'component-patterns...',\n description:\n 'a list of component names, IDs or patterns (separated by space). run \"bit pattern --help\" to get more data about patterns. By default, all modified are tagged.',\n },\n ];\n helpUrl = 'components/tags';\n alias = 't';\n loader = true;\n options = [\n ['m', 'message <message>', 'a log message describing latest changes'],\n ['', 'unmodified', 'include unmodified components (by default, only new and modified components are tagged)'],\n [\n '',\n 'editor [editor]',\n 'EXPERIMENTAL. open an editor to write a tag message for each component. optionally, specify the editor-name (defaults to vim).',\n ],\n ['v', 'ver <version>', 'tag with the given version'],\n ['l', 'increment <level>', `options are: [${RELEASE_TYPES.join(', ')}], default to patch`],\n ['', 'prerelease-id <id>', 'prerelease identifier (e.g. \"dev\" to get \"1.0.0-dev.1\")'],\n ['p', 'patch', 'syntactic sugar for \"--increment patch\"'],\n ['', 'minor', 'syntactic sugar for \"--increment minor\"'],\n ['', 'major', 'syntactic sugar for \"--increment major\"'],\n ['', 'pre-release [identifier]', 'syntactic sugar for \"--increment prerelease\" and `--prerelease-id <identifier>`'],\n ['', 'snapped', 'EXPERIMENTAL. tag components that their head is a snap (not a tag)'],\n ['', 'unmerged', 'EXPERIMENTAL. complete a merge process by tagging the unmerged components'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n ['', 'skip-auto-tag', 'skip auto tagging dependents'],\n ['', 'soft', 'do not persist. only keep note of the changes to be made'],\n ['', 'persist', 'persist the changes generated by --soft tag'],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'force-deploy', 'run the tag pipeline although the build failed'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'],\n ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],\n [\n 'a',\n 'all [version]',\n 'DEPRECATED (not needed anymore, it is the default now). tag all new and modified components',\n ],\n ['s', 'scope [version]', 'DEPRECATED (use \"--unmodified\" instead). tag all components of the current scope'],\n [\n 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-tag even if tests are failing and even when component has not changed',\n ],\n ['', 'disable-deploy-pipeline', 'DEPRECATED. use --disable-tag-pipeline instead'],\n ] as CommandOptions;\n migration = true;\n remoteOp = true; // In case a compiler / tester is not installed\n examples = [{ cmd: 'tag --ver 1.0.0', description: 'tag all components to version 1.0.0' }];\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n // eslint-disable-next-line complexity\n async report(\n [patterns = []]: [string[]],\n {\n message = '',\n ver,\n all = false,\n editor = '',\n snapped = false,\n unmerged = false,\n patch,\n minor,\n major,\n preRelease,\n increment,\n prereleaseId,\n force = false,\n ignoreUnresolvedDependencies,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipAutoTag = false,\n scope,\n unmodified = false,\n build,\n soft = false,\n persist = false,\n disableDeployPipeline = false,\n disableTagPipeline = false,\n forceDeploy = false,\n incrementBy = 1,\n }: {\n all?: boolean | string;\n snapped?: boolean;\n unmerged?: boolean;\n ver?: string;\n force?: boolean;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n increment?: ReleaseType;\n preRelease?: string;\n prereleaseId?: string;\n ignoreUnresolvedDependencies?: boolean;\n ignoreIssues?: string;\n scope?: string | boolean;\n incrementBy?: number;\n disableDeployPipeline?: boolean;\n disableTagPipeline?: boolean;\n } & Partial<BasicTagParams>\n ): Promise<string> {\n if (typeof ignoreUnresolvedDependencies === 'boolean') {\n throw new BitError(`--ignore-unresolved-dependencies has been removed, please use --ignore-issues instead`);\n }\n if (ignoreIssues && typeof ignoreIssues === 'boolean') {\n throw new BitError(`--ignore-issues expects issues to be ignored, please run \"bit tag -h\" for the issues list`);\n }\n if (disableDeployPipeline) {\n this.logger.consoleWarning(`--disable-deploy-pipeline is deprecated, please use --disable-tag-pipeline instead`);\n }\n if (!message && !persist) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your tag`\n );\n }\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. \"bit tag\" by default will tag all new and modified components. to specify a version, use --ver flag`\n );\n if (typeof all === 'string') {\n ver = all;\n }\n }\n if (scope) {\n this.logger.consoleWarning(`--scope is deprecated, use --unmodified instead`);\n unmodified = true;\n if (typeof scope === 'string') {\n ver = scope;\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 (patterns.length) unmodified = true;\n }\n if (prereleaseId && (!increment || increment === 'major' || increment === 'minor' || increment === 'patch')) {\n throw new BitError(\n `--prerelease-id should be entered along with --increment flag, while --increment must be one of the following: [prepatch, prerelease, preminor, premajor]`\n );\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new BitError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n const getReleaseType = (): ReleaseType => {\n if (increment) {\n if (!RELEASE_TYPES.includes(increment)) {\n throw new BitError(`invalid increment-level \"${increment}\".\n semver allows the following options only: ${RELEASE_TYPES.join(', ')}`);\n }\n return increment;\n }\n if (major) return 'major';\n if (minor) return 'minor';\n if (patch) return 'patch';\n if (preRelease) return 'prerelease';\n return DEFAULT_BIT_RELEASE_TYPE;\n };\n const getPreReleaseId = (): string | undefined => {\n if (prereleaseId) {\n return prereleaseId;\n }\n if (preRelease && typeof preRelease === 'string') {\n return preRelease;\n }\n return undefined;\n };\n\n const disableTagAndSnapPipelines = disableTagPipeline || disableDeployPipeline;\n\n const params = {\n ids: patterns,\n snapped,\n unmerged,\n editor,\n message,\n releaseType: getReleaseType(),\n preReleaseId: getPreReleaseId(),\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipAutoTag,\n build,\n soft,\n persist,\n unmodified,\n disableTagAndSnapPipelines,\n forceDeploy,\n incrementBy,\n version: ver,\n };\n\n const results = await this.snapping.tag(params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n const { taggedComponents, autoTaggedResults, warnings, newComponents }: TagResults = results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = `\\n(use \"bit export [collection]\" to push these components to a remote\")\n(use \"bit reset\" to unstage versions)\\n`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the changes\")\n(use \"bit reset --soft\" to remove the soft-tags)\\n`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoTaggedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged first version for components'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that set to get a version bump'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n 'keep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n warningsOutput +\n chalk.green(\n `${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged`\n ) +\n tagExplanation +\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n publishOutput() +\n softTagClarification\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;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;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKA,MAAMA,aAAa,GAAG,CAAC,OAAD,EAAU,UAAV,EAAsB,OAAtB,EAA+B,UAA/B,EAA2C,OAA3C,EAAoD,UAApD,EAAgE,YAAhE,CAAtB;;AAEO,MAAMC,MAAN,CAAgC;EAmEpB;EAGjBC,WAAW,CAASC,QAAT,EAAyCC,MAAzC,EAAyD;IAAA,KAAhDD,QAAgD,GAAhDA,QAAgD;IAAA,KAAhBC,MAAgB,GAAhBA,MAAgB;IAAA,8CArE7D,6BAqE6D;IAAA,+CApE5D,aAoE4D;IAAA,qDAnEtD,uFAmEsD;IAAA,6DAlE7C;AACzB,0HAiEsE;IAAA,mDAhExD,CACV;MACEC,IAAI,EAAE,uBADR;MAEEC,WAAW,EACT;IAHJ,CADU,CAgEwD;IAAA,i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,CAACmB,SAAR,GACzBjB,gBAAA,CAAM6C,IAAN,CACE,iHADF,CADyB,GAIzB,EAJJ;IAKA,OACEhC,cAAc,GACdb,gBAAA,CAAMiC,KAAN,CACG,GAAE9B,gBAAgB,CAACpB,MAAjB,GAA0B6B,eAAgB,iBAAgBd,OAAO,CAACmB,SAAR,GAAoB,OAApB,GAA8B,EAAG,QADhG,CADA,GAIAD,cAJA,GAKAqB,cAAc,CAAC,gBAAD,EAAmBK,OAAnB,EAA4B/B,eAA5B,CALd,GAMA0B,cAAc,CAAC,oBAAD,EAAuBM,WAAvB,EAAoCpC,iBAApC,CANd,GAOAuB,aAAa,EAPb,GAQAc,oBATF;EAWD;;AAhSoC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import { ReleaseType } from 'semver';
|
|
3
|
+
import { Logger } from '@teambit/logger';
|
|
4
|
+
import { SnappingMain } from './snapping.main.runtime';
|
|
5
|
+
import { BasicTagParams } from './tag-model-component';
|
|
6
|
+
export declare class TagFromScopeCmd implements Command {
|
|
7
|
+
private snapping;
|
|
8
|
+
private logger;
|
|
9
|
+
name: string;
|
|
10
|
+
group: string;
|
|
11
|
+
private: boolean;
|
|
12
|
+
description: string;
|
|
13
|
+
extendedDescription: string;
|
|
14
|
+
helpUrl: string;
|
|
15
|
+
alias: string;
|
|
16
|
+
loader: boolean;
|
|
17
|
+
options: CommandOptions;
|
|
18
|
+
remoteOp: boolean;
|
|
19
|
+
constructor(snapping: SnappingMain, logger: Logger);
|
|
20
|
+
report([patterns]: [string[]], { push, message, ver, patch, minor, major, preRelease, increment, prereleaseId, ignoreIssues, ignoreNewestVersion, skipTests, build, disableTagPipeline, forceDeploy, incrementBy, }: {
|
|
21
|
+
push?: boolean;
|
|
22
|
+
ver?: string;
|
|
23
|
+
patch?: boolean;
|
|
24
|
+
minor?: boolean;
|
|
25
|
+
major?: boolean;
|
|
26
|
+
increment?: ReleaseType;
|
|
27
|
+
preRelease?: string;
|
|
28
|
+
prereleaseId?: string;
|
|
29
|
+
ignoreIssues?: string;
|
|
30
|
+
incrementBy?: number;
|
|
31
|
+
disableTagPipeline?: boolean;
|
|
32
|
+
} & Partial<BasicTagParams>): Promise<string>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.array.iterator.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.promise.js");
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
exports.TagFromScopeCmd = void 0;
|
|
13
|
+
|
|
14
|
+
function _defineProperty2() {
|
|
15
|
+
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
|
|
17
|
+
_defineProperty2 = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function _chalk() {
|
|
25
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
26
|
+
|
|
27
|
+
_chalk = function () {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function _tag() {
|
|
35
|
+
const data = require("@teambit/legacy/dist/api/consumer/lib/tag");
|
|
36
|
+
|
|
37
|
+
_tag = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function _constants() {
|
|
45
|
+
const data = require("@teambit/legacy/dist/constants");
|
|
46
|
+
|
|
47
|
+
_constants = function () {
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return data;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _componentIssues() {
|
|
55
|
+
const data = require("@teambit/component-issues");
|
|
56
|
+
|
|
57
|
+
_componentIssues = function () {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _bitError() {
|
|
65
|
+
const data = require("@teambit/bit-error");
|
|
66
|
+
|
|
67
|
+
_bitError = function () {
|
|
68
|
+
return data;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return data;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
|
|
75
|
+
|
|
76
|
+
class TagFromScopeCmd {
|
|
77
|
+
// In case a compiler / tester is not installed
|
|
78
|
+
constructor(snapping, logger) {
|
|
79
|
+
this.snapping = snapping;
|
|
80
|
+
this.logger = logger;
|
|
81
|
+
(0, _defineProperty2().default)(this, "name", '_tag <component-id...>');
|
|
82
|
+
(0, _defineProperty2().default)(this, "group", 'development');
|
|
83
|
+
(0, _defineProperty2().default)(this, "private", true);
|
|
84
|
+
(0, _defineProperty2().default)(this, "description", 'create an immutable and exportable component snapshot, tagged with a release version.');
|
|
85
|
+
(0, _defineProperty2().default)(this, "extendedDescription", `you can specify a version per id using "@" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major`);
|
|
86
|
+
(0, _defineProperty2().default)(this, "helpUrl", 'components/tags');
|
|
87
|
+
(0, _defineProperty2().default)(this, "alias", '');
|
|
88
|
+
(0, _defineProperty2().default)(this, "loader", true);
|
|
89
|
+
(0, _defineProperty2().default)(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['m', 'message <message>', 'a log message describing latest changes'], ['v', 'ver <version>', 'tag with the given version'], ['l', 'increment <level>', `options are: [${RELEASE_TYPES.join(', ')}], default to patch`], ['', 'prerelease-id <id>', 'prerelease identifier (e.g. "dev" to get "1.0.0-dev.1")'], ['p', 'patch', 'syntactic sugar for "--increment patch"'], ['', 'minor', 'syntactic sugar for "--increment minor"'], ['', 'major', 'syntactic sugar for "--increment major"'], ['', 'pre-release [identifier]', 'syntactic sugar for "--increment prerelease" and `--prerelease-id <identifier>`'], ['', 'skip-tests', 'skip running component tests during tag process'], ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'], ['', 'force-deploy', 'run the tag pipeline although the build failed'], ['', 'increment-by <number>', '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
|
|
90
|
+
[${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
|
|
91
|
+
to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'], ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag']]);
|
|
92
|
+
(0, _defineProperty2().default)(this, "remoteOp", true);
|
|
93
|
+
} // eslint-disable-next-line complexity
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
async report([patterns = []], {
|
|
97
|
+
push,
|
|
98
|
+
message = '',
|
|
99
|
+
ver,
|
|
100
|
+
patch,
|
|
101
|
+
minor,
|
|
102
|
+
major,
|
|
103
|
+
preRelease,
|
|
104
|
+
increment,
|
|
105
|
+
prereleaseId,
|
|
106
|
+
ignoreIssues,
|
|
107
|
+
ignoreNewestVersion = false,
|
|
108
|
+
skipTests = false,
|
|
109
|
+
build,
|
|
110
|
+
disableTagPipeline = false,
|
|
111
|
+
forceDeploy = false,
|
|
112
|
+
incrementBy = 1
|
|
113
|
+
}) {
|
|
114
|
+
if (ignoreIssues && typeof ignoreIssues === 'boolean') {
|
|
115
|
+
throw new (_bitError().BitError)(`--ignore-issues expects issues to be ignored, please run "bit tag -h" for the issues list`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!message) {
|
|
119
|
+
throw new Error('message is mandatory');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (prereleaseId && (!increment || increment === 'major' || increment === 'minor' || increment === 'patch')) {
|
|
123
|
+
throw new (_bitError().BitError)(`--prerelease-id should be entered along with --increment flag, while --increment must be one of the following: [prepatch, prerelease, preminor, premajor]`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const releaseFlags = [patch, minor, major, preRelease].filter(x => x);
|
|
127
|
+
|
|
128
|
+
if (releaseFlags.length > 1) {
|
|
129
|
+
throw new (_bitError().BitError)('you can use only one of the following - patch, minor, major, pre-release');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const getReleaseType = () => {
|
|
133
|
+
if (increment) {
|
|
134
|
+
if (!RELEASE_TYPES.includes(increment)) {
|
|
135
|
+
throw new (_bitError().BitError)(`invalid increment-level "${increment}".
|
|
136
|
+
semver allows the following options only: ${RELEASE_TYPES.join(', ')}`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return increment;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (major) return 'major';
|
|
143
|
+
if (minor) return 'minor';
|
|
144
|
+
if (patch) return 'patch';
|
|
145
|
+
if (preRelease) return 'prerelease';
|
|
146
|
+
return _constants().DEFAULT_BIT_RELEASE_TYPE;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const getPreReleaseId = () => {
|
|
150
|
+
if (prereleaseId) {
|
|
151
|
+
return prereleaseId;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (preRelease && typeof preRelease === 'string') {
|
|
155
|
+
return preRelease;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return undefined;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const params = {
|
|
162
|
+
ids: patterns,
|
|
163
|
+
push,
|
|
164
|
+
message,
|
|
165
|
+
releaseType: getReleaseType(),
|
|
166
|
+
preReleaseId: getPreReleaseId(),
|
|
167
|
+
ignoreIssues,
|
|
168
|
+
ignoreNewestVersion,
|
|
169
|
+
skipTests,
|
|
170
|
+
build,
|
|
171
|
+
disableTagAndSnapPipelines: disableTagPipeline,
|
|
172
|
+
forceDeploy,
|
|
173
|
+
incrementBy,
|
|
174
|
+
version: ver
|
|
175
|
+
};
|
|
176
|
+
const results = await this.snapping.tagFromScope(params);
|
|
177
|
+
if (!results) return _chalk().default.yellow(_tag().NOTHING_TO_TAG_MSG);
|
|
178
|
+
const {
|
|
179
|
+
taggedComponents,
|
|
180
|
+
autoTaggedResults,
|
|
181
|
+
warnings,
|
|
182
|
+
newComponents
|
|
183
|
+
} = results;
|
|
184
|
+
const changedComponents = taggedComponents.filter(component => !newComponents.searchWithoutVersion(component.id));
|
|
185
|
+
const addedComponents = taggedComponents.filter(component => newComponents.searchWithoutVersion(component.id));
|
|
186
|
+
const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;
|
|
187
|
+
const warningsOutput = warnings && warnings.length ? `${_chalk().default.yellow(warnings.join('\n'))}\n\n` : '';
|
|
188
|
+
const tagExplanationPersist = `\n(use "bit export [collection]" to push these components to a remote")
|
|
189
|
+
(use "bit reset" to unstage versions)\n`;
|
|
190
|
+
const tagExplanationSoft = `\n(use "bit tag --persist" to persist the changes")
|
|
191
|
+
(use "bit reset --soft" to remove the soft-tags)\n`;
|
|
192
|
+
const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;
|
|
193
|
+
|
|
194
|
+
const outputComponents = comps => {
|
|
195
|
+
return comps.map(component => {
|
|
196
|
+
let componentOutput = ` > ${component.id.toString()}`;
|
|
197
|
+
const autoTag = autoTaggedResults.filter(result => result.triggeredBy.searchWithoutScopeAndVersion(component.id));
|
|
198
|
+
|
|
199
|
+
if (autoTag.length) {
|
|
200
|
+
const autoTagComp = autoTag.map(a => a.component.id.toString());
|
|
201
|
+
componentOutput += `\n ${_tag().AUTO_TAGGED_MSG}:
|
|
202
|
+
${autoTagComp.join('\n ')}`;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return componentOutput;
|
|
206
|
+
}).join('\n');
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const publishOutput = () => {
|
|
210
|
+
const {
|
|
211
|
+
publishedPackages
|
|
212
|
+
} = results;
|
|
213
|
+
if (!publishedPackages || !publishedPackages.length) return '';
|
|
214
|
+
const successTitle = `\n\n${_chalk().default.green(`published the following ${publishedPackages.length} component(s) successfully\n`)}`;
|
|
215
|
+
const successCompsStr = publishedPackages.join('\n');
|
|
216
|
+
const successOutput = successCompsStr ? successTitle + successCompsStr : '';
|
|
217
|
+
return successOutput;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';
|
|
221
|
+
|
|
222
|
+
const outputIfExists = (label, explanation, components) => {
|
|
223
|
+
if (!components.length) return '';
|
|
224
|
+
return `\n${_chalk().default.underline(softTagPrefix + label)}\n(${explanation})\n${outputComponents(components)}\n`;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const newDesc = results.isSoftTag ? 'set to be tagged first version for components' : 'first version for components';
|
|
228
|
+
const changedDesc = results.isSoftTag ? 'components that set to get a version bump' : 'components that got a version bump';
|
|
229
|
+
const softTagClarification = results.isSoftTag ? _chalk().default.bold('keep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag') : '';
|
|
230
|
+
return warningsOutput + _chalk().default.green(`${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged`) + tagExplanation + outputIfExists('new components', newDesc, addedComponents) + outputIfExists('changed components', changedDesc, changedComponents) + publishOutput() + softTagClarification;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
exports.TagFromScopeCmd = TagFromScopeCmd;
|
|
236
|
+
|
|
237
|
+
//# sourceMappingURL=tag-from-scope.cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RELEASE_TYPES","TagFromScopeCmd","constructor","snapping","logger","join","Object","keys","IssuesClasses","report","patterns","push","message","ver","patch","minor","major","preRelease","increment","prereleaseId","ignoreIssues","ignoreNewestVersion","skipTests","build","disableTagPipeline","forceDeploy","incrementBy","BitError","Error","releaseFlags","filter","x","length","getReleaseType","includes","DEFAULT_BIT_RELEASE_TYPE","getPreReleaseId","undefined","params","ids","releaseType","preReleaseId","disableTagAndSnapPipelines","version","results","tagFromScope","chalk","yellow","NOTHING_TO_TAG_MSG","taggedComponents","autoTaggedResults","warnings","newComponents","changedComponents","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","warningsOutput","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","outputComponents","comps","map","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_TAGGED_MSG","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","softTagPrefix","outputIfExists","label","explanation","components","underline","newDesc","changedDesc","softTagClarification","bold"],"sources":["tag-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { TagResults, NOTHING_TO_TAG_MSG, AUTO_TAGGED_MSG } from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { DEFAULT_BIT_RELEASE_TYPE } from '@teambit/legacy/dist/constants';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ReleaseType } from 'semver';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagParams } from './tag-model-component';\n\nconst RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];\n\nexport class TagFromScopeCmd implements Command {\n name = '_tag <component-id...>';\n group = 'development';\n private = true;\n description = 'create an immutable and exportable component snapshot, tagged with a release version.';\n extendedDescription = `you can specify a version per id using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major`;\n helpUrl = 'components/tags';\n alias = '';\n loader = true;\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'a log message describing latest changes'],\n ['v', 'ver <version>', 'tag with the given version'],\n ['l', 'increment <level>', `options are: [${RELEASE_TYPES.join(', ')}], default to patch`],\n ['', 'prerelease-id <id>', 'prerelease identifier (e.g. \"dev\" to get \"1.0.0-dev.1\")'],\n ['p', 'patch', 'syntactic sugar for \"--increment patch\"'],\n ['', 'minor', 'syntactic sugar for \"--increment minor\"'],\n ['', 'major', 'syntactic sugar for \"--increment major\"'],\n ['', 'pre-release [identifier]', 'syntactic sugar for \"--increment prerelease\" and `--prerelease-id <identifier>`'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'force-deploy', 'run the tag pipeline although the build failed'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'],\n ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],\n ] as CommandOptions;\n remoteOp = true; // In case a compiler / tester is not installed\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n // eslint-disable-next-line complexity\n async report(\n [patterns = []]: [string[]],\n {\n push,\n message = '',\n ver,\n patch,\n minor,\n major,\n preRelease,\n increment,\n prereleaseId,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n build,\n disableTagPipeline = false,\n forceDeploy = false,\n incrementBy = 1,\n }: {\n push?: boolean;\n ver?: string;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n increment?: ReleaseType;\n preRelease?: string;\n prereleaseId?: string;\n ignoreIssues?: string;\n incrementBy?: number;\n disableTagPipeline?: boolean;\n } & Partial<BasicTagParams>\n ): Promise<string> {\n if (ignoreIssues && typeof ignoreIssues === 'boolean') {\n throw new BitError(`--ignore-issues expects issues to be ignored, please run \"bit tag -h\" for the issues list`);\n }\n if (!message) {\n throw new Error('message is mandatory');\n }\n if (prereleaseId && (!increment || increment === 'major' || increment === 'minor' || increment === 'patch')) {\n throw new BitError(\n `--prerelease-id should be entered along with --increment flag, while --increment must be one of the following: [prepatch, prerelease, preminor, premajor]`\n );\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new BitError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n const getReleaseType = (): ReleaseType => {\n if (increment) {\n if (!RELEASE_TYPES.includes(increment)) {\n throw new BitError(`invalid increment-level \"${increment}\".\n semver allows the following options only: ${RELEASE_TYPES.join(', ')}`);\n }\n return increment;\n }\n if (major) return 'major';\n if (minor) return 'minor';\n if (patch) return 'patch';\n if (preRelease) return 'prerelease';\n return DEFAULT_BIT_RELEASE_TYPE;\n };\n const getPreReleaseId = (): string | undefined => {\n if (prereleaseId) {\n return prereleaseId;\n }\n if (preRelease && typeof preRelease === 'string') {\n return preRelease;\n }\n return undefined;\n };\n\n const params = {\n ids: patterns,\n push,\n message,\n releaseType: getReleaseType(),\n preReleaseId: getPreReleaseId(),\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n build,\n disableTagAndSnapPipelines: disableTagPipeline,\n forceDeploy,\n incrementBy,\n version: ver,\n };\n\n const results = await this.snapping.tagFromScope(params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n const { taggedComponents, autoTaggedResults, warnings, newComponents }: TagResults = results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = `\\n(use \"bit export [collection]\" to push these components to a remote\")\n(use \"bit reset\" to unstage versions)\\n`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the changes\")\n(use \"bit reset --soft\" to remove the soft-tags)\\n`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoTaggedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged first version for components'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that set to get a version bump'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n 'keep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n warningsOutput +\n chalk.green(\n `${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged`\n ) +\n tagExplanation +\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n publishOutput() +\n softTagClarification\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;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;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKA,MAAMA,aAAa,GAAG,CAAC,OAAD,EAAU,UAAV,EAAsB,OAAtB,EAA+B,UAA/B,EAA2C,OAA3C,EAAoD,UAApD,EAAgE,YAAhE,CAAtB;;AAEO,MAAMC,eAAN,CAAyC;EAqC7B;EAEjBC,WAAW,CAASC,QAAT,EAAyCC,MAAzC,EAAyD;IAAA,KAAhDD,QAAgD,GAAhDA,QAAgD;IAAA,KAAhBC,MAAgB,GAAhBA,MAAgB;IAAA,8CAtC7D,wBAsC6D;IAAA,+CArC5D,aAqC4D;IAAA,iDApC1D,IAoC0D;IAAA,qDAnCtD,uFAmCsD;IAAA,6DAlC7C,6FAkC6C;IAAA,iDAjC1D,iBAiC0D;IAAA,+CAhC5D,EAgC4D;IAAA,gDA/B3D,IA+B2D;IAAA,iDA9B1D,CACR,CAAC,EAAD,EAAK,MAAL,EAAa,6DAAb,CADQ,EAER,CAAC,GAAD,EAAM,mBAAN,EAA2B,yCAA3B,CAFQ,EAGR,CAAC,GAAD,EAAM,eAAN,EAAuB,4BAAvB,CAHQ,EAIR,CAAC,GAAD,EAAM,mBAAN,EAA4B,iBAAgBJ,aAAa,CAACK,IAAd,CAAmB,IAAnB,CAAyB,qBAArE,CAJQ,EAKR,CAAC,EAAD,EAAK,oBAAL,EAA2B,yDAA3B,CALQ,EAMR,C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,aAAa,GAAGE,KAAhC,CAAuC,MAAKC,WAAY,MAAKrB,gBAAgB,CAACsB,UAAD,CAAa,IAAtG;IACD,CAHD;;IAKA,MAAME,OAAO,GAAG5C,OAAO,CAACmB,SAAR,GACZ,+CADY,GAEZ,8BAFJ;IAGA,MAAM0B,WAAW,GAAG7C,OAAO,CAACmB,SAAR,GAChB,2CADgB,GAEhB,oCAFJ;IAGA,MAAM2B,oBAAoB,GAAG9C,OAAO,CAACmB,SAAR,GACzBjB,gBAAA,CAAM6C,IAAN,CACE,iHADF,CADyB,GAIzB,EAJJ;IAKA,OACEhC,cAAc,GACdb,gBAAA,CAAMiC,KAAN,CACG,GAAE9B,gBAAgB,CAACjB,MAAjB,GAA0B0B,eAAgB,iBAAgBd,OAAO,CAACmB,SAAR,GAAoB,OAApB,GAA8B,EAAG,QADhG,CADA,GAIAD,cAJA,GAKAqB,cAAc,CAAC,gBAAD,EAAmBK,OAAnB,EAA4B/B,eAA5B,CALd,GAMA0B,cAAc,CAAC,oBAAD,EAAuBM,WAAvB,EAAoCpC,iBAApC,CANd,GAOAuB,aAAa,EAPb,GAQAc,oBATF;EAWD;;AA3M6C"}
|
|
@@ -2,15 +2,32 @@ import { ReleaseType } from 'semver';
|
|
|
2
2
|
import { BitId, BitIds } from '@teambit/legacy/dist/bit-id';
|
|
3
3
|
import Component from '@teambit/legacy/dist/consumer/component/consumer-component';
|
|
4
4
|
import { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag';
|
|
5
|
-
import {
|
|
5
|
+
import { BuilderMain } from '@teambit/builder';
|
|
6
6
|
import { ModelComponent } from '@teambit/legacy/dist/scope/models';
|
|
7
7
|
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
8
|
+
import { ScopeMain } from '@teambit/scope';
|
|
8
9
|
import { Workspace } from '@teambit/workspace';
|
|
9
10
|
import { SnappingMain } from './snapping.main.runtime';
|
|
10
11
|
export declare type onTagIdTransformer = (id: BitId) => BitId | null;
|
|
11
|
-
export declare
|
|
12
|
-
|
|
12
|
+
export declare type BasicTagParams = {
|
|
13
|
+
message: string;
|
|
14
|
+
ignoreNewestVersion?: boolean;
|
|
15
|
+
skipTests?: boolean;
|
|
16
|
+
skipAutoTag?: boolean;
|
|
17
|
+
build?: boolean;
|
|
18
|
+
soft?: boolean;
|
|
19
|
+
persist: boolean;
|
|
20
|
+
disableTagAndSnapPipelines?: boolean;
|
|
21
|
+
forceDeploy?: boolean;
|
|
22
|
+
preReleaseId?: string;
|
|
23
|
+
editor?: string;
|
|
24
|
+
unmodified?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function tagModelComponent({ workspace, scope, snapping, builder, consumerComponents, ids, message, editor, exactVersion, releaseType, preReleaseId, ignoreNewestVersion, skipTests, skipAutoTag, soft, build, persist, isSnap, disableTagAndSnapPipelines, forceDeploy, incrementBy, packageManagerConfigRootDir, dependencyResolver, }: {
|
|
27
|
+
workspace?: Workspace;
|
|
28
|
+
scope: ScopeMain;
|
|
13
29
|
snapping: SnappingMain;
|
|
30
|
+
builder: BuilderMain;
|
|
14
31
|
consumerComponents: Component[];
|
|
15
32
|
ids: BitIds;
|
|
16
33
|
exactVersion?: string | null | undefined;
|
|
@@ -255,7 +255,9 @@ function getVersionByEnteredId(enteredIds, component, modelComponent) {
|
|
|
255
255
|
|
|
256
256
|
async function tagModelComponent({
|
|
257
257
|
workspace,
|
|
258
|
+
scope,
|
|
258
259
|
snapping,
|
|
260
|
+
builder,
|
|
259
261
|
consumerComponents,
|
|
260
262
|
ids,
|
|
261
263
|
message,
|
|
@@ -276,8 +278,8 @@ async function tagModelComponent({
|
|
|
276
278
|
packageManagerConfigRootDir,
|
|
277
279
|
dependencyResolver
|
|
278
280
|
}) {
|
|
279
|
-
const consumer = workspace.consumer;
|
|
280
|
-
const
|
|
281
|
+
const consumer = workspace === null || workspace === void 0 ? void 0 : workspace.consumer;
|
|
282
|
+
const legacyScope = scope.legacyScope;
|
|
281
283
|
const consumerComponentsIdsMap = {}; // Concat and unique all the dependencies from all the components so we will not import
|
|
282
284
|
// the same dependency more then once, it's mainly for performance purpose
|
|
283
285
|
|
|
@@ -295,7 +297,7 @@ async function tagModelComponent({
|
|
|
295
297
|
|
|
296
298
|
|
|
297
299
|
const idsToTriggerAutoTag = idsToTag.filter(id => id.hasVersion());
|
|
298
|
-
const autoTagData = skipAutoTag ? [] : await (0, _autoTag().getAutoTagInfo)(consumer, _bitId().BitIds.fromArray(idsToTriggerAutoTag));
|
|
300
|
+
const autoTagData = skipAutoTag || !consumer ? [] : await (0, _autoTag().getAutoTagInfo)(consumer, _bitId().BitIds.fromArray(idsToTriggerAutoTag));
|
|
299
301
|
const autoTagComponents = autoTagData.map(autoTagItem => autoTagItem.component);
|
|
300
302
|
const autoTagComponentsFiltered = autoTagComponents.filter(c => !idsToTag.has(c.id));
|
|
301
303
|
|
|
@@ -303,13 +305,13 @@ async function tagModelComponent({
|
|
|
303
305
|
|
|
304
306
|
const allComponentsToTag = [...componentsToTag, ...autoTagComponentsFiltered];
|
|
305
307
|
const messagesFromEditorFetcher = new (_messagePerComponent().MessagePerComponentFetcher)(idsToTag, autoTagIds);
|
|
306
|
-
const messagePerId = editor ? await messagesFromEditorFetcher.getMessagesFromEditor(
|
|
308
|
+
const messagePerId = editor ? await messagesFromEditorFetcher.getMessagesFromEditor(legacyScope.tmp, editor) : []; // check for each one of the components whether it is using an old version
|
|
307
309
|
|
|
308
310
|
if (!ignoreNewestVersion && !isSnap) {
|
|
309
311
|
const newestVersionsP = allComponentsToTag.map(async component => {
|
|
310
312
|
if (component.componentFromModel) {
|
|
311
313
|
// otherwise it's a new component, so this check is irrelevant
|
|
312
|
-
const modelComponent = await
|
|
314
|
+
const modelComponent = await legacyScope.getModelComponentIfExist(component.id);
|
|
313
315
|
if (!modelComponent) throw new (_showDoctorError().default)(`component ${component.id} was not found in the model`);
|
|
314
316
|
if (!modelComponent.listVersions().length) return null; // no versions yet, no issues.
|
|
315
317
|
|
|
@@ -338,20 +340,21 @@ async function tagModelComponent({
|
|
|
338
340
|
_logger().default.debugAndAddBreadCrumb('tag-model-components', 'sequentially persist all components'); // go through all components and find the future versions for them
|
|
339
341
|
|
|
340
342
|
|
|
341
|
-
isSnap ? setHashes(allComponentsToTag) : await setFutureVersions(allComponentsToTag,
|
|
343
|
+
isSnap ? setHashes(allComponentsToTag) : await setFutureVersions(allComponentsToTag, legacyScope, releaseType, exactVersion, persist, autoTagIds, ids, incrementBy, preReleaseId, soft);
|
|
342
344
|
setCurrentSchema(allComponentsToTag); // go through all dependencies and update their versions
|
|
343
345
|
|
|
344
346
|
updateDependenciesVersions(allComponentsToTag, dependencyResolver);
|
|
345
347
|
await addLogToComponents(componentsToTag, autoTagComponents, persist, message, messagePerId);
|
|
346
348
|
|
|
347
349
|
if (soft) {
|
|
350
|
+
if (!consumer) throw new Error(`unable to soft-tag without consumer`);
|
|
348
351
|
consumer.updateNextVersionOnBitmap(allComponentsToTag, preReleaseId);
|
|
349
352
|
} else {
|
|
350
|
-
await snapping._addFlattenedDependenciesToComponents(
|
|
353
|
+
await snapping._addFlattenedDependenciesToComponents(legacyScope, allComponentsToTag);
|
|
351
354
|
emptyBuilderData(allComponentsToTag);
|
|
352
355
|
addBuildStatus(allComponentsToTag, _constants().BuildStatus.Pending);
|
|
353
|
-
await addComponentsToScope(
|
|
354
|
-
await updateComponentsVersions(workspace, allComponentsToTag);
|
|
356
|
+
await addComponentsToScope(legacyScope, allComponentsToTag, Boolean(build), consumer);
|
|
357
|
+
if (workspace) await updateComponentsVersions(workspace, allComponentsToTag);
|
|
355
358
|
}
|
|
356
359
|
|
|
357
360
|
const publishedPackages = [];
|
|
@@ -364,19 +367,29 @@ async function tagModelComponent({
|
|
|
364
367
|
skipTests,
|
|
365
368
|
isSnap
|
|
366
369
|
};
|
|
370
|
+
const seedersOnly = !workspace; // if tag from scope, build only the given components
|
|
371
|
+
|
|
367
372
|
const isolateOptions = {
|
|
368
|
-
packageManagerConfigRootDir
|
|
373
|
+
packageManagerConfigRootDir,
|
|
374
|
+
seedersOnly
|
|
369
375
|
};
|
|
370
|
-
|
|
371
|
-
|
|
376
|
+
await scope.reloadAspectsWithNewVersion(allComponentsToTag);
|
|
377
|
+
const harmonyComps = await (workspace || scope).getManyByLegacy(allComponentsToTag);
|
|
378
|
+
const {
|
|
379
|
+
builderDataMap
|
|
380
|
+
} = await builder.tagListener(harmonyComps, onTagOpts, isolateOptions);
|
|
381
|
+
const buildResult = scope.builderDataMapToLegacyOnTagResults(builderDataMap);
|
|
382
|
+
|
|
383
|
+
snapping._updateComponentsByTagResult(allComponentsToTag, buildResult);
|
|
384
|
+
|
|
372
385
|
publishedPackages.push(...snapping._getPublishedPackages(allComponentsToTag));
|
|
373
386
|
addBuildStatus(allComponentsToTag, _constants().BuildStatus.Succeed);
|
|
374
|
-
await (0, _pMapSeries().default)(allComponentsToTag, consumerComponent =>
|
|
387
|
+
await (0, _pMapSeries().default)(allComponentsToTag, consumerComponent => legacyScope.sources.enrichSource(consumerComponent));
|
|
375
388
|
}
|
|
376
389
|
|
|
377
390
|
if (!soft) {
|
|
378
391
|
await removeDeletedComponentsFromBitmap(allComponentsToTag, workspace);
|
|
379
|
-
await
|
|
392
|
+
await legacyScope.objects.persist();
|
|
380
393
|
}
|
|
381
394
|
|
|
382
395
|
return {
|
|
@@ -387,6 +400,10 @@ async function tagModelComponent({
|
|
|
387
400
|
}
|
|
388
401
|
|
|
389
402
|
async function removeDeletedComponentsFromBitmap(comps, workspace) {
|
|
403
|
+
if (!workspace) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
|
|
390
407
|
await Promise.all(comps.map(async comp => {
|
|
391
408
|
if (comp.removed) {
|
|
392
409
|
const compId = await workspace.resolveComponentId(comp.id);
|
|
@@ -395,16 +412,23 @@ async function removeDeletedComponentsFromBitmap(comps, workspace) {
|
|
|
395
412
|
}));
|
|
396
413
|
}
|
|
397
414
|
|
|
398
|
-
async function addComponentsToScope(
|
|
399
|
-
const lane = await
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
415
|
+
async function addComponentsToScope(scope, components, shouldValidateVersion, consumer) {
|
|
416
|
+
const lane = await scope.getCurrentLaneObject();
|
|
417
|
+
|
|
418
|
+
if (consumer) {
|
|
419
|
+
await (0, _pMapSeries().default)(components, async component => {
|
|
420
|
+
await scope.sources.addSource({
|
|
421
|
+
source: component,
|
|
422
|
+
consumer,
|
|
423
|
+
lane,
|
|
424
|
+
shouldValidateVersion
|
|
425
|
+
});
|
|
406
426
|
});
|
|
407
|
-
}
|
|
427
|
+
} else {
|
|
428
|
+
await (0, _pMapSeries().default)(components, async component => {
|
|
429
|
+
await scope.sources.addSourceFromScope(component, lane);
|
|
430
|
+
});
|
|
431
|
+
}
|
|
408
432
|
}
|
|
409
433
|
|
|
410
434
|
function emptyBuilderData(components) {
|