@teambit/forking 0.0.2 → 0.0.9

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/fork.cmd.js CHANGED
@@ -39,7 +39,7 @@ class ForkCmd {
39
39
  (0, _defineProperty2().default)(this, "group", 'collaborate');
40
40
  (0, _defineProperty2().default)(this, "skipWorkspace", true);
41
41
  (0, _defineProperty2().default)(this, "alias", '');
42
- (0, _defineProperty2().default)(this, "options", [['s', 'scope', 'default scope for the newly created component'], ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`']]);
42
+ (0, _defineProperty2().default)(this, "options", [['s', 'scope <string>', 'default scope for the newly created component'], ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`']]);
43
43
  (0, _defineProperty2().default)(this, "loader", true);
44
44
  (0, _defineProperty2().default)(this, "migration", true);
45
45
  (0, _defineProperty2().default)(this, "remoteOp", true);
@@ -1 +1 @@
1
- {"version":3,"sources":["fork.cmd.ts"],"names":["ForkCmd","constructor","forking","report","sourceId","targetId","options","results","fork","targetIdStr","toString","chalk","green","bold"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AASO,MAAMA,OAAN,CAAiC;AActCC,EAAAA,WAAW,CAASC,OAAT,EAA+B;AAAA,SAAtBA,OAAsB,GAAtBA,OAAsB;AAAA,kDAbnC,8BAamC;AAAA,yDAZ5B,6DAY4B;AAAA,mDAXlC,aAWkC;AAAA,2DAV1B,IAU0B;AAAA,mDATlC,EASkC;AAAA,qDARhC,CACR,CAAC,GAAD,EAAM,OAAN,EAAe,+CAAf,CADQ,EAER,CAAC,GAAD,EAAM,eAAN,EAAuB,qFAAvB,CAFQ,CAQgC;AAAA,oDAJjC,IAIiC;AAAA,uDAH9B,IAG8B;AAAA,sDAF/B,IAE+B;AAAE;;AAEhC,QAANC,MAAM,CAAC,CAACC,QAAD,EAAWC,QAAX,CAAD,EAAyCC,OAAzC,EAAgF;AAC1F,UAAMC,OAAO,GAAG,MAAM,KAAKL,OAAL,CAAaM,IAAb,CAAkBJ,QAAlB,EAA4BC,QAA5B,EAAsCC,OAAtC,CAAtB;AACA,UAAMG,WAAW,GAAGF,OAAO,CAACG,QAAR,EAApB;AACA,WAAOC,iBAAMC,KAAN,CAAa,uBAAsBD,iBAAME,IAAN,CAAWJ,WAAX,CAAwB,SAAQE,iBAAME,IAAN,CAAWT,QAAX,CAAqB,EAAxF,CAAP;AACD;;AApBqC","sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ForkingMain } from '.';\n\nexport type ForkOptions = {\n scope?: string;\n path?: string;\n};\n\nexport class ForkCmd implements Command {\n name = 'fork <source-id> [target-id]';\n description = 'EXPERIMENTAL. create a new component out of an existing one';\n group = 'collaborate';\n skipWorkspace = true;\n alias = '';\n options = [\n ['s', 'scope', 'default scope for the newly created component'],\n ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private forking: ForkingMain) {}\n\n async report([sourceId, targetId]: [string, string], options: ForkOptions): Promise<string> {\n const results = await this.forking.fork(sourceId, targetId, options);\n const targetIdStr = results.toString();\n return chalk.green(`successfully forked ${chalk.bold(targetIdStr)} from ${chalk.bold(sourceId)}`);\n }\n}\n"]}
1
+ {"version":3,"sources":["fork.cmd.ts"],"names":["ForkCmd","constructor","forking","report","sourceId","targetId","options","results","fork","targetIdStr","toString","chalk","green","bold"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AASO,MAAMA,OAAN,CAAiC;AActCC,EAAAA,WAAW,CAASC,OAAT,EAA+B;AAAA,SAAtBA,OAAsB,GAAtBA,OAAsB;AAAA,kDAbnC,8BAamC;AAAA,yDAZ5B,6DAY4B;AAAA,mDAXlC,aAWkC;AAAA,2DAV1B,IAU0B;AAAA,mDATlC,EASkC;AAAA,qDARhC,CACR,CAAC,GAAD,EAAM,gBAAN,EAAwB,+CAAxB,CADQ,EAER,CAAC,GAAD,EAAM,eAAN,EAAuB,qFAAvB,CAFQ,CAQgC;AAAA,oDAJjC,IAIiC;AAAA,uDAH9B,IAG8B;AAAA,sDAF/B,IAE+B;AAAE;;AAEhC,QAANC,MAAM,CAAC,CAACC,QAAD,EAAWC,QAAX,CAAD,EAAyCC,OAAzC,EAAgF;AAC1F,UAAMC,OAAO,GAAG,MAAM,KAAKL,OAAL,CAAaM,IAAb,CAAkBJ,QAAlB,EAA4BC,QAA5B,EAAsCC,OAAtC,CAAtB;AACA,UAAMG,WAAW,GAAGF,OAAO,CAACG,QAAR,EAApB;AACA,WAAOC,iBAAMC,KAAN,CAAa,uBAAsBD,iBAAME,IAAN,CAAWJ,WAAX,CAAwB,SAAQE,iBAAME,IAAN,CAAWT,QAAX,CAAqB,EAAxF,CAAP;AACD;;AApBqC","sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ForkingMain } from '.';\n\nexport type ForkOptions = {\n scope?: string;\n path?: string;\n};\n\nexport class ForkCmd implements Command {\n name = 'fork <source-id> [target-id]';\n description = 'EXPERIMENTAL. create a new component out of an existing one';\n group = 'collaborate';\n skipWorkspace = true;\n alias = '';\n options = [\n ['s', 'scope <string>', 'default scope for the newly created component'],\n ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private forking: ForkingMain) {}\n\n async report([sourceId, targetId]: [string, string], options: ForkOptions): Promise<string> {\n const results = await this.forking.fork(sourceId, targetId, options);\n const targetIdStr = results.toString();\n return chalk.green(`successfully forked ${chalk.bold(targetIdStr)} from ${chalk.bold(sourceId)}`);\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { Schema } from '@teambit/graphql';
2
+ import { ForkingMain } from './forking.main.runtime';
3
+ export declare function forkingSchema(forking: ForkingMain): Schema;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.forkingSchema = forkingSchema;
9
+
10
+ function _graphqlTag() {
11
+ const data = _interopRequireDefault(require("graphql-tag"));
12
+
13
+ _graphqlTag = function () {
14
+ return data;
15
+ };
16
+
17
+ return data;
18
+ }
19
+
20
+ function forkingSchema(forking) {
21
+ return {
22
+ typeDefs: (0, _graphqlTag().default)`
23
+ extend type Component {
24
+ forking: ForkingInfo
25
+ }
26
+
27
+ type ForkingInfo {
28
+ forkedFrom: String
29
+ }
30
+ `,
31
+ resolvers: {
32
+ Component: {
33
+ forking: component => {
34
+ const forkInfo = forking.getForkInfo(component);
35
+ return {
36
+ forkedFrom: forkInfo === null || forkInfo === void 0 ? void 0 : forkInfo.forkedFrom.toString()
37
+ };
38
+ }
39
+ }
40
+ }
41
+ };
42
+ }
43
+
44
+ //# sourceMappingURL=forking.graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["forking.graphql.ts"],"names":["forkingSchema","forking","typeDefs","resolvers","Component","component","forkInfo","getForkInfo","forkedFrom","toString"],"mappings":";;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,SAASA,aAAT,CAAuBC,OAAvB,EAAqD;AAC1D,SAAO;AACLC,IAAAA,QAAQ,EAAE,0BAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KATS;AAULC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAE;AACTH,QAAAA,OAAO,EAAGI,SAAD,IAA0B;AACjC,gBAAMC,QAAQ,GAAGL,OAAO,CAACM,WAAR,CAAoBF,SAApB,CAAjB;AACA,iBAAO;AACLG,YAAAA,UAAU,EAAEF,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEE,UAAV,CAAqBC,QAArB;AADP,WAAP;AAGD;AANQ;AADF;AAVN,GAAP;AAqBD","sourcesContent":["import { Component } from '@teambit/component';\nimport { Schema } from '@teambit/graphql';\nimport gql from 'graphql-tag';\nimport { ForkingMain } from './forking.main.runtime';\n\nexport function forkingSchema(forking: ForkingMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n forking: ForkingInfo\n }\n\n type ForkingInfo {\n forkedFrom: String\n }\n `,\n resolvers: {\n Component: {\n forking: (component: Component) => {\n const forkInfo = forking.getForkInfo(component);\n return {\n forkedFrom: forkInfo?.forkedFrom.toString(),\n };\n },\n },\n },\n };\n}\n"]}
@@ -3,6 +3,7 @@ import { DependencyResolverMain } from '@teambit/dependency-resolver';
3
3
  import { Workspace } from '@teambit/workspace';
4
4
  import { Component, ComponentID, ComponentMain } from '@teambit/component';
5
5
  import { ComponentIdObj } from '@teambit/component-id';
6
+ import { GraphqlMain } from '@teambit/graphql';
6
7
  import { NewComponentHelperMain } from '@teambit/new-component-helper';
7
8
  import { ForkOptions } from './fork.cmd';
8
9
  export declare type ForkInfo = {
@@ -21,12 +22,13 @@ export declare class ForkingMain {
21
22
  static slots: never[];
22
23
  static dependencies: import("@teambit/harmony").Aspect[];
23
24
  static runtime: import("@teambit/harmony").RuntimeDefinition;
24
- static provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper]: [
25
+ static provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper, graphql]: [
25
26
  CLIMain,
26
27
  Workspace,
27
28
  DependencyResolverMain,
28
29
  ComponentMain,
29
- NewComponentHelperMain
30
+ NewComponentHelperMain,
31
+ GraphqlMain
30
32
  ]): Promise<ForkingMain>;
31
33
  }
32
34
  export declare type ForkConfig = {
@@ -71,6 +71,16 @@ function _component() {
71
71
  return data;
72
72
  }
73
73
 
74
+ function _graphql() {
75
+ const data = _interopRequireDefault(require("@teambit/graphql"));
76
+
77
+ _graphql = function () {
78
+ return data;
79
+ };
80
+
81
+ return data;
82
+ }
83
+
74
84
  function _newComponentHelper() {
75
85
  const data = _interopRequireDefault(require("@teambit/new-component-helper"));
76
86
 
@@ -111,6 +121,16 @@ function _forking2() {
111
121
  return data;
112
122
  }
113
123
 
124
+ function _forking3() {
125
+ const data = require("./forking.graphql");
126
+
127
+ _forking3 = function () {
128
+ return data;
129
+ };
130
+
131
+ return data;
132
+ }
133
+
114
134
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
115
135
 
116
136
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -128,9 +148,10 @@ class ForkingMain {
128
148
 
129
149
  async fork(sourceIdStr, targetId, options) {
130
150
  const sourceId = await this.workspace.resolveComponentId(sourceIdStr);
131
- const existingInWorkspace = await this.workspace.getIfExist(sourceId);
151
+ const exists = this.workspace.exists(sourceId);
132
152
 
133
- if (existingInWorkspace) {
153
+ if (exists) {
154
+ const existingInWorkspace = await this.workspace.get(sourceId);
134
155
  return this.forkExistingInWorkspace(existingInWorkspace, targetId, options);
135
156
  }
136
157
 
@@ -155,16 +176,14 @@ please specify the target-id arg`);
155
176
  }
156
177
 
157
178
  const targetCompId = this.newComponentHelper.getNewComponentId(targetId, undefined, options === null || options === void 0 ? void 0 : options.scope);
158
- const targetPath = this.newComponentHelper.getNewComponentPath(targetCompId, options === null || options === void 0 ? void 0 : options.path);
159
179
  const config = await this.getConfig(existing);
160
- await this.newComponentHelper.writeAndAddNewComp(existing, targetPath, targetCompId, config);
180
+ await this.newComponentHelper.writeAndAddNewComp(existing, targetCompId, options, config);
161
181
  return targetCompId;
162
182
  }
163
183
 
164
184
  async forkRemoteComponent(sourceId, targetId, options) {
165
185
  const targetName = targetId || sourceId.fullName;
166
186
  const targetCompId = this.newComponentHelper.getNewComponentId(targetName, undefined, options === null || options === void 0 ? void 0 : options.scope);
167
- const targetPath = this.newComponentHelper.getNewComponentPath(targetCompId, options === null || options === void 0 ? void 0 : options.path);
168
187
  const comp = await this.workspace.scope.getRemoteComponent(sourceId);
169
188
  const deps = await this.dependencyResolver.getDependencies(comp); // only bring auto-resolved dependencies, others should be set in the workspace.jsonc template
170
189
 
@@ -183,7 +202,7 @@ please specify the target-id arg`);
183
202
  updateExisting: true
184
203
  });
185
204
  const config = await this.getConfig(comp);
186
- await this.newComponentHelper.writeAndAddNewComp(comp, targetPath, targetCompId, config);
205
+ await this.newComponentHelper.writeAndAddNewComp(comp, targetCompId, options, config);
187
206
  await this.dependencyResolver.persistConfig(this.workspace.path);
188
207
  await this.workspace.install(undefined, {
189
208
  dedupe: true,
@@ -204,9 +223,10 @@ please specify the target-id arg`);
204
223
  });
205
224
  }
206
225
 
207
- static async provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper]) {
226
+ static async provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper, graphql]) {
208
227
  const forkingMain = new ForkingMain(workspace, dependencyResolver, newComponentHelper);
209
228
  cli.register(new (_fork().ForkCmd)(forkingMain));
229
+ graphql.register((0, _forking3().forkingSchema)(forkingMain));
210
230
  componentMain.registerShowFragments([new (_forking2().ForkingFragment)(forkingMain)]);
211
231
  return forkingMain;
212
232
  }
@@ -215,7 +235,7 @@ please specify the target-id arg`);
215
235
 
216
236
  exports.ForkingMain = ForkingMain;
217
237
  (0, _defineProperty2().default)(ForkingMain, "slots", []);
218
- (0, _defineProperty2().default)(ForkingMain, "dependencies", [_cli().CLIAspect, _workspace().default, _dependencyResolver().DependencyResolverAspect, _component().default, _newComponentHelper().default]);
238
+ (0, _defineProperty2().default)(ForkingMain, "dependencies", [_cli().CLIAspect, _workspace().default, _dependencyResolver().DependencyResolverAspect, _component().default, _newComponentHelper().default, _graphql().default]);
219
239
  (0, _defineProperty2().default)(ForkingMain, "runtime", _cli().MainRuntime);
220
240
 
221
241
  _forking().ForkingAspect.addRuntime(ForkingMain);
@@ -1 +1 @@
1
- {"version":3,"sources":["forking.main.runtime.ts"],"names":["ForkingMain","constructor","workspace","dependencyResolver","newComponentHelper","fork","sourceIdStr","targetId","options","sourceId","resolveComponentId","existingInWorkspace","getIfExist","forkExistingInWorkspace","sourceIdWithScope","_legacy","scope","ComponentID","fromLegacy","BitId","parse","forkRemoteComponent","getForkInfo","component","forkConfig","state","aspects","get","ForkingAspect","id","config","forkedFrom","fromObject","existing","Error","toStringWithoutVersion","targetCompId","getNewComponentId","undefined","targetPath","getNewComponentPath","path","getConfig","writeAndAddNewComp","targetName","fullName","comp","getRemoteComponent","deps","getDependencies","workspacePolicyEntries","filter","dep","source","map","dependencyId","getPackageName","lifecycleType","lifecycle","value","version","addToRootPolicy","updateExisting","persistConfig","install","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","fromExisting","getConfigFromExistingToNewComponent","toObject","provider","cli","componentMain","forkingMain","register","ForkCmd","registerShowFragments","ForkingFragment","CLIAspect","WorkspaceAspect","DependencyResolverAspect","ComponentAspect","NewComponentHelperAspect","MainRuntime","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;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,CAAuB1B,SAAvB,EAAkC;AACtC2B,MAAAA,MAAM,EAAE,IAD8B;AAEtCC,MAAAA,MAAM,EAAE,KAF8B;AAGtCC,MAAAA,uBAAuB,EAAE,IAHa;AAItCC,MAAAA,6BAA6B,EAAE,KAJO;AAKtCN,MAAAA,cAAc,EAAE;AALsB,KAAlC,CAAN;AAQA,WAAO1B,YAAP;AACD;;AAEsB,QAATM,SAAS,CAACI,IAAD,EAAkB;AACvC,UAAMuB,YAAY,GAAG,MAAM,KAAKjE,kBAAL,CAAwBkE,mCAAxB,CAA4DxB,IAA5D,CAA3B;AACA,2CACKuB,YADL;AAEE,OAACzC,yBAAcC,EAAf,GAAoB;AAClBE,QAAAA,UAAU,EAAEe,IAAI,CAACjB,EAAL,CAAQ0C,QAAR;AADM;AAFtB;AAMD;;AAWoB,eAARC,QAAQ,CAAC,CAACC,GAAD,EAAMvE,SAAN,EAAiBC,kBAAjB,EAAqCuE,aAArC,EAAoDtE,kBAApD,CAAD,EAMlB;AACD,UAAMuE,WAAW,GAAG,IAAI3E,WAAJ,CAAgBE,SAAhB,EAA2BC,kBAA3B,EAA+CC,kBAA/C,CAApB;AACAqE,IAAAA,GAAG,CAACG,QAAJ,CAAa,KAAIC,eAAJ,EAAYF,WAAZ,CAAb;AACAD,IAAAA,aAAa,CAACI,qBAAd,CAAoC,CAAC,KAAIC,2BAAJ,EAAoBJ,WAApB,CAAD,CAApC;AACA,WAAOA,WAAP;AACD;;AArGsB;;;gCAAZ3E,W,WAiFI,E;gCAjFJA,W,kBAkFW,CACpBgF,gBADoB,EAEpBC,oBAFoB,EAGpBC,8CAHoB,EAIpBC,oBAJoB,EAKpBC,6BALoB,C;gCAlFXpF,W,aAyFMqF,kB;;AAenBzD,yBAAc0D,UAAd,CAAyBtF,WAAzB","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { ComponentIdObj } from '@teambit/component-id';\nimport NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { ForkCmd, ForkOptions } from './fork.cmd';\nimport { ForkingAspect } from './forking.aspect';\nimport { ForkingFragment } from './forking.fragment';\n\nexport type ForkInfo = {\n forkedFrom: ComponentID;\n};\n\nexport class ForkingMain {\n constructor(\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain,\n private newComponentHelper: NewComponentHelperMain\n ) {}\n\n async fork(sourceIdStr: string, targetId?: string, options?: ForkOptions): Promise<ComponentID> {\n const sourceId = await this.workspace.resolveComponentId(sourceIdStr);\n const existingInWorkspace = await this.workspace.getIfExist(sourceId);\n if (existingInWorkspace) {\n return this.forkExistingInWorkspace(existingInWorkspace, targetId, options);\n }\n const sourceIdWithScope = sourceId._legacy.scope\n ? sourceId\n : ComponentID.fromLegacy(BitId.parse(sourceIdStr, true));\n return this.forkRemoteComponent(sourceIdWithScope, targetId, options);\n }\n\n getForkInfo(component: Component): ForkInfo | null {\n const forkConfig = component.state.aspects.get(ForkingAspect.id)?.config as ForkConfig | undefined;\n if (!forkConfig) return null;\n return {\n forkedFrom: ComponentID.fromObject(forkConfig.forkedFrom),\n };\n }\n\n private async forkExistingInWorkspace(existing: Component, targetId?: string, options?: ForkOptions) {\n if (!targetId) {\n throw new Error(`error: unable to create \"${existing.id.toStringWithoutVersion()}\" component, a component with the same name already exists.\nplease specify the target-id arg`);\n }\n const targetCompId = this.newComponentHelper.getNewComponentId(targetId, undefined, options?.scope);\n const targetPath = this.newComponentHelper.getNewComponentPath(targetCompId, options?.path);\n const config = await this.getConfig(existing);\n await this.newComponentHelper.writeAndAddNewComp(existing, targetPath, targetCompId, config);\n\n return targetCompId;\n }\n private async forkRemoteComponent(sourceId: ComponentID, targetId?: string, options?: ForkOptions) {\n const targetName = targetId || sourceId.fullName;\n const targetCompId = this.newComponentHelper.getNewComponentId(targetName, undefined, options?.scope);\n const targetPath = this.newComponentHelper.getNewComponentPath(targetCompId, options?.path);\n const comp = await this.workspace.scope.getRemoteComponent(sourceId);\n\n const deps = await this.dependencyResolver.getDependencies(comp);\n // only bring auto-resolved dependencies, others should be set in the workspace.jsonc template\n const workspacePolicyEntries = deps\n .filter((dep) => dep.source === 'auto')\n .map((dep) => ({\n dependencyId: dep.getPackageName?.() || dep.id,\n lifecycleType: dep.lifecycle === 'dev' ? 'runtime' : dep.lifecycle,\n value: {\n version: dep.version,\n },\n }));\n this.dependencyResolver.addToRootPolicy(workspacePolicyEntries, { updateExisting: true });\n const config = await this.getConfig(comp);\n await this.newComponentHelper.writeAndAddNewComp(comp, targetPath, targetCompId, config);\n await this.dependencyResolver.persistConfig(this.workspace.path);\n await this.workspace.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n\n return targetCompId;\n }\n\n private async getConfig(comp: Component) {\n const fromExisting = await this.newComponentHelper.getConfigFromExistingToNewComponent(comp);\n return {\n ...fromExisting,\n [ForkingAspect.id]: {\n forkedFrom: comp.id.toObject(),\n },\n };\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n DependencyResolverAspect,\n ComponentAspect,\n NewComponentHelperAspect,\n ];\n static runtime = MainRuntime;\n static async provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper]: [\n CLIMain,\n Workspace,\n DependencyResolverMain,\n ComponentMain,\n NewComponentHelperMain\n ]) {\n const forkingMain = new ForkingMain(workspace, dependencyResolver, newComponentHelper);\n cli.register(new ForkCmd(forkingMain));\n componentMain.registerShowFragments([new ForkingFragment(forkingMain)]);\n return forkingMain;\n }\n}\n\nForkingAspect.addRuntime(ForkingMain);\n\nexport type ForkConfig = {\n forkedFrom: ComponentIdObj;\n};\n"]}
1
+ {"version":3,"sources":["forking.main.runtime.ts"],"names":["ForkingMain","constructor","workspace","dependencyResolver","newComponentHelper","fork","sourceIdStr","targetId","options","sourceId","resolveComponentId","exists","existingInWorkspace","get","forkExistingInWorkspace","sourceIdWithScope","_legacy","scope","ComponentID","fromLegacy","BitId","parse","forkRemoteComponent","getForkInfo","component","forkConfig","state","aspects","ForkingAspect","id","config","forkedFrom","fromObject","existing","Error","toStringWithoutVersion","targetCompId","getNewComponentId","undefined","getConfig","writeAndAddNewComp","targetName","fullName","comp","getRemoteComponent","deps","getDependencies","workspacePolicyEntries","filter","dep","source","map","dependencyId","getPackageName","lifecycleType","lifecycle","value","version","addToRootPolicy","updateExisting","persistConfig","path","install","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","fromExisting","getConfigFromExistingToNewComponent","toObject","provider","cli","componentMain","graphql","forkingMain","register","ForkCmd","registerShowFragments","ForkingFragment","CLIAspect","WorkspaceAspect","DependencyResolverAspect","ComponentAspect","NewComponentHelperAspect","GraphqlAspect","MainRuntime","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;;AAMO,MAAMA,WAAN,CAAkB;AACvBC,EAAAA,WAAW,CACDC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EAOlB;AACD,UAAMC,WAAW,GAAG,IAAI1E,WAAJ,CAAgBE,SAAhB,EAA2BC,kBAA3B,EAA+CC,kBAA/C,CAApB;AACAmE,IAAAA,GAAG,CAACI,QAAJ,CAAa,KAAIC,eAAJ,EAAYF,WAAZ,CAAb;AACAD,IAAAA,OAAO,CAACE,QAAR,CAAiB,+BAAcD,WAAd,CAAjB;AACAF,IAAAA,aAAa,CAACK,qBAAd,CAAoC,CAAC,KAAIC,2BAAJ,EAAoBJ,WAApB,CAAD,CAApC;AACA,WAAOA,WAAP;AACD;;AAxGsB;;;gCAAZ1E,W,WAiFI,E;gCAjFJA,W,kBAkFW,CACpB+E,gBADoB,EAEpBC,oBAFoB,EAGpBC,8CAHoB,EAIpBC,oBAJoB,EAKpBC,6BALoB,EAMpBC,kBANoB,C;gCAlFXpF,W,aA0FMqF,kB;;AAiBnBzD,yBAAc0D,UAAd,CAAyBtF,WAAzB","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { ComponentIdObj } from '@teambit/component-id';\nimport GraphqlAspect, { GraphqlMain } from '@teambit/graphql';\nimport NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { ForkCmd, ForkOptions } from './fork.cmd';\nimport { ForkingAspect } from './forking.aspect';\nimport { ForkingFragment } from './forking.fragment';\nimport { forkingSchema } from './forking.graphql';\n\nexport type ForkInfo = {\n forkedFrom: ComponentID;\n};\n\nexport class ForkingMain {\n constructor(\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain,\n private newComponentHelper: NewComponentHelperMain\n ) {}\n\n async fork(sourceIdStr: string, targetId?: string, options?: ForkOptions): Promise<ComponentID> {\n const sourceId = await this.workspace.resolveComponentId(sourceIdStr);\n const exists = this.workspace.exists(sourceId);\n if (exists) {\n const existingInWorkspace = await this.workspace.get(sourceId);\n return this.forkExistingInWorkspace(existingInWorkspace, targetId, options);\n }\n const sourceIdWithScope = sourceId._legacy.scope\n ? sourceId\n : ComponentID.fromLegacy(BitId.parse(sourceIdStr, true));\n return this.forkRemoteComponent(sourceIdWithScope, targetId, options);\n }\n\n getForkInfo(component: Component): ForkInfo | null {\n const forkConfig = component.state.aspects.get(ForkingAspect.id)?.config as ForkConfig | undefined;\n if (!forkConfig) return null;\n return {\n forkedFrom: ComponentID.fromObject(forkConfig.forkedFrom),\n };\n }\n\n private async forkExistingInWorkspace(existing: Component, targetId?: string, options?: ForkOptions) {\n if (!targetId) {\n throw new Error(`error: unable to create \"${existing.id.toStringWithoutVersion()}\" component, a component with the same name already exists.\nplease specify the target-id arg`);\n }\n const targetCompId = this.newComponentHelper.getNewComponentId(targetId, undefined, options?.scope);\n\n const config = await this.getConfig(existing);\n await this.newComponentHelper.writeAndAddNewComp(existing, targetCompId, options, config);\n\n return targetCompId;\n }\n private async forkRemoteComponent(sourceId: ComponentID, targetId?: string, options?: ForkOptions) {\n const targetName = targetId || sourceId.fullName;\n const targetCompId = this.newComponentHelper.getNewComponentId(targetName, undefined, options?.scope);\n const comp = await this.workspace.scope.getRemoteComponent(sourceId);\n\n const deps = await this.dependencyResolver.getDependencies(comp);\n // only bring auto-resolved dependencies, others should be set in the workspace.jsonc template\n const workspacePolicyEntries = deps\n .filter((dep) => dep.source === 'auto')\n .map((dep) => ({\n dependencyId: dep.getPackageName?.() || dep.id,\n lifecycleType: dep.lifecycle === 'dev' ? 'runtime' : dep.lifecycle,\n value: {\n version: dep.version,\n },\n }));\n this.dependencyResolver.addToRootPolicy(workspacePolicyEntries, { updateExisting: true });\n const config = await this.getConfig(comp);\n await this.newComponentHelper.writeAndAddNewComp(comp, targetCompId, options, config);\n await this.dependencyResolver.persistConfig(this.workspace.path);\n await this.workspace.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n\n return targetCompId;\n }\n\n private async getConfig(comp: Component) {\n const fromExisting = await this.newComponentHelper.getConfigFromExistingToNewComponent(comp);\n return {\n ...fromExisting,\n [ForkingAspect.id]: {\n forkedFrom: comp.id.toObject(),\n },\n };\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n DependencyResolverAspect,\n ComponentAspect,\n NewComponentHelperAspect,\n GraphqlAspect,\n ];\n static runtime = MainRuntime;\n static async provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper, graphql]: [\n CLIMain,\n Workspace,\n DependencyResolverMain,\n ComponentMain,\n NewComponentHelperMain,\n GraphqlMain\n ]) {\n const forkingMain = new ForkingMain(workspace, dependencyResolver, newComponentHelper);\n cli.register(new ForkCmd(forkingMain));\n graphql.register(forkingSchema(forkingMain));\n componentMain.registerShowFragments([new ForkingFragment(forkingMain)]);\n return forkingMain;\n }\n}\n\nForkingAspect.addRuntime(ForkingMain);\n\nexport type ForkConfig = {\n forkedFrom: ComponentIdObj;\n};\n"]}
package/package.json CHANGED
@@ -1,25 +1,27 @@
1
1
  {
2
2
  "name": "@teambit/forking",
3
- "version": "0.0.2",
3
+ "version": "0.0.9",
4
4
  "homepage": "https://bit.dev/teambit/component/forking",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "forking",
9
- "version": "0.0.2"
9
+ "version": "0.0.9"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
13
13
  "@teambit/harmony": "0.2.11",
14
+ "graphql-tag": "2.12.1",
14
15
  "@babel/runtime": "7.12.18",
15
16
  "core-js": "^3.0.0",
16
- "@teambit/cli": "0.0.410",
17
- "@teambit/component": "0.0.598",
17
+ "@teambit/cli": "0.0.417",
18
+ "@teambit/component": "0.0.605",
19
+ "@teambit/graphql": "0.0.605",
18
20
  "@teambit/component-id": "0.0.398",
19
- "@teambit/dependency-resolver": "0.0.598",
21
+ "@teambit/dependency-resolver": "0.0.605",
20
22
  "@teambit/legacy-bit-id": "0.0.397",
21
- "@teambit/new-component-helper": "0.0.2",
22
- "@teambit/workspace": "0.0.598"
23
+ "@teambit/new-component-helper": "0.0.9",
24
+ "@teambit/workspace": "0.0.605"
23
25
  },
24
26
  "devDependencies": {
25
27
  "@types/mocha": "5.2.7",
@@ -30,7 +32,7 @@
30
32
  "@types/node": "12.20.4"
31
33
  },
32
34
  "peerDependencies": {
33
- "@teambit/legacy": "1.0.197",
35
+ "@teambit/legacy": "1.0.201",
34
36
  "react-dom": "^16.8.0 || ^17.0.0",
35
37
  "react": "^16.8.0 || ^17.0.0"
36
38
  },
@@ -58,7 +60,7 @@
58
60
  "react": "-"
59
61
  },
60
62
  "peerDependencies": {
61
- "@teambit/legacy": "1.0.197",
63
+ "@teambit/legacy": "1.0.201",
62
64
  "react-dom": "^16.8.0 || ^17.0.0",
63
65
  "react": "^16.8.0 || ^17.0.0"
64
66
  }