@teambit/component-compare 1.0.1054 → 1.0.1056
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/diff-cmd.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare class DiffCmd implements Command {
|
|
|
29
29
|
description: string;
|
|
30
30
|
}[];
|
|
31
31
|
loader: boolean;
|
|
32
|
+
pager: boolean;
|
|
32
33
|
constructor(componentCompareMain: ComponentCompareMain);
|
|
33
34
|
report([pattern, version, toVersion]: [string, string, string], flags: DiffFlags): Promise<string>;
|
|
34
35
|
json([pattern, version, toVersion]: [string, string, string], flags: DiffFlags): Promise<{
|
package/dist/diff-cmd.js
CHANGED
|
@@ -95,6 +95,7 @@ if both "version" and "to-version" are provided, compare those two versions dire
|
|
|
95
95
|
description: 'return the diff result as json for programmatic consumption'
|
|
96
96
|
}]);
|
|
97
97
|
_defineProperty(this, "loader", true);
|
|
98
|
+
_defineProperty(this, "pager", true);
|
|
98
99
|
}
|
|
99
100
|
async report([pattern, version, toVersion], flags) {
|
|
100
101
|
const outputOpts = this.parseOutputOpts(flags);
|
package/dist/diff-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_bitError","_legacy","_legacy2","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DiffCmd","constructor","componentCompareMain","name","description","COMPONENT_PATTERN_HELP","cmd","report","pattern","version","toVersion","flags","outputOpts","parseOutputOpts","diffResults","runDiff","chalk","yellow","outputDiffResultsFormatted","json","filtered","filterDiffResults","map","result","id","toStringWithoutVersion","hasDiff","filesDiff","fd","status","diffOutput","projectFileDiffForJson","fieldsDiff","opts","filePath","stat","countDiffLines","nameOnly","verbose","table","parent","diffByCLIValues","file","filesOnly","configsOnly","files","split","f","trim","Boolean","undefined","BitError","exports"],"sources":["diff-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { DiffOutputOptions, DiffResults, FileDiff } from '@teambit/legacy.component-diff';\nimport { countDiffLines, filterDiffResults, outputDiffResultsFormatted } from '@teambit/legacy.component-diff';\nimport type { ComponentCompareMain } from './component-compare.main.runtime';\n\ntype DiffFlags = {\n verbose?: boolean;\n table?: boolean;\n parent?: boolean;\n file?: string;\n filesOnly?: boolean;\n configsOnly?: boolean;\n nameOnly?: boolean;\n stat?: boolean;\n json?: boolean;\n};\n\nexport class DiffCmd implements Command {\n name = 'diff [component-pattern] [version] [to-version]';\n group = 'info-analysis';\n description = 'compare component changes between versions or against the current workspace';\n extendedDescription = `shows a detailed diff of component files, dependencies, and configuration changes.\nby default, compares workspace changes against the latest version. specify versions to compare historical changes.\nsupports pattern matching to filter components and various output formats for better readability.\nfor ai-agent workflows, use --name-only to list what changed, --file to drill into a specific file,\n--files-only / --configs-only to focus on one diff category, or --json for machine-readable output.`;\n helpUrl = 'docs/components/merging-changes#compare-component-snaps';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'version',\n description: `the base version to compare from. if omitted, compares the workspace's current files to the component's latest version.`,\n },\n {\n name: 'to-version',\n description: `the target version to compare against \"version\".\nif both \"version\" and \"to-version\" are provided, compare those two versions directly (ignoring the workspace).`,\n },\n ];\n alias = '';\n options = [\n ['p', 'parent', 'compare the specified \"version\" to its immediate parent instead of comparing to the current one'],\n ['v', 'verbose', 'show a more verbose output where possible'],\n ['t', 'table', 'show tables instead of plain text for dependencies diff'],\n [\n '',\n 'file <paths>',\n 'show only file diffs for the given component-relative path(s). comma-separated. implies --files-only',\n ],\n ['', 'files-only', 'show only file-content diffs; omit dependency, env, and aspect-config changes'],\n ['', 'configs-only', 'show only dependency, env, and aspect-config changes; omit file-content diffs'],\n ['', 'name-only', 'summary: list changed files with status (M/A/D) and changed field categories; no diff bodies'],\n ['', 'stat', 'summary: like --name-only but includes +N -M line counts per file'],\n ['j', 'json', 'return the diff result as json'],\n ] as CommandOptions;\n examples = [\n { cmd: 'diff', description: 'show diff for all modified components' },\n { cmd: 'diff foo', description: 'show diff for a component \"foo\"' },\n { cmd: 'diff foo 0.0.1', description: 'show diff for a component \"foo\" from the current state to version 0.0.1' },\n { cmd: 'diff foo 0.0.1 0.0.2', description: 'show diff for a component \"foo\" from version 0.0.1 to version 0.0.2' },\n {\n cmd: \"diff '$codeModified' \",\n description: 'show diff only for components with modified files. ignore config changes',\n },\n {\n cmd: 'diff foo 0.0.2 --parent',\n description: 'compare \"foo@0.0.2\" to its parent version. showing what changed in 0.0.2',\n },\n { cmd: 'diff foo --name-only', description: 'list changed files and field categories without diff bodies' },\n { cmd: 'diff foo --file src/index.ts', description: 'show the diff of a single file in a component' },\n { cmd: 'diff foo --files-only', description: 'show only source-code diffs, skip dependency/config changes' },\n { cmd: 'diff foo --json', description: 'return the diff result as json for programmatic consumption' },\n ];\n loader = true;\n\n constructor(private componentCompareMain: ComponentCompareMain) {}\n\n async report([pattern, version, toVersion]: [string, string, string], flags: DiffFlags) {\n const outputOpts = this.parseOutputOpts(flags);\n const diffResults = await this.runDiff([pattern, version, toVersion], flags);\n if (!diffResults.length) {\n return chalk.yellow('there are no modified components to diff');\n }\n return outputDiffResultsFormatted(diffResults, outputOpts);\n }\n\n async json([pattern, version, toVersion]: [string, string, string], flags: DiffFlags) {\n const outputOpts = this.parseOutputOpts(flags);\n const diffResults = await this.runDiff([pattern, version, toVersion], flags);\n const filtered = filterDiffResults(diffResults, outputOpts);\n return filtered.map((result) => ({\n id: result.id.toStringWithoutVersion(),\n hasDiff: result.hasDiff,\n filesDiff: result.filesDiff\n ?.filter((fd) => fd.status !== 'UNCHANGED' && fd.diffOutput)\n .map((fd) => this.projectFileDiffForJson(fd, outputOpts)),\n fieldsDiff: result.fieldsDiff,\n }));\n }\n\n private projectFileDiffForJson(fd: FileDiff, opts: DiffOutputOptions) {\n const { filePath, status } = fd;\n if (opts.stat) {\n return { filePath, status, ...countDiffLines(fd.diffOutput) };\n }\n if (opts.nameOnly) {\n return { filePath, status };\n }\n return { filePath, status, diffOutput: fd.diffOutput };\n }\n\n private async runDiff(\n [pattern, version, toVersion]: [string, string, string],\n { verbose = false, table = false, parent }: DiffFlags\n ): Promise<DiffResults[]> {\n return this.componentCompareMain.diffByCLIValues(pattern, version, toVersion, {\n verbose,\n table,\n parent,\n });\n }\n\n private parseOutputOpts(flags: DiffFlags): DiffOutputOptions {\n const { file, filesOnly, configsOnly, nameOnly, stat } = flags;\n const files = file\n ? file\n .split(',')\n .map((f) => f.trim())\n .filter(Boolean)\n : undefined;\n\n if (filesOnly && configsOnly) {\n throw new BitError('--files-only and --configs-only are mutually exclusive');\n }\n if (configsOnly && files && files.length) {\n throw new BitError('--file and --configs-only are mutually exclusive');\n }\n if (nameOnly && stat) {\n throw new BitError('--name-only and --stat are mutually exclusive');\n }\n\n return {\n filesOnly: filesOnly || Boolean(files && files.length),\n configsOnly,\n files,\n nameOnly,\n stat,\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;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAA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,EAAE;MACxC,MAAM,KAAIqE,oBAAQ,EAAC,kDAAkD,CAAC;IACxE;IACA,IAAId,QAAQ,IAAIF,IAAI,EAAE;MACpB,MAAM,KAAIgB,oBAAQ,EAAC,+CAA+C,CAAC;IACrE;IAEA,OAAO;MACLR,SAAS,EAAEA,SAAS,IAAIM,OAAO,CAACJ,KAAK,IAAIA,KAAK,CAAC/D,MAAM,CAAC;MACtD8D,WAAW;MACXC,KAAK;MACLR,QAAQ;MACRF;IACF,CAAC;EACH;AACF;AAACiB,OAAA,CAAApD,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_bitError","_legacy","_legacy2","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DiffCmd","constructor","componentCompareMain","name","description","COMPONENT_PATTERN_HELP","cmd","report","pattern","version","toVersion","flags","outputOpts","parseOutputOpts","diffResults","runDiff","chalk","yellow","outputDiffResultsFormatted","json","filtered","filterDiffResults","map","result","id","toStringWithoutVersion","hasDiff","filesDiff","fd","status","diffOutput","projectFileDiffForJson","fieldsDiff","opts","filePath","stat","countDiffLines","nameOnly","verbose","table","parent","diffByCLIValues","file","filesOnly","configsOnly","files","split","f","trim","Boolean","undefined","BitError","exports"],"sources":["diff-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { DiffOutputOptions, DiffResults, FileDiff } from '@teambit/legacy.component-diff';\nimport { countDiffLines, filterDiffResults, outputDiffResultsFormatted } from '@teambit/legacy.component-diff';\nimport type { ComponentCompareMain } from './component-compare.main.runtime';\n\ntype DiffFlags = {\n verbose?: boolean;\n table?: boolean;\n parent?: boolean;\n file?: string;\n filesOnly?: boolean;\n configsOnly?: boolean;\n nameOnly?: boolean;\n stat?: boolean;\n json?: boolean;\n};\n\nexport class DiffCmd implements Command {\n name = 'diff [component-pattern] [version] [to-version]';\n group = 'info-analysis';\n description = 'compare component changes between versions or against the current workspace';\n extendedDescription = `shows a detailed diff of component files, dependencies, and configuration changes.\nby default, compares workspace changes against the latest version. specify versions to compare historical changes.\nsupports pattern matching to filter components and various output formats for better readability.\nfor ai-agent workflows, use --name-only to list what changed, --file to drill into a specific file,\n--files-only / --configs-only to focus on one diff category, or --json for machine-readable output.`;\n helpUrl = 'docs/components/merging-changes#compare-component-snaps';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'version',\n description: `the base version to compare from. if omitted, compares the workspace's current files to the component's latest version.`,\n },\n {\n name: 'to-version',\n description: `the target version to compare against \"version\".\nif both \"version\" and \"to-version\" are provided, compare those two versions directly (ignoring the workspace).`,\n },\n ];\n alias = '';\n options = [\n ['p', 'parent', 'compare the specified \"version\" to its immediate parent instead of comparing to the current one'],\n ['v', 'verbose', 'show a more verbose output where possible'],\n ['t', 'table', 'show tables instead of plain text for dependencies diff'],\n [\n '',\n 'file <paths>',\n 'show only file diffs for the given component-relative path(s). comma-separated. implies --files-only',\n ],\n ['', 'files-only', 'show only file-content diffs; omit dependency, env, and aspect-config changes'],\n ['', 'configs-only', 'show only dependency, env, and aspect-config changes; omit file-content diffs'],\n ['', 'name-only', 'summary: list changed files with status (M/A/D) and changed field categories; no diff bodies'],\n ['', 'stat', 'summary: like --name-only but includes +N -M line counts per file'],\n ['j', 'json', 'return the diff result as json'],\n ] as CommandOptions;\n examples = [\n { cmd: 'diff', description: 'show diff for all modified components' },\n { cmd: 'diff foo', description: 'show diff for a component \"foo\"' },\n { cmd: 'diff foo 0.0.1', description: 'show diff for a component \"foo\" from the current state to version 0.0.1' },\n { cmd: 'diff foo 0.0.1 0.0.2', description: 'show diff for a component \"foo\" from version 0.0.1 to version 0.0.2' },\n {\n cmd: \"diff '$codeModified' \",\n description: 'show diff only for components with modified files. ignore config changes',\n },\n {\n cmd: 'diff foo 0.0.2 --parent',\n description: 'compare \"foo@0.0.2\" to its parent version. showing what changed in 0.0.2',\n },\n { cmd: 'diff foo --name-only', description: 'list changed files and field categories without diff bodies' },\n { cmd: 'diff foo --file src/index.ts', description: 'show the diff of a single file in a component' },\n { cmd: 'diff foo --files-only', description: 'show only source-code diffs, skip dependency/config changes' },\n { cmd: 'diff foo --json', description: 'return the diff result as json for programmatic consumption' },\n ];\n loader = true;\n pager = true;\n\n constructor(private componentCompareMain: ComponentCompareMain) {}\n\n async report([pattern, version, toVersion]: [string, string, string], flags: DiffFlags) {\n const outputOpts = this.parseOutputOpts(flags);\n const diffResults = await this.runDiff([pattern, version, toVersion], flags);\n if (!diffResults.length) {\n return chalk.yellow('there are no modified components to diff');\n }\n return outputDiffResultsFormatted(diffResults, outputOpts);\n }\n\n async json([pattern, version, toVersion]: [string, string, string], flags: DiffFlags) {\n const outputOpts = this.parseOutputOpts(flags);\n const diffResults = await this.runDiff([pattern, version, toVersion], flags);\n const filtered = filterDiffResults(diffResults, outputOpts);\n return filtered.map((result) => ({\n id: result.id.toStringWithoutVersion(),\n hasDiff: result.hasDiff,\n filesDiff: result.filesDiff\n ?.filter((fd) => fd.status !== 'UNCHANGED' && fd.diffOutput)\n .map((fd) => this.projectFileDiffForJson(fd, outputOpts)),\n fieldsDiff: result.fieldsDiff,\n }));\n }\n\n private projectFileDiffForJson(fd: FileDiff, opts: DiffOutputOptions) {\n const { filePath, status } = fd;\n if (opts.stat) {\n return { filePath, status, ...countDiffLines(fd.diffOutput) };\n }\n if (opts.nameOnly) {\n return { filePath, status };\n }\n return { filePath, status, diffOutput: fd.diffOutput };\n }\n\n private async runDiff(\n [pattern, version, toVersion]: [string, string, string],\n { verbose = false, table = false, parent }: DiffFlags\n ): Promise<DiffResults[]> {\n return this.componentCompareMain.diffByCLIValues(pattern, version, toVersion, {\n verbose,\n table,\n parent,\n });\n }\n\n private parseOutputOpts(flags: DiffFlags): DiffOutputOptions {\n const { file, filesOnly, configsOnly, nameOnly, stat } = flags;\n const files = file\n ? file\n .split(',')\n .map((f) => f.trim())\n .filter(Boolean)\n : undefined;\n\n if (filesOnly && configsOnly) {\n throw new BitError('--files-only and --configs-only are mutually exclusive');\n }\n if (configsOnly && files && files.length) {\n throw new BitError('--file and --configs-only are mutually exclusive');\n }\n if (nameOnly && stat) {\n throw new BitError('--name-only and --stat are mutually exclusive');\n }\n\n return {\n filesOnly: filesOnly || Boolean(files && files.length),\n configsOnly,\n files,\n nameOnly,\n stat,\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;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+G,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,M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AAAA,OAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component-compare@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component-compare@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component-compare@1.0.1056/dist/component-compare.compositions.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component-compare@1.0.1056/dist/component-compare.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component-compare",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1056",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/component-compare",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component-compare",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1056"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
@@ -18,27 +18,27 @@
|
|
|
18
18
|
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.502",
|
|
19
19
|
"@teambit/harmony": "0.4.12",
|
|
20
20
|
"@teambit/bit-error": "0.0.404",
|
|
21
|
-
"@teambit/cli": "0.0.1350",
|
|
22
21
|
"@teambit/component-id": "1.2.4",
|
|
23
22
|
"@teambit/legacy.component-diff": "0.0.192",
|
|
24
23
|
"@teambit/legacy.consumer-component": "0.0.137",
|
|
25
|
-
"@teambit/logger": "0.0.1443",
|
|
26
24
|
"@teambit/component.ui.component-compare.changelog": "0.0.244",
|
|
27
25
|
"@teambit/component.ui.component-compare.compare-aspects.compare-aspects": "0.0.155",
|
|
28
26
|
"@teambit/component.ui.component-compare.component-compare": "0.0.268",
|
|
29
27
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.527",
|
|
30
28
|
"@teambit/legacy.constants": "0.0.34",
|
|
31
|
-
"@teambit/component": "1.0.
|
|
32
|
-
"@teambit/graphql": "1.0.
|
|
33
|
-
"@teambit/builder": "1.0.
|
|
34
|
-
"@teambit/
|
|
35
|
-
"@teambit/
|
|
36
|
-
"@teambit/
|
|
37
|
-
"@teambit/
|
|
38
|
-
"@teambit/
|
|
39
|
-
"@teambit/
|
|
40
|
-
"@teambit/
|
|
41
|
-
"@teambit/
|
|
29
|
+
"@teambit/component": "1.0.1056",
|
|
30
|
+
"@teambit/graphql": "1.0.1056",
|
|
31
|
+
"@teambit/builder": "1.0.1056",
|
|
32
|
+
"@teambit/cli": "0.0.1351",
|
|
33
|
+
"@teambit/dependency-resolver": "1.0.1056",
|
|
34
|
+
"@teambit/importer": "1.0.1056",
|
|
35
|
+
"@teambit/logger": "0.0.1444",
|
|
36
|
+
"@teambit/objects": "0.0.563",
|
|
37
|
+
"@teambit/schema": "1.0.1056",
|
|
38
|
+
"@teambit/scope": "1.0.1056",
|
|
39
|
+
"@teambit/tester": "1.0.1056",
|
|
40
|
+
"@teambit/workspace": "1.0.1056",
|
|
41
|
+
"@teambit/ui": "1.0.1056"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/lodash": "4.14.165",
|