@teambit/snapping 1.0.27 → 1.0.28
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/reset-cmd.d.ts +2 -1
- package/dist/reset-cmd.js +7 -2
- package/dist/reset-cmd.js.map +1 -1
- package/dist/snap-cmd.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +6 -6
- package/dist/snapping.main.runtime.js +42 -35
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/tag-cmd.d.ts +2 -2
- package/dist/tag-cmd.js.map +1 -1
- package/dist/tag-model-component.d.ts +4 -5
- package/dist/tag-model-component.js +12 -12
- package/dist/tag-model-component.js.map +1 -1
- package/package.json +23 -24
- /package/dist/{preview-1697628054879.js → preview-1697836073970.js} +0 -0
package/dist/reset-cmd.d.ts
CHANGED
|
@@ -15,10 +15,11 @@ export default class ResetCmd implements Command {
|
|
|
15
15
|
loader: boolean;
|
|
16
16
|
migration: boolean;
|
|
17
17
|
constructor(snapping: SnappingMain);
|
|
18
|
-
report([pattern]: [string], { all, head, force, soft, }: {
|
|
18
|
+
report([pattern]: [string], { all, head, force, soft, neverExported, }: {
|
|
19
19
|
all?: boolean;
|
|
20
20
|
head?: boolean;
|
|
21
21
|
force?: boolean;
|
|
22
22
|
soft?: boolean;
|
|
23
|
+
neverExported?: boolean;
|
|
23
24
|
}): Promise<string>;
|
|
24
25
|
}
|
package/dist/reset-cmd.js
CHANGED
|
@@ -44,7 +44,7 @@ class ResetCmd {
|
|
|
44
44
|
_defineProperty(this, "group", 'development');
|
|
45
45
|
_defineProperty(this, "extendedDescription", `https://${_constants().BASE_DOCS_DOMAIN}/components/tags#undoing-a-tag`);
|
|
46
46
|
_defineProperty(this, "alias", '');
|
|
47
|
-
_defineProperty(this, "options", [['a', 'all', 'revert all unexported tags/snaps for all components'], ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'], ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'], ['f', 'force', "revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted"]]);
|
|
47
|
+
_defineProperty(this, "options", [['a', 'all', 'revert all unexported tags/snaps for all components'], ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'], ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'], ['f', 'force', "revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted"], ['', 'never-exported', 'reset only components that were never exported']]);
|
|
48
48
|
_defineProperty(this, "loader", true);
|
|
49
49
|
_defineProperty(this, "migration", true);
|
|
50
50
|
}
|
|
@@ -52,8 +52,13 @@ class ResetCmd {
|
|
|
52
52
|
all = false,
|
|
53
53
|
head = false,
|
|
54
54
|
force = false,
|
|
55
|
-
soft = false
|
|
55
|
+
soft = false,
|
|
56
|
+
neverExported = false
|
|
56
57
|
}) {
|
|
58
|
+
if (neverExported) {
|
|
59
|
+
const compIds = await this.snapping.resetNeverExported();
|
|
60
|
+
return _chalk().default.green(`successfully reset the following never-exported components:\n${compIds.join('\n')}`);
|
|
61
|
+
}
|
|
57
62
|
if (!pattern && !all) {
|
|
58
63
|
throw new (_bitError().BitError)('please specify a component-pattern or use --all flag');
|
|
59
64
|
}
|
package/dist/reset-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","_chalk","_interopRequireDefault","_constants","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","ResetCmd","constructor","snapping","name","description","COMPONENT_PATTERN_HELP","BASE_DOCS_DOMAIN","report","pattern","all","head","force","soft","BitError","results","isSoftUntag","reset","titleSuffix","title","
|
|
1
|
+
{"version":3,"names":["_bitError","data","require","_chalk","_interopRequireDefault","_constants","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","ResetCmd","constructor","snapping","name","description","COMPONENT_PATTERN_HELP","BASE_DOCS_DOMAIN","report","pattern","all","head","force","soft","neverExported","compIds","resetNeverExported","chalk","green","join","BitError","results","isSoftUntag","reset","titleSuffix","title","length","components","map","result","cyan","id","toStringWithoutVersion","versions","exports"],"sources":["reset-cmd.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BASE_DOCS_DOMAIN, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { SnappingMain } from './snapping.main.runtime';\n\nexport default class ResetCmd implements Command {\n name = 'reset [component-pattern]';\n description = 'revert tagged or snapped versions for component(s)';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'component-version',\n description: 'the version to untag (semver for tags. hash for snaps)',\n },\n ];\n group = 'development';\n extendedDescription = `https://${BASE_DOCS_DOMAIN}/components/tags#undoing-a-tag`;\n alias = '';\n options = [\n ['a', 'all', 'revert all unexported tags/snaps for all components'],\n ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'],\n ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'],\n [\n 'f',\n 'force',\n \"revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted\",\n ],\n ['', 'never-exported', 'reset only components that were never exported'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain) {}\n\n async report(\n [pattern]: [string],\n {\n all = false,\n head = false,\n force = false,\n soft = false,\n neverExported = false,\n }: { all?: boolean; head?: boolean; force?: boolean; soft?: boolean; neverExported?: boolean }\n ) {\n if (neverExported) {\n const compIds = await this.snapping.resetNeverExported();\n return chalk.green(`successfully reset the following never-exported components:\\n${compIds.join('\\n')}`);\n }\n if (!pattern && !all) {\n throw new BitError('please specify a component-pattern or use --all flag');\n }\n if (pattern && all) {\n throw new BitError('please specify either a component-pattern or --all flag, not both');\n }\n if (soft && head) {\n throw new BitError('please specify either --soft or --head flag, not both');\n }\n const { results, isSoftUntag } = await this.snapping.reset(pattern, head, force, soft);\n const titleSuffix = isSoftUntag ? 'soft-untagged (are not candidates for tagging any more)' : 'untagged';\n const title = chalk.green(`${results.length} component(s) were ${titleSuffix}:\\n`);\n const components = results.map((result) => {\n return `${chalk.cyan(result.id.toStringWithoutVersion())}. version(s): ${result.versions.join(', ')}`;\n });\n return title + components.join('\\n');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0F,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA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|
package/dist/snap-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_constants","_tagCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapCmd","constructor","snapping","logger","globalConfig","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","ignoreBuildErrors","unmodified","failFast","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","length","warningsOutput","snapExplanation","compInBold","version","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","green","outputIdsIfExists","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n NOTHING_TO_SNAP_MSG,\n AUTO_SNAPPED_MSG,\n COMPONENT_PATTERN_HELP,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy/dist/constants';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (non-release version)';\n extendedDescription: string;\n group = 'development';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`,\n },\n ];\n helpUrl = 'reference/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'],\n ['', 'unmerged', 'complete a merge process by snapping the unmerged components'],\n ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the snap'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'skip-auto-snap', 'skip auto snapping dependents'],\n [\n '',\n 'disable-snap-pipeline',\n 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment',\n ],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n [\n 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-snap even if tests are failing and even when component has not changed',\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n all = false,\n force = false,\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n forceDeploy = false,\n ignoreBuildErrors = false,\n unmodified = false,\n failFast = false,\n }: {\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --ignore-build-errors depending on the use case`\n );\n if (pattern) unmodified = true;\n }\n if (!message && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your snap, will be displayed in the version history`\n );\n }\n if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n unmodified,\n exitOnFirstFailedTask: failFast,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n const { snappedComponents, autoSnappedResults, warnings, newComponents, laneName, removedComponents }: SnapResults =\n results;\n const changedComponents = snappedComponents.filter((component) => {\n return (\n !newComponents.searchWithoutVersion(component.id) && !removedComponents?.searchWithoutVersion(component.id)\n );\n });\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const snapExplanation = `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)\\n`;\n\n const compInBold = (id: BitId) => {\n const version = id.hasVersion() ? `@${id.version}` : '';\n return `${chalk.bold(id.toStringWithoutVersion())}${version}`;\n };\n\n const outputComponents = (comps: ConsumerComponent[]) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${compInBold(component.id)}`;\n const autoTag = autoSnappedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => compInBold(a.component.id));\n componentOutput += `\\n ${AUTO_SNAPPED_MSG} (${autoTagComp.length} total):\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n\n return (\n warningsOutput +\n chalk.green(`${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation +\n outputIfExists('new components', 'first version for components', addedComponents) +\n outputIfExists('changed components', 'components that got a version bump', changedComponents) +\n outputIdsIfExists('removed components', removedComponents)\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAA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AM,IAAKA,MAAM,CAACC,WAAW,CAAClB,oBAAoB,CAACD,SAAS,CAACE,EAAE,CAAC,CAAC;QAC5G,IAAIe,OAAO,CAACZ,MAAM,EAAE;UAClB,MAAMe,WAAW,GAAGH,OAAO,CAACF,GAAG,CAAEM,CAAC,IAAKb,UAAU,CAACa,CAAC,CAACrB,SAAS,CAACE,EAAE,CAAC,CAAC;UAClEc,eAAe,IAAK,YAAWM,6BAAiB,KAAIF,WAAW,CAACf,MAAO;AACnF,cAAce,WAAW,CAACxD,IAAI,CAAC,gBAAgB,CAAE,EAAC;QACxC;QACA,OAAOoD,eAAe;MACxB,CAAC,CAAC,CACDpD,IAAI,CAAC,IAAI,CAAC;IACf,CAAC;IAED,MAAM2D,cAAc,GAAGA,CAACC,KAAK,EAAEC,WAAW,EAAEC,UAAU,KAAK;MACzD,IAAI,CAACA,UAAU,CAACrB,MAAM,EAAE,OAAO,EAAE;MACjC,OAAQ,KAAIhB,gBAAK,CAACsC,SAAS,CAACH,KAAK,CAAE,MAAKC,WAAY,MAAKZ,gBAAgB,CAACa,UAAU,CAAE,IAAG;IAC3F,CAAC;IACD,MAAME,OAAO,GAAGhC,QAAQ,GAAI,QAAOA,QAAS,QAAO,GAAG,EAAE;IAExD,OACEU,cAAc,GACdjB,gBAAK,CAACwC,KAAK,CAAE,GAAErC,iBAAiB,CAACa,MAAM,GAAGD,eAAgB,wBAAuBwB,OAAQ,EAAC,CAAC,GAC3FrB,eAAe,GACfgB,cAAc,CAAC,gBAAgB,EAAE,8BAA8B,EAAEpB,eAAe,CAAC,GACjFoB,cAAc,CAAC,oBAAoB,EAAE,oCAAoC,EAAEzB,iBAAiB,CAAC,GAC7F,IAAAgC,2BAAiB,EAAC,oBAAoB,EAAEjC,iBAAiB,CAAC;EAE9D;AACF;AAACkC,OAAA,CAAA7E,OAAA,GAAAA,OAAA"}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_constants","_tagCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapCmd","constructor","snapping","logger","globalConfig","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","ignoreBuildErrors","unmodified","failFast","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","length","warningsOutput","snapExplanation","compInBold","version","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","green","outputIdsIfExists","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n NOTHING_TO_SNAP_MSG,\n AUTO_SNAPPED_MSG,\n COMPONENT_PATTERN_HELP,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy/dist/constants';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (non-release version)';\n extendedDescription: string;\n group = 'development';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`,\n },\n ];\n helpUrl = 'reference/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'],\n ['', 'unmerged', 'complete a merge process by snapping the unmerged components'],\n ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the snap'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'skip-auto-snap', 'skip auto snapping dependents'],\n [\n '',\n 'disable-snap-pipeline',\n 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment',\n ],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n [\n 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-snap even if tests are failing and even when component has not changed',\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n all = false,\n force = false,\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n forceDeploy = false,\n ignoreBuildErrors = false,\n unmodified = false,\n failFast = false,\n }: {\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --ignore-build-errors depending on the use case`\n );\n if (pattern) unmodified = true;\n }\n if (!message && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your snap, will be displayed in the version history`\n );\n }\n if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n unmodified,\n exitOnFirstFailedTask: failFast,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n const { snappedComponents, autoSnappedResults, warnings, newComponents, laneName, removedComponents }: SnapResults =\n results;\n const changedComponents = snappedComponents.filter((component) => {\n return (\n !newComponents.searchWithoutVersion(component.id) && !removedComponents?.searchWithoutVersion(component.id)\n );\n });\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const snapExplanation = `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)\\n`;\n\n const compInBold = (id: ComponentID) => {\n const version = id.hasVersion() ? `@${id.version}` : '';\n return `${chalk.bold(id.toStringWithoutVersion())}${version}`;\n };\n\n const outputComponents = (comps: ConsumerComponent[]) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${compInBold(component.id)}`;\n const autoTag = autoSnappedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => compInBold(a.component.id));\n componentOutput += `\\n ${AUTO_SNAPPED_MSG} (${autoTagComp.length} total):\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n\n return (\n warningsOutput +\n chalk.green(`${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation +\n outputIfExists('new components', 'first version for components', addedComponents) +\n outputIfExists('changed components', 'components that got a version bump', changedComponents) +\n outputIdsIfExists('removed components', removedComponents)\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAA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AMe,WAAW,GAAGH,OAAO,CAACF,GAAG,CAAEM,CAAC,IAAKb,UAAU,CAACa,CAAC,CAACrB,SAAS,CAACE,EAAE,CAAC,CAAC;UAClEc,eAAe,IAAK,YAAWM,6BAAiB,KAAIF,WAAW,CAACf,MAAO;AACnF,cAAce,WAAW,CAACxD,IAAI,CAAC,gBAAgB,CAAE,EAAC;QACxC;QACA,OAAOoD,eAAe;MACxB,CAAC,CAAC,CACDpD,IAAI,CAAC,IAAI,CAAC;IACf,CAAC;IAED,MAAM2D,cAAc,GAAGA,CAACC,KAAK,EAAEC,WAAW,EAAEC,UAAU,KAAK;MACzD,IAAI,CAACA,UAAU,CAACrB,MAAM,EAAE,OAAO,EAAE;MACjC,OAAQ,KAAIhB,gBAAK,CAACsC,SAAS,CAACH,KAAK,CAAE,MAAKC,WAAY,MAAKZ,gBAAgB,CAACa,UAAU,CAAE,IAAG;IAC3F,CAAC;IACD,MAAME,OAAO,GAAGhC,QAAQ,GAAI,QAAOA,QAAS,QAAO,GAAG,EAAE;IAExD,OACEU,cAAc,GACdjB,gBAAK,CAACwC,KAAK,CAAE,GAAErC,iBAAiB,CAACa,MAAM,GAAGD,eAAgB,wBAAuBwB,OAAQ,EAAC,CAAC,GAC3FrB,eAAe,GACfgB,cAAc,CAAC,gBAAgB,EAAE,8BAA8B,EAAEpB,eAAe,CAAC,GACjFoB,cAAc,CAAC,oBAAoB,EAAE,oCAAoC,EAAEzB,iBAAiB,CAAC,GAC7F,IAAAgC,2BAAiB,EAAC,oBAAoB,EAAEjC,iBAAiB,CAAC;EAE9D;AACF;AAACkC,OAAA,CAAA7E,OAAA,GAAAA,OAAA"}
|
|
@@ -2,7 +2,7 @@ import { CLIMain } from '@teambit/cli';
|
|
|
2
2
|
import { LegacyOnTagResult } from '@teambit/legacy/dist/scope/scope';
|
|
3
3
|
import { Workspace } from '@teambit/workspace';
|
|
4
4
|
import { ReleaseType } from 'semver';
|
|
5
|
-
import {
|
|
5
|
+
import { ComponentID, ComponentIdList } from '@teambit/component-id';
|
|
6
6
|
import { Consumer } from '@teambit/legacy/dist/consumer';
|
|
7
7
|
import { Logger, LoggerMain } from '@teambit/logger';
|
|
8
8
|
import ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';
|
|
@@ -16,7 +16,6 @@ import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
|
16
16
|
import { BuilderMain } from '@teambit/builder';
|
|
17
17
|
import { ImporterMain } from '@teambit/importer';
|
|
18
18
|
import { ExportMain } from '@teambit/export';
|
|
19
|
-
import { ComponentID } from '@teambit/component-id';
|
|
20
19
|
import { BitObject } from '@teambit/legacy/dist/scope/objects';
|
|
21
20
|
import { GlobalConfigMain } from '@teambit/global-config';
|
|
22
21
|
import { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag';
|
|
@@ -48,8 +47,8 @@ export declare type TagResults = BasicTagResults & {
|
|
|
48
47
|
};
|
|
49
48
|
export declare type BasicTagResults = {
|
|
50
49
|
warnings: string[];
|
|
51
|
-
newComponents:
|
|
52
|
-
removedComponents?:
|
|
50
|
+
newComponents: ComponentIdList;
|
|
51
|
+
removedComponents?: ComponentIdList;
|
|
53
52
|
};
|
|
54
53
|
export declare class SnappingMain {
|
|
55
54
|
private workspace;
|
|
@@ -100,7 +99,7 @@ export declare class SnappingMain {
|
|
|
100
99
|
snap({ pattern, legacyBitIds, // @todo: change to ComponentID[]. pass only if have the ids already parsed.
|
|
101
100
|
unmerged, editor, message, ignoreIssues, skipTests, skipAutoSnap, build, disableTagAndSnapPipelines, ignoreBuildErrors, unmodified, exitOnFirstFailedTask, }: {
|
|
102
101
|
pattern?: string;
|
|
103
|
-
legacyBitIds?:
|
|
102
|
+
legacyBitIds?: ComponentIdList;
|
|
104
103
|
unmerged?: boolean;
|
|
105
104
|
editor?: string;
|
|
106
105
|
message?: string;
|
|
@@ -121,6 +120,7 @@ export declare class SnappingMain {
|
|
|
121
120
|
results: untagResult[];
|
|
122
121
|
isSoftUntag: boolean;
|
|
123
122
|
}>;
|
|
123
|
+
resetNeverExported(): Promise<ComponentID[]>;
|
|
124
124
|
_addFlattenedDependenciesToComponents(components: ConsumerComponent[]): Promise<void>;
|
|
125
125
|
throwForDepsFromAnotherLane(components: ConsumerComponent[]): Promise<void>;
|
|
126
126
|
private throwForVariousIssues;
|
|
@@ -153,7 +153,7 @@ export declare class SnappingMain {
|
|
|
153
153
|
*/
|
|
154
154
|
getCompIdWithExactVersionAccordingToSemver(compId: ComponentID): Promise<ComponentID>;
|
|
155
155
|
private updateSourceFiles;
|
|
156
|
-
updateDependenciesVersionsOfComponent(component: Component, dependencies: ComponentID[], currentBitIds:
|
|
156
|
+
updateDependenciesVersionsOfComponent(component: Component, dependencies: ComponentID[], currentBitIds: ComponentID[]): Promise<void>;
|
|
157
157
|
private getComponentsToTag;
|
|
158
158
|
static slots: never[];
|
|
159
159
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
@@ -60,9 +60,9 @@ function _analytics() {
|
|
|
60
60
|
};
|
|
61
61
|
return data;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const data = require("@teambit/
|
|
65
|
-
|
|
63
|
+
function _componentId() {
|
|
64
|
+
const data = require("@teambit/component-id");
|
|
65
|
+
_componentId = function () {
|
|
66
66
|
return data;
|
|
67
67
|
};
|
|
68
68
|
return data;
|
|
@@ -401,7 +401,7 @@ class SnappingMain {
|
|
|
401
401
|
warnings
|
|
402
402
|
} = await this.getComponentsToTag(unmodified, exactVersion, persist, ids, snapped, unmerged);
|
|
403
403
|
if (_ramda().default.isEmpty(bitIds)) return null;
|
|
404
|
-
const legacyBitIds =
|
|
404
|
+
const legacyBitIds = _componentId().ComponentIdList.fromArray(bitIds);
|
|
405
405
|
this.logger.debug(`tagging the following components: ${legacyBitIds.toString()}`);
|
|
406
406
|
const components = await this.loadComponentsForTagOrSnap(legacyBitIds, !soft);
|
|
407
407
|
const consumerComponents = components.map(c => c.state._consumer);
|
|
@@ -502,7 +502,6 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
502
502
|
await Promise.all(tagDataPerComp.map(async tagData => {
|
|
503
503
|
tagData.dependencies = tagData.dependencies ? await Promise.all(tagData.dependencies.map(d => this.getCompIdWithExactVersionAccordingToSemver(d))) : [];
|
|
504
504
|
}));
|
|
505
|
-
const bitIds = componentIds.map(c => c._legacy);
|
|
506
505
|
const components = await this.scope.getMany(componentIds);
|
|
507
506
|
await Promise.all(components.map(async comp => {
|
|
508
507
|
const tagData = tagDataPerComp.find(t => t.componentId.isEqual(comp.id, {
|
|
@@ -510,7 +509,7 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
510
509
|
}));
|
|
511
510
|
if (!tagData) throw new Error(`unable to find ${comp.id.toString()} in tagDataPerComp`);
|
|
512
511
|
if (!tagData.dependencies.length) return;
|
|
513
|
-
await this.updateDependenciesVersionsOfComponent(comp, tagData.dependencies,
|
|
512
|
+
await this.updateDependenciesVersionsOfComponent(comp, tagData.dependencies, componentIds);
|
|
514
513
|
}));
|
|
515
514
|
await this.scope.loadManyCompsAspects(components);
|
|
516
515
|
const consumerComponents = components.map(c => c.state._consumer);
|
|
@@ -518,7 +517,7 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
518
517
|
if (!comp.buildStatus) throw new Error(`tag-from-scope expect ${comp.id.toString()} to have buildStatus`);
|
|
519
518
|
return comp.buildStatus === _constants().BuildStatus.Succeed;
|
|
520
519
|
});
|
|
521
|
-
const legacyIds =
|
|
520
|
+
const legacyIds = _componentId().ComponentIdList.fromArray(componentIds.map(id => id));
|
|
522
521
|
const results = await (0, _tagModelComponent().tagModelComponent)(_objectSpread(_objectSpread({}, params), {}, {
|
|
523
522
|
scope: this.scope,
|
|
524
523
|
consumerComponents,
|
|
@@ -552,7 +551,7 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
552
551
|
isSoftTag: false,
|
|
553
552
|
publishedPackages,
|
|
554
553
|
warnings: [],
|
|
555
|
-
newComponents: new (
|
|
554
|
+
newComponents: new (_componentId().ComponentIdList)()
|
|
556
555
|
};
|
|
557
556
|
}
|
|
558
557
|
async snapFromScope(snapDataPerCompRaw, params) {
|
|
@@ -569,7 +568,6 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
569
568
|
};
|
|
570
569
|
}));
|
|
571
570
|
const componentIds = snapDataPerComp.map(t => t.componentId);
|
|
572
|
-
const bitIds = componentIds.map(c => c._legacy);
|
|
573
571
|
const componentIdsLatest = componentIds.map(id => id.changeVersion(_constants().LATEST));
|
|
574
572
|
let lane;
|
|
575
573
|
const laneIdStr = params.lane;
|
|
@@ -597,14 +595,14 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
597
595
|
if (!snapData) throw new Error(`unable to find ${comp.id.toString()} in snapDataPerComp`);
|
|
598
596
|
if (snapData.aspects) await this.scope.addAspectsFromConfigObject(comp, snapData.aspects);
|
|
599
597
|
if (snapData.dependencies.length) {
|
|
600
|
-
await this.updateDependenciesVersionsOfComponent(comp, snapData.dependencies,
|
|
598
|
+
await this.updateDependenciesVersionsOfComponent(comp, snapData.dependencies, componentIds);
|
|
601
599
|
}
|
|
602
600
|
if ((_snapData$files = snapData.files) !== null && _snapData$files !== void 0 && _snapData$files.length) {
|
|
603
601
|
await this.updateSourceFiles(comp, snapData.files);
|
|
604
602
|
}
|
|
605
603
|
}));
|
|
606
604
|
const consumerComponents = components.map(c => c.state._consumer);
|
|
607
|
-
const legacyIds =
|
|
605
|
+
const legacyIds = _componentId().ComponentIdList.fromArray(componentIds.map(id => id));
|
|
608
606
|
const results = await (0, _tagModelComponent().tagModelComponent)(_objectSpread(_objectSpread({}, params), {}, {
|
|
609
607
|
scope: this.scope,
|
|
610
608
|
consumerComponents,
|
|
@@ -743,7 +741,7 @@ there are matching among unmodified components thought. consider using --unmodif
|
|
|
743
741
|
if (!componentIds.length) {
|
|
744
742
|
return null;
|
|
745
743
|
}
|
|
746
|
-
return
|
|
744
|
+
return _componentId().ComponentIdList.fromArray(componentIds);
|
|
747
745
|
}
|
|
748
746
|
}
|
|
749
747
|
|
|
@@ -761,25 +759,24 @@ there are matching among unmodified components thought. consider using --unmodif
|
|
|
761
759
|
}
|
|
762
760
|
const candidateComponents = await (0, _untagComponent().getComponentsWithOptionToUntag)(consumer);
|
|
763
761
|
const idsMatchingPattern = await this.workspace.idsByPattern(componentPattern);
|
|
764
|
-
const idsMatchingPatternBitIds =
|
|
765
|
-
const componentsToUntag = candidateComponents.filter(modelComponent => idsMatchingPatternBitIds.hasWithoutVersion(modelComponent.
|
|
762
|
+
const idsMatchingPatternBitIds = _componentId().ComponentIdList.fromArray(idsMatchingPattern.map(id => id));
|
|
763
|
+
const componentsToUntag = candidateComponents.filter(modelComponent => idsMatchingPatternBitIds.hasWithoutVersion(modelComponent.toComponentId()));
|
|
766
764
|
return (0, _untagComponent().removeLocalVersionsForMultipleComponents)(componentsToUntag, currentLane, head, force, consumer.scope);
|
|
767
765
|
};
|
|
768
766
|
const softUntag = async () => {
|
|
769
767
|
const componentsList = new (_componentsList().default)(consumer);
|
|
770
|
-
const
|
|
771
|
-
const softTaggedComponentsIds = await this.workspace.resolveMultipleComponentIds(softTaggedComponents);
|
|
768
|
+
const softTaggedComponentsIds = componentsList.listSoftTaggedComponents();
|
|
772
769
|
const idsToRemoveSoftTags = componentPattern ? this.workspace.scope.filterIdsFromPoolIdsByPattern(componentPattern, softTaggedComponentsIds) : softTaggedComponentsIds;
|
|
773
770
|
return (0, _lodash().compact)(idsToRemoveSoftTags.map(componentId => {
|
|
774
771
|
var _componentMap$nextVer;
|
|
775
|
-
const componentMap = consumer.bitMap.getComponent(componentId
|
|
772
|
+
const componentMap = consumer.bitMap.getComponent(componentId, {
|
|
776
773
|
ignoreVersion: true
|
|
777
774
|
});
|
|
778
775
|
const removedVersion = (_componentMap$nextVer = componentMap.nextVersion) === null || _componentMap$nextVer === void 0 ? void 0 : _componentMap$nextVer.version;
|
|
779
776
|
if (!removedVersion) return null;
|
|
780
777
|
componentMap.clearNextVersion();
|
|
781
778
|
return {
|
|
782
|
-
id: componentId
|
|
779
|
+
id: componentId,
|
|
783
780
|
versions: [removedVersion]
|
|
784
781
|
};
|
|
785
782
|
}));
|
|
@@ -801,6 +798,14 @@ there are matching among unmodified components thought. consider using --unmodif
|
|
|
801
798
|
isSoftUntag: !isRealUntag
|
|
802
799
|
};
|
|
803
800
|
}
|
|
801
|
+
async resetNeverExported() {
|
|
802
|
+
const notExported = this.workspace.consumer.getNotExportedIds();
|
|
803
|
+
const hashes = notExported.map(id => _objects().BitObject.makeHash(id.fullName));
|
|
804
|
+
await this.scope.legacyScope.objects.deleteObjectsFromFS(hashes.map(h => _objects().Ref.from(h)));
|
|
805
|
+
notExported.map(id => this.workspace.consumer.bitMap.updateComponentId(id.changeVersion(undefined)));
|
|
806
|
+
await this.workspace.bitMap.write();
|
|
807
|
+
return notExported;
|
|
808
|
+
}
|
|
804
809
|
async _addFlattenedDependenciesToComponents(components) {
|
|
805
810
|
_loader().default.start('importing missing dependencies...');
|
|
806
811
|
const getLane = async () => {
|
|
@@ -819,11 +824,11 @@ there are matching among unmodified components thought. consider using --unmodif
|
|
|
819
824
|
}
|
|
820
825
|
async throwForDepsFromAnotherLane(components) {
|
|
821
826
|
const lane = await this.scope.legacyScope.getCurrentLaneObject();
|
|
822
|
-
const allIds =
|
|
827
|
+
const allIds = _componentId().ComponentIdList.fromArray(components.map(c => c.id));
|
|
823
828
|
const missingDeps = await (0, _pMapSeries().default)(components, async component => {
|
|
824
829
|
return this.throwForDepsFromAnotherLaneForComp(component, allIds, lane || undefined);
|
|
825
830
|
});
|
|
826
|
-
const flattenedMissingDeps =
|
|
831
|
+
const flattenedMissingDeps = _componentId().ComponentIdList.uniqFromArray(missingDeps.flat().map(id => id.changeVersion(undefined)));
|
|
827
832
|
if (!flattenedMissingDeps.length) return;
|
|
828
833
|
// ignore the cache. even if the component exists locally, we still need its VersionHistory object
|
|
829
834
|
// in order to traverse the history and determine whether it's part of the lane history.
|
|
@@ -849,7 +854,7 @@ there are matching among unmodified components thought. consider using --unmodif
|
|
|
849
854
|
const deps = component.getAllDependencies();
|
|
850
855
|
const missingDeps = [];
|
|
851
856
|
await Promise.all(deps.map(async dep => {
|
|
852
|
-
if (!dep.id
|
|
857
|
+
if (!this.scope.isExported(dep.id) || !dep.id.hasVersion()) return;
|
|
853
858
|
if ((0, _componentVersion().isTag)(dep.id.version)) return;
|
|
854
859
|
if (allIds.hasWithoutVersion(dep.id)) return; // it's tagged/snapped now.
|
|
855
860
|
let isPartOfHistory;
|
|
@@ -887,15 +892,15 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
887
892
|
addEdges(comp.id, comp.extensionDependencies, 'ext');
|
|
888
893
|
});
|
|
889
894
|
const allFlattened = components.map(comp => comp.flattenedDependencies);
|
|
890
|
-
const allFlattenedUniq =
|
|
895
|
+
const allFlattenedUniq = _componentId().ComponentIdList.uniqFromArray(allFlattened.flat());
|
|
891
896
|
const allFlattenedWithoutCurrent = allFlattenedUniq.filter(id => !components.find(c => c.id.isEqual(id)));
|
|
892
|
-
const componentsAndVersions = await this.scope.legacyScope.getComponentsAndVersions(
|
|
897
|
+
const componentsAndVersions = await this.scope.legacyScope.getComponentsAndVersions(_componentId().ComponentIdList.fromArray(allFlattenedWithoutCurrent));
|
|
893
898
|
componentsAndVersions.forEach(({
|
|
894
899
|
component,
|
|
895
900
|
version,
|
|
896
901
|
versionStr
|
|
897
902
|
}) => {
|
|
898
|
-
const compId = component.
|
|
903
|
+
const compId = component.toComponentId().changeVersion(versionStr);
|
|
899
904
|
graph.setNode(new (_graph().Node)(compId.toString(), compId));
|
|
900
905
|
addEdges(compId, version.dependencies, 'prod');
|
|
901
906
|
addEdges(compId, version.devDependencies, 'dev');
|
|
@@ -1001,6 +1006,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1001
1006
|
async _addCompFromScopeToObjects(source, lane) {
|
|
1002
1007
|
const objectRepo = this.objectsRepo;
|
|
1003
1008
|
// if a component exists in the model, add a new version. Otherwise, create a new component on the model
|
|
1009
|
+
// @todo: fix the ts error here with "source"
|
|
1004
1010
|
const component = await this.scope.legacyScope.sources.findOrAddComponent(source);
|
|
1005
1011
|
const artifactFiles = (0, _artifactFiles().getArtifactsFiles)(source.extensions);
|
|
1006
1012
|
const artifacts = this.transformArtifactsFromVinylToSource(artifactFiles);
|
|
@@ -1038,7 +1044,9 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1038
1044
|
return consumerComponent;
|
|
1039
1045
|
}
|
|
1040
1046
|
async _getObjectsToEnrichComp(consumerComponent, modifiedLog) {
|
|
1041
|
-
const component = consumerComponent.modelComponent || (
|
|
1047
|
+
const component = consumerComponent.modelComponent || (
|
|
1048
|
+
// @todo: fix the ts error here with "source"
|
|
1049
|
+
await this.scope.legacyScope.sources.findOrAddComponent(consumerComponent));
|
|
1042
1050
|
const version = await component.loadVersion(consumerComponent.id.version, this.objectsRepo, true, true);
|
|
1043
1051
|
if (modifiedLog) version.addModifiedLog(modifiedLog);
|
|
1044
1052
|
const artifactFiles = (0, _artifactFiles().getArtifactsFiles)(consumerComponent.extensions);
|
|
@@ -1090,7 +1098,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1090
1098
|
}
|
|
1091
1099
|
}
|
|
1092
1100
|
throwForPendingImport(components) {
|
|
1093
|
-
const componentsMissingFromScope = components.filter(c => !c.componentFromModel && c.id
|
|
1101
|
+
const componentsMissingFromScope = components.filter(c => !c.componentFromModel && this.scope.isExported(c.id)).map(c => c.id.toString());
|
|
1094
1102
|
if (componentsMissingFromScope.length) {
|
|
1095
1103
|
throw new (_componentsPendingImport().default)(componentsMissingFromScope);
|
|
1096
1104
|
}
|
|
@@ -1157,8 +1165,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1157
1165
|
if (!currentFiles.length) throw new Error(`unable to update component ${component.id.toString()}, all files were deleted`);
|
|
1158
1166
|
}
|
|
1159
1167
|
async updateDependenciesVersionsOfComponent(component, dependencies, currentBitIds) {
|
|
1160
|
-
const
|
|
1161
|
-
const updatedIds = _bitId().BitIds.fromArray([...currentBitIds, ...depsBitIds]);
|
|
1168
|
+
const updatedIds = _componentId().ComponentIdList.fromArray([...currentBitIds, ...dependencies]);
|
|
1162
1169
|
const componentIdStr = component.id.toString();
|
|
1163
1170
|
const legacyComponent = component.state._consumer;
|
|
1164
1171
|
const deps = [...legacyComponent.dependencies.get(), ...legacyComponent.devDependencies.get()];
|
|
@@ -1178,10 +1185,10 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1178
1185
|
}
|
|
1179
1186
|
});
|
|
1180
1187
|
legacyComponent.extensions.forEach(ext => {
|
|
1181
|
-
if (!ext.
|
|
1182
|
-
const updatedBitId = updatedIds.searchWithoutVersion(ext.
|
|
1188
|
+
if (!ext.newExtensionId) return;
|
|
1189
|
+
const updatedBitId = updatedIds.searchWithoutVersion(ext.newExtensionId);
|
|
1183
1190
|
if (updatedBitId) {
|
|
1184
|
-
this.logger.debug(`updating "${componentIdStr}", extension ${ext.
|
|
1191
|
+
this.logger.debug(`updating "${componentIdStr}", extension ${ext.newExtensionId.toString()} to version ${updatedBitId.version}}`);
|
|
1185
1192
|
ext.extensionId = updatedBitId;
|
|
1186
1193
|
}
|
|
1187
1194
|
});
|
|
@@ -1212,7 +1219,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1212
1219
|
}
|
|
1213
1220
|
const tagPendingComponentsIds = includeUnmodified ? await this.workspace.listPotentialTagIds() : await this.workspace.listTagPendingIds();
|
|
1214
1221
|
const snappedComponents = await componentsList.listSnappedComponentsOnMain();
|
|
1215
|
-
const snappedComponentsIds = snappedComponents.map(c => c.
|
|
1222
|
+
const snappedComponentsIds = snappedComponents.map(c => c.toComponentId());
|
|
1216
1223
|
if (ids.length) {
|
|
1217
1224
|
const componentIds = await (0, _pMapSeries().default)(ids, async id => {
|
|
1218
1225
|
const [idWithoutVer, version] = id.split('@');
|
|
@@ -1223,13 +1230,13 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1223
1230
|
}
|
|
1224
1231
|
const componentId = await this.workspace.resolveComponentId(idWithoutVer);
|
|
1225
1232
|
if (!includeUnmodified) {
|
|
1226
|
-
const componentStatus = await this.workspace.consumer.getComponentStatusById(componentId
|
|
1233
|
+
const componentStatus = await this.workspace.consumer.getComponentStatusById(componentId);
|
|
1227
1234
|
if (componentStatus.modified === false) return null;
|
|
1228
1235
|
}
|
|
1229
1236
|
return componentId.changeVersion(version);
|
|
1230
1237
|
});
|
|
1231
1238
|
return {
|
|
1232
|
-
bitIds: (0, _lodash().compact)(componentIds.flat())
|
|
1239
|
+
bitIds: (0, _lodash().compact)(componentIds.flat()),
|
|
1233
1240
|
warnings
|
|
1234
1241
|
};
|
|
1235
1242
|
}
|
|
@@ -1245,7 +1252,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1245
1252
|
warnings
|
|
1246
1253
|
};
|
|
1247
1254
|
}
|
|
1248
|
-
const tagPendingBitIds = tagPendingComponentsIds.map(id => id
|
|
1255
|
+
const tagPendingBitIds = tagPendingComponentsIds.map(id => id);
|
|
1249
1256
|
const tagPendingBitIdsIncludeSnapped = [...tagPendingBitIds, ...snappedComponentsIds];
|
|
1250
1257
|
if (includeUnmodified && exactVersion) {
|
|
1251
1258
|
const tagPendingComponentsLatest = await this.workspace.scope.legacyScope.latestVersions(tagPendingBitIds, false);
|