@teambit/snapping 1.0.439 → 1.0.441
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/artifacts/__bit_junit.xml +9 -9
- package/artifacts/schema.json +964 -828
- package/dist/snap-from-scope.cmd.d.ts +1 -0
- package/dist/snap-from-scope.cmd.js +1 -0
- package/dist/snap-from-scope.cmd.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +10 -3
- package/dist/snapping.main.runtime.js +72 -19
- package/dist/snapping.main.runtime.js.map +1 -1
- package/package.json +28 -26
- /package/dist/{preview-1729567258586.js → preview-1729691647544.js} +0 -0
|
@@ -52,6 +52,7 @@ the input data is a stringified JSON of an array of the following object.
|
|
|
52
52
|
type?: 'runtime' | 'dev' | 'peer'; // default "runtime".
|
|
53
53
|
}>;
|
|
54
54
|
removeDependencies?: string[]; // component-id (for components) or package-name (for packages) to remove from the dependencies.
|
|
55
|
+
forkFrom?: string; // origin id to fork from. the componentId is the new id. (no need to populate isNew prop).
|
|
55
56
|
}
|
|
56
57
|
an example of the final data: '[{"componentId":"ci.remote2/comp-b","message": "first snap"}]'
|
|
57
58
|
`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","SnapFromScopeCmd","constructor","snapping","logger","keys","IssuesClasses","join","report","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","updateDependents","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","map","id","toString","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId","files","file","path","content","Buffer","from","exports"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type FileData = { path: string; content: string; delete?: boolean };\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n files?: FileData[];\n isNew?: boolean;\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n removeDependencies?: string[];\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n updateDependents?: boolean;\n} & BasicTagSnapParams;\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // dependencies include versions. for components use component-id. e.g. [teambit.compilation/compiler@1.0.0, lodash@4.17.21]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.\n isNew?: boolean; // if it's new, it'll be generated from the given files. otherwise, it'll be fetched from the scope and updated.\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{ // new dependencies (components and packages) to add.\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n removeDependencies?: string[]; // component-id (for components) or package-name (for packages) to remove from the dependencies.\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\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 [\n '',\n 'update-dependents',\n 'when snapped on a lane, mark it as update-dependents so it will be skipped from the workspace',\n ],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger\n ) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n updateDependents,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n if (updateDependents && !lane) {\n throw new BitError('update-dependents flag is only available when snapping from a lane');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n updateDependents,\n });\n\n return {\n exportedIds: results.exportedIds?.map((id) => id.toString()),\n snappedIds: results.snappedIds.map((id) => id.toString()),\n };\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n dataItem.files?.forEach((file) => {\n if (!file.path) throw new Error('expect file to have \"path\" prop');\n if (file.content) {\n file.content = Buffer.from(file.content, 'base64').toString();\n }\n });\n });\n\n return dataParsed;\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,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IA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C,OAAOiE,GAAQ,EAAE;MACjB,MAAM,IAAIC,KAAK,CAAC,gDAAgDD,GAAG,CAACpB,OAAO,EAAE,CAAC;IAChF;IACA,IAAI,CAACsB,KAAK,CAACC,OAAO,CAACN,UAAU,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,4BAA4B,CAAC;IAC/C;IACAJ,UAAU,CAACO,OAAO,CAAEC,QAAQ,IAAK;MAC/B,IAAI,CAACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;MACzFI,QAAQ,CAACE,KAAK,EAAEH,OAAO,CAAEI,IAAI,IAAK;QAChC,IAAI,CAACA,IAAI,CAACC,IAAI,EAAE,MAAM,IAAIR,KAAK,CAAC,iCAAiC,CAAC;QAClE,IAAIO,IAAI,CAACE,OAAO,EAAE;UAChBF,IAAI,CAACE,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACJ,IAAI,CAACE,OAAO,EAAE,QAAQ,CAAC,CAACd,QAAQ,CAAC,CAAC;QAC/D;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAOC,UAAU;EACnB;AACF;AAACgB,OAAA,CAAApD,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","SnapFromScopeCmd","constructor","snapping","logger","keys","IssuesClasses","join","report","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","updateDependents","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","map","id","toString","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId","files","file","path","content","Buffer","from","exports"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type FileData = { path: string; content: string; delete?: boolean };\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n files?: FileData[];\n isNew?: boolean;\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n removeDependencies?: string[];\n forkFrom?: string; // origin id to fork from. the componentId is the new id. (no need to populate isNew prop).\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n updateDependents?: boolean;\n} & BasicTagSnapParams;\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // dependencies include versions. for components use component-id. e.g. [teambit.compilation/compiler@1.0.0, lodash@4.17.21]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.\n isNew?: boolean; // if it's new, it'll be generated from the given files. otherwise, it'll be fetched from the scope and updated.\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{ // new dependencies (components and packages) to add.\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n removeDependencies?: string[]; // component-id (for components) or package-name (for packages) to remove from the dependencies.\n forkFrom?: string; // origin id to fork from. the componentId is the new id. (no need to populate isNew prop).\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\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 [\n '',\n 'update-dependents',\n 'when snapped on a lane, mark it as update-dependents so it will be skipped from the workspace',\n ],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger\n ) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n updateDependents,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n if (updateDependents && !lane) {\n throw new BitError('update-dependents flag is only available when snapping from a lane');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n updateDependents,\n });\n\n return {\n exportedIds: results.exportedIds?.map((id) => id.toString()),\n snappedIds: results.snappedIds.map((id) => id.toString()),\n };\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n dataItem.files?.forEach((file) => {\n if (!file.path) throw new Error('expect file to have \"path\" prop');\n if (file.content) {\n file.content = Buffer.from(file.content, 'base64').toString();\n }\n });\n });\n\n return dataParsed;\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,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;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ACzD,IAAY,EAAwB;IACpD,IAAI8D,UAAmB;IACvB,IAAI;MACFA,UAAU,GAAGC,IAAI,CAACC,KAAK,CAAChE,IAAI,CAAC;IAC/B,CAAC,CAAC,OAAOiE,GAAQ,EAAE;MACjB,MAAM,IAAIC,KAAK,CAAC,gDAAgDD,GAAG,CAACpB,OAAO,EAAE,CAAC;IAChF;IACA,IAAI,CAACsB,KAAK,CAACC,OAAO,CAACN,UAAU,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,4BAA4B,CAAC;IAC/C;IACAJ,UAAU,CAACO,OAAO,CAAEC,QAAQ,IAAK;MAC/B,IAAI,CAACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;MACzFI,QAAQ,CAACE,KAAK,EAAEH,OAAO,CAAEI,IAAI,IAAK;QAChC,IAAI,CAACA,IAAI,CAACC,IAAI,EAAE,MAAM,IAAIR,KAAK,CAAC,iCAAiC,CAAC;QAClE,IAAIO,IAAI,CAACE,OAAO,EAAE;UAChBF,IAAI,CAACE,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACJ,IAAI,CAACE,OAAO,EAAE,QAAQ,CAAC,CAACd,QAAQ,CAAC,CAAC;QAC/D;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAOC,UAAU;EACnB;AACF;AAACgB,OAAA,CAAApD,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -24,6 +24,8 @@ import { TagDataPerCompRaw } from './tag-from-scope.cmd';
|
|
|
24
24
|
import { SnapDataPerCompRaw, FileData } from './snap-from-scope.cmd';
|
|
25
25
|
import { untagResult } from './reset-component';
|
|
26
26
|
import { ApplicationMain } from '@teambit/application';
|
|
27
|
+
import { ForkingMain } from '@teambit/forking';
|
|
28
|
+
import { InstallMain } from '@teambit/install';
|
|
27
29
|
export type TagDataPerComp = {
|
|
28
30
|
componentId: ComponentID;
|
|
29
31
|
dependencies: ComponentID[];
|
|
@@ -46,6 +48,7 @@ export type SnapDataParsed = {
|
|
|
46
48
|
type: 'runtime' | 'dev' | 'peer';
|
|
47
49
|
}[];
|
|
48
50
|
removeDependencies?: string[];
|
|
51
|
+
forkFrom?: ComponentID;
|
|
49
52
|
};
|
|
50
53
|
export type SnapResults = BasicTagResults & {
|
|
51
54
|
snappedComponents: ConsumerComponent[];
|
|
@@ -81,8 +84,10 @@ export declare class SnappingMain {
|
|
|
81
84
|
private importer;
|
|
82
85
|
private deps;
|
|
83
86
|
private application;
|
|
87
|
+
private forking;
|
|
88
|
+
private install;
|
|
84
89
|
private objectsRepo;
|
|
85
|
-
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain, insights: InsightsMain, dependencyResolver: DependencyResolverMain, scope: ScopeMain, exporter: ExportMain, builder: BuilderMain, importer: ImporterMain, deps: DependenciesMain, application: ApplicationMain);
|
|
90
|
+
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain, insights: InsightsMain, dependencyResolver: DependencyResolverMain, scope: ScopeMain, exporter: ExportMain, builder: BuilderMain, importer: ImporterMain, deps: DependenciesMain, application: ApplicationMain, forking: ForkingMain, install: InstallMain);
|
|
86
91
|
/**
|
|
87
92
|
* tag the given component ids or all modified/new components if "all" param is set.
|
|
88
93
|
* tag is a similar operation as a snap, which saves the changes into the local scope, but it also creates an alias
|
|
@@ -187,7 +192,7 @@ export declare class SnappingMain {
|
|
|
187
192
|
static slots: never[];
|
|
188
193
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
189
194
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
190
|
-
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application,]: [
|
|
195
|
+
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application, forking, install,]: [
|
|
191
196
|
Workspace,
|
|
192
197
|
CLIMain,
|
|
193
198
|
LoggerMain,
|
|
@@ -200,7 +205,9 @@ export declare class SnappingMain {
|
|
|
200
205
|
ImporterMain,
|
|
201
206
|
GlobalConfigMain,
|
|
202
207
|
DependenciesMain,
|
|
203
|
-
ApplicationMain
|
|
208
|
+
ApplicationMain,
|
|
209
|
+
ForkingMain,
|
|
210
|
+
InstallMain
|
|
204
211
|
]): Promise<SnappingMain>;
|
|
205
212
|
}
|
|
206
213
|
export default SnappingMain;
|
|
@@ -333,6 +333,20 @@ function _lanesModules() {
|
|
|
333
333
|
};
|
|
334
334
|
return data;
|
|
335
335
|
}
|
|
336
|
+
function _forking() {
|
|
337
|
+
const data = require("@teambit/forking");
|
|
338
|
+
_forking = function () {
|
|
339
|
+
return data;
|
|
340
|
+
};
|
|
341
|
+
return data;
|
|
342
|
+
}
|
|
343
|
+
function _install() {
|
|
344
|
+
const data = require("@teambit/install");
|
|
345
|
+
_install = function () {
|
|
346
|
+
return data;
|
|
347
|
+
};
|
|
348
|
+
return data;
|
|
349
|
+
}
|
|
336
350
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
337
351
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
338
352
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -340,7 +354,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
340
354
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
341
355
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
342
356
|
class SnappingMain {
|
|
343
|
-
constructor(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application) {
|
|
357
|
+
constructor(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application, forking, install) {
|
|
344
358
|
this.workspace = workspace;
|
|
345
359
|
this.logger = logger;
|
|
346
360
|
this.issues = issues;
|
|
@@ -352,6 +366,8 @@ class SnappingMain {
|
|
|
352
366
|
this.importer = importer;
|
|
353
367
|
this.deps = deps;
|
|
354
368
|
this.application = application;
|
|
369
|
+
this.forking = forking;
|
|
370
|
+
this.install = install;
|
|
355
371
|
_defineProperty(this, "objectsRepo", void 0);
|
|
356
372
|
this.objectsRepo = this.scope?.legacyScope?.objects;
|
|
357
373
|
}
|
|
@@ -563,7 +579,8 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
563
579
|
};
|
|
564
580
|
}
|
|
565
581
|
async snapFromScope(snapDataPerCompRaw, params) {
|
|
566
|
-
|
|
582
|
+
const hasForkedFrom = snapDataPerCompRaw.some(s => s.forkFrom);
|
|
583
|
+
if (this.workspace && !hasForkedFrom) {
|
|
567
584
|
throw new (_bitError().BitError)(`unable to run this command from a workspace, please create a new bare-scope and run it from there`);
|
|
568
585
|
}
|
|
569
586
|
let lane;
|
|
@@ -602,17 +619,43 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
602
619
|
isComponent: dep.isComponent ?? true,
|
|
603
620
|
type: dep.type ?? 'runtime'
|
|
604
621
|
})),
|
|
605
|
-
removeDependencies: snapData.removeDependencies
|
|
622
|
+
removeDependencies: snapData.removeDependencies,
|
|
623
|
+
forkFrom: snapData.forkFrom ? _componentId().ComponentID.fromString(snapData.forkFrom) : undefined
|
|
606
624
|
};
|
|
607
625
|
});
|
|
608
626
|
|
|
609
627
|
// console.log('snapDataPerComp', JSON.stringify(snapDataPerComp, undefined, 2));
|
|
610
628
|
|
|
611
|
-
const componentIds = (0, _lodash().compact)(snapDataPerComp.map(t => t.isNew ? null : t.componentId));
|
|
629
|
+
const componentIds = (0, _lodash().compact)(snapDataPerComp.map(t => t.isNew || t.forkFrom ? null : t.componentId));
|
|
612
630
|
const allCompIds = snapDataPerComp.map(s => s.componentId);
|
|
613
631
|
const componentIdsLatest = componentIds.map(id => id.changeVersion(_constants().LATEST));
|
|
614
|
-
const newCompsData = (0, _lodash().compact)(snapDataPerComp.map(t => t.isNew ? t : null));
|
|
632
|
+
const newCompsData = (0, _lodash().compact)(snapDataPerComp.map(t => t.isNew && !t.forkFrom ? t : null));
|
|
633
|
+
const forkedFromData = (0, _lodash().compact)(snapDataPerComp.map(t => t.forkFrom ? t : null));
|
|
615
634
|
const newComponents = await Promise.all(newCompsData.map(newComp => (0, _generateCompFromScope().generateCompFromScope)(this.scope, newComp, this)));
|
|
635
|
+
const forkMultipleData = forkedFromData.map(f => ({
|
|
636
|
+
sourceId: f.forkFrom.toString(),
|
|
637
|
+
targetId: f.componentId.fullName,
|
|
638
|
+
targetScope: f.componentId.scope
|
|
639
|
+
}));
|
|
640
|
+
const forkResults = forkMultipleData.length ? await this.forking.forkMultipleFromRemote(forkMultipleData, {
|
|
641
|
+
refactor: true
|
|
642
|
+
}) : [];
|
|
643
|
+
const newEnvData = {};
|
|
644
|
+
forkedFromData.forEach(f => {
|
|
645
|
+
const bitmapElem = this.workspace.bitMap.getBitmapEntry(f.componentId);
|
|
646
|
+
// @ts-ignore
|
|
647
|
+
const env = bitmapElem?.config?.['teambit.envs/envs'].env;
|
|
648
|
+
if (!env) return;
|
|
649
|
+
const found = forkedFromData.find(fo => fo.forkFrom?.toStringWithoutVersion() === env);
|
|
650
|
+
if (!found) return;
|
|
651
|
+
const newEnvStr = found.componentId.toString();
|
|
652
|
+
if (!newEnvData[newEnvStr]) newEnvData[newEnvStr] = [];
|
|
653
|
+
newEnvData[newEnvStr].push(f.componentId);
|
|
654
|
+
});
|
|
655
|
+
await (0, _pMapSeries().default)(Object.entries(newEnvData), async ([env, compIds]) => {
|
|
656
|
+
await this.workspace.setEnvToComponents(_componentId().ComponentID.fromString(env), compIds, false);
|
|
657
|
+
});
|
|
658
|
+
const newForkedComponents = forkResults.length ? await this.workspace.getMany(forkResults.map(f => f.targetCompId)) : [];
|
|
616
659
|
await this.scope.import(componentIdsLatest, {
|
|
617
660
|
preferDependencyGraph: false,
|
|
618
661
|
lane,
|
|
@@ -642,7 +685,7 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
642
685
|
});
|
|
643
686
|
});
|
|
644
687
|
}
|
|
645
|
-
const components = [...existingComponents, ...newComponents];
|
|
688
|
+
const components = [...existingComponents, ...newComponents, ...newForkedComponents];
|
|
646
689
|
|
|
647
690
|
// this must be done before we load component aspects later on, because this updated deps may update aspects.
|
|
648
691
|
await (0, _pMapSeries().default)(components, async component => {
|
|
@@ -652,22 +695,32 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
652
695
|
});
|
|
653
696
|
|
|
654
697
|
// for new components these are not needed. coz when generating them we already add the aspects and the files.
|
|
655
|
-
await Promise.all(existingComponents.map(async comp => {
|
|
698
|
+
await Promise.all([...existingComponents, ...newForkedComponents].map(async comp => {
|
|
656
699
|
const snapData = getSnapData(comp.id);
|
|
657
700
|
if (snapData.aspects) await this.scope.addAspectsFromConfigObject(comp, snapData.aspects);
|
|
658
701
|
if (snapData.files?.length) {
|
|
659
702
|
await this.updateSourceFiles(comp, snapData.files);
|
|
660
703
|
}
|
|
661
704
|
}));
|
|
705
|
+
if (!this.workspace) {
|
|
706
|
+
// load the aspects user configured to set on the components. it creates capsules if needed.
|
|
707
|
+
// otherwise, when a user set a custom-env, it won't be loaded and the Version object will leave the
|
|
708
|
+
// teambit.envs/envs in a weird state. the config will be set correctly but the data will be set to the default
|
|
709
|
+
// node env.
|
|
710
|
+
await this.scope.loadManyCompsAspects(components);
|
|
662
711
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
712
|
+
// this is similar to what happens in the workspace. the "onLoad" is running and populating the "data" of the aspects.
|
|
713
|
+
await (0, _pMapSeries().default)(components, async comp => this.scope.executeOnCompAspectReCalcSlot(comp));
|
|
714
|
+
} else {
|
|
715
|
+
// for the forked components, it's on the workspace, so all it is missing now is the installation
|
|
716
|
+
await this.install.install(undefined, {
|
|
717
|
+
dedupe: true,
|
|
718
|
+
import: false,
|
|
719
|
+
copyPeerToRuntimeOnRoot: true,
|
|
720
|
+
copyPeerToRuntimeOnComponents: false,
|
|
721
|
+
updateExisting: false
|
|
722
|
+
});
|
|
723
|
+
}
|
|
671
724
|
const consumerComponents = components.map(c => c.state._consumer);
|
|
672
725
|
const ids = _componentId().ComponentIdList.fromArray(allCompIds);
|
|
673
726
|
const results = await (0, _tagModelComponent().tagModelComponent)(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -1231,7 +1284,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1231
1284
|
}
|
|
1232
1285
|
return;
|
|
1233
1286
|
}
|
|
1234
|
-
const currentFile = currentFiles.find(f => f.
|
|
1287
|
+
const currentFile = currentFiles.find(f => f.relative === file.path);
|
|
1235
1288
|
if (currentFile) {
|
|
1236
1289
|
currentFile.contents = Buffer.from(file.content);
|
|
1237
1290
|
} else {
|
|
@@ -1377,9 +1430,9 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1377
1430
|
warnings
|
|
1378
1431
|
};
|
|
1379
1432
|
}
|
|
1380
|
-
static async provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application]) {
|
|
1433
|
+
static async provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application, forking, install]) {
|
|
1381
1434
|
const logger = loggerMain.createLogger(_snapping().SnappingAspect.id);
|
|
1382
|
-
const snapping = new SnappingMain(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application);
|
|
1435
|
+
const snapping = new SnappingMain(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application, forking, install);
|
|
1383
1436
|
const snapCmd = new (_snapCmd().SnapCmd)(snapping, logger, globalConfig);
|
|
1384
1437
|
const tagCmd = new (_tagCmd().TagCmd)(snapping, logger, globalConfig);
|
|
1385
1438
|
const tagFromScopeCmd = new (_tagFromScope().TagFromScopeCmd)(snapping, logger);
|
|
@@ -1392,7 +1445,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1392
1445
|
}
|
|
1393
1446
|
exports.SnappingMain = SnappingMain;
|
|
1394
1447
|
_defineProperty(SnappingMain, "slots", []);
|
|
1395
|
-
_defineProperty(SnappingMain, "dependencies", [_workspace().WorkspaceAspect, _cli().CLIAspect, _logger().LoggerAspect, _issues().IssuesAspect, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().ImporterAspect, _globalConfig().GlobalConfigAspect, _dependencies().DependenciesAspect, _application().ApplicationAspect]);
|
|
1448
|
+
_defineProperty(SnappingMain, "dependencies", [_workspace().WorkspaceAspect, _cli().CLIAspect, _logger().LoggerAspect, _issues().IssuesAspect, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().ImporterAspect, _globalConfig().GlobalConfigAspect, _dependencies().DependenciesAspect, _application().ApplicationAspect, _forking().ForkingAspect, _install().InstallAspect]);
|
|
1396
1449
|
_defineProperty(SnappingMain, "runtime", _cli().MainRuntime);
|
|
1397
1450
|
_snapping().SnappingAspect.addRuntime(SnappingMain);
|
|
1398
1451
|
var _default = exports.default = SnappingMain;
|