@teambit/forking 0.0.285 → 0.0.286

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
@@ -1,36 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.js");
6
-
7
5
  require("core-js/modules/es.promise.js");
8
-
9
6
  Object.defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
9
  exports.ForkCmd = void 0;
13
-
14
10
  function _defineProperty2() {
15
11
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
-
17
12
  _defineProperty2 = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function _chalk() {
25
18
  const data = _interopRequireDefault(require("chalk"));
26
-
27
19
  _chalk = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  class ForkCmd {
35
25
  constructor(forking) {
36
26
  this.forking = forking;
@@ -52,15 +42,12 @@ class ForkCmd {
52
42
  (0, _defineProperty2().default)(this, "migration", true);
53
43
  (0, _defineProperty2().default)(this, "remoteOp", true);
54
44
  }
55
-
56
45
  async report([sourceId, targetId], options) {
57
46
  const results = await this.forking.fork(sourceId, targetId, options);
58
47
  const targetIdStr = results.toString();
59
48
  return _chalk().default.green(`successfully forked ${_chalk().default.bold(targetIdStr)} from ${_chalk().default.bold(sourceId)}`);
60
49
  }
61
-
62
50
  }
63
-
64
51
  exports.ForkCmd = ForkCmd;
65
52
 
66
53
  //# sourceMappingURL=fork.cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ForkCmd","constructor","forking","name","description","report","sourceId","targetId","options","results","fork","targetIdStr","toString","chalk","green","bold"],"sources":["fork.cmd.ts"],"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 refactor?: boolean;\n skipDependencyInstallation?: boolean;\n};\n\nexport class ForkCmd implements Command {\n name = 'fork <source-component-id> [target-component-name]';\n description = 'EXPERIMENTAL. create a new component out of an existing one (copies source files and config)';\n arguments = [\n { name: 'source-component-id', description: 'the component id of the source component' },\n {\n name: 'target-component-name',\n description:\n \"the name for the new component (component name without scope). to set a different scope, use the '--scope' flag\",\n },\n ];\n group = 'collaborate';\n skipWorkspace = true;\n alias = '';\n\n options = [\n ['s', 'scope <string>', 'default scope for the new component'],\n [\n 'p',\n 'path <string>',\n 'relative path in the workspace for the new component. by default the path is `<scope>/<namespace>/<name>`',\n ],\n ['r', 'refactor', 'update the import/require statements in all dependent components (in the same workspace)'],\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ] as CommandOptions;\n\n example: [\n {\n cmd: 'fork teambit.base-ui/input/button ui/button';\n description: \"create a component named 'ui/button' out of the remote 'input/button' component\";\n }\n ];\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAWO,MAAMA,OAAN,CAAiC;EAoCtCC,WAAW,CAASC,OAAT,EAA+B;IAAA,KAAtBA,OAAsB,GAAtBA,OAAsB;IAAA,8CAnCnC,oDAmCmC;IAAA,qDAlC5B,8FAkC4B;IAAA,mDAjC9B,CACV;MAAEC,IAAI,EAAE,qBAAR;MAA+BC,WAAW,EAAE;IAA5C,CADU,EAEV;MACED,IAAI,EAAE,uBADR;MAEEC,WAAW,EACT;IAHJ,CAFU,CAiC8B;IAAA,+CAzBlC,aAyBkC;IAAA,uDAxB1B,IAwB0B;IAAA,+CAvBlC,EAuBkC;IAAA,iDArBhC,CACR,CAAC,GAAD,EAAM,gBAAN,EAAwB,qCAAxB,CADQ,EAER,CACE,GADF,EAEE,eAFF,EAGE,2GAHF,CAFQ,EAOR,CAAC,GAAD,EAAM,UAAN,EAAkB,0FAAlB,CAPQ,EAQR,CAAC,EAAD,EAAK,8BAAL,EAAqC,oDAArC,CARQ,CAqBgC;IAAA;IAAA,gDAJjC,IAIiC;IAAA,mDAH9B,IAG8B;IAAA,kDAF/B,IAE+B;EAAE;;EAEhC,MAANC,MAAM,CAAC,CAACC,QAAD,EAAWC,QAAX,CAAD,EAAyCC,OAAzC,EAAgF;IAC1F,MAAMC,OAAO,GAAG,MAAM,KAAKP,OAAL,CAAaQ,IAAb,CAAkBJ,QAAlB,EAA4BC,QAA5B,EAAsCC,OAAtC,CAAtB;IACA,MAAMG,WAAW,GAAGF,OAAO,CAACG,QAAR,EAApB;IACA,OAAOC,gBAAA,CAAMC,KAAN,CAAa,uBAAsBD,gBAAA,CAAME,IAAN,CAAWJ,WAAX,CAAwB,SAAQE,gBAAA,CAAME,IAAN,CAAWT,QAAX,CAAqB,EAAxF,CAAP;EACD;;AA1CqC"}
1
+ {"version":3,"names":["ForkCmd","constructor","forking","name","description","report","sourceId","targetId","options","results","fork","targetIdStr","toString","chalk","green","bold"],"sources":["fork.cmd.ts"],"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 refactor?: boolean;\n skipDependencyInstallation?: boolean;\n};\n\nexport class ForkCmd implements Command {\n name = 'fork <source-component-id> [target-component-name]';\n description = 'EXPERIMENTAL. create a new component out of an existing one (copies source files and config)';\n arguments = [\n { name: 'source-component-id', description: 'the component id of the source component' },\n {\n name: 'target-component-name',\n description:\n \"the name for the new component (component name without scope). to set a different scope, use the '--scope' flag\",\n },\n ];\n group = 'collaborate';\n skipWorkspace = true;\n alias = '';\n\n options = [\n ['s', 'scope <string>', 'default scope for the new component'],\n [\n 'p',\n 'path <string>',\n 'relative path in the workspace for the new component. by default the path is `<scope>/<namespace>/<name>`',\n ],\n ['r', 'refactor', 'update the import/require statements in all dependent components (in the same workspace)'],\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ] as CommandOptions;\n\n example: [\n {\n cmd: 'fork teambit.base-ui/input/button ui/button';\n description: \"create a component named 'ui/button' out of the remote 'input/button' component\";\n }\n ];\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"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAWO,MAAMA,OAAO,CAAoB;EAoCtCC,WAAW,CAASC,OAAoB,EAAE;IAAA,KAAtBA,OAAoB,GAApBA,OAAoB;IAAA,8CAnCjC,oDAAoD;IAAA,qDAC7C,8FAA8F;IAAA,mDAChG,CACV;MAAEC,IAAI,EAAE,qBAAqB;MAAEC,WAAW,EAAE;IAA2C,CAAC,EACxF;MACED,IAAI,EAAE,uBAAuB;MAC7BC,WAAW,EACT;IACJ,CAAC,CACF;IAAA,+CACO,aAAa;IAAA,uDACL,IAAI;IAAA,+CACZ,EAAE;IAAA,iDAEA,CACR,CAAC,GAAG,EAAE,gBAAgB,EAAE,qCAAqC,CAAC,EAC9D,CACE,GAAG,EACH,eAAe,EACf,2GAA2G,CAC5G,EACD,CAAC,GAAG,EAAE,UAAU,EAAE,0FAA0F,CAAC,EAC7G,CAAC,EAAE,EAAE,8BAA8B,EAAE,oDAAoD,CAAC,CAC3F;IAAA;IAAA,gDAQQ,IAAI;IAAA,mDACD,IAAI;IAAA,kDACL,IAAI;EAE4B;EAE3C,MAAMC,MAAM,CAAC,CAACC,QAAQ,EAAEC,QAAQ,CAAmB,EAAEC,OAAoB,EAAmB;IAC1F,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACP,OAAO,CAACQ,IAAI,CAACJ,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,CAAC;IACpE,MAAMG,WAAW,GAAGF,OAAO,CAACG,QAAQ,EAAE;IACtC,OAAOC,gBAAK,CAACC,KAAK,CAAE,uBAAsBD,gBAAK,CAACE,IAAI,CAACJ,WAAW,CAAE,SAAQE,gBAAK,CAACE,IAAI,CAACT,QAAQ,CAAE,EAAC,CAAC;EACnG;AACF;AAAC"}
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ForkingAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const ForkingAspect = _harmony().Aspect.create({
19
15
  id: 'teambit.component/forking'
20
16
  });
21
-
22
17
  exports.ForkingAspect = ForkingAspect;
23
18
 
24
19
  //# sourceMappingURL=forking.aspect.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ForkingAspect","Aspect","create","id"],"sources":["forking.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const ForkingAspect = Aspect.create({\n id: 'teambit.component/forking',\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,aAAa,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EACzCC,EAAE,EAAE;AADqC,CAAd,CAAtB"}
1
+ {"version":3,"names":["ForkingAspect","Aspect","create","id"],"sources":["forking.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const ForkingAspect = Aspect.create({\n id: 'teambit.component/forking',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,aAAa,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACzCC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Logo = void 0;
9
-
10
8
  function _react() {
11
9
  const data = _interopRequireDefault(require("react"));
12
-
13
10
  _react = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/forking.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=forking.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["forking.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/forking.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["forking.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/forking.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAqD,EAAG,CAE1F;AAAC"}
@@ -1,31 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.promise.js");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.ForkingFragment = void 0;
11
-
12
9
  function _defineProperty2() {
13
10
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
-
15
11
  _defineProperty2 = function () {
16
12
  return data;
17
13
  };
18
-
19
14
  return data;
20
15
  }
21
-
22
16
  class ForkingFragment {
23
17
  constructor(forking) {
24
18
  this.forking = forking;
25
19
  (0, _defineProperty2().default)(this, "title", 'forking');
26
20
  (0, _defineProperty2().default)(this, "weight", 3);
27
21
  }
28
-
29
22
  async renderRow(component) {
30
23
  const forkingInfo = this.forking.getForkInfo(component);
31
24
  const content = forkingInfo ? `origin: ${forkingInfo.forkedFrom.toString()}` : '';
@@ -34,16 +27,13 @@ class ForkingFragment {
34
27
  content
35
28
  };
36
29
  }
37
-
38
30
  async json(component) {
39
31
  return {
40
32
  title: this.title,
41
33
  json: this.forking.getForkInfo(component)
42
34
  };
43
35
  }
44
-
45
36
  }
46
-
47
37
  exports.ForkingFragment = ForkingFragment;
48
38
 
49
39
  //# sourceMappingURL=forking.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ForkingFragment","constructor","forking","renderRow","component","forkingInfo","getForkInfo","content","forkedFrom","toString","title","json"],"sources":["forking.fragment.ts"],"sourcesContent":["import { Component, ShowFragment } from '@teambit/component';\nimport { ForkingMain } from './forking.main.runtime';\n\nexport class ForkingFragment implements ShowFragment {\n constructor(private forking: ForkingMain) {}\n\n title = 'forking';\n\n async renderRow(component: Component) {\n const forkingInfo = this.forking.getForkInfo(component);\n const content = forkingInfo ? `origin: ${forkingInfo.forkedFrom.toString()}` : '';\n return {\n title: this.title,\n content,\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: this.forking.getForkInfo(component),\n };\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGO,MAAMA,eAAN,CAA8C;EACnDC,WAAW,CAASC,OAAT,EAA+B;IAAA,KAAtBA,OAAsB,GAAtBA,OAAsB;IAAA,+CAElC,SAFkC;IAAA,gDAoBjC,CApBiC;EAAE;;EAI7B,MAATC,SAAS,CAACC,SAAD,EAAuB;IACpC,MAAMC,WAAW,GAAG,KAAKH,OAAL,CAAaI,WAAb,CAAyBF,SAAzB,CAApB;IACA,MAAMG,OAAO,GAAGF,WAAW,GAAI,WAAUA,WAAW,CAACG,UAAZ,CAAuBC,QAAvB,EAAkC,EAAhD,GAAoD,EAA/E;IACA,OAAO;MACLC,KAAK,EAAE,KAAKA,KADP;MAELH;IAFK,CAAP;EAID;;EAES,MAAJI,IAAI,CAACP,SAAD,EAAuB;IAC/B,OAAO;MACLM,KAAK,EAAE,KAAKA,KADP;MAELC,IAAI,EAAE,KAAKT,OAAL,CAAaI,WAAb,CAAyBF,SAAzB;IAFD,CAAP;EAID;;AAnBkD"}
1
+ {"version":3,"names":["ForkingFragment","constructor","forking","renderRow","component","forkingInfo","getForkInfo","content","forkedFrom","toString","title","json"],"sources":["forking.fragment.ts"],"sourcesContent":["import { Component, ShowFragment } from '@teambit/component';\nimport { ForkingMain } from './forking.main.runtime';\n\nexport class ForkingFragment implements ShowFragment {\n constructor(private forking: ForkingMain) {}\n\n title = 'forking';\n\n async renderRow(component: Component) {\n const forkingInfo = this.forking.getForkInfo(component);\n const content = forkingInfo ? `origin: ${forkingInfo.forkedFrom.toString()}` : '';\n return {\n title: this.title,\n content,\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: this.forking.getForkInfo(component),\n };\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGO,MAAMA,eAAe,CAAyB;EACnDC,WAAW,CAASC,OAAoB,EAAE;IAAA,KAAtBA,OAAoB,GAApBA,OAAoB;IAAA,+CAEhC,SAAS;IAAA,gDAkBR,CAAC;EApBiC;EAI3C,MAAMC,SAAS,CAACC,SAAoB,EAAE;IACpC,MAAMC,WAAW,GAAG,IAAI,CAACH,OAAO,CAACI,WAAW,CAACF,SAAS,CAAC;IACvD,MAAMG,OAAO,GAAGF,WAAW,GAAI,WAAUA,WAAW,CAACG,UAAU,CAACC,QAAQ,EAAG,EAAC,GAAG,EAAE;IACjF,OAAO;MACLC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBH;IACF,CAAC;EACH;EAEA,MAAMI,IAAI,CAACP,SAAoB,EAAE;IAC/B,OAAO;MACLM,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,IAAI,EAAE,IAAI,CAACT,OAAO,CAACI,WAAW,CAACF,SAAS;IAC1C,CAAC;EACH;AAGF;AAAC"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.forkingSchema = forkingSchema;
9
-
10
8
  function _graphqlTag() {
11
9
  const data = _interopRequireDefault(require("graphql-tag"));
12
-
13
10
  _graphqlTag = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  function forkingSchema(forking) {
21
16
  return {
22
17
  typeDefs: (0, _graphqlTag().default)`
@@ -1 +1 @@
1
- {"version":3,"names":["forkingSchema","forking","typeDefs","gql","resolvers","Component","component","forkInfo","getForkInfo","forkedFrom","toString"],"sources":["forking.graphql.ts"],"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"],"mappings":";;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,SAASA,aAAT,CAAuBC,OAAvB,EAAqD;EAC1D,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAA,CAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KATS;IAULC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTJ,OAAO,EAAGK,SAAD,IAA0B;UACjC,MAAMC,QAAQ,GAAGN,OAAO,CAACO,WAAR,CAAoBF,SAApB,CAAjB;UACA,OAAO;YACLG,UAAU,EAAEF,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEE,UAAV,CAAqBC,QAArB;UADP,CAAP;QAGD;MANQ;IADF;EAVN,CAAP;AAqBD"}
1
+ {"version":3,"names":["forkingSchema","forking","typeDefs","gql","resolvers","Component","component","forkInfo","getForkInfo","forkedFrom","toString"],"sources":["forking.graphql.ts"],"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"],"mappings":";;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,SAASA,aAAa,CAACC,OAAoB,EAAU;EAC1D,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTJ,OAAO,EAAGK,SAAoB,IAAK;UACjC,MAAMC,QAAQ,GAAGN,OAAO,CAACO,WAAW,CAACF,SAAS,CAAC;UAC/C,OAAO;YACLG,UAAU,EAAEF,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,UAAU,CAACC,QAAQ;UAC3C,CAAC;QACH;MACF;IACF;EACF,CAAC;AACH"}
@@ -1,242 +1,167 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.flat.js");
6
-
7
5
  require("core-js/modules/es.array.iterator.js");
8
-
9
6
  require("core-js/modules/es.array.unscopables.flat.js");
10
-
11
7
  require("core-js/modules/es.promise.js");
12
-
13
8
  require("core-js/modules/es.regexp.exec.js");
14
-
15
9
  require("core-js/modules/es.string.replace.js");
16
-
17
10
  Object.defineProperty(exports, "__esModule", {
18
11
  value: true
19
12
  });
20
13
  exports.ForkingMain = void 0;
21
-
22
14
  function _defineProperty2() {
23
15
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
24
-
25
16
  _defineProperty2 = function () {
26
17
  return data;
27
18
  };
28
-
29
19
  return data;
30
20
  }
31
-
32
21
  function _cli() {
33
22
  const data = require("@teambit/cli");
34
-
35
23
  _cli = function () {
36
24
  return data;
37
25
  };
38
-
39
26
  return data;
40
27
  }
41
-
42
28
  function _dependencyResolver() {
43
29
  const data = require("@teambit/dependency-resolver");
44
-
45
30
  _dependencyResolver = function () {
46
31
  return data;
47
32
  };
48
-
49
33
  return data;
50
34
  }
51
-
52
35
  function _legacyBitId() {
53
36
  const data = require("@teambit/legacy-bit-id");
54
-
55
37
  _legacyBitId = function () {
56
38
  return data;
57
39
  };
58
-
59
40
  return data;
60
41
  }
61
-
62
42
  function _workspace() {
63
43
  const data = _interopRequireDefault(require("@teambit/workspace"));
64
-
65
44
  _workspace = function () {
66
45
  return data;
67
46
  };
68
-
69
47
  return data;
70
48
  }
71
-
72
49
  function _bitId() {
73
50
  const data = require("@teambit/legacy/dist/bit-id");
74
-
75
51
  _bitId = function () {
76
52
  return data;
77
53
  };
78
-
79
54
  return data;
80
55
  }
81
-
82
56
  function _exceptions() {
83
57
  const data = require("@teambit/legacy/dist/consumer/exceptions");
84
-
85
58
  _exceptions = function () {
86
59
  return data;
87
60
  };
88
-
89
61
  return data;
90
62
  }
91
-
92
63
  function _lodash() {
93
64
  const data = require("lodash");
94
-
95
65
  _lodash = function () {
96
66
  return data;
97
67
  };
98
-
99
68
  return data;
100
69
  }
101
-
102
70
  function _component() {
103
71
  const data = _interopRequireWildcard(require("@teambit/component"));
104
-
105
72
  _component = function () {
106
73
  return data;
107
74
  };
108
-
109
75
  return data;
110
76
  }
111
-
112
77
  function _graphql() {
113
78
  const data = _interopRequireDefault(require("@teambit/graphql"));
114
-
115
79
  _graphql = function () {
116
80
  return data;
117
81
  };
118
-
119
82
  return data;
120
83
  }
121
-
122
84
  function _refactoring() {
123
85
  const data = _interopRequireDefault(require("@teambit/refactoring"));
124
-
125
86
  _refactoring = function () {
126
87
  return data;
127
88
  };
128
-
129
89
  return data;
130
90
  }
131
-
132
91
  function _pMapSeries() {
133
92
  const data = _interopRequireDefault(require("p-map-series"));
134
-
135
93
  _pMapSeries = function () {
136
94
  return data;
137
95
  };
138
-
139
96
  return data;
140
97
  }
141
-
142
98
  function _pkg() {
143
99
  const data = _interopRequireDefault(require("@teambit/pkg"));
144
-
145
100
  _pkg = function () {
146
101
  return data;
147
102
  };
148
-
149
103
  return data;
150
104
  }
151
-
152
105
  function _bitError() {
153
106
  const data = require("@teambit/bit-error");
154
-
155
107
  _bitError = function () {
156
108
  return data;
157
109
  };
158
-
159
110
  return data;
160
111
  }
161
-
162
112
  function _newComponentHelper() {
163
113
  const data = _interopRequireDefault(require("@teambit/new-component-helper"));
164
-
165
114
  _newComponentHelper = function () {
166
115
  return data;
167
116
  };
168
-
169
117
  return data;
170
118
  }
171
-
172
119
  function _install() {
173
120
  const data = require("@teambit/install");
174
-
175
121
  _install = function () {
176
122
  return data;
177
123
  };
178
-
179
124
  return data;
180
125
  }
181
-
182
126
  function _fork() {
183
127
  const data = require("./fork.cmd");
184
-
185
128
  _fork = function () {
186
129
  return data;
187
130
  };
188
-
189
131
  return data;
190
132
  }
191
-
192
133
  function _forking() {
193
134
  const data = require("./forking.aspect");
194
-
195
135
  _forking = function () {
196
136
  return data;
197
137
  };
198
-
199
138
  return data;
200
139
  }
201
-
202
140
  function _forking2() {
203
141
  const data = require("./forking.fragment");
204
-
205
142
  _forking2 = function () {
206
143
  return data;
207
144
  };
208
-
209
145
  return data;
210
146
  }
211
-
212
147
  function _forking3() {
213
148
  const data = require("./forking.graphql");
214
-
215
149
  _forking3 = function () {
216
150
  return data;
217
151
  };
218
-
219
152
  return data;
220
153
  }
221
-
222
154
  function _scopeFork() {
223
155
  const data = require("./scope-fork.cmd");
224
-
225
156
  _scopeFork = function () {
226
157
  return data;
227
158
  };
228
-
229
159
  return data;
230
160
  }
231
-
232
161
  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); }
233
-
234
162
  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; }
235
-
236
163
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
237
-
238
164
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
239
-
240
165
  class ForkingMain {
241
166
  constructor(workspace, install, dependencyResolver, newComponentHelper, refactoring, pkg) {
242
167
  this.workspace = workspace;
@@ -246,23 +171,20 @@ class ForkingMain {
246
171
  this.refactoring = refactoring;
247
172
  this.pkg = pkg;
248
173
  }
174
+
249
175
  /**
250
176
  * create a new copy of existing/remote component.
251
177
  * the new component holds a reference to the old one for future reference.
252
178
  * if refactor option is enable, change the source-code to update all dependencies with the new name.
253
179
  */
254
-
255
-
256
180
  async fork(sourceId, targetId, options) {
257
181
  if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
258
182
  const sourceCompId = await this.workspace.resolveComponentId(sourceId);
259
183
  const exists = this.workspace.exists(sourceCompId);
260
-
261
184
  if (exists) {
262
185
  const existingInWorkspace = await this.workspace.get(sourceCompId);
263
186
  return this.forkExistingInWorkspace(existingInWorkspace, targetId, options);
264
187
  }
265
-
266
188
  const sourceIdWithScope = sourceCompId._legacy.scope ? sourceCompId : _component().ComponentID.fromLegacy(_legacyBitId().BitId.parse(sourceId, true));
267
189
  const {
268
190
  targetCompId,
@@ -272,21 +194,18 @@ class ForkingMain {
272
194
  if (!(options !== null && options !== void 0 && options.skipDependencyInstallation)) await this.installDeps();
273
195
  return targetCompId;
274
196
  }
197
+
275
198
  /**
276
199
  * get the forking data, such as the source where a component was forked from
277
200
  */
278
-
279
-
280
201
  getForkInfo(component) {
281
202
  var _component$state$aspe;
282
-
283
203
  const forkConfig = (_component$state$aspe = component.state.aspects.get(_forking().ForkingAspect.id)) === null || _component$state$aspe === void 0 ? void 0 : _component$state$aspe.config;
284
204
  if (!forkConfig) return null;
285
205
  return {
286
206
  forkedFrom: _component().ComponentID.fromObject(forkConfig.forkedFrom)
287
207
  };
288
208
  }
289
-
290
209
  async forkMultipleFromRemote(componentsToFork, options = {}) {
291
210
  const {
292
211
  scope
@@ -313,7 +232,6 @@ class ForkingMain {
313
232
  });
314
233
  await this.refactorMultipleAndInstall(results, options);
315
234
  }
316
-
317
235
  async refactorMultipleAndInstall(results, options = {}) {
318
236
  const oldPackages = [];
319
237
  const stringsToReplace = results.map(({
@@ -335,14 +253,12 @@ class ForkingMain {
335
253
  }];
336
254
  }).flat();
337
255
  const allComponents = await this.workspace.list();
338
-
339
256
  if (options.refactor) {
340
257
  const {
341
258
  changedComponents
342
259
  } = await this.refactoring.replaceMultipleStrings(allComponents, stringsToReplace);
343
260
  await Promise.all(changedComponents.map(comp => this.workspace.write(comp)));
344
261
  }
345
-
346
262
  const forkedComponents = results.map(result => result.component);
347
263
  const policy = await Promise.all(forkedComponents.map(comp => this.extractDeps(comp)));
348
264
  const policyFlatAndUnique = (0, _lodash().uniqBy)(policy.flat(), 'dependencyId');
@@ -351,30 +267,23 @@ class ForkingMain {
351
267
  updateExisting: true
352
268
  });
353
269
  await this.dependencyResolver.persistConfig(this.workspace.path);
354
-
355
270
  if (options.install) {
356
271
  await this.installDeps();
357
272
  }
358
273
  }
274
+
359
275
  /**
360
276
  * fork all components of the given scope
361
277
  */
362
-
363
-
364
278
  async forkScope(originalScope, newScope) {
365
279
  const idsFromOriginalScope = await this.workspace.scope.listRemoteScope(originalScope);
366
-
367
280
  if (!idsFromOriginalScope.length) {
368
281
  throw new Error(`unable to find components to fork from ${originalScope}`);
369
282
  }
370
-
371
283
  const workspaceIds = await this.workspace.listIds();
372
-
373
284
  const workspaceBitIds = _bitId().BitIds.fromArray(workspaceIds.map(id => id._legacy));
374
-
375
285
  idsFromOriginalScope.forEach(id => {
376
286
  const existInWorkspace = workspaceBitIds.searchWithoutScopeAndVersion(id._legacy);
377
-
378
287
  if (existInWorkspace) {
379
288
  throw new Error(`unable to fork "${id.toString()}". the workspace has a component "${existInWorkspace.toString()}" with the same name`);
380
289
  }
@@ -383,11 +292,9 @@ class ForkingMain {
383
292
  const components = await this.workspace.scope.getManyRemoteComponents(idsFromOriginalScope);
384
293
  await (0, _pMapSeries().default)(components, async component => {
385
294
  const config = await this.getConfig(component);
386
-
387
295
  const targetCompId = _component().ComponentID.fromObject({
388
296
  name: component.id.fullName
389
297
  }, newScope);
390
-
391
298
  await this.newComponentHelper.writeAndAddNewComp(component, targetCompId, {
392
299
  scope: newScope
393
300
  }, config);
@@ -403,17 +310,14 @@ class ForkingMain {
403
310
  });
404
311
  return multipleForkInfo.map(info => info.targetCompId);
405
312
  }
406
-
407
313
  async forkExistingInWorkspace(existing, targetId, options) {
408
314
  if (!targetId) {
409
315
  throw new Error(`error: unable to create "${existing.id.toStringWithoutVersion()}" component, a component with the same name already exists.
410
316
  please specify the target-id arg`);
411
317
  }
412
-
413
318
  const targetCompId = this.newComponentHelper.getNewComponentId(targetId, undefined, options === null || options === void 0 ? void 0 : options.scope);
414
319
  const config = await this.getConfig(existing);
415
320
  await this.newComponentHelper.writeAndAddNewComp(existing, targetCompId, options, config);
416
-
417
321
  if (options !== null && options !== void 0 && options.refactor) {
418
322
  const allComponents = await this.workspace.list();
419
323
  const {
@@ -421,16 +325,13 @@ please specify the target-id arg`);
421
325
  } = await this.refactoring.refactorDependencyName(allComponents, existing.id, targetId);
422
326
  await Promise.all(changedComponents.map(comp => this.workspace.write(comp)));
423
327
  }
424
-
425
328
  return targetCompId;
426
329
  }
427
-
428
330
  async forkRemoteComponent(sourceId, targetId, options) {
429
331
  if (options !== null && options !== void 0 && options.refactor) {
430
332
  throw new (_bitError().BitError)(`the component ${sourceId.toStringWithoutVersion()} is not in the workspace, you can't use the --refactor flag.
431
333
  the reason is that the refactor changes the components using ${sourceId.toStringWithoutVersion()}, since it's not in the workspace, no components were using it, so nothing to refactor`);
432
334
  }
433
-
434
335
  const targetName = targetId || sourceId.fullName;
435
336
  const targetCompId = this.newComponentHelper.getNewComponentId(targetName, undefined, options === null || options === void 0 ? void 0 : options.scope);
436
337
  const component = await this.workspace.scope.getRemoteComponent(sourceId);
@@ -445,7 +346,6 @@ the reason is that the refactor changes the components using ${sourceId.toString
445
346
  component
446
347
  };
447
348
  }
448
-
449
349
  async saveDeps(component) {
450
350
  const workspacePolicyEntries = await this.extractDeps(component);
451
351
  this.dependencyResolver.addToRootPolicy(workspacePolicyEntries, {
@@ -453,7 +353,6 @@ the reason is that the refactor changes the components using ${sourceId.toString
453
353
  });
454
354
  await this.dependencyResolver.persistConfig(this.workspace.path);
455
355
  }
456
-
457
356
  async installDeps() {
458
357
  await this.install.install(undefined, {
459
358
  dedupe: true,
@@ -463,12 +362,10 @@ the reason is that the refactor changes the components using ${sourceId.toString
463
362
  updateExisting: false
464
363
  });
465
364
  }
466
-
467
365
  async extractDeps(component) {
468
366
  const deps = await this.dependencyResolver.getDependencies(component);
469
367
  return deps.filter(dep => dep.source === 'auto').map(dep => {
470
368
  var _dep$getPackageName;
471
-
472
369
  return {
473
370
  dependencyId: ((_dep$getPackageName = dep.getPackageName) === null || _dep$getPackageName === void 0 ? void 0 : _dep$getPackageName.call(dep)) || dep.id,
474
371
  lifecycleType: dep.lifecycle === 'dev' ? 'runtime' : dep.lifecycle,
@@ -478,7 +375,6 @@ the reason is that the refactor changes the components using ${sourceId.toString
478
375
  };
479
376
  });
480
377
  }
481
-
482
378
  async getConfig(comp) {
483
379
  const fromExisting = await this.newComponentHelper.getConfigFromExistingToNewComponent(comp);
484
380
  return _objectSpread(_objectSpread({}, fromExisting), {}, {
@@ -487,10 +383,8 @@ the reason is that the refactor changes the components using ${sourceId.toString
487
383
  }
488
384
  });
489
385
  }
490
-
491
386
  static async provider([cli, workspace, dependencyResolver, componentMain, newComponentHelper, graphql, refactoring, pkg, install]) {
492
387
  var _scopeCommand$command;
493
-
494
388
  const forkingMain = new ForkingMain(workspace, install, dependencyResolver, newComponentHelper, refactoring, pkg);
495
389
  cli.register(new (_fork().ForkCmd)(forkingMain));
496
390
  graphql.register((0, _forking3().forkingSchema)(forkingMain));
@@ -499,14 +393,11 @@ the reason is that the refactor changes the components using ${sourceId.toString
499
393
  scopeCommand === null || scopeCommand === void 0 ? void 0 : (_scopeCommand$command = scopeCommand.commands) === null || _scopeCommand$command === void 0 ? void 0 : _scopeCommand$command.push(new (_scopeFork().ScopeForkCmd)(forkingMain));
500
394
  return forkingMain;
501
395
  }
502
-
503
396
  }
504
-
505
397
  exports.ForkingMain = ForkingMain;
506
398
  (0, _defineProperty2().default)(ForkingMain, "slots", []);
507
399
  (0, _defineProperty2().default)(ForkingMain, "dependencies", [_cli().CLIAspect, _workspace().default, _dependencyResolver().DependencyResolverAspect, _component().default, _newComponentHelper().default, _graphql().default, _refactoring().default, _pkg().default, _install().InstallAspect]);
508
400
  (0, _defineProperty2().default)(ForkingMain, "runtime", _cli().MainRuntime);
509
-
510
401
  _forking().ForkingAspect.addRuntime(ForkingMain);
511
402
 
512
403
  //# sourceMappingURL=forking.main.runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ForkingMain","constructor","workspace","install","dependencyResolver","newComponentHelper","refactoring","pkg","fork","sourceId","targetId","options","ConsumerNotFound","sourceCompId","resolveComponentId","exists","existingInWorkspace","get","forkExistingInWorkspace","sourceIdWithScope","_legacy","scope","ComponentID","fromLegacy","BitId","parse","targetCompId","component","forkRemoteComponent","saveDeps","skipDependencyInstallation","installDeps","getForkInfo","forkConfig","state","aspects","ForkingAspect","id","config","forkedFrom","fromObject","forkMultipleFromRemote","componentsToFork","results","pMapSeries","path","refactorMultipleAndInstall","oldPackages","stringsToReplace","map","oldPackageName","getPackageName","push","newName","fullName","replace","scopeToReplace","newPackageName","oldStr","newStr","toStringWithoutVersion","flat","allComponents","list","refactor","changedComponents","replaceMultipleStrings","Promise","all","comp","write","forkedComponents","result","policy","extractDeps","policyFlatAndUnique","uniqBy","policyWithoutWorkspaceComps","filter","dep","includes","dependencyId","addToRootPolicy","updateExisting","persistConfig","forkScope","originalScope","newScope","idsFromOriginalScope","listRemoteScope","length","Error","workspaceIds","listIds","workspaceBitIds","BitIds","fromArray","forEach","existInWorkspace","searchWithoutScopeAndVersion","toString","multipleForkInfo","components","getManyRemoteComponents","getConfig","name","writeAndAddNewComp","info","existing","getNewComponentId","undefined","refactorDependencyName","BitError","targetName","getRemoteComponent","workspacePolicyEntries","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","deps","getDependencies","source","lifecycleType","lifecycle","value","version","fromExisting","getConfigFromExistingToNewComponent","toObject","provider","cli","componentMain","graphql","forkingMain","register","ForkCmd","forkingSchema","registerShowFragments","ForkingFragment","scopeCommand","getCommand","commands","ScopeForkCmd","CLIAspect","WorkspaceAspect","DependencyResolverAspect","ComponentAspect","NewComponentHelperAspect","GraphqlAspect","RefactoringAspect","PkgAspect","InstallAspect","MainRuntime","addRuntime"],"sources":["forking.main.runtime.ts"],"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 { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport { uniqBy } from 'lodash';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { ComponentIdObj } from '@teambit/component-id';\nimport GraphqlAspect, { GraphqlMain } from '@teambit/graphql';\nimport RefactoringAspect, { MultipleStringsReplacement, RefactoringMain } from '@teambit/refactoring';\nimport pMapSeries from 'p-map-series';\nimport PkgAspect, { PkgMain } from '@teambit/pkg';\nimport { BitError } from '@teambit/bit-error';\nimport NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { ForkCmd, ForkOptions } from './fork.cmd';\nimport { ForkingAspect } from './forking.aspect';\nimport { ForkingFragment } from './forking.fragment';\nimport { forkingSchema } from './forking.graphql';\nimport { ScopeForkCmd } from './scope-fork.cmd';\n\nexport type ForkInfo = {\n forkedFrom: ComponentID;\n};\n\ntype MultipleForkInfo = {\n targetCompId: ComponentID;\n sourceId: string;\n component: Component;\n};\n\ntype MultipleComponentsToFork = Array<{\n sourceId: string;\n targetId?: string; // if not specify, it'll be the same as the source\n path?: string; // if not specify, use the default component path\n}>;\n\ntype MultipleForkOptions = {\n refactor?: boolean;\n scope?: string; // different scope-name than the original components\n install?: boolean; // whether to run \"bit install\" once done.\n};\n\nexport class ForkingMain {\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private dependencyResolver: DependencyResolverMain,\n private newComponentHelper: NewComponentHelperMain,\n private refactoring: RefactoringMain,\n private pkg: PkgMain\n ) {}\n\n /**\n * create a new copy of existing/remote component.\n * the new component holds a reference to the old one for future reference.\n * if refactor option is enable, change the source-code to update all dependencies with the new name.\n */\n async fork(sourceId: string, targetId?: string, options?: ForkOptions): Promise<ComponentID> {\n if (!this.workspace) throw new ConsumerNotFound();\n const sourceCompId = await this.workspace.resolveComponentId(sourceId);\n const exists = this.workspace.exists(sourceCompId);\n if (exists) {\n const existingInWorkspace = await this.workspace.get(sourceCompId);\n return this.forkExistingInWorkspace(existingInWorkspace, targetId, options);\n }\n const sourceIdWithScope = sourceCompId._legacy.scope\n ? sourceCompId\n : ComponentID.fromLegacy(BitId.parse(sourceId, true));\n const { targetCompId, component } = await this.forkRemoteComponent(sourceIdWithScope, targetId, options);\n await this.saveDeps(component);\n if (!options?.skipDependencyInstallation) await this.installDeps();\n return targetCompId;\n }\n\n /**\n * get the forking data, such as the source where a component was forked from\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 async forkMultipleFromRemote(componentsToFork: MultipleComponentsToFork, options: MultipleForkOptions = {}) {\n const { scope } = options;\n const results = await pMapSeries(componentsToFork, async ({ sourceId, targetId, path }) => {\n const sourceCompId = await this.workspace.resolveComponentId(sourceId);\n const sourceIdWithScope = sourceCompId._legacy.scope\n ? sourceCompId\n : ComponentID.fromLegacy(BitId.parse(sourceId, true));\n const { targetCompId, component } = await this.forkRemoteComponent(sourceIdWithScope, targetId, { scope, path });\n return { targetCompId, sourceId, component };\n });\n await this.refactorMultipleAndInstall(results, options);\n }\n\n private async refactorMultipleAndInstall(results: MultipleForkInfo[], options: MultipleForkOptions = {}) {\n const oldPackages: string[] = [];\n const stringsToReplace: MultipleStringsReplacement = results\n .map(({ targetCompId, sourceId, component }) => {\n const oldPackageName = this.pkg.getPackageName(component);\n oldPackages.push(oldPackageName);\n const newName = targetCompId.fullName.replace(/\\//g, '.');\n const scopeToReplace = targetCompId.scope.replace('.', '/');\n const newPackageName = `@${scopeToReplace}.${newName}`;\n return [\n { oldStr: oldPackageName, newStr: newPackageName },\n { oldStr: sourceId, newStr: targetCompId.toStringWithoutVersion() },\n ];\n })\n .flat();\n const allComponents = await this.workspace.list();\n if (options.refactor) {\n const { changedComponents } = await this.refactoring.replaceMultipleStrings(allComponents, stringsToReplace);\n await Promise.all(changedComponents.map((comp) => this.workspace.write(comp)));\n }\n const forkedComponents = results.map((result) => result.component);\n const policy = await Promise.all(forkedComponents.map((comp) => this.extractDeps(comp)));\n const policyFlatAndUnique = uniqBy(policy.flat(), 'dependencyId');\n const policyWithoutWorkspaceComps = policyFlatAndUnique.filter((dep) => !oldPackages.includes(dep.dependencyId));\n this.dependencyResolver.addToRootPolicy(policyWithoutWorkspaceComps, { updateExisting: true });\n await this.dependencyResolver.persistConfig(this.workspace.path);\n if (options.install) {\n await this.installDeps();\n }\n }\n\n /**\n * fork all components of the given scope\n */\n async forkScope(originalScope: string, newScope: string): Promise<ComponentID[]> {\n const idsFromOriginalScope = await this.workspace.scope.listRemoteScope(originalScope);\n if (!idsFromOriginalScope.length) {\n throw new Error(`unable to find components to fork from ${originalScope}`);\n }\n const workspaceIds = await this.workspace.listIds();\n const workspaceBitIds = BitIds.fromArray(workspaceIds.map((id) => id._legacy));\n idsFromOriginalScope.forEach((id) => {\n const existInWorkspace = workspaceBitIds.searchWithoutScopeAndVersion(id._legacy);\n if (existInWorkspace) {\n throw new Error(\n `unable to fork \"${id.toString()}\". the workspace has a component \"${existInWorkspace.toString()}\" with the same name`\n );\n }\n });\n const multipleForkInfo: MultipleForkInfo[] = [];\n const components = await this.workspace.scope.getManyRemoteComponents(idsFromOriginalScope);\n await pMapSeries(components, async (component) => {\n const config = await this.getConfig(component);\n const targetCompId = ComponentID.fromObject({ name: component.id.fullName }, newScope);\n await this.newComponentHelper.writeAndAddNewComp(component, targetCompId, { scope: newScope }, config);\n multipleForkInfo.push({ targetCompId, sourceId: component.id.toStringWithoutVersion(), component });\n });\n await this.refactorMultipleAndInstall(multipleForkInfo, { refactor: true, install: true });\n return multipleForkInfo.map((info) => info.targetCompId);\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 if (options?.refactor) {\n const allComponents = await this.workspace.list();\n const { changedComponents } = await this.refactoring.refactorDependencyName(allComponents, existing.id, targetId);\n await Promise.all(changedComponents.map((comp) => this.workspace.write(comp)));\n }\n return targetCompId;\n }\n\n private async forkRemoteComponent(\n sourceId: ComponentID,\n targetId?: string,\n options?: ForkOptions\n ): Promise<{\n targetCompId: ComponentID;\n component: Component;\n }> {\n if (options?.refactor) {\n throw new BitError(`the component ${sourceId.toStringWithoutVersion()} is not in the workspace, you can't use the --refactor flag.\nthe reason is that the refactor changes the components using ${sourceId.toStringWithoutVersion()}, since it's not in the workspace, no components were using it, so nothing to refactor`);\n }\n const targetName = targetId || sourceId.fullName;\n const targetCompId = this.newComponentHelper.getNewComponentId(targetName, undefined, options?.scope);\n const component = await this.workspace.scope.getRemoteComponent(sourceId);\n await this.refactoring.replaceMultipleStrings(\n [component],\n [\n {\n oldStr: sourceId.toStringWithoutVersion(),\n newStr: targetCompId.toStringWithoutVersion(),\n },\n ]\n );\n const config = await this.getConfig(component);\n await this.newComponentHelper.writeAndAddNewComp(component, targetCompId, options, config);\n\n return { targetCompId, component };\n }\n\n private async saveDeps(component: Component) {\n const workspacePolicyEntries = await this.extractDeps(component);\n this.dependencyResolver.addToRootPolicy(workspacePolicyEntries, { updateExisting: true });\n await this.dependencyResolver.persistConfig(this.workspace.path);\n }\n\n private async installDeps() {\n await this.install.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n }\n\n private async extractDeps(component: Component) {\n const deps = await this.dependencyResolver.getDependencies(component);\n return 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 }\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 RefactoringAspect,\n PkgAspect,\n InstallAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n dependencyResolver,\n componentMain,\n newComponentHelper,\n graphql,\n refactoring,\n pkg,\n install,\n ]: [\n CLIMain,\n Workspace,\n DependencyResolverMain,\n ComponentMain,\n NewComponentHelperMain,\n GraphqlMain,\n RefactoringMain,\n PkgMain,\n InstallMain\n ]) {\n const forkingMain = new ForkingMain(workspace, install, dependencyResolver, newComponentHelper, refactoring, pkg);\n cli.register(new ForkCmd(forkingMain));\n graphql.register(forkingSchema(forkingMain));\n componentMain.registerShowFragments([new ForkingFragment(forkingMain)]);\n\n const scopeCommand = cli.getCommand('scope');\n scopeCommand?.commands?.push(new ScopeForkCmd(forkingMain));\n\n return forkingMain;\n }\n}\n\nForkingAspect.addRuntime(ForkingMain);\n\nexport type ForkConfig = {\n forkedFrom: ComponentIdObj;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;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,CAA7B;IAEA,OAAOA,WAAP;EACD;;AAtPsB;;;gCAAZtI,W,WA2MI,E;gCA3MJA,W,kBA4MW,CACpBgJ,gBADoB,EAEpBC,oBAFoB,EAGpBC,8CAHoB,EAIpBC,oBAJoB,EAKpBC,6BALoB,EAMpBC,kBANoB,EAOpBC,sBAPoB,EAQpBC,cARoB,EASpBC,wBAToB,C;gCA5MXxJ,W,aAuNMyJ,kB;;AAkCnBrH,wBAAA,CAAcsH,UAAd,CAAyB1J,WAAzB"}
1
+ {"version":3,"names":["ForkingMain","constructor","workspace","install","dependencyResolver","newComponentHelper","refactoring","pkg","fork","sourceId","targetId","options","ConsumerNotFound","sourceCompId","resolveComponentId","exists","existingInWorkspace","get","forkExistingInWorkspace","sourceIdWithScope","_legacy","scope","ComponentID","fromLegacy","BitId","parse","targetCompId","component","forkRemoteComponent","saveDeps","skipDependencyInstallation","installDeps","getForkInfo","forkConfig","state","aspects","ForkingAspect","id","config","forkedFrom","fromObject","forkMultipleFromRemote","componentsToFork","results","pMapSeries","path","refactorMultipleAndInstall","oldPackages","stringsToReplace","map","oldPackageName","getPackageName","push","newName","fullName","replace","scopeToReplace","newPackageName","oldStr","newStr","toStringWithoutVersion","flat","allComponents","list","refactor","changedComponents","replaceMultipleStrings","Promise","all","comp","write","forkedComponents","result","policy","extractDeps","policyFlatAndUnique","uniqBy","policyWithoutWorkspaceComps","filter","dep","includes","dependencyId","addToRootPolicy","updateExisting","persistConfig","forkScope","originalScope","newScope","idsFromOriginalScope","listRemoteScope","length","Error","workspaceIds","listIds","workspaceBitIds","BitIds","fromArray","forEach","existInWorkspace","searchWithoutScopeAndVersion","toString","multipleForkInfo","components","getManyRemoteComponents","getConfig","name","writeAndAddNewComp","info","existing","getNewComponentId","undefined","refactorDependencyName","BitError","targetName","getRemoteComponent","workspacePolicyEntries","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","deps","getDependencies","source","lifecycleType","lifecycle","value","version","fromExisting","getConfigFromExistingToNewComponent","toObject","provider","cli","componentMain","graphql","forkingMain","register","ForkCmd","forkingSchema","registerShowFragments","ForkingFragment","scopeCommand","getCommand","commands","ScopeForkCmd","CLIAspect","WorkspaceAspect","DependencyResolverAspect","ComponentAspect","NewComponentHelperAspect","GraphqlAspect","RefactoringAspect","PkgAspect","InstallAspect","MainRuntime","addRuntime"],"sources":["forking.main.runtime.ts"],"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 { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport { uniqBy } from 'lodash';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { ComponentIdObj } from '@teambit/component-id';\nimport GraphqlAspect, { GraphqlMain } from '@teambit/graphql';\nimport RefactoringAspect, { MultipleStringsReplacement, RefactoringMain } from '@teambit/refactoring';\nimport pMapSeries from 'p-map-series';\nimport PkgAspect, { PkgMain } from '@teambit/pkg';\nimport { BitError } from '@teambit/bit-error';\nimport NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { ForkCmd, ForkOptions } from './fork.cmd';\nimport { ForkingAspect } from './forking.aspect';\nimport { ForkingFragment } from './forking.fragment';\nimport { forkingSchema } from './forking.graphql';\nimport { ScopeForkCmd } from './scope-fork.cmd';\n\nexport type ForkInfo = {\n forkedFrom: ComponentID;\n};\n\ntype MultipleForkInfo = {\n targetCompId: ComponentID;\n sourceId: string;\n component: Component;\n};\n\ntype MultipleComponentsToFork = Array<{\n sourceId: string;\n targetId?: string; // if not specify, it'll be the same as the source\n path?: string; // if not specify, use the default component path\n}>;\n\ntype MultipleForkOptions = {\n refactor?: boolean;\n scope?: string; // different scope-name than the original components\n install?: boolean; // whether to run \"bit install\" once done.\n};\n\nexport class ForkingMain {\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private dependencyResolver: DependencyResolverMain,\n private newComponentHelper: NewComponentHelperMain,\n private refactoring: RefactoringMain,\n private pkg: PkgMain\n ) {}\n\n /**\n * create a new copy of existing/remote component.\n * the new component holds a reference to the old one for future reference.\n * if refactor option is enable, change the source-code to update all dependencies with the new name.\n */\n async fork(sourceId: string, targetId?: string, options?: ForkOptions): Promise<ComponentID> {\n if (!this.workspace) throw new ConsumerNotFound();\n const sourceCompId = await this.workspace.resolveComponentId(sourceId);\n const exists = this.workspace.exists(sourceCompId);\n if (exists) {\n const existingInWorkspace = await this.workspace.get(sourceCompId);\n return this.forkExistingInWorkspace(existingInWorkspace, targetId, options);\n }\n const sourceIdWithScope = sourceCompId._legacy.scope\n ? sourceCompId\n : ComponentID.fromLegacy(BitId.parse(sourceId, true));\n const { targetCompId, component } = await this.forkRemoteComponent(sourceIdWithScope, targetId, options);\n await this.saveDeps(component);\n if (!options?.skipDependencyInstallation) await this.installDeps();\n return targetCompId;\n }\n\n /**\n * get the forking data, such as the source where a component was forked from\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 async forkMultipleFromRemote(componentsToFork: MultipleComponentsToFork, options: MultipleForkOptions = {}) {\n const { scope } = options;\n const results = await pMapSeries(componentsToFork, async ({ sourceId, targetId, path }) => {\n const sourceCompId = await this.workspace.resolveComponentId(sourceId);\n const sourceIdWithScope = sourceCompId._legacy.scope\n ? sourceCompId\n : ComponentID.fromLegacy(BitId.parse(sourceId, true));\n const { targetCompId, component } = await this.forkRemoteComponent(sourceIdWithScope, targetId, { scope, path });\n return { targetCompId, sourceId, component };\n });\n await this.refactorMultipleAndInstall(results, options);\n }\n\n private async refactorMultipleAndInstall(results: MultipleForkInfo[], options: MultipleForkOptions = {}) {\n const oldPackages: string[] = [];\n const stringsToReplace: MultipleStringsReplacement = results\n .map(({ targetCompId, sourceId, component }) => {\n const oldPackageName = this.pkg.getPackageName(component);\n oldPackages.push(oldPackageName);\n const newName = targetCompId.fullName.replace(/\\//g, '.');\n const scopeToReplace = targetCompId.scope.replace('.', '/');\n const newPackageName = `@${scopeToReplace}.${newName}`;\n return [\n { oldStr: oldPackageName, newStr: newPackageName },\n { oldStr: sourceId, newStr: targetCompId.toStringWithoutVersion() },\n ];\n })\n .flat();\n const allComponents = await this.workspace.list();\n if (options.refactor) {\n const { changedComponents } = await this.refactoring.replaceMultipleStrings(allComponents, stringsToReplace);\n await Promise.all(changedComponents.map((comp) => this.workspace.write(comp)));\n }\n const forkedComponents = results.map((result) => result.component);\n const policy = await Promise.all(forkedComponents.map((comp) => this.extractDeps(comp)));\n const policyFlatAndUnique = uniqBy(policy.flat(), 'dependencyId');\n const policyWithoutWorkspaceComps = policyFlatAndUnique.filter((dep) => !oldPackages.includes(dep.dependencyId));\n this.dependencyResolver.addToRootPolicy(policyWithoutWorkspaceComps, { updateExisting: true });\n await this.dependencyResolver.persistConfig(this.workspace.path);\n if (options.install) {\n await this.installDeps();\n }\n }\n\n /**\n * fork all components of the given scope\n */\n async forkScope(originalScope: string, newScope: string): Promise<ComponentID[]> {\n const idsFromOriginalScope = await this.workspace.scope.listRemoteScope(originalScope);\n if (!idsFromOriginalScope.length) {\n throw new Error(`unable to find components to fork from ${originalScope}`);\n }\n const workspaceIds = await this.workspace.listIds();\n const workspaceBitIds = BitIds.fromArray(workspaceIds.map((id) => id._legacy));\n idsFromOriginalScope.forEach((id) => {\n const existInWorkspace = workspaceBitIds.searchWithoutScopeAndVersion(id._legacy);\n if (existInWorkspace) {\n throw new Error(\n `unable to fork \"${id.toString()}\". the workspace has a component \"${existInWorkspace.toString()}\" with the same name`\n );\n }\n });\n const multipleForkInfo: MultipleForkInfo[] = [];\n const components = await this.workspace.scope.getManyRemoteComponents(idsFromOriginalScope);\n await pMapSeries(components, async (component) => {\n const config = await this.getConfig(component);\n const targetCompId = ComponentID.fromObject({ name: component.id.fullName }, newScope);\n await this.newComponentHelper.writeAndAddNewComp(component, targetCompId, { scope: newScope }, config);\n multipleForkInfo.push({ targetCompId, sourceId: component.id.toStringWithoutVersion(), component });\n });\n await this.refactorMultipleAndInstall(multipleForkInfo, { refactor: true, install: true });\n return multipleForkInfo.map((info) => info.targetCompId);\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 if (options?.refactor) {\n const allComponents = await this.workspace.list();\n const { changedComponents } = await this.refactoring.refactorDependencyName(allComponents, existing.id, targetId);\n await Promise.all(changedComponents.map((comp) => this.workspace.write(comp)));\n }\n return targetCompId;\n }\n\n private async forkRemoteComponent(\n sourceId: ComponentID,\n targetId?: string,\n options?: ForkOptions\n ): Promise<{\n targetCompId: ComponentID;\n component: Component;\n }> {\n if (options?.refactor) {\n throw new BitError(`the component ${sourceId.toStringWithoutVersion()} is not in the workspace, you can't use the --refactor flag.\nthe reason is that the refactor changes the components using ${sourceId.toStringWithoutVersion()}, since it's not in the workspace, no components were using it, so nothing to refactor`);\n }\n const targetName = targetId || sourceId.fullName;\n const targetCompId = this.newComponentHelper.getNewComponentId(targetName, undefined, options?.scope);\n const component = await this.workspace.scope.getRemoteComponent(sourceId);\n await this.refactoring.replaceMultipleStrings(\n [component],\n [\n {\n oldStr: sourceId.toStringWithoutVersion(),\n newStr: targetCompId.toStringWithoutVersion(),\n },\n ]\n );\n const config = await this.getConfig(component);\n await this.newComponentHelper.writeAndAddNewComp(component, targetCompId, options, config);\n\n return { targetCompId, component };\n }\n\n private async saveDeps(component: Component) {\n const workspacePolicyEntries = await this.extractDeps(component);\n this.dependencyResolver.addToRootPolicy(workspacePolicyEntries, { updateExisting: true });\n await this.dependencyResolver.persistConfig(this.workspace.path);\n }\n\n private async installDeps() {\n await this.install.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n }\n\n private async extractDeps(component: Component) {\n const deps = await this.dependencyResolver.getDependencies(component);\n return 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 }\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 RefactoringAspect,\n PkgAspect,\n InstallAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n dependencyResolver,\n componentMain,\n newComponentHelper,\n graphql,\n refactoring,\n pkg,\n install,\n ]: [\n CLIMain,\n Workspace,\n DependencyResolverMain,\n ComponentMain,\n NewComponentHelperMain,\n GraphqlMain,\n RefactoringMain,\n PkgMain,\n InstallMain\n ]) {\n const forkingMain = new ForkingMain(workspace, install, dependencyResolver, newComponentHelper, refactoring, pkg);\n cli.register(new ForkCmd(forkingMain));\n graphql.register(forkingSchema(forkingMain));\n componentMain.registerShowFragments([new ForkingFragment(forkingMain)]);\n\n const scopeCommand = cli.getCommand('scope');\n scopeCommand?.commands?.push(new ScopeForkCmd(forkingMain));\n\n return forkingMain;\n }\n}\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A,YAAY,gDAAZA,YAAY,CAAEE,QAAQ,0DAAtB,sBAAwB1F,IAAI,CAAC,KAAI2F,yBAAY,EAACT,WAAW,CAAC,CAAC;IAE3D,OAAOA,WAAW;EACpB;AACF;AAAC;AAAA,gCAvPYtI,WAAW,WA2MP,EAAE;AAAA,gCA3MNA,WAAW,kBA4MA,CACpBgJ,gBAAS,EACTC,oBAAe,EACfC,8CAAwB,EACxBC,oBAAe,EACfC,6BAAwB,EACxBC,kBAAa,EACbC,sBAAiB,EACjBC,cAAS,EACTC,wBAAa,CACd;AAAA,gCAtNUxJ,WAAW,aAuNLyJ,kBAAW;AAkC9BrH,wBAAa,CAACsH,UAAU,CAAC1J,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -10,19 +10,14 @@ Object.defineProperty(exports, "ForkingAspect", {
10
10
  }
11
11
  });
12
12
  exports.default = void 0;
13
-
14
13
  function _forking() {
15
14
  const data = require("./forking.aspect");
16
-
17
15
  _forking = function () {
18
16
  return data;
19
17
  };
20
-
21
18
  return data;
22
19
  }
23
-
24
20
  var _default = _forking().ForkingAspect;
25
-
26
21
  exports.default = _default;
27
22
 
28
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ForkingAspect"],"sources":["index.ts"],"sourcesContent":["import { ForkingAspect } from './forking.aspect';\n\nexport type { ForkingMain } from './forking.main.runtime';\nexport default ForkingAspect;\nexport { ForkingAspect };\n"],"mappings":";;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;eAGeA,wB"}
1
+ {"version":3,"names":["ForkingAspect"],"sources":["index.ts"],"sourcesContent":["import { ForkingAspect } from './forking.aspect';\n\nexport type { ForkingMain } from './forking.main.runtime';\nexport default ForkingAspect;\nexport { ForkingAspect };\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAiD,eAGlCA,wBAAa;AAAA"}
@@ -1,36 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.js");
6
-
7
5
  require("core-js/modules/es.promise.js");
8
-
9
6
  Object.defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
9
  exports.ScopeForkCmd = void 0;
13
-
14
10
  function _defineProperty2() {
15
11
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
-
17
12
  _defineProperty2 = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function _chalk() {
25
18
  const data = _interopRequireDefault(require("chalk"));
26
-
27
19
  _chalk = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  class ScopeForkCmd {
35
25
  constructor(forking) {
36
26
  this.forking = forking;
@@ -39,17 +29,12 @@ class ScopeForkCmd {
39
29
  (0, _defineProperty2().default)(this, "options", []);
40
30
  (0, _defineProperty2().default)(this, "group", 'development');
41
31
  }
42
-
43
32
  async report([originalScope, newScope]) {
44
33
  const forkedIds = await this.forking.forkScope(originalScope, newScope);
45
-
46
34
  const title = _chalk().default.green(`successfully forked ${_chalk().default.bold(originalScope)} into ${_chalk().default.bold(newScope)}. the following components were created`);
47
-
48
35
  return `${title}\n${forkedIds.map(id => id.toString()).join('\n')}`;
49
36
  }
50
-
51
37
  }
52
-
53
38
  exports.ScopeForkCmd = ScopeForkCmd;
54
39
 
55
40
  //# sourceMappingURL=scope-fork.cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ScopeForkCmd","constructor","forking","report","originalScope","newScope","forkedIds","forkScope","title","chalk","green","bold","map","id","toString","join"],"sources":["scope-fork.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { ForkingMain } from './forking.main.runtime';\n\nexport class ScopeForkCmd implements Command {\n name = 'fork <original-scope> <new-scope>';\n description = 'fork all components of the original-scope and refactor the source-code to use the new package names';\n options = [] as CommandOptions;\n group = 'development';\n\n constructor(private forking: ForkingMain) {}\n\n async report([originalScope, newScope]: [string, string]) {\n const forkedIds = await this.forking.forkScope(originalScope, newScope);\n const title = chalk.green(\n `successfully forked ${chalk.bold(originalScope)} into ${chalk.bold(\n newScope\n )}. the following components were created`\n );\n return `${title}\\n${forkedIds.map((id) => id.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,YAAN,CAAsC;EAM3CC,WAAW,CAASC,OAAT,EAA+B;IAAA,KAAtBA,OAAsB,GAAtBA,OAAsB;IAAA,8CALnC,mCAKmC;IAAA,qDAJ5B,qGAI4B;IAAA,iDAHhC,EAGgC;IAAA,+CAFlC,aAEkC;EAAE;;EAEhC,MAANC,MAAM,CAAC,CAACC,aAAD,EAAgBC,QAAhB,CAAD,EAA8C;IACxD,MAAMC,SAAS,GAAG,MAAM,KAAKJ,OAAL,CAAaK,SAAb,CAAuBH,aAAvB,EAAsCC,QAAtC,CAAxB;;IACA,MAAMG,KAAK,GAAGC,gBAAA,CAAMC,KAAN,CACX,uBAAsBD,gBAAA,CAAME,IAAN,CAAWP,aAAX,CAA0B,SAAQK,gBAAA,CAAME,IAAN,CACvDN,QADuD,CAEvD,yCAHU,CAAd;;IAKA,OAAQ,GAAEG,KAAM,KAAIF,SAAS,CAACM,GAAV,CAAeC,EAAD,IAAQA,EAAE,CAACC,QAAH,EAAtB,EAAqCC,IAArC,CAA0C,IAA1C,CAAgD,EAApE;EACD;;AAhB0C"}
1
+ {"version":3,"names":["ScopeForkCmd","constructor","forking","report","originalScope","newScope","forkedIds","forkScope","title","chalk","green","bold","map","id","toString","join"],"sources":["scope-fork.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { ForkingMain } from './forking.main.runtime';\n\nexport class ScopeForkCmd implements Command {\n name = 'fork <original-scope> <new-scope>';\n description = 'fork all components of the original-scope and refactor the source-code to use the new package names';\n options = [] as CommandOptions;\n group = 'development';\n\n constructor(private forking: ForkingMain) {}\n\n async report([originalScope, newScope]: [string, string]) {\n const forkedIds = await this.forking.forkScope(originalScope, newScope);\n const title = chalk.green(\n `successfully forked ${chalk.bold(originalScope)} into ${chalk.bold(\n newScope\n )}. the following components were created`\n );\n return `${title}\\n${forkedIds.map((id) => id.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,YAAY,CAAoB;EAM3CC,WAAW,CAASC,OAAoB,EAAE;IAAA,KAAtBA,OAAoB,GAApBA,OAAoB;IAAA,8CALjC,mCAAmC;IAAA,qDAC5B,qGAAqG;IAAA,iDACzG,EAAE;IAAA,+CACJ,aAAa;EAEsB;EAE3C,MAAMC,MAAM,CAAC,CAACC,aAAa,EAAEC,QAAQ,CAAmB,EAAE;IACxD,MAAMC,SAAS,GAAG,MAAM,IAAI,CAACJ,OAAO,CAACK,SAAS,CAACH,aAAa,EAAEC,QAAQ,CAAC;IACvE,MAAMG,KAAK,GAAGC,gBAAK,CAACC,KAAK,CACtB,uBAAsBD,gBAAK,CAACE,IAAI,CAACP,aAAa,CAAE,SAAQK,gBAAK,CAACE,IAAI,CACjEN,QAAQ,CACR,yCAAwC,CAC3C;IACD,OAAQ,GAAEG,KAAM,KAAIF,SAAS,CAACM,GAAG,CAAEC,EAAE,IAAKA,EAAE,CAACC,QAAQ,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAE,EAAC;EACvE;AACF;AAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/forking",
3
- "version": "0.0.285",
3
+ "version": "0.0.286",
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.285"
9
+ "version": "0.0.286"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,17 +17,17 @@
17
17
  "core-js": "^3.0.0",
18
18
  "@teambit/harmony": "0.3.3",
19
19
  "@teambit/cli": "0.0.591",
20
- "@teambit/component": "0.0.881",
21
- "@teambit/graphql": "0.0.881",
20
+ "@teambit/component": "0.0.882",
21
+ "@teambit/graphql": "0.0.882",
22
22
  "@teambit/bit-error": "0.0.400",
23
23
  "@teambit/component-id": "0.0.418",
24
- "@teambit/dependency-resolver": "0.0.881",
25
- "@teambit/install": "0.0.28",
24
+ "@teambit/dependency-resolver": "0.0.882",
25
+ "@teambit/install": "0.0.29",
26
26
  "@teambit/legacy-bit-id": "0.0.414",
27
- "@teambit/new-component-helper": "0.0.285",
28
- "@teambit/pkg": "0.0.881",
29
- "@teambit/refactoring": "0.0.178",
30
- "@teambit/workspace": "0.0.881"
27
+ "@teambit/new-component-helper": "0.0.286",
28
+ "@teambit/pkg": "0.0.882",
29
+ "@teambit/refactoring": "0.0.179",
30
+ "@teambit/workspace": "0.0.882"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/react": "^17.0.8",
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_forking@0.0.285/dist/forking.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_forking@0.0.285/dist/forking.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_forking@0.0.286/dist/forking.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_forking@0.0.286/dist/forking.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];